ATLAS Offline Software
Loading...
Searching...
No Matches
eFexTauRoI_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 eFexTauRoI_v1::s_tobEtScale = 100.;
20 const float eFexTauRoI_v1::s_xTobEtScale = 25.;
21 const float eFexTauRoI_v1::s_towerEtaWidth = 0.1;
22
27
28 void eFexTauRoI_v1::initialize( unsigned int eFexNumber, unsigned int shelf, uint32_t word0 ) {
29 using std::numbers::pi;
30
31 // xTOBs will have eFEX and Shelf numbers in word 1
32 // To save space, use the second word of this object, which is not part of a TOB, to store these values
33 uint32_t word1 = 0;
35 word1 |= (shelf&s_shelfMask)<<s_shelfBit;
36 setWord0( word0 );
37 setWord1( word1 );
38
41 float etaVal = computeEta();
42 setEta( etaVal );
43 float phiVal = iPhi() * pi/32. + pi/64.;
44 if (phiVal > pi) phiVal = phiVal - 2.*pi;
45 setPhi( phiVal );
46
49 if (type() == TOB) setIsTOB(1);
50 else setIsTOB(0);
51
52 return;
53 }
54
55
57
58 using std::numbers::pi;
59
60 // xTOBs will have eFEX and Shelf numbers in word 1
61 // So all we need to do is set the TOB words
62 setWord0( word0 );
63 setWord1( word1 );
64
67 float etaVal = computeEta();
68 setEta( etaVal );
69 float phiVal = iPhi() * pi/32. + pi/64.;
70 if (phiVal > pi) phiVal = phiVal - 2.*pi;
71 setPhi( phiVal );
72
75 if (type() == TOB) setIsTOB(1);
76 else setIsTOB(0);
77
78 return;
79 }
80
83 setWord0 )
85 setWord1 )
86
87
89 setRCoreNumerator )
91 setRCoreDenominator )
93 setRHadNumerator )
95 setRHadDenominator )
96
99 setIsTOB )
100
103 setEt )
105 setEta )
107 setPhi )
108
109
111
113 unsigned int eFexTauRoI_v1::tobVersion() const {
114 return (word0() >> s_versionBit) & s_versionMask;
115 }
116
118 unsigned int eFexTauRoI_v1::eFexNumber() const {
119 return (word1() >> s_eFexBit) & s_eFexMask;
120 }
121
122 // Shelf number. Usually 0 or 1, but can be 12 for Surface Test Facility.
123 unsigned int eFexTauRoI_v1::shelfNumber() const {
124 return (word1() >> s_shelfBit) & s_shelfMask;
125 }
126
129 if (etXTOB() == 0) return TOB;
130 else return xTOB;
131 }
132
134 unsigned int eFexTauRoI_v1::fpga() const {
135 return (word0() >> s_fpgaBit) & s_fpgaMask;
136 }
137
138 unsigned int eFexTauRoI_v1::fpgaEta() const {
139 return (word0() >> s_etaBit) & s_etaMask;
140 }
141
142 unsigned int eFexTauRoI_v1::fpgaPhi() const {
143 return (word0() >> s_phiBit) & s_phiMask;
144 }
145
147 return (word0() >> s_updownBit) & s_updownMask;
148 }
149
150 unsigned int eFexTauRoI_v1::seed() const {
151 return (word0() >> s_seedBit) & s_seedMask;
152 }
153
155 return (word0() >> s_maxBit) & s_maxMask;
156 }
157
159 unsigned int eFexTauRoI_v1::etTOB() const {
160 // Data content = TOB
161 if (etXTOB() == 0) {
162 return (word0() >> s_etBit) & s_etMask;
163 }
164 // Data Content = xTOB. Need to remove lower bits and cap range
165 else {
166 unsigned int etWord = (etXTOB() >> s_etBitXTOB);
167 if (etWord > s_etMask) etWord = s_etMask;
168 return etWord;
169 }
170 }
171
173 unsigned int eFexTauRoI_v1::etXTOB() const {
175 return (word1() >> s_etBit) & s_etFullMask;
176 }
177
178
180 unsigned int eFexTauRoI_v1::bdtScore() const {
182 if (tobVersion() == Heuristic || type() != xTOB) return 0;
183 return (word0() >> s_bdtScoreBit) & s_bdtScoreMask;
184 }
185
186
188 unsigned int eFexTauRoI_v1::rCoreThresholds() const {
189 // Return rCore results if used, otherwise return 0
190 return (tobVersion() == Heuristic ? tauOneThresholds() : 0);
191 }
192
194 unsigned int eFexTauRoI_v1::bdtThresholds() const {
195 // Return BDT results if used, otherwise return 0
196 return (tobVersion() == Heuristic ? 0 : tauOneThresholds());
197 }
198
200 unsigned int eFexTauRoI_v1::rHadThresholds() const {
201 return tauTwoThresholds();
202 }
203
205 unsigned int eFexTauRoI_v1::tauOneThresholds() const {
206 return (word0() >> s_veto1Bit) & s_veto1Mask;
207 }
208
209 unsigned int eFexTauRoI_v1::tauTwoThresholds() const {
210 return (word0() >> s_veto2Bit) & s_veto2Mask;
211 }
212
214 return (word0() >> s_veto3Bit) & s_veto3Mask;
215 }
216
218 unsigned int eFexTauRoI_v1::bcn4() const {
219 return (word1() >> s_bcn4Bit) & s_bcn4Mask;
220 }
221
224 // Do something sensible if called for a TOB
225 if (etXTOB() == 0) return word0();
226 // When called for xTOB
227 else {
228 uint32_t word = word0() + etTOB();
229 return word;
230 }
231 }
232
236 float eFexTauRoI_v1::rCore() const {
237 if (rCoreDenominator() > 0) return (static_cast<float>(rCoreNumerator())/static_cast<float>(rCoreDenominator()));
238 else return 0.;
239 }
240
241 float eFexTauRoI_v1::rHad() const {
242 if (rHadDenominator() > 0) return (static_cast<float>(rHadNumerator())/static_cast<float>(rHadDenominator()));
243 else return 0.;
244 }
245
247
250
252 // only use LSB of shelfNumber to determine the octant
253 // (shelfNumber is 0 or 1 in P1, but can be 12 in the STF)
254 unsigned int octant = int(eFexNumber()/3) + (shelfNumber()%2)*s_shelfPhiWidth;
255
257 unsigned int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
258 if (index >= s_numPhi) index -= s_numPhi;
259
260 return index;
261 }
262
268
271
273 return index;
274
275 }
276
279
281 return iPhi()*2;
282
283 }
284
287
290 return iEta()*4 + seed();
291
292 }
293
295 if (tobVersion() == Heuristic) {
296 return iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
297 }
299 }
300
301
302} // 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 tau region of interest.
static const int s_fpgaBit
Constants used in decoding TOB words For TOB word format changes these can be replaced by arrays in t...
unsigned int tobVersion() const
Data decoded from the TOB/RoI word and eFEX number.
static const int s_etaBit
void setWord0(uint32_t value)
Set the "raw" 32-bit words describing the e/gamma candidate.
static const int s_veto2Bit
static const int s_veto2Mask
int iPhi() const
Setter for the above.
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
static const int s_bdtScoreBit
static const int s_veto1Bit
ObjectType type() const
Object type (TOB or xTOB)
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
unsigned int shelfNumber() const
static const int s_etBitXTOB
unsigned int eFexNumber() const
eFEX number
static const int s_versionBit
static const int s_etaMask
static const int s_phiBit
static const int s_seedBit
static const int s_seedMask
static const int s_shelfMask
unsigned int bdtThresholds() const
Alternative Tau Condition 1 (BDT) results.
unsigned int rHadThresholds() const
Tau Condition 2 (Had/EM) results.
static const int s_shelfBit
unsigned int bdtScore() const
BDT Score (xTOB only)
static const int s_maxMask
uint16_t rHadNumerator() const
@ Heuristic
This object is generated by the heuristic algorithm.
static const int s_eFexPhiOffset
static const int s_veto3Bit
static const int s_minEta
static const float s_tobEtScale
Constants used in converting to ATLAS units.
eFexTauRoI_v1()
Default constructor.
int iEta() const
setter for the above
unsigned int fpgaEta() const
eta index within FPGA
static const int s_numPhi
unsigned int tauOneThresholds() const
Tau Condition 1 (generic) results.
uint16_t rCoreDenominator() const
static const int s_fpgaEtaWidth
unsigned int seed() const
getter for integer eta index (-25->24)
ObjectType
Object types.
@ xTOB
This object is an xTOB (2*32 bit words)
@ TOB
This object is a TOB (1*32 bit word)
static const float s_towerEtaWidth
static const int s_etMask
static const float s_xTobEtScale
static const int s_eFexPhiWidth
static const int s_veto1Mask
float rCore() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
uint16_t rCoreNumerator() const
Actual values used in algorithm (setters and getters)
static const int s_updownBit
unsigned int bcn4() const
Last 4 bits of BCN (xTOB only)
void setEta(float value)
Floating point, full precision (0.025)
uint32_t tobWord() const
Return TOB word corresponding to this TOB or xTOB.
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
bool seedMax() const
Seed = max flag. Is this really useful?
static const int s_eFexEtaWidth
static const int s_bdtScoreMask
void setWord1(uint32_t value)
static const int s_etBit
unsigned int tauThreeThresholds() const
Tau Condition 3 (unused) results.
static const int s_phiMask
void initialize(unsigned int eFexNumber, unsigned int shelf, uint32_t word0)
Initialise the object with its most important properties.
unsigned int etXTOB() const
Cluster ET (xTOB ET scale, 25 MeV/count)
static const int s_bcn4Mask
static const int s_shelfPhiWidth
unsigned int fpgaPhi() const
phi index within FPGA
static const int s_fpgaMask
static const int s_maxBit
int iEtaTopo() const
Getter for integer phi index (0-63)
static const int s_eFexBit
static const int s_veto3Mask
unsigned int fpga() const
FPGA number.
uint16_t rHadDenominator() const
static const int s_versionMask
float computeEta() const
Compute TOB eta.
static const int s_bcn4Bit
void setIsTOB(char value)
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
void setPhi(float value)
Floating point, ATLAS phi convention (-pi -> pi)
void setEt(float value)
floating point value (MeV, TOB scale)
static const int s_eFexMask
static const int s_updownMask
bool upNotDown() const
Cluster up/down flag (1 = up, 0 = down)
uint32_t word1() const
unsigned int rCoreThresholds() const
Tau Condition 1 (rCore) results.
static const int s_etFullMask
Forward declaration.
Definition index.py:1
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setWord1 setRCoreDenominator rHadDenominator
setWord1 rCoreDenominator
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
setEventNumber uint32_t