Belle II Software development
TOPCalChannelPulseHeight Class Reference

Pulse height parameterizations for all 512 channels of 16 modules. More...

#include <TOPCalChannelPulseHeight.h>

Inheritance diagram for TOPCalChannelPulseHeight:

Public Types

enum  EStatus {
  c_Default = 0 ,
  c_Calibrated = 1 ,
  c_Unusable = 2
}
 Calibration status of a constant. More...
 

Public Member Functions

 TOPCalChannelPulseHeight ()
 Default constructor.
 
void setParameters (int moduleID, unsigned channel, double x0, double p1, double p2)
 Sets calibration for a single channel and switches status to calibrated.
 
void setUnusable (int moduleID, unsigned channel)
 Switches calibration status to unusable to flag badly calibrated constant.
 
const TOPPulseHeightPargetParameters (int moduleID, unsigned channel) const
 Returns pulse height parameters for a given slot and channel.
 
bool isCalibrated (int moduleID, unsigned channel) const
 Returns calibration status.
 
bool isDefault (int moduleID, unsigned channel) const
 Returns calibration status.
 
bool isUnusable (int moduleID, unsigned channel) const
 Returns calibration status.
 

Private Types

enum  {
  c_numModules = 16 ,
  c_numChannels = 512
}
 Sizes. More...
 

Private Member Functions

 ClassDef (TOPCalChannelPulseHeight, 3)
 ClassDef.
 

Private Attributes

TOPPulseHeightPar m_par [c_numModules][c_numChannels]
 calibration constants
 
EStatus m_status [c_numModules][c_numChannels] = {{c_Default}}
 calibration status
 

Detailed Description

Pulse height parameterizations for all 512 channels of 16 modules.

Parameterization is: P(x) = (x/x0)^p1 * exp(-(x/x0)^p2), x0 > 0, p1 >= 0, p2 > 0 From channel gain/efficiency calibration

Definition at line 26 of file TOPCalChannelPulseHeight.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Sizes.

Enumerator
c_numModules 

number of modules

c_numChannels 

number of channels per module

Definition at line 181 of file TOPCalChannelPulseHeight.h.

181 {
182 c_numModules = 16,
183 c_numChannels = 512
184 };
@ c_numChannels
number of channels per module

◆ EStatus

enum EStatus

Calibration status of a constant.

Enumerator
c_Default 

uncalibrated default value

c_Calibrated 

good calibrated value

c_Unusable 

bad calibrated value

Definition at line 32 of file TOPCalChannelPulseHeight.h.

32 {
33 c_Default = 0,
34 c_Calibrated = 1,
35 c_Unusable = 2
36 };
@ c_Default
uncalibrated default value

Constructor & Destructor Documentation

◆ TOPCalChannelPulseHeight()

Default constructor.

Definition at line 41 of file TOPCalChannelPulseHeight.h.

42 {}

Member Function Documentation

◆ getParameters()

const TOPPulseHeightPar & getParameters ( int  moduleID,
unsigned  channel 
) const
inline

Returns pulse height parameters for a given slot and channel.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)
Returns
parameters of pulse heigth distribution

Definition at line 115 of file TOPCalChannelPulseHeight.h.

116 {
117 unsigned module = moduleID - 1;
118 if (module >= c_numModules) {
119 B2WARNING("Invalid slot number, "
120 "returning parameters of slot 1 channel 0 (" << ClassName() << ")"
121 << LogVar("slot", moduleID));
122 return m_par[0][0];
123 }
124 if (channel >= c_numChannels) {
125 B2WARNING("Invalid channel, "
126 "returning parameters of channel 0 (" << ClassName() << ")"
127 << LogVar("channel", channel));
128 return m_par[module][0];
129 }
130 return m_par[module][channel];
131 }
TOPPulseHeightPar m_par[c_numModules][c_numChannels]
calibration constants
Class to store variables with their name which were sent to the logging service.

◆ isCalibrated()

bool isCalibrated ( int  moduleID,
unsigned  channel 
) const
inline

Returns calibration status.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)
Returns
true, if good calibrated

