ATLAS Offline Software
gFexJetRoI_v1.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 
7 // System include(s):
8 #include <stdexcept>
9 
10 // xAOD include(s):
12 
13 // Local include(s):
15 
16 namespace xAOD {
17 
19  const float gFexJetRoI_v1::s_PhiWidth = (2*M_PI)/32; //In central region, gFex has 32 bins in phi
20  const std::vector<float> gFexJetRoI_v1::s_EtaEdge = { -4.9, -4.45, -4.0, -3.5, -3.3, -3.1,
21  -2.9, -2.7, -2.5, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1.0,
22  -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0,
23  1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.5, 2.7, 2.9,
24  3.1, 3.3, 3.5, 4.0, 4.45, 4.9 }; //Indices 0-3 and 37-40 are niot currently used in hardware (don't receive energy info)
25 
26  const std::vector<float> gFexJetRoI_v1::s_EtaCenter = { -4.7, -4.2, -3.7, -3.4, -3.2, -3,
27  -2.8, -2.6, -2.35, -2.1, -1.9, -1.7, -1.5, -1.3, -1.1, -0.9,
28  -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1,
29  1.3, 1.5, 1.7, 1.9, 2.1, 2.35, 2.6, 2.8, 3.0,
30  3.2, 3.4, 3.7, 4.2, 4.7};
31 
32 
33  //vector<float> gFexJetRoI_v1::s_maxEta = {};
34 
36  : SG::AuxElement() {
37 
38  }
39 
41 
42  setWord( word );
45  setTobEt( unpackEt() );
50 
51  }
52 
53  int gFexJetRoI_v1::menuEta() const {
54  return static_cast<int>(eta()*40)/4;
55  }
56 
57 
60  setWord )
62  setScale )
64  setSaturated )
65 
68 
71  setgFexType )
73  setTobEt )
75  setEta )
77  setPhi )
78 
79  uint8_t gFexJetRoI_v1::status() const {
80  static const Accessor< uint8_t > acc( "gFexJetStatus" );
81  return acc( *this );
82  }
84  static const Accessor< uint8_t > acc( "gFexJetStatus" );
85  acc( *this ) = value;
86  return;
87  }
88 
89 
90  // Methods to decode data from the TOB/RoI and return to the user
91 
92 
93  // Object disambiguation ()
95  auto tobID = (word() >> s_tobIDBit) & s_tobIDMask;
96  if (tobID == 0 ){
97  return gRho;
98  }
99  else if (tobID == 1 || tobID == 2) {
100  return gBlockLead;
101  }
102  else if (tobID == 3 || tobID == 4 ) {
103  return gBlockSub;
104  }
105  else if (tobID == 5 || tobID == 6) {
106  return gJet;
107  }
108  else return -999;
109  }
110 
112  return gFexType() == gBlockLead;
113  }
114 
116  return gFexType() == gBlockSub;
117  }
118 
119  bool gFexJetRoI_v1::isgJet() const {
120  return gFexType() == gJet;
121  }
122 
123  bool gFexJetRoI_v1::isgRho() const {
124  return gFexType() == gRho;
125  }
126 
127 
128  unsigned int gFexJetRoI_v1::unpackStatus() const{
129  return (word() >> s_statusBit) & s_statusMask;
130  }
131 
132  unsigned int gFexJetRoI_v1::unpackSaturated() const{
133  return (word() >> s_saturBit) & s_saturMask;
134  }
135 
136 
137  // Raw ET on TOB scale
139  // Data content = TOB
140  int16_t energy = (word() >> s_etBit) & s_etMask;
141  return energy;
142  }
143 
144  // Return an eta index in the range 0-49
145  unsigned int gFexJetRoI_v1::unpackEtaIndex() const {
146  return (word() >> s_etaBit) & s_etaMask;
147  }
148 
149  // Return an eta index in the range 0-32
150  unsigned int gFexJetRoI_v1::unpackPhiIndex() const {
151  return (word() >> s_phiBit) & s_phiMask;
152 
153  }
154 
155  // Methods that require combining results or applying scales
156 
157  float gFexJetRoI_v1::et() const {
158  return gFexTobEt()*tobEtScale();
159  }
160 
161 
162  // Floating point coordinates. Return the center of Eta.
163  float gFexJetRoI_v1::eta() const {
164  if (gFexType() != gRho){
165  return s_EtaCenter[iEta()];
166  }
167  return 0;
168  }
169 
171  float gFexJetRoI_v1::etaMin() const {
172  if (gFexType() != gRho){
173  return s_EtaEdge[iEta()];
174  }
175  return 0;
176  }
177 
178  float gFexJetRoI_v1::etaMax() const {
179  if (gFexType() != gRho){
180  return s_EtaEdge[iEta()+1];
181  }
182  return 0;
183  }
184 
185 
186 
187  // Floating point coordinates using gFex convention [0, 2pi].
188  // Returns the centre phi coordinate.
189  float gFexJetRoI_v1::phi_gFex() const {
190  float phi_out = 0;
191  if (gFexType() != gRho){
192  phi_out = (iPhi() * s_PhiWidth) + (s_PhiWidth/2);
193  }
194  return phi_out;
195  }
196 
197 
198  // Floating point coordinates using gFex convention [0, 2pi].
199  // Returns the low edge of the phi bin.
201  float phi_out = 0;
202  if (gFexType() != gRho){
203  phi_out = iPhi() * s_PhiWidth;
204  }
205  return phi_out;
206  }
207 
208  // Floating point coordinates using gFex convention [0, 2pi].
209  // Returns the high edge of the phi bin.
211  float phi_out = 0;
212  if (gFexType() != gRho){
213  phi_out = iPhi() * s_PhiWidth + s_PhiWidth;
214  }
215  return phi_out;
216  }
217 
218  // Floating point coordinates using ATLAS convention [-pi, pi].
219  // Returns the centre phi coordinate.
220  float gFexJetRoI_v1::phi() const {
221  float phi_out = 0;
222  if (gFexType() != gRho){
223  if (phi_gFex() < M_PI) phi_out = phi_gFex();
224  else phi_out = (phi_gFex() - 2*M_PI);
225  }
226  return phi_out;
227  }
228 
229  // Floating point coordinates using ATLAS convention [-pi, pi].
230  // Returns the high edge of the phi bin.
231  float gFexJetRoI_v1::phiMax() const {
232  float phi_out = 0;
233  if (gFexType() != gRho){
234  if (phiMax_gFex() < M_PI) phi_out = phiMax_gFex();
235  else phi_out = (phiMax_gFex() - 2*M_PI);
236  }
237  return phi_out;
238  }
239 
240  // Floating point coordinates using ATLAS convention [-pi, pi].
241  // Returns the low edge of the phi bin.
242  float gFexJetRoI_v1::phiMin() const {
243  float phi_out = 0;
244  if (gFexType() != gRho){
245  if (phiMin_gFex() < M_PI) phi_out = phiMin_gFex();
246  else phi_out = (phiMin_gFex() - 2*M_PI);
247  }
248  return phi_out;
249  }
250 
251  // Returns phi index in the range used by L1Topo (0->127).
253  int phi_out = 0;
254  if (gFexType() != gRho){
255  if (( iEta() <= 3 ) || ( (iEta() >= 36) )){
256  phi_out = ( 8 * iPhi() ) + 4;
257  }
258  else if ( iEta() >3 && iEta() < 36 ){
259  phi_out = ( 4 * iPhi() ) + 2;
260  }
261  else return -999;
262  }
263  return phi_out;
264  }
265 
266 
267 } // namespace xAOD
xAOD::gFexJetRoI_v1::setScale
void setScale(int value)
Set the "raw" 32-bit words describing the object candidate.
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::gFexJetRoI_v1::phi_gFex
float phi_gFex() const
retrieves the phi index from the 32-bit word
Definition: gFexJetRoI_v1.cxx:189
xAOD::gFexJetRoI_v1::isgJet
bool isgJet() const
Definition: gFexJetRoI_v1.cxx:119
xAOD::gFexJetRoI_v1::phiMax
float phiMax() const
Low value of phi corresponding to phi index (using ATLAS convention, phi in [-pi, pi]).
Definition: gFexJetRoI_v1.cxx:231
xAOD::gFexJetRoI_v1::s_phiMask
static const int s_phiMask
Definition: gFexJetRoI_v1.h:132
xAOD::gFexJetRoI_v1::setgFexType
void setgFexType(int type)
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::gFexJetRoI_v1::setTobEt
void setTobEt(int16_t value)
getter for integer ET on TOB scale (3.2 GeV/count)
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::gFexJetRoI_v1::eta
float eta() const
retrieves the Eta index from the 32-bit word
Definition: gFexJetRoI_v1.cxx:163
SG::Accessor< uint8_t >
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::gFexJetRoI_v1::etaMax
float etaMax() const
Floating point.
Definition: gFexJetRoI_v1.cxx:178
xAOD::gFexJetRoI_v1::gBlockLead
@ gBlockLead
This object is a TOB (32 bit word)
Definition: gFexJetRoI_v1.h:37
xAOD::gFexJetRoI_v1::s_tobIDMask
static const int s_tobIDMask
Definition: gFexJetRoI_v1.h:137
xAOD::gFexJetRoI_v1::unpackEtaIndex
unsigned int unpackEtaIndex() const
setter for the above
Definition: gFexJetRoI_v1.cxx:145
xAOD::gFexJetRoI_v1::etaMin
float etaMin() const
Floating point.
Definition: gFexJetRoI_v1.cxx:171
xAOD::gFexJetRoI_v1::setWord
void setWord(uint32_t value)
Set the "raw" 32-bit words describing the object candidate.
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::gFexJetRoI_v1::unpackSaturated
unsigned int unpackSaturated() const
Definition: gFexJetRoI_v1.cxx:132
athena.value
value
Definition: athena.py:124
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::gFexJetRoI_v1::word
uint32_t word() const
The "raw" 32-bit word describing the object candidate.
xAOD::gFexJetRoI_v1::gFexTobEt
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
xAOD::gFexJetRoI_v1::s_statusBit
static const int s_statusBit
Definition: gFexJetRoI_v1.h:126
xAOD::gFexJetRoI_v1::phiMin_gFex
float phiMin_gFex() const
Central value of phi corresponding to phi index (using gFex convention, phi in [0,...
Definition: gFexJetRoI_v1.cxx:200
xAOD::gFexJetRoI_v1::phiMax_gFex
float phiMax_gFex() const
Low value of phi corresponding to phi index (using gFex convention, phi in [0, 2pi]).
Definition: gFexJetRoI_v1.cxx:210
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
xAOD::gFexJetRoI_v1::tobEtScale
int tobEtScale() const
xAOD::gFexJetRoI_v1::iPhiTopo
int iPhiTopo() const
High value of phi corresponding to phi index (using ATLAS convention, phi in [-pi,...
Definition: gFexJetRoI_v1.cxx:252
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
setWord
void setWord(uint32_t)
xAOD::gFexJetRoI_v1::setStatus
void setStatus(uint8_t value)
xAOD::gFexJetRoI_v1::unpackPhiIndex
unsigned int unpackPhiIndex() const
Setter for the above.
Definition: gFexJetRoI_v1.cxx:150
xAOD::gFexJetRoI_v1::s_etBit
static const int s_etBit
Definition: gFexJetRoI_v1.h:125
xAOD::gFexJetRoI_v1::gRho
@ gRho
Definition: gFexJetRoI_v1.h:36
xAOD::gFexJetRoI_v1::phi
float phi() const
High value of phi corresponding to phi index (using gFex convention, phi in [0, 2pi]).
Definition: gFexJetRoI_v1.cxx:220
xAOD::saturated
setScaleOne setStatusOne saturated
Definition: gFexGlobalRoI_v1.cxx:51
xAOD::gFexJetRoI_v1::s_statusMask
static const int s_statusMask
Definition: gFexJetRoI_v1.h:135
xAOD::gFexJetRoI_v1::gBlockSub
@ gBlockSub
This object is a TOB (32 bit word)
Definition: gFexJetRoI_v1.h:38
xAOD::gFexJetRoI_v1::iPhi
uint8_t iPhi() const
Floating point.
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
xAOD::gFexJetRoI_v1::setEta
void setEta(uint8_t value)
getter for integer eta index (0-63)
xAOD::gFexJetRoI_v1::s_EtaCenter
static const std::vector< float > s_EtaCenter
Definition: gFexJetRoI_v1.h:113
xAOD::gFexJetRoI_v1::unpackEt
int16_t unpackEt() const
setter for the above
Definition: gFexJetRoI_v1.cxx:138
xAOD::gFexJetRoI_v1::setPhi
void setPhi(uint8_t value)
Getter for integer phi index (0-32) --> check numbers for gFEX.
xAOD::gFexJetRoI_v1
Class describing properties of a LVL1 gFEX jet Trigger Object (TOB) in the xAOD format.
Definition: gFexJetRoI_v1.h:25
xAOD::gFexJetRoI_v1::gFexType
int gFexType() const
retrieves the Saturated info from the 32-bit word
xAOD::gFexJetRoI_v1::isgBlockSub
bool isgBlockSub() const
Definition: gFexJetRoI_v1.cxx:115
xAOD::gFexJetRoI_v1::s_etaBit
static const int s_etaBit
Definition: gFexJetRoI_v1.h:124
xAOD::gFexJetRoI_v1::s_etaMask
static const int s_etaMask
Definition: gFexJetRoI_v1.h:133
xAOD::gFexJetRoI_v1::iEta
uint8_t iEta() const
floating point value (GeV, TOB scale)
xAOD::gFexJetRoI_v1::et
float et() const
retrieves the Et index from the 32-bit word
Definition: gFexJetRoI_v1.cxx:157
xAOD::gFexJetRoI_v1::s_etMask
static const int s_etMask
Definition: gFexJetRoI_v1.h:134
xAOD::gFexJetRoI_v1::menuEta
int menuEta() const
the eta index to use for looking up thresholds in the menu
Definition: gFexJetRoI_v1.cxx:53
xAOD::gFexJetRoI_v1::s_saturMask
static const int s_saturMask
Definition: gFexJetRoI_v1.h:131
xAOD::gFexJetRoI_v1::unpackStatus
unsigned int unpackStatus() const
Definition: gFexJetRoI_v1.cxx:128
gFexJetRoI_v1.h
xAOD::gFexType
setScale gFexType
Definition: gFexJetRoI_v1.cxx:70
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
xAOD::gFexJetRoI_v1::s_EtaEdge
static const std::vector< float > s_EtaEdge
Definition: gFexJetRoI_v1.h:112
xAOD::gFexJetRoI_v1::gJet
@ gJet
This object is a TOB (32 bit word)
Definition: gFexJetRoI_v1.h:39
xAOD::gFexJetRoI_v1::phiMin
float phiMin() const
Central value of phi corresponding to phi index (using ATLAS convention, phi in [-pi,...
Definition: gFexJetRoI_v1.cxx:242
xAOD::gFexJetRoI_v1::gFexJetRoI_v1
gFexJetRoI_v1()
Default constructor.
Definition: gFexJetRoI_v1.cxx:35
xAOD::tobEtScale
tobEtScale
Definition: gFexJetRoI_v1.cxx:61
xAOD::gFexJetRoI_v1::s_phiBit
static const int s_phiBit
Definition: gFexJetRoI_v1.h:123
xAOD::gFexJetRoI_v1::initialize
void initialize(uint32_t word, int tobEtScale)
Initialise the object with its most important properties: only the word for gFEX.
Definition: gFexJetRoI_v1.cxx:40
xAOD::gFexJetRoI_v1::setSaturated
void setSaturated(uint8_t value)
merge.status
status
Definition: merge.py:17
xAOD::gFexJetRoI_v1::unpackType
int unpackType() const
Definition: gFexJetRoI_v1.cxx:94
xAOD::gFexJetRoI_v1::isgRho
bool isgRho() const
Definition: gFexJetRoI_v1.cxx:123
xAOD::gFexJetRoI_v1::isgBlockLead
bool isgBlockLead() const
Identification of object type with flags.
Definition: gFexJetRoI_v1.cxx:111
xAOD::gFexJetRoI_v1::s_saturBit
static const int s_saturBit
Constants used in decoding TOB words For TOB word format changes these can be replaced by arrays in t...
Definition: gFexJetRoI_v1.h:122
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
xAOD::gFexJetRoI_v1::s_tobIDBit
static const int s_tobIDBit
Definition: gFexJetRoI_v1.h:128
xAOD::gFexJetRoI_v1::s_PhiWidth
static const float s_PhiWidth
Constants used in converting to ATLAS units.
Definition: gFexJetRoI_v1.h:111