Belle II Software development
TOPCalChannelRQE.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12#include <framework/logging/Logger.h>
13
14namespace Belle2 {
24 class TOPCalChannelRQE: public TObject {
25 public:
26
30 enum EStatus {
33 c_Unusable = 2
34 };
35
40
47 void setRQE(int moduleID, unsigned channel, double relQE)
48 {
49 unsigned module = moduleID - 1;
50 if (module >= c_numModules) {
51 B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
52 return;
53 }
54 if (channel >= c_numChannels) {
55 B2ERROR("Invalid channel number, constant not set (" << ClassName() << ")");
56 return;
57 }
58 m_relQE[module][channel] = relQE;
59 m_status[module][channel] = c_Calibrated;
60 }
61
67 void setUnusable(int moduleID, unsigned channel)
68 {
69 unsigned module = moduleID - 1;
70 if (module >= c_numModules) {
71 B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
72 return;
73 }
74 if (channel >= c_numChannels) {
75 B2ERROR("Invalid channel number, status not set (" << ClassName() << ")");
76 return;
77 }
78 m_status[module][channel] = c_Unusable;
79 }
80
87 double getRQE(int moduleID, unsigned channel) const
88 {
89 unsigned module = moduleID - 1;
90 if (module >= c_numModules) {
91 B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
92 return 0;
93 }
94 if (channel >= c_numChannels) {
95 B2WARNING("Invalid channel number, returning 0 (" << ClassName() << ")");
96 return 0;
97 }
98 if (m_status[module][channel] == c_Default) return 1.0;
99 return m_relQE[module][channel];
100 }
101
108 bool isCalibrated(int moduleID, unsigned channel) const
109 {
110 unsigned module = moduleID - 1;
111 if (module >= c_numModules) return false;
112 if (channel >= c_numChannels) return false;
113 return m_status[module][channel] == c_Calibrated;
114 }
115
122 bool isDefault(int moduleID, unsigned channel) const
123 {
124 unsigned module = moduleID - 1;
125 if (module >= c_numModules) return false;
126 if (channel >= c_numChannels) return false;
127 return m_status[module][channel] == c_Default;
128 }
129
136 bool isUnusable(int moduleID, unsigned channel) const
137 {
138 unsigned module = moduleID - 1;
139 if (module >= c_numModules) return false;
140 if (channel >= c_numChannels) return false;
141 return m_status[module][channel] == c_Unusable;
142 }
143
144 private:
145
149 enum {
151 c_numChannels = 512
152 };
153
154 // Note: if initialization list is too short others are set to 0 (see comment in TOPCalChannelMask)
160 };
161
163} // end namespace Belle2
164
Class to store relative quantum efficiency of channels w.r.t initial one measured in PMT QA QE is exp...
ClassDef(TOPCalChannelRQE, 1)
ClassDef.
bool isCalibrated(int moduleID, unsigned channel) const
Returns calibration status.
@ c_numChannels
number of channels per module
@ c_numModules
number of modules
EStatus m_status[c_numModules][c_numChannels]
calibration status
void setUnusable(int moduleID, unsigned channel)
Switches calibration status to unusable to flag badly calibrated constant.
EStatus
Calibration status of a constant.
@ c_Calibrated
good calibrated value
@ c_Unusable
bad calibrated value
@ c_Default
uncalibrated default value
double getRQE(int moduleID, unsigned channel) const
Returns the relative QE for a single channel (1.0 if status is c_Default)
bool isDefault(int moduleID, unsigned channel) const
Returns calibration status.
TOPCalChannelRQE()
Default constructor.
void setRQE(int moduleID, unsigned channel, double relQE)
Sets the relative QE for a single channel and switches status to calibrated.
float m_relQE[c_numModules][c_numChannels]
relative quantum efficiency
bool isUnusable(int moduleID, unsigned channel) const
Returns calibration status.
Abstract base class for different kinds of events.