ATLAS Offline Software
eFexTauRoI_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 eFexTauRoI_v1::s_tobEtScale = 100.;
20  const float eFexTauRoI_v1::s_xTobEtScale = 25.;
21  const float eFexTauRoI_v1::s_towerEtaWidth = 0.1;
22 
24  : SG::AuxElement() {
25 
26  }
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 
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 
154  bool eFexTauRoI_v1::seedMax() const {
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() != BDT || 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() == BDT ? tauOneThresholds() : 0);
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 
213  unsigned int eFexTauRoI_v1::tauThreeThresholds() const {
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 
249  int eFexTauRoI_v1::iPhi() const {
250 
252  unsigned int octant = int(eFexNumber()/3) + shelfNumber()*s_shelfPhiWidth;
253 
255  unsigned int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
256  if (index >= s_numPhi) index -= s_numPhi;
257 
258  return index;
259  }
260 
265  int eFexTauRoI_v1::iEta() const {
266 
269 
271  return index;
272 
273  }
274 
277 
279  return iPhi()*2;
280 
281  }
282 
285 
288  return iEta()*4 + seed();
289 
290  }
291 
293  if (tobVersion() == Heuristic) {
294  return iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
295  }
296  return iEta()*s_towerEtaWidth + s_towerEtaWidth/2;
297  }
298 
299 
300 } // namespace xAOD
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::eFexTauRoI_v1::rCoreThresholds
unsigned int rCoreThresholds() const
Tau Condition 1 (rCore) results.
Definition: eFexTauRoI_v1.cxx:188
xAOD::eFexTauRoI_v1::word1
uint32_t word1() const
xAOD::eFexTauRoI_v1::iEtaTopo
int iEtaTopo() const
Getter for integer phi index (0-63)
Definition: eFexTauRoI_v1.cxx:284
xAOD::eFexTauRoI_v1::s_shelfPhiWidth
static const int s_shelfPhiWidth
Definition: eFexTauRoI_v1.h:224
xAOD::eFexTauRoI_v1::s_updownBit
static const int s_updownBit
Definition: eFexTauRoI_v1.h:185
xAOD::eFexTauRoI_v1::s_bcn4Bit
static const int s_bcn4Bit
Definition: eFexTauRoI_v1.h:190
et
Extra patterns decribing particle interation process.
xAOD::eFexTauRoI_v1::setWord1
void setWord1(uint32_t value)
xAOD::eFexTauRoI_v1::s_seedBit
static const int s_seedBit
Definition: eFexTauRoI_v1.h:184
xAOD::eFexTauRoI_v1::BDT
@ BDT
This object is generated by the BDT algorithm.
Definition: eFexTauRoI_v1.h:48
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:87
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::eFexTauRoI_v1::s_phiMask
static const int s_phiMask
Definition: eFexTauRoI_v1.h:198
xAOD::eFexTauRoI_v1::s_numPhi
static const int s_numPhi
Definition: eFexTauRoI_v1.h:215
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::eFexTauRoI_v1::xTOB
@ xTOB
This object is an xTOB (2*32 bit words)
Definition: eFexTauRoI_v1.h:41
xAOD::eFexTauRoI_v1::s_tobEtScale
static const float s_tobEtScale
Constants used in converting to ATLAS units.
Definition: eFexTauRoI_v1.h:167
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::eFexTauRoI_v1::rHadDenominator
uint16_t rHadDenominator() const
xAOD::eFexTauRoI_v1::s_veto3Mask
static const int s_veto3Mask
Definition: eFexTauRoI_v1.h:201
xAOD::eFexTauRoI_v1::seedMax
bool seedMax() const
Seed = max flag. Is this really useful?
Definition: eFexTauRoI_v1.cxx:154
index
Definition: index.py:1
xAOD::eFexTauRoI_v1::setWord0
void setWord0(uint32_t value)
Set the "raw" 32-bit words describing the e/gamma candidate.
xAOD::eFexTauRoI_v1::initialize
void initialize(unsigned int eFexNumber, unsigned int shelf, uint32_t word0)
Initialise the object with its most important properties.
Definition: eFexTauRoI_v1.cxx:28
xAOD::eFexTauRoI_v1::tauTwoThresholds
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
Definition: eFexTauRoI_v1.cxx:209
xAOD::eFexTauRoI_v1::s_seedMask
static const int s_seedMask
Definition: eFexTauRoI_v1.h:202
xAOD::eFexTauRoI_v1::word0
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
xAOD::eFexTauRoI_v1::rCore
float rCore() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
Definition: eFexTauRoI_v1.cxx:236
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::eFexTauRoI_v1::tobWord
uint32_t tobWord() const
Return TOB word corresponding to this TOB or xTOB.
Definition: eFexTauRoI_v1.cxx:223
xAOD::eFexTauRoI_v1::s_maxMask
static const int s_maxMask
Definition: eFexTauRoI_v1.h:204
xAOD::eFexTauRoI_v1::setEt
void setEt(float value)
floating point value (MeV, TOB scale)
xAOD::eFexTauRoI_v1::ObjectType
ObjectType
Object types.
Definition: eFexTauRoI_v1.h:40
xAOD::eFexTauRoI_v1::shelfNumber
unsigned int shelfNumber() const
Shelf number.
Definition: eFexTauRoI_v1.cxx:123
xAOD::eFexTauRoI_v1::s_fpgaMask
static const int s_fpgaMask
Definition: eFexTauRoI_v1.h:196
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::eFexTauRoI_v1::etXTOB
unsigned int etXTOB() const
Cluster ET (xTOB ET scale, 25 MeV/count)
Definition: eFexTauRoI_v1.cxx:173
pi
#define pi
Definition: TileMuonFitter.cxx:65
xAOD::eFexTauRoI_v1::s_eFexMask
static const int s_eFexMask
Definition: eFexTauRoI_v1.h:209
xAOD::eFexTauRoI_v1::setEta
void setEta(float value)
Floating point, full precision (0.025)
xAOD::eFexTauRoI_v1::s_eFexPhiWidth
static const int s_eFexPhiWidth
Definition: eFexTauRoI_v1.h:218
xAOD::eFexTauRoI_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: eFexTauRoI_v1.h:178
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
xAOD::rHadDenominator
setWord1 setRCoreDenominator rHadDenominator
Definition: eFexTauRoI_v1.cxx:94
SG::IAuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::eFexTauRoI_v1::fpga
unsigned int fpga() const
FPGA number.
Definition: eFexTauRoI_v1.cxx:134
xAOD::eFexTauRoI_v1::s_eFexPhiOffset
static const int s_eFexPhiOffset
Definition: eFexTauRoI_v1.h:219
xAOD::eFexTauRoI_v1::tauOneThresholds
unsigned int tauOneThresholds() const
Tau Condition 1 (generic) results.
Definition: eFexTauRoI_v1.cxx:205
xAOD::eFexTauRoI_v1::s_shelfMask
static const int s_shelfMask
Definition: eFexTauRoI_v1.h:210
xAOD::eFexTauRoI_v1::tobVersion
unsigned int tobVersion() const
Data decoded from the TOB/RoI word and eFEX number.
Definition: eFexTauRoI_v1.cxx:113
xAOD::eFexTauRoI_v1::s_shelfBit
static const int s_shelfBit
Definition: eFexTauRoI_v1.h:191
eFexTauRoI_v1.h
xAOD::eFexTauRoI_v1::s_etBit
static const int s_etBit
Definition: eFexTauRoI_v1.h:188
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
xAOD::eFexTauRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexTauRoI_v1.cxx:276
xAOD::eFexTauRoI_v1::s_maxBit
static const int s_maxBit
Definition: eFexTauRoI_v1.h:186
xAOD::eFexTauRoI_v1::TOB
@ TOB
This object is a TOB (1*32 bit word)
Definition: eFexTauRoI_v1.h:42
xAOD::eFexTauRoI_v1
Class describing a LVL1 eFEX tau region of interest.
Definition: eFexTauRoI_v1.h:29
xAOD::eFexTauRoI_v1::s_eFexEtaWidth
static const int s_eFexEtaWidth
Definition: eFexTauRoI_v1.h:222
xAOD::eFexTauRoI_v1::eFexTauRoI_v1
eFexTauRoI_v1()
Default constructor.
Definition: eFexTauRoI_v1.cxx:23
xAOD::eFexTauRoI_v1::rHad
float rHad() const
Definition: eFexTauRoI_v1.cxx:241
xAOD::eFexTauRoI_v1::s_updownMask
static const int s_updownMask
Definition: eFexTauRoI_v1.h:203
xAOD::eFexTauRoI_v1::s_minEta
static const int s_minEta
Definition: eFexTauRoI_v1.h:225
xAOD::eFexTauRoI_v1::Heuristic
@ Heuristic
This object is generated by the heuristic algorithm.
Definition: eFexTauRoI_v1.h:47
xAOD::eFexTauRoI_v1::bdtThresholds
unsigned int bdtThresholds() const
Alternative Tau Condition 1 (BDT) results.
Definition: eFexTauRoI_v1.cxx:194
xAOD::eFexTauRoI_v1::iPhi
int iPhi() const
Setter for the above.
Definition: eFexTauRoI_v1.cxx:249
xAOD::eFexTauRoI_v1::s_bdtScoreBit
static const int s_bdtScoreBit
Definition: eFexTauRoI_v1.h:193
xAOD::eFexTauRoI_v1::fpgaPhi
unsigned int fpgaPhi() const
phi index within FPGA
Definition: eFexTauRoI_v1.cxx:142
xAOD::eFexTauRoI_v1::computeEta
float computeEta() const
Compute TOB eta.
Definition: eFexTauRoI_v1.cxx:292
xAOD::eFexTauRoI_v1::seed
unsigned int seed() const
getter for integer eta index (-25->24)
Definition: eFexTauRoI_v1.cxx:150
xAOD::eFexTauRoI_v1::s_xTobEtScale
static const float s_xTobEtScale
Definition: eFexTauRoI_v1.h:168
xAOD::eFexTauRoI_v1::eFexNumber
unsigned int eFexNumber() const
eFEX number
Definition: eFexTauRoI_v1.cxx:118
xAOD::eFexTauRoI_v1::upNotDown
bool upNotDown() const
Cluster up/down flag (1 = up, 0 = down)
Definition: eFexTauRoI_v1.cxx:146
xAOD::eFexTauRoI_v1::s_etMask
static const int s_etMask
Definition: eFexTauRoI_v1.h:206
xAOD::eFexTauRoI_v1::s_etaMask
static const int s_etaMask
Definition: eFexTauRoI_v1.h:197
xAOD::eFexTauRoI_v1::rHadNumerator
uint16_t rHadNumerator() const
xAOD::eFexTauRoI_v1::s_towerEtaWidth
static const float s_towerEtaWidth
Definition: eFexTauRoI_v1.h:169
xAOD::eFexTauRoI_v1::s_bdtScoreMask
static const int s_bdtScoreMask
Definition: eFexTauRoI_v1.h:211
xAOD::eFexTauRoI_v1::s_veto3Bit
static const int s_veto3Bit
Definition: eFexTauRoI_v1.h:181
xAOD::eFexTauRoI_v1::fpgaEta
unsigned int fpgaEta() const
eta index within FPGA
Definition: eFexTauRoI_v1.cxx:138
xAOD::eFexTauRoI_v1::bcn4
unsigned int bcn4() const
Last 4 bits of BCN (xTOB only)
Definition: eFexTauRoI_v1.cxx:218
xAOD::eFexTauRoI_v1::s_etFullMask
static const int s_etFullMask
Definition: eFexTauRoI_v1.h:207
xAOD::eFexTauRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexTauRoI_v1.cxx:159
xAOD::eFexTauRoI_v1::rCoreNumerator
uint16_t rCoreNumerator() const
Actual values used in algorithm (setters and getters)
xAOD::eFexTauRoI_v1::s_veto1Bit
static const int s_veto1Bit
Definition: eFexTauRoI_v1.h:183
xAOD::eFexTauRoI_v1::bdtScore
unsigned int bdtScore() const
BDT Score (xTOB only)
Definition: eFexTauRoI_v1.cxx:180
xAOD::eFexTauRoI_v1::iEta
int iEta() const
setter for the above
Definition: eFexTauRoI_v1.cxx:265
xAOD::eFexTauRoI_v1::s_etBitXTOB
static const int s_etBitXTOB
Definition: eFexTauRoI_v1.h:189
xAOD::eFexTauRoI_v1::s_veto2Mask
static const int s_veto2Mask
Definition: eFexTauRoI_v1.h:200
xAOD::eFexTauRoI_v1::s_veto2Bit
static const int s_veto2Bit
Definition: eFexTauRoI_v1.h:182
xAOD::eFexTauRoI_v1::setIsTOB
void setIsTOB(char value)
xAOD::eFexTauRoI_v1::s_etaBit
static const int s_etaBit
Definition: eFexTauRoI_v1.h:179
xAOD::eFexTauRoI_v1::s_phiBit
static const int s_phiBit
Definition: eFexTauRoI_v1.h:180
xAOD::eFexTauRoI_v1::setPhi
void setPhi(float value)
Floating point, ATLAS phi convention (-pi -> pi)
xAOD::eFexTauRoI_v1::s_eFexBit
static const int s_eFexBit
Definition: eFexTauRoI_v1.h:192
xAOD::eFexTauRoI_v1::s_bcn4Mask
static const int s_bcn4Mask
Definition: eFexTauRoI_v1.h:208
xAOD::eFexTauRoI_v1::s_fpgaEtaWidth
static const int s_fpgaEtaWidth
Definition: eFexTauRoI_v1.h:223
xAOD::eFexTauRoI_v1::s_veto1Mask
static const int s_veto1Mask
Definition: eFexTauRoI_v1.h:199
xAOD::eFexTauRoI_v1::rCoreDenominator
uint16_t rCoreDenominator() const
xAOD::eFexTauRoI_v1::rHadThresholds
unsigned int rHadThresholds() const
Tau Condition 2 (Had/EM) results.
Definition: eFexTauRoI_v1.cxx:200
xAOD::eFexTauRoI_v1::tauThreeThresholds
unsigned int tauThreeThresholds() const
Tau Condition 3 (unused) results.
Definition: eFexTauRoI_v1.cxx:213
xAOD::eFexTauRoI_v1::type
ObjectType type() const
Object type (TOB or xTOB)
Definition: eFexTauRoI_v1.cxx:128
xAOD::rCoreDenominator
setWord1 rCoreDenominator
Definition: eFexTauRoI_v1.cxx:90