Definition at line 139 of file TOPCalChannelPulseHeight.h.

140 {
141 unsigned module = moduleID - 1;
142 if (module >= c_numModules) return false;
143 if (channel >= c_numChannels) return false;
144 return m_status[module][channel] == c_Calibrated;
145 }
EStatus m_status[c_numModules][c_numChannels]
calibration status

◆ isDefault()

bool isDefault ( int  moduleID,
unsigned  channel 
) const
inline

Returns calibration status.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)
Returns
true, if default (not calibrated)

Definition at line 153 of file TOPCalChannelPulseHeight.h.

154 {
155 unsigned module = moduleID - 1;
156 if (module >= c_numModules) return false;
157 if (channel >= c_numChannels) return false;
158 return m_status[module][channel] == c_Default;
159 }

◆ isUnusable()

bool isUnusable ( int  moduleID,
unsigned  channel 
) const
inline

Returns calibration status.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)
Returns
true, if bad calibrated

Definition at line 167 of file TOPCalChannelPulseHeight.h.

168 {
169 unsigned module = moduleID - 1;
170 if (module >= c_numModules) return false;
171 if (channel >= c_numChannels) return false;
172 return m_status[module][channel] == c_Unusable;
173 }

◆ setParameters()

void setParameters ( int  moduleID,
unsigned  channel,
double  x0,
double  p1,
double  p2 
)
inline

Sets calibration for a single channel and switches status to calibrated.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)
x0distribution parameter (x0 > 0)
p1distribution parameter (p1 >= 0)
p2distribution parameter (p2 > 0)

Definition at line 52 of file TOPCalChannelPulseHeight.h.

53 {
54 unsigned module = moduleID - 1;
55 if (module >= c_numModules) {
56 B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
57 return;
58 }
59 if (channel >= c_numChannels) {
60 B2ERROR("Invalid channel number, constant not set (" << ClassName() << ")");
61 return;
62 }
63 if (x0 <= 0) {
64 B2ERROR("Invalid parameter value x0, constant not set (" << ClassName() << ")."
65 << LogVar("x0", x0)
66 << LogVar("slot", moduleID)
67 << LogVar("channel", channel));
68 return;
69 }
70 if (p1 < 0) {
71 B2ERROR("Invalid parameter value p1, constant not set (" << ClassName() << ")."
72 << LogVar("p1", p1)
73 << LogVar("slot", moduleID)
74 << LogVar("channel", channel));
75 return;
76 }
77 if (p2 <= 0) {
78 B2ERROR("Invalid parameter value p2, constant not set (" << ClassName() << ")."
79 << LogVar("p2", p2)
80 << LogVar("slot", moduleID)
81 << LogVar("channel", channel));
82 return;
83 }
84 m_par[module][channel].x0 = x0;
85 m_par[module][channel].p1 = p1;
86 m_par[module][channel].p2 = p2;
87 m_status[module][channel] = c_Calibrated;
88 }
float p1
distribution parameter p1
float x0
distribution parameter x0 [ADC counts]
float p2
distribution parameter p2

◆ setUnusable()

void setUnusable ( int  moduleID,
unsigned  channel 
)
inline

Switches calibration status to unusable to flag badly calibrated constant.

Parameters
moduleIDmodule ID (1-based)
channelhardware channel number (0-based)

Definition at line 95 of file TOPCalChannelPulseHeight.h.

96 {
97 unsigned module = moduleID - 1;
98 if (module >= c_numModules) {
99 B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
100 return;
101 }
102 if (channel >= c_numChannels) {
103 B2ERROR("Invalid channel number, status not set (" << ClassName() << ")");
104 return;
105 }
106 m_status[module][channel] = c_Unusable;
107 }

Member Data Documentation

◆ m_par

calibration constants

Definition at line 186 of file TOPCalChannelPulseHeight.h.

◆ m_status

EStatus m_status[c_numModules][c_numChannels] = {{c_Default}}
private

calibration status

Definition at line 187 of file TOPCalChannelPulseHeight.h.


The documentation for this class was generated from the following file: