Belle II Software  release-05-02-19
ECLCalDigit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * ECL dataobject ECLCalDigit. *
6  * *
7  * Author: The Belle II Collaboration *
8  * Contributors: Torben Ferber (ferber@physics.ubc.ca) (TF) *
9  * *
10  * This software is provided "as is" without any warranty. *
11  **************************************************************************/
12 
13 #ifndef ECLCALDIGIT_H
14 #define ECLCALDIGIT_H
15 
16 #include <framework/datastore/RelationsObject.h>
17 #include <ecl/dataobjects/ECLDsp.h>
18 
19 namespace Belle2 {
28  class ECLCalDigit : public RelationsObject {
29  public:
30 
32  enum StatusBit {
33  c_IsEnergyCalibrated = 1 << 0,
34  c_IsTimeCalibrated = 1 << 1,
35  c_IsTimeResolutionCalibrated = 1 << 2,
36  c_IsFailedFit = 1 << 3,
37  c_IsFailedTimeResolution = 1 << 4,
38  c_IsCalibrated = c_IsEnergyCalibrated | c_IsTimeCalibrated | c_IsTimeResolutionCalibrated,
39  };
40 
43  {
44  m_CellId = 0;
45  m_Time = 0;
46  m_TimeResolution = 0;
47  m_Energy = 0;
48  m_Status = 0;
53  m_TwoComponentSavedChi2[0] = -1;
54  m_TwoComponentSavedChi2[1] = -1;
55  m_TwoComponentSavedChi2[2] = -1;
57  }
58 
61  void setCellId(int CellId) { m_CellId = CellId; }
62 
65  void setEnergy(double Energy) { m_Energy = Energy; }
66 
69  void setTwoComponentTotalEnergy(double Energy) { m_TwoComponentTotalEnergy = Energy; }
70 
73  void setTwoComponentHadronEnergy(double Energy) { m_TwoComponentHadronEnergy = Energy; }
74 
77  void setTwoComponentDiodeEnergy(double Energy) { m_TwoComponentDiodeEnergy = Energy; }
78 
81  void setTwoComponentChi2(double chi) { m_TwoComponentChi2 = chi; }
82 
86  void setTwoComponentSavedChi2(ECLDsp::TwoComponentFitType FitTypeIn, double input)
87  {
88  unsigned int index = FitTypeIn ;
89  m_TwoComponentSavedChi2[index] = input;
90  }
91 
95 
98  void setTime(double Time) { m_Time = Time; }
99 
102  void setTimeResolution(double TimeResolution) { m_TimeResolution = TimeResolution; }
103 
106  void setStatus(unsigned short int status) { m_Status = status; }
107 
110  void addStatus(unsigned short int bitmask) { m_Status |= bitmask; }
111 
114  void removeStatus(unsigned short int bitmask) { m_Status &= (~bitmask); }
115 
119  int getCellId() const { return m_CellId; }
120 
124  double getEnergy() const { return m_Energy; }
125 
130 
135 
140 
144  double getTwoComponentChi2() const { return m_TwoComponentChi2; }
145 
151  {
152  unsigned int index = FitTypeIn ;
153  return m_TwoComponentSavedChi2[index];
154  }
155 
160 
164  double getTime() const { return m_Time; }
165 
169  double getTimeResolution() const { return m_TimeResolution; }
170 
174  bool hasStatus(unsigned short int bitmask) const { return (m_Status & bitmask) == bitmask; }
175 
179  bool isCalibrated() const;
180 
184  bool isEnergyCalibrated() const;
185 
189  bool isTimeCalibrated() const;
190 
194  bool isTimeResolutionCalibrated() const;
195 
199  bool isFailedFit() const;
200 
204  bool isTimeResolutionFailed() const;
205 
206  private:
207 
208  int m_CellId;
209  double m_Time;
210  double m_TimeResolution;
211  double m_Energy;
212  unsigned short int m_Status;
216  double m_TwoComponentChi2;
217  double m_TwoComponentSavedChi2[3];
220  // 1: first version (TF)
221  // 2: added m_TimeResolution (TF)
222  // 3: added status bits for failed fits (TF)
223  // 4: added offline fit variables (SL)
224  // 5: added diode and pile-up photon offline fit hypothesis (SL)
225  // 6: added m_TwoComponentSavedChi2[3] to save chi2 for each fit tried (SL)
228  };
229 
230  // inline isCalibrated
231  inline bool ECLCalDigit::isCalibrated() const
232  {
233  return hasStatus(c_IsCalibrated);
234  }
235 
236  // inline isEnergyCalibrated
237  inline bool ECLCalDigit::isEnergyCalibrated() const
238  {
239  return hasStatus(c_IsEnergyCalibrated);
240  }
241 
242  // inline isTimeCalibrated
243  inline bool ECLCalDigit::isTimeCalibrated() const
244  {
245  return hasStatus(c_IsTimeCalibrated);
246  }
247 
248  // inline isTimeResolutionCalibrated
249  inline bool ECLCalDigit::isTimeResolutionCalibrated() const
250  {
251  return hasStatus(c_IsTimeResolutionCalibrated);
252  }
253 
254  // inline isFailedFit
255  inline bool ECLCalDigit::isFailedFit() const
256  {
257  return hasStatus(c_IsFailedFit);
258  }
259 
260  // inline isTimeResolutionFailed
261  inline bool ECLCalDigit::isTimeResolutionFailed() const
262  {
263  return hasStatus(c_IsFailedTimeResolution);
264  }
265 
266 
268 } // end namespace Belle2
269 
270 #endif
Belle2::ECLCalDigit::setTime
void setTime(double Time)
Set Calibrated Time.
Definition: ECLCalDigit.h:108
Belle2::ECLCalDigit::m_TwoComponentTotalEnergy
double m_TwoComponentTotalEnergy
Calibrated Two Component Total Energy.
Definition: ECLCalDigit.h:223
Belle2::ECLCalDigit::getEnergy
double getEnergy() const
Get Calibrated Energy.
Definition: ECLCalDigit.h:134
Belle2::ECLCalDigit::setTwoComponentHadronEnergy
void setTwoComponentHadronEnergy(double Energy)
Set two component hadron energy.
Definition: ECLCalDigit.h:83
Belle2::ECLCalDigit::getTwoComponentChi2
double getTwoComponentChi2() const
Get two componnent chi2.
Definition: ECLCalDigit.h:154
Belle2::ECLCalDigit::isTimeResolutionFailed
bool isTimeResolutionFailed() const
Get Boolean time resolution failed status.
Definition: ECLCalDigit.h:271
Belle2::ECLCalDigit::m_TwoComponentChi2
double m_TwoComponentChi2
Two Component chi2.
Definition: ECLCalDigit.h:226
Belle2::ECLCalDigit
Class to store calibrated ECLDigits: ECLCalDigits.
Definition: ECLCalDigit.h:38
Belle2::ECLDsp::TwoComponentFitType
TwoComponentFitType
Offline two component fit type.
Definition: ECLDsp.h:42
Belle2::ECLCalDigit::m_Energy
double m_Energy
Calibrated Energy.
Definition: ECLCalDigit.h:221
Belle2::ECLCalDigit::getCellId
int getCellId() const
Get Cell ID.
Definition: ECLCalDigit.h:129
Belle2::ECLCalDigit::hasStatus
bool hasStatus(unsigned short int bitmask) const
Get Calibration Status.
Definition: ECLCalDigit.h:184
Belle2::ECLCalDigit::setTwoComponentDiodeEnergy
void setTwoComponentDiodeEnergy(double Energy)
Set two component diode energy.
Definition: ECLCalDigit.h:87
Belle2::ECLCalDigit::isCalibrated
bool isCalibrated() const
Get Boolean Calibration Status.
Definition: ECLCalDigit.h:241
Belle2::ECLCalDigit::isEnergyCalibrated
bool isEnergyCalibrated() const
Get Boolean Energy Calibration Status.
Definition: ECLCalDigit.h:247
Belle2::ECLCalDigit::ClassDef
ClassDef(ECLCalDigit, 6)
ClassDef.
Belle2::ECLCalDigit::m_Status
unsigned short int m_Status
Calibration and Fit Status.
Definition: ECLCalDigit.h:222
Belle2::ECLCalDigit::m_TwoComponentHadronEnergy
double m_TwoComponentHadronEnergy
Calibrated Hadron Component Energy.
Definition: ECLCalDigit.h:224
Belle2::ECLCalDigit::setTwoComponentSavedChi2
void setTwoComponentSavedChi2(ECLDsp::TwoComponentFitType FitTypeIn, double input)
Set two comp chi2 for a fit type see enum TwoComponentFitType in ECLDsp.h for description of fit type...
Definition: ECLCalDigit.h:96
Belle2::ECLCalDigit::getTimeResolution
double getTimeResolution() const
Get Calibrated Time Resolution.
Definition: ECLCalDigit.h:179
Belle2::ECLCalDigit::m_TwoComponentFitType
ECLDsp::TwoComponentFitType m_TwoComponentFitType
offline fit hypothesis.
Definition: ECLCalDigit.h:228
Belle2::ECLCalDigit::setTimeResolution
void setTimeResolution(double TimeResolution)
Set Calibrated Time Resolution.
Definition: ECLCalDigit.h:112
Belle2::ECLCalDigit::ECLCalDigit
ECLCalDigit()
default constructor for ROOT
Definition: ECLCalDigit.h:52
Belle2::ECLDsp::poorChi2
@ poorChi2
All offline fit attempts were greater than chi2 threshold.
Definition: ECLDsp.h:43
Belle2::ECLCalDigit::setTwoComponentChi2
void setTwoComponentChi2(double chi)
Set two component chi2.
Definition: ECLCalDigit.h:91
Belle2::ECLCalDigit::setStatus
void setStatus(unsigned short int status)
Set Calibration Status (overwrites previously set bits)
Definition: ECLCalDigit.h:116
Belle2::ECLCalDigit::getTime
double getTime() const
Get Calibrated Time.
Definition: ECLCalDigit.h:174
Belle2::ECLCalDigit::m_TimeResolution
double m_TimeResolution
Calibrated Time resolution.
Definition: ECLCalDigit.h:220
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLCalDigit::getTwoComponentHadronEnergy
double getTwoComponentHadronEnergy() const
Get Two Component calibrated hadron component Energy.
Definition: ECLCalDigit.h:144
Belle2::ECLCalDigit::m_TwoComponentSavedChi2
double m_TwoComponentSavedChi2[3]
Two comp chi2 for each fit tried in reconstruction.
Definition: ECLCalDigit.h:227
Belle2::ECLCalDigit::setEnergy
void setEnergy(double Energy)
Set Calibrated Energy.
Definition: ECLCalDigit.h:75
Belle2::ECLCalDigit::m_CellId
int m_CellId
Cell ID.
Definition: ECLCalDigit.h:218
Belle2::ECLCalDigit::setTwoComponentFitType
void setTwoComponentFitType(ECLDsp::TwoComponentFitType ft)
Set two component fit type.
Definition: ECLCalDigit.h:104
Belle2::ECLCalDigit::isFailedFit
bool isFailedFit() const
Get Boolean Fit Failed Status.
Definition: ECLCalDigit.h:265
Belle2::ECLCalDigit::m_TwoComponentDiodeEnergy
double m_TwoComponentDiodeEnergy
Calibrated Diode Component Energy.
Definition: ECLCalDigit.h:225
Belle2::ECLCalDigit::addStatus
void addStatus(unsigned short int bitmask)
Add Calibration Status.
Definition: ECLCalDigit.h:120
Belle2::ECLCalDigit::m_Time
double m_Time
Calibrated Time.
Definition: ECLCalDigit.h:219
Belle2::ECLCalDigit::setTwoComponentTotalEnergy
void setTwoComponentTotalEnergy(double Energy)
Set two component total energy.
Definition: ECLCalDigit.h:79
Belle2::ECLCalDigit::StatusBit
StatusBit
status enumerator
Definition: ECLCalDigit.h:42
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::ECLCalDigit::getTwoComponentTotalEnergy
double getTwoComponentTotalEnergy() const
Get Two Component calibrated Total Energy.
Definition: ECLCalDigit.h:139
Belle2::Time
Definition: Time.h:14
Belle2::ECLCalDigit::removeStatus
void removeStatus(unsigned short int bitmask)
Remove Calibration Status.
Definition: ECLCalDigit.h:124
Belle2::ECLCalDigit::isTimeCalibrated
bool isTimeCalibrated() const
Get Boolean Time Calibration Status.
Definition: ECLCalDigit.h:253
Belle2::ECLCalDigit::getTwoComponentDiodeEnergy
double getTwoComponentDiodeEnergy() const
Get Two Component calibrated diode component Energy.
Definition: ECLCalDigit.h:149
Belle2::ECLCalDigit::getTwoComponentFitType
ECLDsp::TwoComponentFitType getTwoComponentFitType() const
Get two componnent fit type.
Definition: ECLCalDigit.h:169
Belle2::ECLCalDigit::setCellId
void setCellId(int CellId)
Set Cell ID.
Definition: ECLCalDigit.h:71
Belle2::ECLCalDigit::getTwoComponentSavedChi2
double getTwoComponentSavedChi2(ECLDsp::TwoComponentFitType FitTypeIn) const
get two comp chi2 for a fit type see enum TwoComponentFitType in ECLDsp.h for description of fit type...
Definition: ECLCalDigit.h:160
Belle2::ECLCalDigit::isTimeResolutionCalibrated
bool isTimeResolutionCalibrated() const
Get Boolean Time Resolution Calibration Status.
Definition: ECLCalDigit.h:259