Belle II Software  release-05-01-25
TOPCalChannelRQE.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <TObject.h>
14 #include <framework/logging/Logger.h>
15 
16 namespace Belle2 {
26  class TOPCalChannelRQE: public TObject {
27  public:
28 
32  enum EStatus {
33  c_Default = 0,
35  c_Unusable = 2
36  };
37 
42 
49  void setRQE(int moduleID, unsigned channel, double relQE)
50  {
51  unsigned module = moduleID - 1;
52  if (module >= c_numModules) {
53  B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
54  return;
55  }
56  if (channel >= c_numChannels) {
57  B2ERROR("Invalid channel number, constant not set (" << ClassName() << ")");
58  return;
59  }
60  m_relQE[module][channel] = relQE;
61  m_status[module][channel] = c_Calibrated;
62  }
63 
69  void setUnusable(int moduleID, unsigned channel)
70  {
71  unsigned module = moduleID - 1;
72  if (module >= c_numModules) {
73  B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
74  return;
75  }
76  if (channel >= c_numChannels) {
77  B2ERROR("Invalid channel number, status not set (" << ClassName() << ")");
78  return;
79  }
80  m_status[module][channel] = c_Unusable;
81  }
82 
89  double getRQE(int moduleID, unsigned channel) const
90  {
91  unsigned module = moduleID - 1;
92  if (module >= c_numModules) {
93  B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
94  return 0;
95  }
96  if (channel >= c_numChannels) {
97  B2WARNING("Invalid channel number, returning 0 (" << ClassName() << ")");
98  return 0;
99  }
100  if (m_status[module][channel] == c_Default) return 1.0;
101  return m_relQE[module][channel];
102  }
103 
110  bool isCalibrated(int moduleID, unsigned channel) const
111  {
112  unsigned module = moduleID - 1;
113  if (module >= c_numModules) return false;
114  if (channel >= c_numChannels) return false;
115  return m_status[module][channel] == c_Calibrated;
116  }
117 
124  bool isDefault(int moduleID, unsigned channel) const
125  {
126  unsigned module = moduleID - 1;
127  if (module >= c_numModules) return false;
128  if (channel >= c_numChannels) return false;
129  return m_status[module][channel] == c_Default;
130  }
131 
138  bool isUnusable(int moduleID, unsigned channel) const
139  {
140  unsigned module = moduleID - 1;
141  if (module >= c_numModules) return false;
142  if (channel >= c_numChannels) return false;
143  return m_status[module][channel] == c_Unusable;
144  }
145 
146  private:
147 
151  enum {
152  c_numModules = 16,
153  c_numChannels = 512
154  };
155 
156  // Note: if initialization list is too short others are set to 0 (see comment in TOPCalChannelMask)
157  float m_relQE[c_numModules][c_numChannels] = {{0.0}};
162  };
163 
165 } // end namespace Belle2
166 
Belle2::TOPCalChannelRQE::setUnusable
void setUnusable(int moduleID, unsigned channel)
Switches calibration status to unusable to flag badly calibrated constant.
Definition: TOPCalChannelRQE.h:77
Belle2::TOPCalChannelRQE::TOPCalChannelRQE
TOPCalChannelRQE()
Default constructor.
Definition: TOPCalChannelRQE.h:49
Belle2::TOPCalChannelRQE::m_relQE
float m_relQE[c_numModules][c_numChannels]
relative quantum efficiency
Definition: TOPCalChannelRQE.h:165
Belle2::TOPCalChannelRQE::EStatus
EStatus
Calibration status of a constant.
Definition: TOPCalChannelRQE.h:40
Belle2::TOPCalChannelRQE::isCalibrated
bool isCalibrated(int moduleID, unsigned channel) const
Returns calibration status.
Definition: TOPCalChannelRQE.h:118
Belle2::TOPCalChannelRQE::isUnusable
bool isUnusable(int moduleID, unsigned channel) const
Returns calibration status.
Definition: TOPCalChannelRQE.h:146
Belle2::TOPCalChannelRQE::c_numModules
@ c_numModules
number of modules
Definition: TOPCalChannelRQE.h:160
Belle2::TOPCalChannelRQE::c_Calibrated
@ c_Calibrated
good calibrated value
Definition: TOPCalChannelRQE.h:42
Belle2::TOPCalChannelRQE::setRQE
void setRQE(int moduleID, unsigned channel, double relQE)
Sets the relative QE for a single channel and switches status to calibrated.
Definition: TOPCalChannelRQE.h:57
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPCalChannelRQE::isDefault
bool isDefault(int moduleID, unsigned channel) const
Returns calibration status.
Definition: TOPCalChannelRQE.h:132
Belle2::TOPCalChannelRQE::c_Default
@ c_Default
uncalibrated default value
Definition: TOPCalChannelRQE.h:41
Belle2::TOPCalChannelRQE::c_numChannels
@ c_numChannels
number of channels per module
Definition: TOPCalChannelRQE.h:161
Belle2::TOPCalChannelRQE::c_Unusable
@ c_Unusable
bad calibrated value
Definition: TOPCalChannelRQE.h:43
Belle2::TOPCalChannelRQE::ClassDef
ClassDef(TOPCalChannelRQE, 1)
ClassDef.
Belle2::TOPCalChannelRQE::m_status
EStatus m_status[c_numModules][c_numChannels]
calibration status
Definition: TOPCalChannelRQE.h:166
Belle2::TOPCalChannelRQE::getRQE
double getRQE(int moduleID, unsigned channel) const
Returns the relative QE for a single channel (1.0 if status is c_Default)
Definition: TOPCalChannelRQE.h:97
Belle2::TOPCalChannelRQE
Class to store relative quantum efficiency of channels w.r.t initial one measured in PMT QA QE is exp...
Definition: TOPCalChannelRQE.h:34