9 #include <top/dbobjects/TOPCalChannelMask.h>
11 #include <framework/logging/Logger.h>
21 void TOPCalChannelMask::setStatus(
int moduleID,
unsigned channel,
EStatus status)
23 int module = moduleID - 1;
24 if (!check(module, channel)) {
25 B2WARNING(
"Channel status not set");
28 m_status[module][channel] = status;
31 void TOPCalChannelMask::setActive(
int moduleID,
unsigned channel)
33 int module = moduleID - 1;
34 if (!check(module, channel)) {
35 B2WARNING(
"Channel status 'active' not set");
38 m_status[module][channel] = c_Active;
41 void TOPCalChannelMask::setDead(
int moduleID,
unsigned channel)
43 int module = moduleID - 1;
44 if (!check(module, channel)) {
45 B2WARNING(
"Channel status 'dead' not set");
48 m_status[module][channel] = c_Dead;
51 void TOPCalChannelMask::setNoisy(
int moduleID,
unsigned channel)
53 int module = moduleID - 1;
54 if (!check(module, channel)) {
55 B2WARNING(
"Channel status 'noisy' not set");
58 m_status[module][channel] = c_Noisy;
62 unsigned channel)
const
64 int module = moduleID - 1;
65 if (!check(module, channel)) {
66 B2WARNING(
"Returning dead channel value");
69 return m_status[module][channel];
72 bool TOPCalChannelMask::isActive(
int moduleID,
unsigned channel)
const
74 int module = moduleID - 1;
75 if (!check(module, channel)) {
76 B2WARNING(
"Returning false");
79 return (m_status[module][channel] == c_Active);
82 bool TOPCalChannelMask::check(
const int module,
const unsigned channel)
const
84 if (module >= c_numModules) {
85 B2ERROR(
"Invalid module number (" << ClassName() <<
")");
89 B2ERROR(
"Invalid module number (" << ClassName() <<
")");
92 if (channel >= c_numChannels) {
93 B2ERROR(
"Invalid channel number (" << ClassName() <<
")");
99 int TOPCalChannelMask::getNumOf(
EStatus check)
const
102 for (
const auto& statuses : m_status) {
103 for (
const auto status : statuses) {
104 if (status == check) n++;
110 int TOPCalChannelMask::getNumOf(
EStatus check,
int moduleID)
const
112 unsigned module = moduleID - 1;
113 if (module < c_numModules) {
115 const auto& statuses = m_status[module];
116 for (
const auto status : statuses) {
117 if (status == check) n++;
121 B2ERROR(
"Invalid module number (" << ClassName() <<
")");
EStatus
Status of the channel.
Abstract base class for different kinds of events.