Belle II Software  release-08-01-10
ECLCalDigit.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 #include <framework/datastore/RelationsObject.h>
12 #include <ecl/dataobjects/ECLDsp.h>
13 
14 namespace Belle2 {
23  class ECLCalDigit : public RelationsObject {
24  public:
25 
27  enum StatusBit {
28  c_IsEnergyCalibrated = 1 << 0,
29  c_IsTimeCalibrated = 1 << 1,
30  c_IsTimeResolutionCalibrated = 1 << 2,
31  c_IsFailedFit = 1 << 3,
32  c_IsFailedTimeResolution = 1 << 4,
33  c_IsCalibrated = c_IsEnergyCalibrated | c_IsTimeCalibrated | c_IsTimeResolutionCalibrated,
34  };
35 
38  {
39  m_CellId = 0;
40  m_Time = 0;
41  m_TimeResolution = 0;
42  m_Energy = 0;
43  m_Status = 0;
47  m_TwoComponentChi2 = -1;
48  m_TwoComponentSavedChi2[0] = -1;
49  m_TwoComponentSavedChi2[1] = -1;
50  m_TwoComponentSavedChi2[2] = -1;
52  }
53 
56  void setCellId(int CellId) { m_CellId = CellId; }
57 
60  void setEnergy(double Energy) { m_Energy = Energy; }
61 
64  void setTwoComponentTotalEnergy(double Energy) { m_TwoComponentTotalEnergy = Energy; }
65 
68  void setTwoComponentHadronEnergy(double Energy) { m_TwoComponentHadronEnergy = Energy; }
69 
72  void setTwoComponentDiodeEnergy(double Energy) { m_TwoComponentDiodeEnergy = Energy; }
73 
76  void setTwoComponentChi2(double chi) { m_TwoComponentChi2 = chi; }
77 
82  {
83  unsigned int index = FitTypeIn ;
84  m_TwoComponentSavedChi2[index] = input;
85  }
86 
90 
93  void setTime(double Time) { m_Time = Time; }
94 
97  void setTimeResolution(double TimeResolution) { m_TimeResolution = TimeResolution; }
98 
101  void setStatus(unsigned short int status) { m_Status = status; }
102 
105  void addStatus(unsigned short int bitmask) { m_Status |= bitmask; }
106 
109  void removeStatus(unsigned short int bitmask) { m_Status &= (~bitmask); }
110 
114  int getCellId() const { return m_CellId; }
115 
119  double getEnergy() const { return m_Energy; }
120 
125 
130 
135 
139  double getTwoComponentChi2() const { return m_TwoComponentChi2; }
140 
146  {
147  unsigned int index = FitTypeIn ;
148  return m_TwoComponentSavedChi2[index];
149  }
150 
155 
159  double getTime() const { return m_Time; }
160 
164  double getTimeResolution() const { return m_TimeResolution; }
165 
169  bool hasStatus(unsigned short int bitmask) const { return (m_Status & bitmask) == bitmask; }
170 
174  bool isCalibrated() const;
175 
179  bool isEnergyCalibrated() const;
180 
184  bool isTimeCalibrated() const;
185 
189  bool isTimeResolutionCalibrated() const;
190 
194  bool isFailedFit() const;
195 
199  bool isTimeResolutionFailed() const;
200 
201  private:
202 
203  int m_CellId;
204  double m_Time;
206  double m_Energy;
207  unsigned short int m_Status;
215  // 1: first version (TF)
216  // 2: added m_TimeResolution (TF)
217  // 3: added status bits for failed fits (TF)
218  // 4: added offline fit variables (SL)
219  // 5: added diode and pile-up photon offline fit hypothesis (SL)
220  // 6: added m_TwoComponentSavedChi2[3] to save chi2 for each fit tried (SL)
223  };
224 
225  // inline isCalibrated
226  inline bool ECLCalDigit::isCalibrated() const
227  {
228  return hasStatus(c_IsCalibrated);
229  }
230 
231  // inline isEnergyCalibrated
233  {
234  return hasStatus(c_IsEnergyCalibrated);
235  }
236 
237  // inline isTimeCalibrated
238  inline bool ECLCalDigit::isTimeCalibrated() const
239  {
240  return hasStatus(c_IsTimeCalibrated);
241  }
242 
243  // inline isTimeResolutionCalibrated
245  {
246  return hasStatus(c_IsTimeResolutionCalibrated);
247  }
248 
249  // inline isFailedFit
250  inline bool ECLCalDigit::isFailedFit() const
251  {
252  return hasStatus(c_IsFailedFit);
253  }
254 
255  // inline isTimeResolutionFailed
257  {
258  return hasStatus(c_IsFailedTimeResolution);
259  }
260 
261 
263 } // end namespace Belle2
Class to store calibrated ECLDigits: ECLCalDigits.
Definition: ECLCalDigit.h:23
ECLDsp::TwoComponentFitType m_TwoComponentFitType
offline fit hypothesis.
Definition: ECLCalDigit.h:213
StatusBit
status enumerator
Definition: ECLCalDigit.h:27
void setTwoComponentChi2(double chi)
Set two component chi2.
Definition: ECLCalDigit.h:76
double m_TwoComponentChi2
Two Component chi2.
Definition: ECLCalDigit.h:211
int getCellId() const
Get Cell ID.
Definition: ECLCalDigit.h:114
double m_Energy
Calibrated Energy.
Definition: ECLCalDigit.h:206
void setTimeResolution(double TimeResolution)
Set Calibrated Time Resolution.
Definition: ECLCalDigit.h:97
void setEnergy(double Energy)
Set Calibrated Energy.
Definition: ECLCalDigit.h:60
double m_TimeResolution
Calibrated Time resolution.
Definition: ECLCalDigit.h:205
int m_CellId
Cell ID.
Definition: ECLCalDigit.h:203
double m_TwoComponentHadronEnergy
Calibrated Hadron Component Energy.
Definition: ECLCalDigit.h:209
void addStatus(unsigned short int bitmask)
Add Calibration Status.
Definition: ECLCalDigit.h:105
double m_TwoComponentDiodeEnergy
Calibrated Diode Component Energy.
Definition: ECLCalDigit.h:210
double getTwoComponentDiodeEnergy() const
Get Two Component calibrated diode component Energy.
Definition: ECLCalDigit.h:134
void setTwoComponentDiodeEnergy(double Energy)
Set two component diode energy.
Definition: ECLCalDigit.h:72
void setCellId(int CellId)
Set Cell ID.
Definition: ECLCalDigit.h:56
double getEnergy() const
Get Calibrated Energy.
Definition: ECLCalDigit.h:119
bool hasStatus(unsigned short int bitmask) const
Get Calibration Status.
Definition: ECLCalDigit.h:169
double m_TwoComponentTotalEnergy
Calibrated Two Component Total Energy.
Definition: ECLCalDigit.h:208
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:81
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:145
void setTwoComponentFitType(ECLDsp::TwoComponentFitType ft)
Set two component fit type.
Definition: ECLCalDigit.h:89
void removeStatus(unsigned short int bitmask)
Remove Calibration Status.
Definition: ECLCalDigit.h:109
unsigned short int m_Status
Calibration and Fit Status.
Definition: ECLCalDigit.h:207
double m_Time
Calibrated Time.
Definition: ECLCalDigit.h:204
ECLCalDigit()
default constructor for ROOT
Definition: ECLCalDigit.h:37
ClassDef(ECLCalDigit, 6)
ClassDef.
void setTwoComponentHadronEnergy(double Energy)
Set two component hadron energy.
Definition: ECLCalDigit.h:68
double getTwoComponentChi2() const
Get two componnent chi2.
Definition: ECLCalDigit.h:139
double getTwoComponentHadronEnergy() const
Get Two Component calibrated hadron component Energy.
Definition: ECLCalDigit.h:129
void setTwoComponentTotalEnergy(double Energy)
Set two component total energy.
Definition: ECLCalDigit.h:64
void setStatus(unsigned short int status)
Set Calibration Status (overwrites previously set bits)
Definition: ECLCalDigit.h:101
void setTime(double Time)
Set Calibrated Time.
Definition: ECLCalDigit.h:93
double getTwoComponentTotalEnergy() const
Get Two Component calibrated Total Energy.
Definition: ECLCalDigit.h:124
double getTimeResolution() const
Get Calibrated Time Resolution.
Definition: ECLCalDigit.h:164
ECLDsp::TwoComponentFitType getTwoComponentFitType() const
Get two componnent fit type.
Definition: ECLCalDigit.h:154
double getTime() const
Get Calibrated Time.
Definition: ECLCalDigit.h:159
double m_TwoComponentSavedChi2[3]
Two comp chi2 for each fit tried in reconstruction.
Definition: ECLCalDigit.h:212
TwoComponentFitType
Offline two component fit type.
Definition: ECLDsp.h:29
@ poorChi2
All offline fit attempts were greater than chi2 threshold.
Definition: ECLDsp.h:30
Defines interface for accessing relations of objects in StoreArray.
bool isTimeResolutionFailed() const
Get Boolean time resolution failed status.
Definition: ECLCalDigit.h:256
bool isEnergyCalibrated() const
Get Boolean Energy Calibration Status.
Definition: ECLCalDigit.h:232
bool isTimeResolutionCalibrated() const
Get Boolean Time Resolution Calibration Status.
Definition: ECLCalDigit.h:244
bool isCalibrated() const
Get Boolean Calibration Status.
Definition: ECLCalDigit.h:226
bool isTimeCalibrated() const
Get Boolean Time Calibration Status.
Definition: ECLCalDigit.h:238
bool isFailedFit() const
Get Boolean Fit Failed Status.
Definition: ECLCalDigit.h:250
Abstract base class for different kinds of events.