ATLAS Offline Software
eFexTauRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // System include(s):
7 #include <stdexcept>
8 
9 // xAOD include(s):
11 
12 // Local include(s):
14 
15 namespace xAOD {
16 
18  const float eFexTauRoI_v1::s_tobEtScale = 100.;
19  const float eFexTauRoI_v1::s_xTobEtScale = 25.;
20  const float eFexTauRoI_v1::s_towerEtaWidth = 0.1;
21 
23  : SG::AuxElement() {
24 
25  }
26 
27  void eFexTauRoI_v1::initialize( unsigned int eFexNumber, unsigned int shelf, uint32_t word0 ) {
28 
29  // xTOBs will have eFEX and Shelf numbers in word 1
30  // To save space, use the second word of this object, which is not part of a TOB, to store these values
31  uint32_t word1 = 0;
33  word1 |= (shelf&s_shelfMask)<<s_shelfBit;
34  setWord0( word0 );
35  setWord1( word1 );
36 
39  float etaVal = computeEta();
40  setEta( etaVal );
41  float phiVal = iPhi() * M_PI/32. + M_PI/64.;
42  if (phiVal > M_PI) phiVal = phiVal - 2.*M_PI;
43  setPhi( phiVal );
44 
47  if (type() == TOB) setIsTOB(1);
48  else setIsTOB(0);
49 
50  return;
51  }
52 
53 
55 
56  // xTOBs will have eFEX and Shelf numbers in word 1
57  // So all we need to do is set the TOB words
58  setWord0( word0 );
59  setWord1( word1 );
60 
63  float etaVal = computeEta();
64  setEta( etaVal );
65  float phiVal = iPhi() * M_PI/32. + M_PI/64.;
66  if (phiVal > M_PI) phiVal = phiVal - 2.*M_PI;
67  setPhi( phiVal );
68 
71  if (type() == TOB) setIsTOB(1);
72  else setIsTOB(0);
73 
74  return;
75  }
76 
79  setWord0 )
81  setWord1 )
82 
83 
85  setRCoreNumerator )
87  setRCoreDenominator )
89  setRHadNumerator )
91  setRHadDenominator )
92 
95  setIsTOB )
96 
99  setEt )
101  setEta )
103  setPhi )
104 
105 
107 
109  unsigned int eFexTauRoI_v1::tobVersion() const {
110  return (word0() >> s_versionBit) & s_versionMask;
111  }
112 
114  unsigned int eFexTauRoI_v1::eFexNumber() const {
115  return (word1() >> s_eFexBit) & s_eFexMask;
116  }
117 
119  unsigned int eFexTauRoI_v1::shelfNumber() const {
120  return (word1() >> s_shelfBit) & s_shelfMask;
121  }
122 
125  if (etXTOB() == 0) return TOB;
126  else return xTOB;
127  }
128 
130  unsigned int eFexTauRoI_v1::fpga() const {
131  return (word0() >> s_fpgaBit) & s_fpgaMask;
132  }
133 
134  unsigned int eFexTauRoI_v1::fpgaEta() const {
135  return (word0() >> s_etaBit) & s_etaMask;
136  }
137 
138  unsigned int eFexTauRoI_v1::fpgaPhi() const {
139  return (word0() >> s_phiBit) & s_phiMask;
140  }
141 
143  return (word0() >> s_updownBit) & s_updownMask;
144  }
145 
146  unsigned int eFexTauRoI_v1::seed() const {
147  return (word0() >> s_seedBit) & s_seedMask;
148  }
149 
150  bool eFexTauRoI_v1::seedMax() const {
151  return (word0() >> s_maxBit) & s_maxMask;
152  }
153 
155  unsigned int eFexTauRoI_v1::etTOB() const {
156  // Data content = TOB
157  if (etXTOB() == 0) {
158  return (word0() >> s_etBit) & s_etMask;
159  }
160  // Data Content = xTOB. Need to remove lower bits and cap range
161  else {
162  unsigned int etWord = (etXTOB() >> s_etBitXTOB);
163  if (etWord > s_etMask) etWord = s_etMask;
164  return etWord;
165  }
166  }
167 
169  unsigned int eFexTauRoI_v1::etXTOB() const {
171  return (word1() >> s_etBit) & s_etFullMask;
172  }
173 
174 
176  unsigned int eFexTauRoI_v1::bdtScore() const {
178  if (tobVersion() != BDT || type() != xTOB) return 0;
179  return (word0() >> s_bdtScoreBit) & s_bdtScoreMask;
180  }
181 
182 
184  unsigned int eFexTauRoI_v1::rCoreThresholds() const {
185  // Return rCore results if used, otherwise return 0
186  return (tobVersion() == Heuristic ? tauOneThresholds() : 0);
187  }
188 
190  unsigned int eFexTauRoI_v1::bdtThresholds() const {
191  // Return BDT results if used, otherwise return 0
192  return (tobVersion() == BDT ? tauOneThresholds() : 0);
193  }
194 
196  unsigned int eFexTauRoI_v1::rHadThresholds() const {
197  return tauTwoThresholds();
198  }
199 
201  unsigned int eFexTauRoI_v1::tauOneThresholds() const {
202  return (word0() >> s_veto1Bit) & s_veto1Mask;
203  }
204 
205  unsigned int eFexTauRoI_v1::tauTwoThresholds() const {
206  return (word0() >> s_veto2Bit) & s_veto2Mask;
207  }
208 
209  unsigned int eFexTauRoI_v1::tauThreeThresholds() const {
210  return (word0() >> s_veto3Bit) & s_veto3Mask;
211  }
212 
214  unsigned int eFexTauRoI_v1::bcn4() const {
215  return (word1() >> s_bcn4Bit) & s_bcn4Mask;
216  }
217 
220  // Do something sensible if called for a TOB
221  if (etXTOB() == 0) return word0();
222  // When called for xTOB
223  else {
224  uint32_t word = word0() + etTOB();
225  return word;
226  }
227  }
228 
232  float eFexTauRoI_v1::rCore() const {
233  if (rCoreDenominator() > 0) return (static_cast<float>(rCoreNumerator())/static_cast<float>(rCoreDenominator()));
234  else return 0.;
235  }
236 
237  float eFexTauRoI_v1::rHad() const {
238  if (rHadDenominator() > 0) return (static_cast<float>(rHadNumerator())/static_cast<float>(rHadDenominator()));
239  else return 0.;
240  }
241 
243 
245  int eFexTauRoI_v1::iPhi() const {
246 
248  unsigned int octant = int(eFexNumber()/3) + shelfNumber()*s_shelfPhiWidth;
249 
251  unsigned int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
252  if (index >= s_numPhi) index -= s_numPhi;
253 
254  return index;
255  }
256 
261  int eFexTauRoI_v1::iEta() const {
262 
265 
267  return index;
268 
269  }
270 
273 
275  return iPhi()*2;
276 
277  }
278 
281 
284  return iEta()*4 + seed();
285 
286  }
287 
289  if (tobVersion() == Heuristic) {
290  return iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
291  }
292  return iEta()*s_towerEtaWidth + s_towerEtaWidth/2;
293  }
294 
295 
296 } // 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:184
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:280
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:82
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::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
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:150
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:27
xAOD::eFexTauRoI_v1::tauTwoThresholds
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
Definition: eFexTauRoI_v1.cxx:205
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.
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::eFexTauRoI_v1::rCore
float rCore() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
Definition: eFexTauRoI_v1.cxx:232
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:219
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:119
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:169
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:90
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:130
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:201
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:109
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:88
xAOD::eFexTauRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexTauRoI_v1.cxx:272
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:22
xAOD::eFexTauRoI_v1::rHad
float rHad() const
Definition: eFexTauRoI_v1.cxx:237
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:190
xAOD::eFexTauRoI_v1::iPhi
int iPhi() const
Setter for the above.
Definition: eFexTauRoI_v1.cxx:245
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:138
xAOD::eFexTauRoI_v1::computeEta
float computeEta() const
Compute TOB eta.
Definition: eFexTauRoI_v1.cxx:288
xAOD::eFexTauRoI_v1::seed
unsigned int seed() const
getter for integer eta index (-25->24)
Definition: eFexTauRoI_v1.cxx:146
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:114
xAOD::eFexTauRoI_v1::upNotDown
bool upNotDown() const
Cluster up/down flag (1 = up, 0 = down)
Definition: eFexTauRoI_v1.cxx:142
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:134
xAOD::eFexTauRoI_v1::bcn4
unsigned int bcn4() const
Last 4 bits of BCN (xTOB only)
Definition: eFexTauRoI_v1.cxx:214
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:155
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:176
xAOD::eFexTauRoI_v1::iEta
int iEta() const
setter for the above
Definition: eFexTauRoI_v1.cxx:261
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::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
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:196
xAOD::eFexTauRoI_v1::tauThreeThresholds
unsigned int tauThreeThresholds() const
Tau Condition 3 (unused) results.
Definition: eFexTauRoI_v1.cxx:209
xAOD::eFexTauRoI_v1::type
ObjectType type() const
Object type (TOB or xTOB)
Definition: eFexTauRoI_v1.cxx:124
xAOD::rCoreDenominator
setWord1 rCoreDenominator
Definition: eFexTauRoI_v1.cxx:86