11 #include <top/dbobjects/TOPCalChannelMask.h>
13 #include <framework/logging/Logger.h>
23 void TOPCalChannelMask::setStatus(
int moduleID,
unsigned channel,
EStatus status)
25 int module = moduleID - 1;
26 if (!check(module, channel)) {
27 B2WARNING(
"Channel status not set");
30 m_status[module][channel] = status;
33 void TOPCalChannelMask::setActive(
int moduleID,
unsigned channel)
35 int module = moduleID - 1;
36 if (!check(module, channel)) {
37 B2WARNING(
"Channel status 'active' not set");
40 m_status[module][channel] = c_Active;
43 void TOPCalChannelMask::setDead(
int moduleID,
unsigned channel)
45 int module = moduleID - 1;
46 if (!check(module, channel)) {
47 B2WARNING(
"Channel status 'dead' not set");
50 m_status[module][channel] = c_Dead;
53 void TOPCalChannelMask::setNoisy(
int moduleID,
unsigned channel)
55 int module = moduleID - 1;
56 if (!check(module, channel)) {
57 B2WARNING(
"Channel status 'noisy' not set");
60 m_status[module][channel] = c_Noisy;
64 unsigned channel)
const
66 int module = moduleID - 1;
67 if (!check(module, channel)) {
68 B2WARNING(
"Returning dead channel value");
71 return m_status[module][channel];
74 bool TOPCalChannelMask::isActive(
int moduleID,
unsigned channel)
const
76 int module = moduleID - 1;
77 if (!check(module, channel)) {
78 B2WARNING(
"Returning false");
81 return (m_status[module][channel] == c_Active);
84 bool TOPCalChannelMask::check(
const int module,
const unsigned channel)
const
86 if (module >= c_numModules) {
87 B2ERROR(
"Invalid module number (" << ClassName() <<
")");
91 B2ERROR(
"Invalid module number (" << ClassName() <<
")");
94 if (channel >= c_numChannels) {
95 B2ERROR(
"Invalid channel number (" << ClassName() <<
")");
101 int TOPCalChannelMask::getNumOf(
EStatus check)
const
104 for (
const auto& statuses : m_status) {
105 for (
const auto status : statuses) {
106 if (status == check) n++;
112 int TOPCalChannelMask::getNumOf(
EStatus check,
int moduleID)
const
114 unsigned module = moduleID - 1;
115 if (module < c_numModules) {
117 const auto& statuses = m_status[module];
118 for (
const auto status : statuses) {
119 if (status == check) n++;
123 B2ERROR(
"Invalid module number (" << ClassName() <<
")");