Belle II Software  release-05-01-25
TOPCalAsicShift.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - 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 #include <top/dbobjects/TOPCalAsicShift.h>
12 #include <framework/logging/Logger.h>
13 
14 using namespace std;
15 
16 namespace Belle2 {
22  void TOPCalAsicShift::setT0(int moduleID, unsigned asic, double T0)
23  {
24  unsigned module = moduleID - 1;
25  if (module >= c_numModules) {
26  B2ERROR("Invalid module number, constant not set (" << ClassName() << ")");
27  return;
28  }
29  if (asic >= c_numAsics) {
30  B2ERROR("Invalid asic number, constant not set (" << ClassName() << ")");
31  return;
32  }
33  m_T0[module][asic] = T0;
34  m_status[module][asic] = c_Calibrated;
35  }
36 
37 
38  void TOPCalAsicShift::setUnusable(int moduleID, unsigned asic)
39  {
40  unsigned module = moduleID - 1;
41  if (module >= c_numModules) {
42  B2ERROR("Invalid module number, status not set (" << ClassName() << ")");
43  return;
44  }
45  if (asic >= c_numAsics) {
46  B2ERROR("Invalid asic number, status not set (" << ClassName() << ")");
47  return;
48  }
49  m_status[module][asic] = c_Unusable;
50  }
51 
52 
53  double TOPCalAsicShift::getT0(int moduleID, unsigned asic) const
54  {
55  unsigned module = moduleID - 1;
56  if (module >= c_numModules) {
57  B2WARNING("Invalid module number, returning 0 (" << ClassName() << ")");
58  return 0;
59  }
60  if (asic >= c_numAsics) {
61  B2WARNING("Invalid asic number, returning 0 (" << ClassName() << ")");
62  return 0;
63  }
64  return m_T0[module][asic];
65  }
66 
67 
68  bool TOPCalAsicShift::isCalibrated(int moduleID, unsigned asic) const
69  {
70  unsigned module = moduleID - 1;
71  if (module >= c_numModules) return false;
72  if (asic >= c_numAsics) return false;
73  return m_status[module][asic] == c_Calibrated;
74  }
75 
76 
77  bool TOPCalAsicShift::isDefault(int moduleID, unsigned asic) const
78  {
79  unsigned module = moduleID - 1;
80  if (module >= c_numModules) return false;
81  if (asic >= c_numAsics) return false;
82  return m_status[module][asic] == c_Default;
83  }
84 
85 
86  bool TOPCalAsicShift::isUnusable(int moduleID, unsigned asic) const
87  {
88  unsigned module = moduleID - 1;
89  if (module >= c_numModules) return false;
90  if (asic >= c_numAsics) return false;
91  return m_status[module][asic] == c_Unusable;
92  }
93 
94 
96 } // end Belle2 namespace
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19