ATLAS Offline Software
Loading...
Searching...
No Matches
gFexJetRoI_v1.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5
6
7// System include(s):
8#include <stdexcept>
9#include <numbers>
10
11// xAOD include(s):
13
14// Local include(s):
16
17namespace xAOD {
18
20 using std::numbers::pi;
21 const float gFexJetRoI_v1::s_PhiWidth = (2*pi)/32; //In central region, gFex has 32 bins in phi
22 const float gFexJetRoI_v1::s_PhiWidthFR = (2*pi)/16; //In central region, gFex has 32 bins in phi
23 const std::vector<float> gFexJetRoI_v1::s_EtaEdge = { -4.9, -4.1, -3.5, -3.25, -3.2, -3.1,
24 -2.9, -2.7, -2.5, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1.0,
25 -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0,
26 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.5, 2.7, 2.9,
27 3.1,3.25, 3.3, 3.5, 4.1, 4.9 }; //Indices 0-3 and 37-40 are niot currently used in hardware (don't receive energy info)
28
29 const std::vector<float> gFexJetRoI_v1::s_EtaCenter = { -4.5, -3.8, -3.38, -3.18, -3.15, -3,
30 -2.8, -2.6, -2.35, -2.1, -1.9, -1.7, -1.5, -1.3, -1.1, -0.9,
31 -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1,
32 1.3, 1.5, 1.7, 1.9, 2.1, 2.35, 2.6, 2.8, 3.0,
33 3.15, 3.18, 3.38, 3.8, 4.5};
34
35
36 //vector<float> gFexJetRoI_v1::s_maxEta = {};
37
42
55
57 return static_cast<int>(eta()*40)/4;
58 }
59
60
63 setWord )
65 setScale )
67 setSaturated )
68
71
74 setgFexType )
76 setTobEt )
78 setEta )
80 setPhi )
81
82 uint8_t gFexJetRoI_v1::status() const {
83 static const Accessor< uint8_t > acc( "gFexJetStatus" );
84 return acc( *this );
85 }
86 void gFexJetRoI_v1::setStatus ( uint8_t value ) {
87 static const Accessor< uint8_t > acc( "gFexJetStatus" );
88 acc( *this ) = value;
89 return;
90 }
91
92
93 // Methods to decode data from the TOB/RoI and return to the user
94
95
96 // Object disambiguation ()
98 auto tobID = (word() >> s_tobIDBit) & s_tobIDMask;
99 if (tobID == 0 ){
100 return gRho;
101 }
102 else if (tobID == 1 || tobID == 2) {
103 return gBlockLead;
104 }
105 else if (tobID == 3 || tobID == 4 ) {
106 return gBlockSub;
107 }
108 else if (tobID == 5 || tobID == 6) {
109 return gJet;
110 }
111 else return -999;
112 }
113
115 return gFexType() == gBlockLead;
116 }
117
119 return gFexType() == gBlockSub;
120 }
121
123 return gFexType() == gJet;
124 }
125
127 return gFexType() == gRho;
128 }
129
130
131 unsigned int gFexJetRoI_v1::unpackStatus() const{
132 return (word() >> s_statusBit) & s_statusMask;
133 }
134
135 unsigned int gFexJetRoI_v1::unpackSaturated() const{
136 return (word() >> s_saturBit) & s_saturMask;
137 }
138
139
140 // Raw ET on TOB scale
142 // Data content = TOB
143 int16_t energy = (word() >> s_etBit) & s_etMask;
144 return energy;
145 }
146
147 // Return an eta index in the range 0-49
148 unsigned int gFexJetRoI_v1::unpackEtaIndex() const {
149 return (word() >> s_etaBit) & s_etaMask;
150 }
151
152 // Return an eta index in the range 0-32
153 unsigned int gFexJetRoI_v1::unpackPhiIndex() const {
154 return (word() >> s_phiBit) & s_phiMask;
155
156 }
157
158 // Methods that require combining results or applying scales
159
160 float gFexJetRoI_v1::et() const {
161 return gFexTobEt()*tobEtScale();
162 }
163
164
165 // Floating point coordinates. Return the center of Eta.
166
167 float gFexJetRoI_v1::eta() const {
168 if (gFexType() != gRho){
169 int new_iEtaFR = 0;
170 // Remapping in the extreme FR
171 if (iEta() < 4 || iEta() > 35){
172 if (iEta() == 2){
173 new_iEtaFR = (int(iPhi())%2 == 0) ? 0 : 1 ;
174 }
175 if (iEta() == 3){
176 new_iEtaFR = (int(iPhi())%2 == 0) ? 2 : 3 ;
177 }
178 if (iEta() == 36){
179 new_iEtaFR = (int(iPhi())%2 == 0) ? 37 : 36 ;
180 }
181 if (iEta() == 37){
182 new_iEtaFR = (int(iPhi())%2 == 0) ? 39 : 38 ;
183 }
184 return s_EtaCenter[new_iEtaFR];
185 }
186 //No remapping for central region |eta| < 3.0
187 else{
188 return s_EtaCenter[iEta()];
189 }
190 }
191 return 0;
192 }
193
195 float gFexJetRoI_v1::etaMin() const {
196 if (gFexType() != gRho){
197 int new_iEtaFR = 0;
198 // Remapping in the extreme FR
199 if (iEta() < 4 || iEta() > 35){
200 if (iEta() == 2){
201 new_iEtaFR = (int(iPhi())%2 == 0) ? 0 : 1 ;
202 }
203 if (iEta() == 3){
204 new_iEtaFR = (int(iPhi())%2 == 0) ? 2 : 3 ;
205 }
206 if (iEta() == 36){
207 new_iEtaFR = (int(iPhi())%2 == 0) ? 37 : 36 ;
208 }
209 if (iEta() == 37){
210 new_iEtaFR = (int(iPhi())%2 == 0) ? 39 : 38 ;
211 }
212 return s_EtaEdge[new_iEtaFR];
213 }
214 //No remapping for central region |eta| < 3.0
215 else{
216 return s_EtaEdge[iEta()];
217 }
218 }
219 return 0;
220 }
221
222 float gFexJetRoI_v1::etaMax() const {
223 if (gFexType() != gRho){
224 int new_iEtaFR = 0;
225 // Remapping in the extreme FR
226 if (iEta() < 4 || iEta() > 35){
227 if (iEta() == 2){
228 new_iEtaFR = (int(iPhi())%2 == 0) ? 0 : 1 ;
229 }
230 if (iEta() == 3){
231 new_iEtaFR = (int(iPhi())%2 == 0) ? 2 : 3 ;
232 }
233 if (iEta() == 36){
234 new_iEtaFR = (int(iPhi())%2 == 0) ? 37 : 36 ;
235 }
236 if (iEta() == 37){
237 new_iEtaFR = (int(iPhi())%2 == 0) ? 39 : 38 ;
238 }
239 return s_EtaEdge[new_iEtaFR + 1];
240 }
241 //No remapping for central region |eta| < 3.0
242 else{
243 return s_EtaEdge[iEta() + 1];
244 }
245 }
246 return 0;
247 }
248
249
250
251 // Floating point coordinates using gFex convention [0, 2pi].
252 // Returns the centre phi coordinate.
253 // Note that for iEta = 0,1,2,3,36,37,38,39 - there are only 16 bins in phi (otherwise 32)
255 float phi_out = 0;
256 if (gFexType() != gRho){
257 float phi_idx;
258 if (iEta() < 4 || iEta() > 35){
259 // take the even iphi() and divide by 2 to get a continuous range (0-15)
260 if (int(iPhi()%2) == 0 ){
261 phi_idx = iPhi()/2;
262 phi_out = (phi_idx * s_PhiWidthFR) + (s_PhiWidthFR/2);
263 }
264 // take the odd iphi() and get a continuous range (0,15)
265 else {
266 phi_idx = (iPhi()-1)/2;
267 phi_out = (phi_idx * s_PhiWidthFR) + (s_PhiWidthFR/2);}
268 }
269 else{
270 phi_out = (iPhi() * s_PhiWidth) + (s_PhiWidth/2);
271 }
272
273 }
274 return phi_out;
275 }
276
277
278 // Floating point coordinates using gFex convention [0, 2pi].
279 // Returns the low edge of the phi bin.
281 float phi_out = 0;
282 if (gFexType() != gRho){
283 phi_out = iPhi() * s_PhiWidth;
284 }
285 return phi_out;
286 }
287
288 // Floating point coordinates using gFex convention [0, 2pi].
289 // Returns the high edge of the phi bin.
291 float phi_out = 0;
292 if (gFexType() != gRho){
293 phi_out = iPhi() * s_PhiWidth + s_PhiWidth;
294 }
295 return phi_out;
296 }
297
298 // Floating point coordinates using ATLAS convention [-pi, pi].
299 // Returns the centre phi coordinate.
300 float gFexJetRoI_v1::phi() const {
301 float phi_out = 0;
302 if (gFexType() != gRho){
303 if (phi_gFex() < pi) phi_out = phi_gFex();
304 else phi_out = (phi_gFex() - 2*pi);
305 }
306 return phi_out;
307 }
308
309 // Floating point coordinates using ATLAS convention [-pi, pi].
310 // Returns the high edge of the phi bin.
311 float gFexJetRoI_v1::phiMax() const {
312 float phi_out = 0;
313 if (gFexType() != gRho){
314 if (phiMax_gFex() < pi) phi_out = phiMax_gFex();
315 else phi_out = (phiMax_gFex() - 2*pi);
316 }
317 return phi_out;
318 }
319
320 // Floating point coordinates using ATLAS convention [-pi, pi].
321 // Returns the low edge of the phi bin.
322 float gFexJetRoI_v1::phiMin() const {
323 float phi_out = 0;
324 if (gFexType() != gRho){
325 if (phiMin_gFex() < pi) phi_out = phiMin_gFex();
326 else phi_out = (phiMin_gFex() - 2*pi);
327 }
328 return phi_out;
329 }
330
331 // Returns phi index in the range used by L1Topo (0->127).
333 int phi_out = 0;
334 if (gFexType() != gRho){
335 if (( iEta() <= 3 ) || ( (iEta() >= 36) )){
336 phi_out = ( 8 * iPhi() ) + 4;
337 }
338 else {
339 phi_out = ( 4 * iPhi() ) + 2;
340 }
341 }
342 return phi_out;
343 }
344
345
346} // namespace xAOD
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define pi
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
AuxElement()
Default constructor.
Class describing properties of a LVL1 gFEX jet Trigger Object (TOB) in the xAOD format.
float phi() const
High value of phi corresponding to phi index (using gFex convention, phi in [0, 2pi]).
float phiMin() const
Central value of phi corresponding to phi index (using ATLAS convention, phi in [-pi,...
void setScale(int value)
Set the "raw" 32-bit words describing the object candidate.
static const int s_saturMask
static const int s_tobIDMask
static const int s_tobIDBit
void setPhi(uint8_t value)
Getter for integer phi index (0-32) --> check numbers for gFEX.
static const float s_PhiWidth
Constants used in converting to ATLAS units.
float phi_gFex() const
retrieves the phi index from the 32-bit word
static const int s_etBit
void setgFexType(int type)
float etaMin() const
Floating point.
float etaMax() const
Floating point.
void setTobEt(int16_t value)
getter for integer ET on TOB scale (3.2 GeV/count)
unsigned int unpackPhiIndex() const
Setter for the above.
uint8_t iEta() const
floating point value (GeV, TOB scale)
unsigned int unpackEtaIndex() const
setter for the above
int menuEta() const
the eta index to use for looking up thresholds in the menu
bool isgBlockLead() const
Identification of object type with flags.
void setSaturated(uint8_t value)
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
uint8_t iPhi() const
Floating point.
int iPhiTopo() const
High value of phi corresponding to phi index (using ATLAS convention, phi in [-pi,...
static const std::vector< float > s_EtaEdge
uint32_t word() const
The "raw" 32-bit word describing the object candidate.
void setEta(uint8_t value)
getter for integer eta index (0-63)
int tobEtScale() const
static const std::vector< float > s_EtaCenter
static const int s_etaBit
unsigned int unpackStatus() const
float eta() const
retrieves the Eta index from the 32-bit word
void setWord(uint32_t value)
Set the "raw" 32-bit words describing the object candidate.
float et() const
retrieves the Et index from the 32-bit word
static const int s_phiMask
void setStatus(uint8_t value)
@ gBlockLead
This object is a TOB (32 bit word)
@ gBlockSub
This object is a TOB (32 bit word)
@ gJet
This object is a TOB (32 bit word)
unsigned int unpackSaturated() const
static const int s_statusMask
int16_t unpackEt() const
setter for the above
gFexJetRoI_v1()
Default constructor.
float phiMax_gFex() const
Low value of phi corresponding to phi index (using gFex convention, phi in [0, 2pi]).
static const int s_saturBit
Constants used in decoding TOB words For TOB word format changes these can be replaced by arrays in t...
static const int s_statusBit
void initialize(uint32_t word, int tobEtScale)
Initialise the object with its most important properties: only the word for gFEX.
static const int s_etMask
static const int s_etaMask
int gFexType() const
retrieves the Saturated info from the 32-bit word
static const float s_PhiWidthFR
float phiMin_gFex() const
Central value of phi corresponding to phi index (using gFex convention, phi in [0,...
static const int s_phiBit
float phiMax() const
Low value of phi corresponding to phi index (using ATLAS convention, phi in [-pi, pi]).
void setWord(uint32_t)
Forward declaration.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setScale setgFexType iEta
setScaleOne setStatusOne saturated
setRawEt setRawPhi int
setScale gFexType
setScaleOne setStatusOne setSaturated int16_t
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
setEventNumber uint32_t