Belle II Software development
TOPCalChannelThresholdEff.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 {
26 class TOPCalChannelThresholdEff: public TObject {
27 public:
28
32 enum EStatus {
35 c_Unusable = 2
36 };
37
43
52 void setThrEff(int moduleID, unsigned channel, float ThrEff, short offlineThreshold)
53 {
54 unsigned module = moduleID - 1;
55 if (module >= c_numModules) {
56 B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
57 return;
58 }
59 if (channel >= c_numChannels) {
60 B2ERROR("Invalid channel number, constant not set (" << ClassName() << ")");
61 return;
62 }
63 m_ThrEff[module][channel] = ThrEff;
64 m_offlineThreshold[module][channel] = offlineThreshold;
65 m_status[module][channel] = c_Calibrated;
66 }
67
73 void setUnusable(int moduleID, unsigned channel)
74 {
75 unsigned module = moduleID - 1;
76 if (module >= c_numModules) {
77 B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
78 return;
79 }
80 if (channel >= c_numChannels) {
81 B2ERROR("Invalid channel number, status not set (" << ClassName() << ")");
82 return;
83 }
84 m_status[module][channel] = c_Unusable;
85 }
86
93 float getThrEff(int moduleID, unsigned channel) const
94 {
95 unsigned module = moduleID - 1;
96 if (module >= c_numModules) {
97 B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
98 return 0;
99 }
100 if (channel >= c_numChannels) {
101 B2WARNING("Invalid channel number, returning 0 (" << ClassName() << ")");
102 return 0;
103 }
104 if (m_status[module][channel] == c_Default) return 1.0;
105 return m_ThrEff[module][channel];
106 }
107
114 bool isCalibrated(int moduleID, unsigned channel) const
115 {
116 unsigned module = moduleID - 1;
117 if (module >= c_numModules) return false;
118 if (channel >= c_numChannels) return false;
119 return m_status[module][channel] == c_Calibrated;
120 }
121
128 bool isDefault(int moduleID, unsigned channel) const
129 {
130 unsigned module = moduleID - 1;
131 if (module >= c_numModules) return false;
132 if (channel >= c_numChannels) return false;
133 return m_status[module][channel] == c_Default;
134 }
135
142 bool isUnusable(int moduleID, unsigned channel) const
143 {
144 unsigned module = moduleID - 1;
145 if (module >= c_numModules) return false;
146 if (channel >= c_numChannels) return false;
147 return m_status[module][channel] == c_Unusable;
148 }
149
156 short getOfflineThreshold(int moduleID, unsigned channel) const
157 {
158 unsigned module = moduleID - 1;
159 if (module >= c_numModules) {
160 B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
161 return 0;
162 }
163 if (channel >= c_numChannels) {
164 B2WARNING("Invalid channel number, returning 0 (" << ClassName() << ")");
165 return 0;
166 }
167 return m_offlineThreshold[module][channel];
168 }
169
170 private:
171
175 enum {c_numModules = 16,
176 c_numChannels = 512
177 };
178
179
186 };
187
189} // end namespace Belle2
190
Class to store the threshold efficiency (i.e.
float m_ThrEff[c_numModules][c_numChannels]
threshold efficiency value.
bool isCalibrated(int moduleID, unsigned channel) const
Returns calibration status.
float getThrEff(int moduleID, unsigned channel) const
Returns the threshold efficiency of a single channel (1.0 if status is c_Default)
EStatus m_status[c_numModules][c_numChannels]
calibration status
short getOfflineThreshold(int moduleID, unsigned channel) const
Returns the threshold value used for efficiency evaluation.
ClassDef(TOPCalChannelThresholdEff, 3)
ClassDef.
void setUnusable(int moduleID, unsigned channel)
Switches calibration status to unusable to flag badly calibrated constant.
EStatus
Calibration status of a constant.
short m_offlineThreshold[c_numModules][c_numChannels]
threshold value used for efficiency evaluation
bool isDefault(int moduleID, unsigned channel) const
Returns calibration status.
@ c_numChannels
number of channels per module
bool isUnusable(int moduleID, unsigned channel) const
Returns calibration status.
void setThrEff(int moduleID, unsigned channel, float ThrEff, short offlineThreshold)
Sets the threshold efficiency and correspolding threshold for a single channel and switches status to...
Abstract base class for different kinds of events.