9#include <framework/logging/Logger.h>
11#include <arich/dbobjects/ARICHModulesInfo.h>
22 std::fill_n(
m_active, N_HAPDS,
false);
27 if (moduleID > N_HAPDS
28 || channelID > N_CHANNELS - 1) B2ERROR(
"ARICHModulesInfo::getChannelQE: module ID or channel ID out of range");
30 int id = (moduleID - 1) * N_CHANNELS + channelID;
36 if (modId > N_HAPDS || chId > N_CHANNELS - 1) B2ERROR(
"ARICHModulesInfo::setChannelQE: module ID or channel ID out of range");
38 int chid = (modId - 1) * N_CHANNELS + chId;
45 if (modId > N_HAPDS) B2ERROR(
"ARICHModulesInfo::addModule: module ID is out of range");
46 if (qeList.size() != N_CHANNELS) B2ERROR(
"ARICHModulesInfo::addModule: incomplete list of channels QEs");
51 std::vector<uint8_t>::iterator it =
m_ChannelQE.begin() + (modId - 1) * N_CHANNELS;
52 for (
auto qe : qeList) {
53 *it = uint8_t(qe + 0.5);
60 if (modId > N_HAPDS) B2ERROR(
"ARICHModulesInfo::isInstalled: module ID is out of range");
67 if (modId > N_HAPDS) B2ERROR(
"ARICHModulesInfo::isActive: module ID is out of range");
74 cout <<
"ARICHModulesInfo: " << endl;
75 cout <<
" Modules status " << endl;
76 cout <<
" ID / installed / active / avg. QE" << endl;
78 for (
int i = 1; i < N_HAPDS + 1; i++) {
79 cout << right << setfill(
' ') << setw(4) << i <<
": ";
86 for (
int j = 0; j < N_CHANNELS; j++) {
89 if (chQE > maxQE) maxQE = chQE;
91 avgQE /= double(N_CHANNELS);
92 cout <<
" " << left << setfill(
'0') << setw(4) << setprecision(2) << avgQE <<
" ";
93 if ((i) % 10 == 0) cout << endl;
95 cout <<
" Maximal channel QE: " << maxQE << endl;
bool m_installed[N_HAPDS]
array of installed HAPDs
void setChannelQE(unsigned modId, unsigned chId, double qe)
Set channel quantum efficiency.
ARICHModulesInfo()
Default constructor.
double getChannelQE(unsigned modId, unsigned chNo) const
Get channel quantum efficiency.
bool isInstalled(unsigned modId) const
Check if module is installed.
bool isActive(unsigned modId) const
Check if module is active.
void print() const
Dump data.
bool m_active[N_HAPDS]
array of active HAPDs
std::vector< uint8_t > m_ChannelQE
Channel QE at 400nm.
void addModule(unsigned modId, std::vector< float > &qeList, bool active)
Add installed module.
Abstract base class for different kinds of events.