Belle II Software  release-08-01-10
KLMChannelStatusAlgorithm.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 /* KLM headers. */
12 #include <klm/dataobjects/KLMChannelMapValue.h>
13 #include <klm/dbobjects/KLMChannelStatus.h>
14 
15 /* Basf2 headers. */
16 #include <calibration/CalibrationAlgorithm.h>
17 
18 namespace Belle2 {
28 
29  public:
30 
34  class Results {
35 
36  friend class KLMChannelStatusAlgorithm;
37 
38  public:
39 
43  Results();
44 
48  Results(const Results& results);
49 
53  ~Results();
54 
59  {
60  return *m_ChannelStatus;
61  }
62 
67  {
68  return *m_ModuleStatus;
69  }
70 
75  {
76  return m_HitMapChannel;
77  }
78 
83  {
84  return m_HitMapModule;
85  }
86 
91  {
92  return m_HitMapSector;
93  }
94 
99  {
100  return m_HitMapModuleNoHot;
101  }
102 
107  {
108  return m_HitMapSectorNoHot;
109  }
110 
115  {
117  }
118 
122  unsigned int getTotalHitNumber() const
123  {
124  return m_TotalHitNumber;
125  }
126 
130  unsigned int getHitNumberEKLM() const
131  {
132  return m_HitNumberEKLM;
133  }
134 
138  unsigned int getHitNumberBKLM() const
139  {
140  return m_HitNumberBKLM;
141  }
142 
143  private:
144 
147 
150 
153 
156 
159 
162 
165 
168 
170  unsigned int m_TotalHitNumber = 0;
171 
173  unsigned int m_HitNumberBKLM = 0;
174 
176  unsigned int m_HitNumberEKLM = 0;
177 
179  unsigned int m_HitNumberBKLMNoHot = 0;
180 
182  unsigned int m_HitNumberEKLMNoHot = 0;
183 
184  };
185 
190 
195 
200 
205  void setForcedCalibration(bool forcedCalibration)
206  {
207  m_ForcedCalibration = forcedCalibration;
208  }
209 
213  void setMinimalModuleHitNumber(unsigned int minimalModuleHitNumber)
214  {
215  m_MinimalModuleHitNumber = minimalModuleHitNumber;
216  }
217 
222  void setMaximalLogSectorHitsRatio(double maximalLogSectorHitsRatio)
223  {
224  m_MaximalLogSectorHitsRatio = maximalLogSectorHitsRatio;
225  }
226 
231  unsigned int minimalHitNumberSingleHotChannel)
232  {
233  m_MinimalHitNumberSingleHotChannel = minimalHitNumberSingleHotChannel;
234  }
235 
239  void setMinimalHitNumberHotChannel(unsigned int minimalHitNumberHotChannel)
240  {
241  m_MinimalHitNumberHotChannel = minimalHitNumberHotChannel;
242  }
243 
249  double minimalHitNumberRatioHotChannel)
250  {
251  m_MinimalHitNumberRatioHotChannel = minimalHitNumberRatioHotChannel;
252  }
253 
258  {
260  }
261 
265  void setMinimalAverageHitNumber(double minimalAverageHitNumber)
266  {
267  m_MinimalAverageHitNumber = minimalAverageHitNumber;
268  }
269 
270 
274  const Results* getResults() const
275  {
276  return &m_Results;
277  }
278 
279  protected:
280 
290  void calibrateSector(KLMSectorNumber sector,
291  double averageHitsActiveSector);
292 
297  void calibrateModule(KLMModuleNumber module);
298 
306  bool markHotChannel(KLMChannelNumber channel, unsigned int moduleHits,
307  int activeChannels);
308 
313  void calibrateChannel(KLMChannelNumber channel);
314 
319  bool m_ForcedCalibration = false;
320 
322  unsigned int m_MinimalModuleHitNumber = 1;
323 
326 
332 
335 
337  unsigned int m_MinimalHitNumberHotChannel = 100;
338 
344 
347 
350 
351  };
352 
354 }
Base class for calibration algorithms.
EResult
The result of calibration.
unsigned int getHitNumberBKLM() const
Get number of hits in BKLM.
unsigned int m_HitNumberEKLM
Number of hits in EKLM.
KLMChannelStatus * m_ChannelStatus
Channel status.
const KLMChannelMapValue< unsigned int > & getHitMapModule() const
Get module hit map.
unsigned int getTotalHitNumber() const
Get total hit number.
const KLMChannelMapValue< unsigned int > & getHitMapModuleNoHot() const
Get module hit map (no hot channels).
KLMChannelStatus & getChannelStatus() const
Get channel status (last calibration).
KLMChannelMapValue< unsigned int > m_HitMapModuleNoHot
Module hit map (no hit channels).
const KLMChannelMapValue< unsigned int > & getHitMapSector() const
Get sector hit map.
KLMChannelMapValue< unsigned int > m_HitMapSectorNoHot
Sector hit map (no hot channels).
KLMChannelMapValue< unsigned int > m_HitMapChannel
Channel hit map.
KLMChannelMapValue< unsigned int > m_ModuleActiveChannelMap
Module active-channel map (number of active channels in module).
KLMChannelStatus & getModuleStatus() const
Get module status (last calibration).
unsigned int m_HitNumberBKLM
Number of hits in BKLM.
KLMChannelMapValue< unsigned int > m_HitMapModule
Module hit map.
unsigned int getHitNumberEKLM() const
Get number of hits in EKLM.
KLMChannelMapValue< unsigned int > m_HitMapSector
Sector hit map.
unsigned int m_HitNumberBKLMNoHot
Number of hits in BKLM (no hot channels).
const KLMChannelMapValue< unsigned int > & getHitMapChannel() const
Get channel hit map.
unsigned int m_HitNumberEKLMNoHot
Number of hits in EKLM (no hot channels).
const KLMChannelMapValue< unsigned int > & getHitMapSectorNoHot() const
Get sector hit map (no hot channels).
const KLMChannelMapValue< unsigned int > & getModuleActiveChannelMap() const
Get module active-channel map.
KLM channel status calibration algorithm.
void setForcedCalibration(bool forcedCalibration)
Set whether the calibration is forced (calibrate even for insufficient average number of hits).
double getMinimalAverageHitNumber() const
Get minimal average number of hits per channel required for calibration.
void setMinimalModuleHitNumber(unsigned int minimalModuleHitNumber)
Set minimal number of hits per module for module-based calibration.
bool markHotChannel(KLMChannelNumber channel, unsigned int moduleHits, int activeChannels)
Mark hot channel.
double m_MinimalAverageHitNumber
Minimal average number of hits per channel required for calibration.
bool m_ForcedCalibration
Whether the calibration is forced (calibrate even for insufficient average number of hits).
const KLMElementNumbers * m_ElementNumbers
Element numbers.
void setMinimalHitNumberHotChannel(unsigned int minimalHitNumberHotChannel)
Set inimal number of hits to mark to mark the channel as hot.
unsigned int m_MinimalModuleHitNumber
Minimal module hit number for module-based calibration.
void calibrateChannel(KLMChannelNumber channel)
Calibrate channel.
double m_MinimalHitNumberRatioHotChannel
Minimal ratio of number of hits in this channel and average over other channels in this module to mar...
unsigned int m_MinimalHitNumberHotChannel
Minimal number of hits to mark to mark the channel as hot.
void calibrateSector(KLMSectorNumber sector, double averageHitsActiveSector)
Caliobrate sector.
void calibrateModule(KLMModuleNumber module)
Calibrate module.
void setMinimalAverageHitNumber(double minimalAverageHitNumber)
Set minimal average number of hits per channel required for calibration.
void setMaximalLogSectorHitsRatio(double maximalLogSectorHitsRatio)
Set maximal absolute value of the logarithm (base 10) of the ratio of the number of hits in this sect...
double m_MaximalLogSectorHitsRatio
Maximal absolute value of the logarithm (base 10) of the ratio of the number of hits in this sector a...
CalibrationAlgorithm::EResult calibrate() override
Calibration.
unsigned int m_MinimalHitNumberSingleHotChannel
Minimal number of hits in a single channel to mark it as hot.
void setMinimalHitNumberRatioHotChannel(double minimalHitNumberRatioHotChannel)
Minimal ratio of number of hits in this channel and average over other channels in this module to mar...
const Results * getResults() const
Get results.
void setMinimalHitNumberSingleHotChannel(unsigned int minimalHitNumberSingleHotChannel)
Set minimal number of hits in a single channel to mark it as hot.
KLM channel status.
KLM element numbers.
uint16_t KLMSectorNumber
Sector number.
uint16_t KLMChannelNumber
Channel number.
uint16_t KLMModuleNumber
Module number.
Abstract base class for different kinds of events.