Belle II Software development
ECLDigit.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/utility/ECLRawDataHadron.h>
13
14namespace Belle2 {
19
24
25 class ECLDigit : public RelationsObject {
26 public:
29 {
30 m_CellId = 0;
31 m_Amp = 0;
32 m_TimeFit = 0;
33 m_Quality = 0;
34 m_Chi = 0;
35 }
36
37 /* Setters */
38
41 void setCellId(int CellId) { m_CellId = CellId; }
42
45 void setAmp(int Amp) { m_Amp = Amp; }
46
47
50 void setTimeFit(int TimeFit) { m_TimeFit = TimeFit; }
51
52
55 void setQuality(unsigned int NewQuality)
56 {
57 // 4 0
58 // v v
59 const unsigned int mask = 0b0000'0011;
60 // Set quality in bits 1..0, keep other bits unchanged
61 m_Quality = (NewQuality & mask) | (m_Quality & ~mask);
62 }
63
66 void setChi(int Chi) { m_Chi = Chi; }
67
71 void setPackedHadronFraction(unsigned int packed_fraction)
72 {
73 // 8 4 0
74 // v v v
75 const unsigned int mask = 0b0011'1110'0000;
76 // Set packed hadron fraction in bits 9..5, keep other bits unchanged
77 m_Quality = ((packed_fraction << 5) & mask) | (m_Quality & ~mask);
78 }
79
83 void setDataFormat(unsigned int format)
84 {
85 // 4 0
86 // v v
87 const unsigned int mask = 0b0001'1100;
88 // Set data availability flag in bits 4..2, keep other bits unchanged
89 m_Quality = ((format << 2) & mask) | (m_Quality & ~mask);
90 }
91
92 /* Getters */
93
97 int getCellId() const { return m_CellId; }
98
102 int getAmp() const { return m_Amp; }
103
107 int getTimeFit() const { return m_TimeFit; }
108
112 int getQuality() const
113 {
114 // 4 0
115 // v v
116 const unsigned int mask = 0b0000'0011;
117 // Get quality from bits 1..0
118 return m_Quality & mask;
119 }
120
124 int getChi() const { return m_Chi; }
125
129 unsigned int getPackedHadronFraction() const
130 {
131 // 8 4 0
132 // v v v
133 const unsigned int mask = 0b0011'1110'0000;
134 // Get packed hadron fraction from bits 9..5
135 return (m_Quality & mask) >> 5;
136 }
137
143 double getHadronFraction() const
144 {
145 using namespace Belle2::ECL::RawDataHadron;
146 unsigned int packed_fraction = getPackedHadronFraction();
147 // Unpack from [0..31] to a floating point value. See unpackHadronFraction for details
148 return unpackHadronFraction(packed_fraction);
149 }
150
154 unsigned int getDataFormat()
155 {
156 // 4 0
157 // v v
158 const unsigned int mask = 0b0001'1100;
159 return (m_Quality & mask) >> 2;
160 }
161
166 static ECLDigit* getByCellID(int cid);
167
168 private:
169
171 int m_Amp;
180 int m_Chi;
181
182 // 2: r25301, data member changed to ints
184
185 };
186
188} // end namespace Belle2
189
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
Definition ECLDigit.h:25
int getAmp() const
Get Fitting Amplitude.
Definition ECLDigit.h:102
int getQuality() const
Get Fitting Quality.
Definition ECLDigit.h:112
int getCellId() const
Get Cell ID.
Definition ECLDigit.h:97
int m_CellId
Cell ID.
Definition ECLDigit.h:170
void setQuality(unsigned int NewQuality)
Set Fitting Quality.
Definition ECLDigit.h:55
void setAmp(int Amp)
Set Fitting Amplitude.
Definition ECLDigit.h:45
void setTimeFit(int TimeFit)
Set Fitting Time.
Definition ECLDigit.h:50
static ECLDigit * getByCellID(int cid)
Find ECLDigit by Cell ID using linear search.
Definition ECLDigit.cc:14
void setCellId(int CellId)
Set Cell ID.
Definition ECLDigit.h:41
double getHadronFraction() const
Get unpacked hadron fraction This is the value of (A_hadron / A_total) from ShaperDSP firmware that s...
Definition ECLDigit.h:143
int getTimeFit() const
Get Fitting Time.
Definition ECLDigit.h:107
int getChi() const
Get Chi-squared.
Definition ECLDigit.h:124
unsigned int getPackedHadronFraction() const
Get packed hadron fraction This is a raw value from the ShaperDSP firmware, useful only for debugging...
Definition ECLDigit.h:129
void setChi(int Chi)
Set Chi-squared.
Definition ECLDigit.h:66
void setPackedHadronFraction(unsigned int packed_fraction)
Set hadron fraction See ecl/utility/include/ECLRawDataHadron.h for details.
Definition ECLDigit.h:71
ECLDigit()
default constructor for ROOT
Definition ECLDigit.h:28
void setDataFormat(unsigned int format)
Set ShaperDSP data format.
Definition ECLDigit.h:83
int m_Quality
Fit information.
Definition ECLDigit.h:179
int m_Chi
Fitting chi2-squared.
Definition ECLDigit.h:180
int m_Amp
Fitting Amplitude.
Definition ECLDigit.h:171
unsigned int getDataFormat()
Get ShaperDSP data format.
Definition ECLDigit.h:154
ClassDef(ECLDigit, 2)
ClassDef.
int m_TimeFit
Fitting Time.
Definition ECLDigit.h:172
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
This is a set of function for packing/unpacking the data produced by the new ShaperDSP firmware that ...
double unpackHadronFraction(int fraction_packed)
Hadron fraction unpacking.
Abstract base class for different kinds of events.