ATLAS Offline Software
eFexEMRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
16 namespace 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 
24  : SG::AuxElement() {
25 
26  }
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 
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  unsigned int octant = int(eFexNumber()/3) + shelfNumber()*s_shelfPhiWidth;
236 
238  int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
239  if (index >= s_numPhi) index -= s_numPhi;
240 
241  return index;
242  }
243 
248  int eFexEMRoI_v1::iEta() const {
249 
252 
254  return index;
255 
256  }
257 
260 
262  return iPhi()*2;
263 
264  }
265 
268 
271  return iEta()*4 + seed();
272 
273  }
274 
275 
276 } // namespace xAOD
xAOD::eFexEMRoI_v1::Rhad
float Rhad() const
Definition: eFexEMRoI_v1.cxx:218
xAOD::eFexEMRoI_v1::s_shelfPhiWidth
static const int s_shelfPhiWidth
Definition: eFexEMRoI_v1.h:204
xAOD::RetaEnv
setWord1 RetaEnv
Definition: eFexEMRoI_v1.cxx:93
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::eFexEMRoI_v1::iEta
int iEta() const
setter for the above
Definition: eFexEMRoI_v1.cxx:248
xAOD::eFexEMRoI_v1::WstotDenominator
uint16_t WstotDenominator() const
et
Extra patterns decribing particle interation process.
xAOD::eFexEMRoI_v1::s_etaBit
static const int s_etaBit
Definition: eFexEMRoI_v1.h:164
xAOD::eFexEMRoI_v1::iEtaTopo
int iEtaTopo() const
Getter for integer phi index (0-63)
Definition: eFexEMRoI_v1.cxx:267
xAOD::eFexEMRoI_v1::s_fpgaMask
static const int s_fpgaMask
Definition: eFexEMRoI_v1.h:179
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:87
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::eFexEMRoI_v1::s_shelfMask
static const int s_shelfMask
Definition: eFexEMRoI_v1.h:192
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::eFexEMRoI_v1::s_minEta
static const int s_minEta
Definition: eFexEMRoI_v1.h:205
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
xAOD::eFexEMRoI_v1::xTOB
@ xTOB
This object is an xTOB (2*32 bit words)
Definition: eFexEMRoI_v1.h:47
xAOD::eFexEMRoI_v1::Reta
float Reta() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
Definition: eFexEMRoI_v1.cxx:212
xAOD::eFexEMRoI_v1::eFexNumber
unsigned int eFexNumber() const
Methods to decode data from the TOB/RoI and return to the user.
Definition: eFexEMRoI_v1.cxx:121
xAOD::eFexEMRoI_v1::s_updownMask
static const int s_updownMask
Definition: eFexEMRoI_v1.h:186
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::eFexEMRoI_v1::etXTOB
unsigned int etXTOB() const
Cluster ET (xTOB ET scale, 25 MeV/count)
Definition: eFexEMRoI_v1.cxx:176
xAOD::eFexEMRoI_v1::s_eFexMask
static const int s_eFexMask
Definition: eFexEMRoI_v1.h:191
xAOD::eFexEMRoI_v1
Class describing a LVL1 eFEX EM region of interest.
Definition: eFexEMRoI_v1.h:33
xAOD::eFexEMRoI_v1::s_tobEtScale
static const float s_tobEtScale
Constants used in converting to ATLAS units.
Definition: eFexEMRoI_v1.h:152
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::eFexEMRoI_v1::TOB
@ TOB
This object is a TOB (1*32 bit word)
Definition: eFexEMRoI_v1.h:48
pi
#define pi
Definition: TileMuonFitter.cxx:65
xAOD::eFexEMRoI_v1::s_eFexEtaWidth
static const int s_eFexEtaWidth
Definition: eFexEMRoI_v1.h:202
xAOD::eFexEMRoI_v1::s_veto2Bit
static const int s_veto2Bit
Definition: eFexEMRoI_v1.h:167
xAOD::eFexEMRoI_v1::s_etBitXTOB
static const int s_etBitXTOB
Definition: eFexEMRoI_v1.h:173
xAOD::eFexEMRoI_v1::s_eFexPhiOffset
static const int s_eFexPhiOffset
Definition: eFexEMRoI_v1.h:199
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
SG::IAuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::eFexEMRoI_v1::s_veto1Bit
static const int s_veto1Bit
Definition: eFexEMRoI_v1.h:168
xAOD::eFexEMRoI_v1::RhadHad
uint16_t RhadHad() const
xAOD::eFexEMRoI_v1::word0
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
xAOD::eFexEMRoI_v1::s_etFullMask
static const int s_etFullMask
Definition: eFexEMRoI_v1.h:189
xAOD::eFexEMRoI_v1::iPhi
int iPhi() const
Setter for the above.
Definition: eFexEMRoI_v1.cxx:232
xAOD::eFexEMRoI_v1::fpgaPhi
unsigned int fpgaPhi() const
phi index within FPGA
Definition: eFexEMRoI_v1.cxx:145
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
xAOD::eFexEMRoI_v1::initialize
void initialize(unsigned int eFexNumber, unsigned int shelf, uint32_t word0)
Initialise the object with its most important properties TOB initialiser.
Definition: eFexEMRoI_v1.cxx:28
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
xAOD::eFexEMRoI_v1::setIsTOB
void setIsTOB(char value)
xAOD::eFexEMRoI_v1::RetaThresholds
unsigned int RetaThresholds() const
Jet Discriminant 1 (R_eta) results.
Definition: eFexEMRoI_v1.cxx:182
xAOD::eFexEMRoI_v1::type
ObjectType type() const
Data decoded from the TOB/RoI word and eFEX number.
Definition: eFexEMRoI_v1.cxx:131
xAOD::eFexEMRoI_v1::word1
uint32_t word1() const
xAOD::eFexEMRoI_v1::eFexEMRoI_v1
eFexEMRoI_v1()
Default constructor.
Definition: eFexEMRoI_v1.cxx:23
xAOD::eFexEMRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexEMRoI_v1.cxx:259
xAOD::eFexEMRoI_v1::s_veto2Mask
static const int s_veto2Mask
Definition: eFexEMRoI_v1.h:183
xAOD::eFexEMRoI_v1::s_maxBit
static const int s_maxBit
Definition: eFexEMRoI_v1.h:171
xAOD::eFexEMRoI_v1::s_eFexBit
static const int s_eFexBit
Definition: eFexEMRoI_v1.h:176
xAOD::eFexEMRoI_v1::s_eFexPhiWidth
static const int s_eFexPhiWidth
Definition: eFexEMRoI_v1.h:198
xAOD::eFexEMRoI_v1::s_seedMask
static const int s_seedMask
Definition: eFexEMRoI_v1.h:185
xAOD::eFexEMRoI_v1::setPhi
void setPhi(float value)
Floating point, ATLAS phi convention (-pi -> pi)
xAOD::eFexEMRoI_v1::s_veto3Mask
static const int s_veto3Mask
Definition: eFexEMRoI_v1.h:184
xAOD::eFexEMRoI_v1::s_updownBit
static const int s_updownBit
Definition: eFexEMRoI_v1.h:170
xAOD::eFexEMRoI_v1::s_seedBit
static const int s_seedBit
Definition: eFexEMRoI_v1.h:169
xAOD::eFexEMRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexEMRoI_v1.cxx:162
xAOD::eFexEMRoI_v1::s_numPhi
static const int s_numPhi
Definition: eFexEMRoI_v1.h:195
xAOD::eFexEMRoI_v1::s_veto3Bit
static const int s_veto3Bit
Definition: eFexEMRoI_v1.h:166
xAOD::eFexEMRoI_v1::WstotThresholds
unsigned int WstotThresholds() const
Jet Discriminant 3 (W_stot) results.
Definition: eFexEMRoI_v1.cxx:190
xAOD::eFexEMRoI_v1::s_bcn4Bit
static const int s_bcn4Bit
Definition: eFexEMRoI_v1.h:174
xAOD::eFexEMRoI_v1::ObjectType
ObjectType
Object types.
Definition: eFexEMRoI_v1.h:46
xAOD::eFexEMRoI_v1::tobWord
uint32_t tobWord() const
Return TOB word corresponding to this TOB or xTOB.
Definition: eFexEMRoI_v1.cxx:199
xAOD::eFexEMRoI_v1::s_maxMask
static const int s_maxMask
Definition: eFexEMRoI_v1.h:187
xAOD::eFexEMRoI_v1::fpgaEta
unsigned int fpgaEta() const
eta index within FPGA
Definition: eFexEMRoI_v1.cxx:141
xAOD::eFexEMRoI_v1::setWord0
void setWord0(uint32_t value)
Set the "raw" 32-bit words describing the e/gamma candidate.
xAOD::eFexEMRoI_v1::s_etaMask
static const int s_etaMask
Definition: eFexEMRoI_v1.h:180
xAOD::eFexEMRoI_v1::s_towerEtaWidth
static const float s_towerEtaWidth
Definition: eFexEMRoI_v1.h:154
xAOD::eFexEMRoI_v1::s_xTobEtScale
static const float s_xTobEtScale
Definition: eFexEMRoI_v1.h:153
eFexEMRoI_v1.h
xAOD::eFexEMRoI_v1::RetaCore
uint16_t RetaCore() const
Actual values used in algorithm (setters and getters)
xAOD::eFexEMRoI_v1::s_etMask
static const int s_etMask
Definition: eFexEMRoI_v1.h:188
xAOD::eFexEMRoI_v1::s_veto1Mask
static const int s_veto1Mask
Definition: eFexEMRoI_v1.h:182
xAOD::eFexEMRoI_v1::seedMax
unsigned int seedMax() const
Seed = max flag. Is this really useful?
Definition: eFexEMRoI_v1.cxx:157
xAOD::eFexEMRoI_v1::setWord1
void setWord1(uint32_t value)
xAOD::eFexEMRoI_v1::s_phiMask
static const int s_phiMask
Definition: eFexEMRoI_v1.h:181
xAOD::eFexEMRoI_v1::s_fpgaEtaWidth
static const int s_fpgaEtaWidth
Definition: eFexEMRoI_v1.h:203
xAOD::eFexEMRoI_v1::WstotNumerator
uint16_t WstotNumerator() const
xAOD::eFexEMRoI_v1::seed
unsigned int seed() const
getter for integer eta index (-25->+24)
Definition: eFexEMRoI_v1.cxx:153
xAOD::eFexEMRoI_v1::s_bcn4Mask
static const int s_bcn4Mask
Definition: eFexEMRoI_v1.h:190
xAOD::eFexEMRoI_v1::s_fpgaBit
static const int s_fpgaBit
Constants used in decoding TOB words For TOB word format changes these can be replaced by arrays in t...
Definition: eFexEMRoI_v1.h:163
xAOD::eFexEMRoI_v1::bcn4
unsigned int bcn4() const
Definition: eFexEMRoI_v1.cxx:194
xAOD::eFexEMRoI_v1::shelfNumber
unsigned int shelfNumber() const
Shelf number.
Definition: eFexEMRoI_v1.cxx:126
xAOD::eFexEMRoI_v1::UpNotDown
unsigned int UpNotDown() const
Cluster up/down flag (1 = up, 0 = down)
Definition: eFexEMRoI_v1.cxx:149
xAOD::RhadHad
setWord1 setRetaEnv RhadHad
Definition: eFexEMRoI_v1.cxx:97
xAOD::eFexEMRoI_v1::s_etBit
static const int s_etBit
Definition: eFexEMRoI_v1.h:172
xAOD::eFexEMRoI_v1::s_shelfBit
static const int s_shelfBit
Definition: eFexEMRoI_v1.h:175
xAOD::eFexEMRoI_v1::Wstot
float Wstot() const
Definition: eFexEMRoI_v1.cxx:224
xAOD::WstotDenominator
setWord1 setRetaEnv setRhadHad WstotDenominator
Definition: eFexEMRoI_v1.cxx:101
xAOD::eFexEMRoI_v1::RhadThresholds
unsigned int RhadThresholds() const
Jet Discriminant 2 (R_had) results.
Definition: eFexEMRoI_v1.cxx:186
xAOD::eFexEMRoI_v1::fpga
unsigned int fpga() const
FPGA number.
Definition: eFexEMRoI_v1.cxx:137
xAOD::eFexEMRoI_v1::RetaEnv
uint16_t RetaEnv() const
xAOD::eFexEMRoI_v1::setEt
void setEt(float value)
floating point value (MeV, TOB scale)
xAOD::eFexEMRoI_v1::setEta
void setEta(float value)
Getter for floating point, full precision (0.025) eta.
xAOD::eFexEMRoI_v1::RhadEM
uint16_t RhadEM() const
xAOD::eFexEMRoI_v1::s_phiBit
static const int s_phiBit
Definition: eFexEMRoI_v1.h:165