Belle II Software development
TOPCalAsicShift.cc
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#include <top/dbobjects/TOPCalAsicShift.h>
10#include <framework/logging/Logger.h>
11
12using namespace std;
13
14namespace Belle2 {
20 void TOPCalAsicShift::setT0(int moduleID, unsigned asic, double T0)
21 {
22 unsigned module = moduleID - 1;
23 if (module >= c_numModules) {
24 B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
25 return;
26 }
27 if (asic >= c_numAsics) {
28 B2ERROR("Invalid asic number, constant not set (" << ClassName() << ")");
29 return;
30 }
31 m_T0[module][asic] = T0;
32 m_status[module][asic] = c_Calibrated;
33 }
34
35
36 void TOPCalAsicShift::setUnusable(int moduleID, unsigned asic)
37 {
38 unsigned module = moduleID - 1;
39 if (module >= c_numModules) {
40 B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
41 return;
42 }
43 if (asic >= c_numAsics) {
44 B2ERROR("Invalid asic number, status not set (" << ClassName() << ")");
45 return;
46 }
47 m_status[module][asic] = c_Unusable;
48 }
49
50
51 double TOPCalAsicShift::getT0(int moduleID, unsigned asic) const
52 {
53 unsigned module = moduleID - 1;
54 if (module >= c_numModules) {
55 B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
56 return 0;
57 }
58 if (asic >= c_numAsics) {
59 B2WARNING("Invalid asic number, returning 0 (" << ClassName() << ")");
60 return 0;
61 }
62 return m_T0[module][asic];
63 }
64
65
66 bool TOPCalAsicShift::isCalibrated(int moduleID, unsigned asic) const
67 {
68 unsigned module = moduleID - 1;
69 if (module >= c_numModules) return false;
70 if (asic >= c_numAsics) return false;
71 return m_status[module][asic] == c_Calibrated;
72 }
73
74
75 bool TOPCalAsicShift::isDefault(int moduleID, unsigned asic) const
76 {
77 unsigned module = moduleID - 1;
78 if (module >= c_numModules) return false;
79 if (asic >= c_numAsics) return false;
80 return m_status[module][asic] == c_Default;
81 }
82
83
84 bool TOPCalAsicShift::isUnusable(int moduleID, unsigned asic) const
85 {
86 unsigned module = moduleID - 1;
87 if (module >= c_numModules) return false;
88 if (asic >= c_numAsics) return false;
89 return m_status[module][asic] == c_Unusable;
90 }
91
92
94} // end Belle2 namespace
@ c_numModules
number of modules
@ c_numAsics
number of ASIC's per module
float m_T0[c_numModules][c_numAsics]
calibration constants
EStatus m_status[c_numModules][c_numAsics]
calibration status
@ c_Calibrated
good calibrated value
@ c_Unusable
bad calibrated value
@ c_Default
uncalibrated default value
void setUnusable(int moduleID, unsigned asic)
Switches calibration status to unusable to flag badly calibrated constant.
bool isCalibrated(int moduleID, unsigned asic) const
Returns calibration status.
bool isDefault(int moduleID, unsigned asic) const
Returns calibration status.
bool isUnusable(int moduleID, unsigned asic) const
Returns calibration status.
void setT0(int moduleID, unsigned asic, double T0)
Sets calibration for a single ASIC and switches status to calibrated.
double getT0(int moduleID, unsigned asic) const
Returns T0 of a single asic.
Abstract base class for different kinds of events.
STL namespace.