Belle II Software development
TOPCalChannelThreshold.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 {
25 class TOPCalChannelThreshold: public TObject {
26 public:
27
31 enum EStatus {
34 c_Unusable = 2
35 };
36
41
48 void setThr(int moduleID, unsigned channel, short Thr)
49 {
50 unsigned module = moduleID - 1;
51 if (module >= c_numModules) {
52 B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
53 return;
54 }
55 if (channel >= c_numChannels) {
56 B2ERROR("Invalid channel number, constant not set (" << ClassName() << ")");
57 return;
58 }
59 m_Thr[module][channel] = Thr;
60 m_status[module][channel] = c_Calibrated;
61 }
62
68 void setUnusable(int moduleID, unsigned channel)
69 {
70 unsigned module = moduleID - 1;
71 if (module >= c_numModules) {
72 B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
73 return;
74 }
75 if (channel >= c_numChannels) {
76 B2ERROR("Invalid channel number, status not set (" << ClassName() << ")");
77 return;
78 }
79 m_status[module][channel] = c_Unusable;
80 }
81
88 short getThr(int moduleID, unsigned channel) const
89 {
90 unsigned module = moduleID - 1;
91 if (module >= c_numModules) {
92 B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
93 return 0;
94 }
95 if (channel >= c_numChannels) {
96 B2WARNING("Invalid channel number, returning 0 (" << ClassName() << ")");
97 return 0;
98 }
99 return m_Thr[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 {c_numModules = 16,
150 c_numChannels = 512
151 };
152
158 };
159
161} // end namespace Belle2
162
Value of the threshold (in ADC counts) used for the pulse identification, for all 512 channels of 16 ...
short getThr(int moduleID, unsigned channel) const
Returns the threshold (in ADC counts) of a single channel.
bool isCalibrated(int moduleID, unsigned channel) const
Returns calibration status.
@ c_numChannels
number of channels per module
ClassDef(TOPCalChannelThreshold, 2)
ClassDef.
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_Default
uncalibrated default value
short m_Thr[c_numModules][c_numChannels]
threshold value in ADC counts.
bool isDefault(int moduleID, unsigned channel) const
Returns calibration status.
TOPCalChannelThreshold()
Default constructor.
void setThr(int moduleID, unsigned channel, short Thr)
Sets the threshold (in ADC counts) for a single channel and switches status to calibrated.
bool isUnusable(int moduleID, unsigned channel) const
Returns calibration status.
Abstract base class for different kinds of events.