9 #include <top/dbobjects/TOPCalChannelT0.h>
10 #include <framework/logging/Logger.h>
20 void TOPCalChannelT0::setT0(
int moduleID,
unsigned channel,
double T0,
double errT0)
22 unsigned module = moduleID - 1;
23 if (module >= c_numModules) {
24 B2ERROR(
"Invalid module number, constant not set (" << ClassName() <<
")");
27 if (channel >= c_numChannels) {
28 B2ERROR(
"Invalid channel number, constant not set (" << ClassName() <<
")");
31 m_T0[module][channel] = T0;
32 m_errT0[module][channel] = errT0;
33 m_status[module][channel] = c_Calibrated;
37 void TOPCalChannelT0::setUnusable(
int moduleID,
unsigned channel)
39 unsigned module = moduleID - 1;
40 if (module >= c_numModules) {
41 B2ERROR(
"Invalid module number, status not set (" << ClassName() <<
")");
44 if (channel >= c_numChannels) {
45 B2ERROR(
"Invalid channel number, status not set (" << ClassName() <<
")");
48 m_status[module][channel] = c_Unusable;
52 void TOPCalChannelT0::suppressAverage()
54 for (
int m = 0; m < c_numModules; m++) {
57 for (
int i = 0; i < c_numChannels; i++) {
58 if (m_status[m][i] == c_Calibrated) {
65 for (
int i = 0; i < c_numChannels; i++) {
66 if (m_status[m][i] != c_Default) m_T0[m][i] -= s;
68 B2INFO(
"Slot " << m + 1 <<
": average of " << s <<
" ns subtracted.");
73 double TOPCalChannelT0::getT0(
int moduleID,
unsigned channel)
const
75 unsigned module = moduleID - 1;
76 if (module >= c_numModules) {
77 B2WARNING(
"Invalid module number, returning 0 (" << ClassName() <<
")");
80 if (channel >= c_numChannels) {
81 B2WARNING(
"Invalid channel number, returning 0 (" << ClassName() <<
")");
84 return m_T0[module][channel];
88 double TOPCalChannelT0::getT0Error(
int moduleID,
unsigned channel)
const
90 unsigned module = moduleID - 1;
91 if (module >= c_numModules) {
92 B2WARNING(
"Invalid module number, returning 0 (" << ClassName() <<
")");
95 if (channel >= c_numChannels) {
96 B2WARNING(
"Invalid channel number, returning 0 (" << ClassName() <<
")");
99 return m_errT0[module][channel];
103 bool TOPCalChannelT0::isCalibrated(
int moduleID,
unsigned channel)
const
105 unsigned module = moduleID - 1;
106 if (module >= c_numModules)
return false;
107 if (channel >= c_numChannels)
return false;
108 return m_status[module][channel] == c_Calibrated;
112 bool TOPCalChannelT0::isDefault(
int moduleID,
unsigned channel)
const
114 unsigned module = moduleID - 1;
115 if (module >= c_numModules)
return false;
116 if (channel >= c_numChannels)
return false;
117 return m_status[module][channel] == c_Default;
121 bool TOPCalChannelT0::isUnusable(
int moduleID,
unsigned channel)
const
123 unsigned module = moduleID - 1;
124 if (module >= c_numModules)
return false;
125 if (channel >= c_numChannels)
return false;
126 return m_status[module][channel] == c_Unusable;
Abstract base class for different kinds of events.