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 {
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
42 {
43 m_CellId = 0;
44 m_Time = 0;
46 m_Energy = 0;
47 m_Status = 0;
56 }
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:
227 double m_Time;
229 double m_Energy;
230 unsigned short int m_Status;
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)
246 };
247
248 // inline isCalibrated
249 inline bool ECLCalDigit::isCalibrated() const
250 {
251 return hasStatus(c_IsCalibrated);
252 }
253
254 // inline isEnergyCalibrated
256 {
257 return hasStatus(c_IsEnergyCalibrated);
258 }
259
260 // inline isTimeCalibrated
262 {
263 return hasStatus(c_IsTimeCalibrated);
264 }
265
266 // inline isTimeResolutionCalibrated
268 {
269 return hasStatus(c_IsTimeResolutionCalibrated);
270 }
271
272 // inline isFailedFit
273 inline bool ECLCalDigit::isFailedFit() const
274 {
275 return hasStatus(c_IsFailedFit);
276 }
277
278 // inline isTimeResolutionFailed
280 {
281 return hasStatus(c_IsFailedTimeResolution);
282 }
283
284 // inline isOnlineFitQuality1
286 {
287 return hasStatus(c_OnlineFitQuality1);
288 }
289
290 // inline isOnlineFitQuality2
292 {
293 return hasStatus(c_OnlineFitQuality2);
294 }
295
296 // inline isOnlineFitQuality3
298 {
299 return hasStatus(c_OnlineFitQuality3);
300 }
301
302 // inline isOnlineFitQuality0
304 {
305 return hasStatus(c_OnlineFitQuality0);
306 }
307
309} // end namespace Belle2
Class to store calibrated ECLDigits: ECLCalDigits.
Definition: ECLCalDigit.h:23
ECLDsp::TwoComponentFitType m_TwoComponentFitType
offline fit hypothesis.
Definition: ECLCalDigit.h:236
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.
Definition: ECLCalDigit.h:234
int getCellId() const
Get Cell ID.
Definition: ECLCalDigit.h:118
double m_Energy
Calibrated Energy.
Definition: ECLCalDigit.h:229
void setTimeResolution(double TimeResolution)
Set Calibrated Time Resolution.
Definition: ECLCalDigit.h:101
void setEnergy(double Energy)
Set Calibrated Energy.
Definition: ECLCalDigit.h:64
double m_TimeResolution
Calibrated Time resolution.
Definition: ECLCalDigit.h:228
int m_CellId
Cell ID.
Definition: ECLCalDigit.h:226
double m_TwoComponentHadronEnergy
Calibrated Hadron Component Energy.
Definition: ECLCalDigit.h:232
void addStatus(unsigned short int bitmask)
Add Calibration Status.
Definition: ECLCalDigit.h:109
double m_TwoComponentDiodeEnergy
Calibrated Diode Component Energy.
Definition: ECLCalDigit.h:233
double getTwoComponentDiodeEnergy() const
Get Two Component calibrated diode component Energy.
Definition: ECLCalDigit.h:138
void setTwoComponentDiodeEnergy(double Energy)
Set two component diode energy.
Definition: ECLCalDigit.h:76
ClassDef(ECLCalDigit, 7)
ClassDef.
void setCellId(int CellId)
Set Cell ID.
Definition: ECLCalDigit.h:60
double getEnergy() const
Get Calibrated Energy.
Definition: ECLCalDigit.h:123
bool hasStatus(unsigned short int bitmask) const
Get Calibration Status.
Definition: ECLCalDigit.h:173
double m_TwoComponentTotalEnergy
Calibrated Two Component Total Energy.
Definition: ECLCalDigit.h:231
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...
Definition: ECLCalDigit.h:149
void setTwoComponentFitType(ECLDsp::TwoComponentFitType ft)
Set two component fit type.
Definition: ECLCalDigit.h:93
void removeStatus(unsigned short int bitmask)
Remove Calibration Status.
Definition: ECLCalDigit.h:113
unsigned short int m_Status
Calibration and Fit Status.
Definition: ECLCalDigit.h:230
double m_Time
Calibrated Time.
Definition: ECLCalDigit.h:227
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.
Definition: ECLCalDigit.h:143
double getTwoComponentHadronEnergy() const
Get Two Component calibrated hadron component Energy.
Definition: ECLCalDigit.h:133
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)
Definition: ECLCalDigit.h:105
void setTime(double Time)
Set Calibrated Time.
Definition: ECLCalDigit.h:97
double getTwoComponentTotalEnergy() const
Get Two Component calibrated Total Energy.
Definition: ECLCalDigit.h:128
double getTimeResolution() const
Get Calibrated Time Resolution.
Definition: ECLCalDigit.h:168
ECLDsp::TwoComponentFitType getTwoComponentFitType() const
Get two component fit type.
Definition: ECLCalDigit.h:158
double getTime() const
Get Calibrated Time.
Definition: ECLCalDigit.h:163
double m_TwoComponentSavedChi2[3]
Two comp chi2 for each fit tried in reconstruction.
Definition: ECLCalDigit.h:235
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:279
bool isEnergyCalibrated() const
Get Boolean Energy Calibration Status.
Definition: ECLCalDigit.h:255
bool isOnlineFitQuality1() const
Get Boolean online fit quality 1.
Definition: ECLCalDigit.h:285
bool isOnlineFitQuality0() const
Get Boolean online fit quality 0.
Definition: ECLCalDigit.h:303
bool isTimeResolutionCalibrated() const
Get Boolean Time Resolution Calibration Status.
Definition: ECLCalDigit.h:267
bool isOnlineFitQuality2() const
Get Boolean online fit quality 2.
Definition: ECLCalDigit.h:291
bool isCalibrated() const
Get Boolean Calibration Status.
Definition: ECLCalDigit.h:249
bool isOnlineFitQuality3() const
Get Boolean online fit quality 3.
Definition: ECLCalDigit.h:297
bool isTimeCalibrated() const
Get Boolean Time Calibration Status.
Definition: ECLCalDigit.h:261
bool isFailedFit() const
Get Boolean Fit Failed Status.
Definition: ECLCalDigit.h:273
Abstract base class for different kinds of events.