Belle II Software development
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
14namespace Belle2 {
19
22
24 public:
26 enum StatusBit {
27 c_IsEnergyCalibrated = 1 << 0,
28 c_IsTimeCalibrated = 1 << 1,
29 c_IsTimeResolutionCalibrated = 1 << 2,
30 c_IsFailedFit = 1 << 3,
31 c_IsFailedTimeResolution = 1 << 4,
32 c_IsCalibrated = c_IsEnergyCalibrated | c_IsTimeCalibrated | c_IsTimeResolutionCalibrated,
33 // constants for the online Fit Quality Flags. For description of these Flags, see https://xwiki.desy.de/xwiki/rest/p/ca7f6
34 c_OnlineFitQuality1 = 1 << 5,
35 c_OnlineFitQuality2 = 1 << 6,
36 c_OnlineFitQuality3 = 1 << 7,
37 c_OnlineFitQuality0 = 1 << 8,
38 };
39
57
60 void setCellId(int CellId) { m_CellId = CellId; }
61
64 void setEnergy(double Energy) { m_Energy = Energy; }
65
68 void setTwoComponentTotalEnergy(double Energy) { m_TwoComponentTotalEnergy = Energy; }
69
73
76 void setTwoComponentDiodeEnergy(double Energy) { m_TwoComponentDiodeEnergy = Energy; }
77
80 void setTwoComponentChi2(double chi) { m_TwoComponentChi2 = chi; }
81
86 {
87 unsigned int index = FitTypeIn;
88 m_TwoComponentSavedChi2[index] = input;
89 }
90
94
97 void setTime(double Time) { m_Time = Time; }
98
101 void setTimeResolution(double TimeResolution) { m_TimeResolution = TimeResolution; }
102
105 void setStatus(unsigned short int status) { m_Status = status; }
106
109 void addStatus(unsigned short int bitmask) { m_Status |= bitmask; }
110
113 void removeStatus(unsigned short int bitmask) { m_Status &= (~bitmask); }
114
118 int getCellId() const { return m_CellId; }
119
123 double getEnergy() const { return m_Energy; }
124
129
134
139
143 double getTwoComponentChi2() const { return m_TwoComponentChi2; }
144
150 {
151 unsigned int index = FitTypeIn;
152 return m_TwoComponentSavedChi2[index];
153 }
154
159
163 double getTime() const { return m_Time; }
164
168 double getTimeResolution() const { return m_TimeResolution; }
169
173 bool hasStatus(unsigned short int bitmask) const { return (m_Status & bitmask) == bitmask; }
174
178 bool isCalibrated() const;
179
183 bool isEnergyCalibrated() const;
184
188 bool isTimeCalibrated() const;
189
193 bool isTimeResolutionCalibrated() const;
194
198 bool isFailedFit() const;
199
203 bool isTimeResolutionFailed() const;
204
208 bool isOnlineFitQuality1() const;
209
213 bool isOnlineFitQuality2() const;
214
218 bool isOnlineFitQuality3() const;
219
223 bool isOnlineFitQuality0() const;
224
225 private:
226 double m_Time;
228 double m_Energy;
230 unsigned short int m_Status;
237
238 // 1: first version (TF)
239 // 2: added m_TimeResolution (TF)
240 // 3: added status bits for failed fits (TF)
241 // 4: added offline fit variables (SL)
242 // 5: added diode and pile-up photon offline fit hypothesis (SL)
243 // 6: added m_TwoComponentSavedChi2[3] to save chi2 for each fit tried (SL)
244 // 7: propagated status flags for the online fit from the ECLDigit object (JE)
245 // 8: Slightly reorder data members to improve memory layout (CW)
247 };
248
249 // inline isCalibrated
250 inline bool ECLCalDigit::isCalibrated() const
251 {
252 return hasStatus(c_IsCalibrated);
253 }
254
255 // inline isEnergyCalibrated
257 {
258 return hasStatus(c_IsEnergyCalibrated);
259 }
260
261 // inline isTimeCalibrated
263 {
264 return hasStatus(c_IsTimeCalibrated);
265 }
266
267 // inline isTimeResolutionCalibrated
269 {
270 return hasStatus(c_IsTimeResolutionCalibrated);
271 }
272
273 // inline isFailedFit
274 inline bool ECLCalDigit::isFailedFit() const
275 {
276 return hasStatus(c_IsFailedFit);
277 }
278
279 // inline isTimeResolutionFailed
281 {
282 return hasStatus(c_IsFailedTimeResolution);
283 }
284
285 // inline isOnlineFitQuality1
287 {
288 return hasStatus(c_OnlineFitQuality1);
289 }
290
291 // inline isOnlineFitQuality2
293 {
294 return hasStatus(c_OnlineFitQuality2);
295 }
296
297 // inline isOnlineFitQuality3
299 {
300 return hasStatus(c_OnlineFitQuality3);
301 }
302
303 // inline isOnlineFitQuality0
305 {
306 return hasStatus(c_OnlineFitQuality0);
307 }
308
310} // end namespace Belle2
ECLDsp::TwoComponentFitType m_TwoComponentFitType
offline fit hypothesis.
StatusBit
status enumerator
Definition ECLCalDigit.h:26
void setTwoComponentChi2(double chi)
Set two component chi2.
Definition ECLCalDigit.h:80
double m_TwoComponentChi2
Two Component chi2.
int getCellId() const
Get Cell ID.
double m_Energy
Calibrated Energy.
void setTimeResolution(double TimeResolution)
Set Calibrated Time Resolution.
void setEnergy(double Energy)
Set Calibrated Energy.
Definition ECLCalDigit.h:64
double m_TimeResolution
Calibrated Time resolution.
int m_CellId
Cell ID.
double m_TwoComponentHadronEnergy
Calibrated Hadron Component Energy.
void addStatus(unsigned short int bitmask)
Add Calibration Status.
double m_TwoComponentDiodeEnergy
Calibrated Diode Component Energy.
double getTwoComponentDiodeEnergy() const
Get Two Component calibrated diode component Energy.
void setTwoComponentDiodeEnergy(double Energy)
Set two component diode energy.
Definition ECLCalDigit.h:76
void setCellId(int CellId)
Set Cell ID.
Definition ECLCalDigit.h:60
double getEnergy() const
Get Calibrated Energy.
bool hasStatus(unsigned short int bitmask) const
Get Calibration Status.
double m_TwoComponentTotalEnergy
Calibrated Two Component Total Energy.
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:85
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...
void setTwoComponentFitType(ECLDsp::TwoComponentFitType ft)
Set two component fit type.
Definition ECLCalDigit.h:93
void removeStatus(unsigned short int bitmask)
Remove Calibration Status.
unsigned short int m_Status
Calibration and Fit Status.
double m_Time
Calibrated Time.
ECLCalDigit()
default constructor for ROOT
Definition ECLCalDigit.h:41
void setTwoComponentHadronEnergy(double Energy)
Set two component hadron energy.
Definition ECLCalDigit.h:72
double getTwoComponentChi2() const
Get two component chi2.
double getTwoComponentHadronEnergy() const
Get Two Component calibrated hadron component Energy.
void setTwoComponentTotalEnergy(double Energy)
Set two component total energy.
Definition ECLCalDigit.h:68
void setStatus(unsigned short int status)
Set Calibration Status (overwrites previously set bits)
void setTime(double Time)
Set Calibrated Time.
Definition ECLCalDigit.h:97
double getTwoComponentTotalEnergy() const
Get Two Component calibrated Total Energy.
double getTimeResolution() const
Get Calibrated Time Resolution.
ECLDsp::TwoComponentFitType getTwoComponentFitType() const
Get two component fit type.
double getTime() const
Get Calibrated Time.
double m_TwoComponentSavedChi2[3]
Two comp chi2 for each fit tried in reconstruction.
ClassDef(ECLCalDigit, 8)
ClassDef.
TwoComponentFitType
Offline two component fit type.
Definition ECLDsp.h:29
@ poorChi2
All offline fit attempts were greater than chi2 threshold.
Definition ECLDsp.h:30
bool isTimeResolutionFailed() const
Get Boolean time resolution failed status.
bool isEnergyCalibrated() const
Get Boolean Energy Calibration Status.
bool isOnlineFitQuality1() const
Get Boolean online fit quality 1.
bool isOnlineFitQuality0() const
Get Boolean online fit quality 0.
bool isTimeResolutionCalibrated() const
Get Boolean Time Resolution Calibration Status.
bool isOnlineFitQuality2() const
Get Boolean online fit quality 2.
bool isCalibrated() const
Get Boolean Calibration Status.
bool isOnlineFitQuality3() const
Get Boolean online fit quality 3.
bool isTimeCalibrated() const
Get Boolean Time Calibration Status.
bool isFailedFit() const
Get Boolean Fit Failed Status.
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Abstract base class for different kinds of events.