9 #include <framework/logging/Logger.h>
11 #include <arich/dbobjects/ARICHChannelMask.h>
17 ARICHChannelMask::ARICHChannelMask()
19 std::fill_n(m_DetectorMask, N_HAPDS * N_CHANNELS / 32 + 1, 0xFFFFFFFF);
22 void ARICHChannelMask::setActiveCh(
unsigned module,
unsigned channel,
bool active)
24 if (module > N_HAPDS || channel > N_CHANNELS) { B2ERROR(
"ARICHChannelMask::setActiveCh: module ID / channel ID out of range!");
return;}
25 int ch = (module - 1) * N_CHANNELS + channel;
27 unsigned int idx = ch / 32;
28 if (active) m_DetectorMask[idx] |= (1 << bit);
29 else m_DetectorMask[idx] &= ~(1 << bit);
32 void ARICHChannelMask::setActiveHAPD(
unsigned module,
bool active)
34 for (
int i = 0; i < N_CHANNELS; i++) {
35 setActiveCh(module, i, active);
39 void ARICHChannelMask::setActiveAPD(
unsigned module,
unsigned apd,
bool active)
41 int fst = N_CHANNELS / 4 * apd;
42 for (
int i = fst; i < fst + N_CHANNELS / 4; i++) {
43 setActiveCh(module, i, active);
47 bool ARICHChannelMask::isActive(
unsigned moduleID,
unsigned channelID)
const
49 int ch = (moduleID - 1) * N_CHANNELS + channelID;
51 unsigned int idx = ch / 32;
52 if (m_DetectorMask[idx] & (1 << bit))
return true;
56 void ARICHChannelMask::print()
const
59 cout << endl <<
"ARICH masked channels" << endl << endl;
60 for (
int i = 0; i < N_HAPDS; i++) {
63 for (
int j = 0; j < N_CHANNELS; j++) {
64 if (!isActive(i + 1, j)) {
65 if (first) cout <<
"Module " << i + 1 <<
": " ;
70 if (!first) cout << endl << endl;
Abstract base class for different kinds of events.