ATLAS Offline Software
Loading...
Searching...
No Matches
eFexEMRoI_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// System include(s):
7#include <stdexcept>
8#include <numbers>
9
10// xAOD include(s):
12
13// Local include(s):
15
16namespace xAOD {
17
19 const float eFexEMRoI_v1::s_tobEtScale = 100.;
20 const float eFexEMRoI_v1::s_xTobEtScale = 25.;
21 const float eFexEMRoI_v1::s_towerEtaWidth = 0.1;
22
27
28 void eFexEMRoI_v1::initialize( unsigned int eFexNumber, unsigned int shelf, uint32_t word0 ) {
29
30 using std::numbers::pi;
31
32 // xTOBs will have eFEX and Shelf numbers in word 1
33 // To save space, use the second word of this object, which is not part of a TOB, to store these values
34 uint32_t word1 = 0;
36 word1 |= (shelf&s_shelfMask)<<s_shelfBit;
37 setWord0( word0 );
38 setWord1( word1 );
39
42 float etaVal = iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
43 setEta( etaVal );
44 float phiVal = iPhi() * pi/32. + pi/64.;
45 if (phiVal > pi) phiVal = phiVal - 2.*pi;
46 setPhi( phiVal );
47
50 if (type() == TOB) setIsTOB(1);
51 else setIsTOB(0);
52
53 return;
54 }
55
56
59
60 using std::numbers::pi;
61
62 // xTOBs will have eFEX and Shelf numbers in word 1
63 // So all we need to do is set the TOB words
64 setWord0( word0 );
65 setWord1( word1 );
66
69 float etaVal = iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
70 setEta( etaVal );
71 float phiVal = iPhi() * pi/32. + pi/64.;
72 if (phiVal > pi) phiVal = phiVal - 2.*pi;
73 setPhi( phiVal );
74
77 if (type() == TOB) setIsTOB(1);
78 else setIsTOB(0);
79
80 return;
81 }
82
83
86 setWord0 )
88 setWord1 )
89
92 setRetaCore )
94 setRetaEnv )
96 setRhadEM )
98 setRhadHad )
100 setWstotNumerator )
102 setWstotDenominator )
103
104
107 setIsTOB )
108
111 setEt )
113 setEta )
115 setPhi )
116
117
119
121 unsigned int eFexEMRoI_v1::eFexNumber() const {
122 return (word1() >> s_eFexBit) & s_eFexMask;
123 }
124
125 // Shelf number. Usually 0 or 1, but can be 12 for Surface Test Facility.
126 unsigned int eFexEMRoI_v1::shelfNumber() const {
127 return (word1() >> s_shelfBit) & s_shelfMask;
128 }
129
132 if (etXTOB() == 0) return TOB;
133 else return xTOB;
134 }
135
137 unsigned int eFexEMRoI_v1::fpga() const {
138 return (word0() >> s_fpgaBit) & s_fpgaMask;
139 }
140
141 unsigned int eFexEMRoI_v1::fpgaEta() const {
142 return (word0() >> s_etaBit) & s_etaMask;
143 }
144
145 unsigned int eFexEMRoI_v1::fpgaPhi() const {
146 return (word0() >> s_phiBit) & s_phiMask;
147 }
148
149 unsigned int eFexEMRoI_v1::UpNotDown() const {
150 return (word0() >> s_updownBit) & s_updownMask;
151 }
152
153 unsigned int eFexEMRoI_v1::seed() const {
154 return (word0() >> s_seedBit) & s_seedMask;
155 }
156
157 unsigned int eFexEMRoI_v1::seedMax() const {
158 return (word0() >> s_maxBit) & s_maxMask;
159 }
160
162 unsigned int eFexEMRoI_v1::etTOB() const {
163 // Data content = TOB
164 if (etXTOB() == 0) {
165 return (word0() >> s_etBit) & s_etMask;
166 }
167 // Data Content = xTOB. Need to remove lower bits and cap range
168 else {
169 unsigned int etWord = (etXTOB() >> s_etBitXTOB);
170 if (etWord > s_etMask) etWord = s_etMask;
171 return etWord;
172 }
173 }
174
176 unsigned int eFexEMRoI_v1::etXTOB() const {
178 return (word1() >> s_etBit) & s_etFullMask;
179 }
180
182 unsigned int eFexEMRoI_v1::RetaThresholds() const {
183 return (word0() >> s_veto1Bit) & s_veto1Mask;
184 }
185
186 unsigned int eFexEMRoI_v1::RhadThresholds() const {
187 return (word0() >> s_veto3Bit) & s_veto3Mask;
188 }
189
190 unsigned int eFexEMRoI_v1::WstotThresholds() const {
191 return (word0() >> s_veto2Bit) & s_veto2Mask;
192 }
193
194 unsigned int eFexEMRoI_v1::bcn4() const {
195 return (word1() >> s_bcn4Bit) & s_bcn4Mask;
196 }
197
200 // Do something sensible if called for a TOB
201 if (etXTOB() == 0) return word0();
202 // When called for xTOB
203 else {
204 uint32_t word = word0() + etTOB();
205 return word;
206 }
207 }
208
212 float eFexEMRoI_v1::Reta() const {
213 float sum = RetaCore() + RetaEnv();
214 if (sum > 0) return (1. - RetaCore()/sum);
215 else return -1.;
216 }
217
218 float eFexEMRoI_v1::Rhad() const {
219 float sum = RhadEM() + RhadHad();
220 if (sum > 0) return (RhadHad()/sum);
221 else return -1.;
222 }
223
224 float eFexEMRoI_v1::Wstot() const {
225 if (WstotDenominator() > 0) return (static_cast<float>(WstotNumerator())/WstotDenominator());
226 else return -1.;
227 }
228
230
232 int eFexEMRoI_v1::iPhi() const {
233
235 // only use LSB of shelfNumber to determine the octant
236 // (shelfNumber is 0 or 1 in P1, but can be 12 in the STF)
237 unsigned int octant = int(eFexNumber()/3) + (shelfNumber()%2)*s_shelfPhiWidth;
238
240 int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
241 if (index >= s_numPhi) index -= s_numPhi;
242
243 return index;
244 }
245
250 int eFexEMRoI_v1::iEta() const {
251
254
256 return index;
257
258 }
259
262
264 return iPhi()*2;
265
266 }
267
270
273 return iEta()*4 + seed();
274
275 }
276
277
278} // namespace xAOD
Scalar eta() const
pseudorapidity method
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define pi
AuxElement()
Default constructor.
Class describing a LVL1 eFEX EM region of interest.
void setEt(float value)
floating point value (MeV, TOB scale)
static const int s_numPhi
static const int s_updownMask
unsigned int shelfNumber() const
static const float s_xTobEtScale
uint16_t WstotDenominator() const
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
void setPhi(float value)
Floating point, ATLAS phi convention (-pi -> pi)
static const float s_tobEtScale
Constants used in converting to ATLAS units.
static const int s_fpgaMask
static const int s_seedMask
static const int s_seedBit
unsigned int eFexNumber() const
Methods to decode data from the TOB/RoI and return to the user.
uint16_t RetaEnv() const
uint16_t WstotNumerator() const
void setWord1(uint32_t value)
uint16_t RetaCore() const
Actual values used in algorithm (setters and getters)
static const int s_etaBit
static const int s_veto3Mask
unsigned int bcn4() const
static const int s_phiMask
unsigned int RetaThresholds() const
Jet Discriminant 1 (R_eta) results.
unsigned int WstotThresholds() const
Jet Discriminant 3 (W_stot) results.
uint16_t RhadHad() const
float Reta() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
static const int s_etBitXTOB
static const int s_etFullMask
static const int s_etBit
unsigned int fpga() const
FPGA number.
unsigned int fpgaPhi() const
phi index within FPGA
static const int s_fpgaBit
Constants used in decoding TOB words For TOB word format changes these can be replaced by arrays in t...
static const int s_veto2Mask
static const int s_eFexPhiOffset
static const int s_bcn4Bit
void setWord0(uint32_t value)
Set the "raw" 32-bit words describing the e/gamma candidate.
unsigned int fpgaEta() const
eta index within FPGA
static const int s_minEta
int iPhi() const
Setter for the above.
static const int s_shelfPhiWidth
static const int s_etaMask
static const int s_shelfBit
static const int s_phiBit
void initialize(unsigned int eFexNumber, unsigned int shelf, uint32_t word0)
Initialise the object with its most important properties TOB initialiser.
static const int s_updownBit
static const int s_eFexPhiWidth
static const int s_maxMask
unsigned int RhadThresholds() const
Jet Discriminant 2 (R_had) results.
static const int s_shelfMask
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
static const int s_veto3Bit
static const int s_veto1Bit
static const int s_veto2Bit
unsigned int seedMax() const
Seed = max flag. Is this really useful?
static const int s_veto1Mask
unsigned int UpNotDown() const
Cluster up/down flag (1 = up, 0 = down)
float Wstot() const
static const int s_etMask
uint16_t RhadEM() const
int iEta() const
setter for the above
static const int s_fpgaEtaWidth
static const int s_bcn4Mask
int iEtaTopo() const
Getter for integer phi index (0-63)
uint32_t word1() const
static const int s_eFexMask
void setEta(float value)
Getter for floating point, full precision (0.025) eta.
static const int s_eFexBit
unsigned int seed() const
getter for integer eta index (-25->+24)
static const float s_towerEtaWidth
static const int s_maxBit
ObjectType type() const
Data decoded from the TOB/RoI word and eFEX number.
ObjectType
Object types.
@ xTOB
This object is an xTOB (2*32 bit words)
@ TOB
This object is a TOB (1*32 bit word)
eFexEMRoI_v1()
Default constructor.
static const int s_eFexEtaWidth
unsigned int etXTOB() const
Cluster ET (xTOB ET scale, 25 MeV/count)
uint32_t tobWord() const
Return TOB word corresponding to this TOB or xTOB.
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
void setIsTOB(char value)
Forward declaration.
Definition index.py:1
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setWord1 setRetaEnv RhadHad
setRawEt setRawPhi int
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
setWord1 uint16_t
setWord1 setRetaEnv setRhadHad WstotDenominator
setEventNumber uint32_t
setWord1 RetaEnv