ATLAS Offline Software
eFexEMRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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 eFexEMRoI_v1::s_tobEtScale = 100.;
19  const float eFexEMRoI_v1::s_xTobEtScale = 25.;
20  const float eFexEMRoI_v1::s_towerEtaWidth = 0.1;
21 
23  : SG::AuxElement() {
24 
25  }
26 
27  void eFexEMRoI_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 = iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
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 
56 
57  // xTOBs will have eFEX and Shelf numbers in word 1
58  // So all we need to do is set the TOB words
59  setWord0( word0 );
60  setWord1( word1 );
61 
64  float etaVal = iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4;
65  setEta( etaVal );
66  float phiVal = iPhi() * M_PI/32. + M_PI/64.;
67  if (phiVal > M_PI) phiVal = phiVal - 2.*M_PI;
68  setPhi( phiVal );
69 
72  if (type() == TOB) setIsTOB(1);
73  else setIsTOB(0);
74 
75  return;
76  }
77 
78 
81  setWord0 )
83  setWord1 )
84 
87  setRetaCore )
89  setRetaEnv )
91  setRhadEM )
93  setRhadHad )
95  setWstotNumerator )
97  setWstotDenominator )
98 
99 
102  setIsTOB )
103 
106  setEt )
108  setEta )
110  setPhi )
111 
112 
114 
116  unsigned int eFexEMRoI_v1::eFexNumber() const {
117  return (word1() >> s_eFexBit) & s_eFexMask;
118  }
119 
121  unsigned int eFexEMRoI_v1::shelfNumber() const {
122  return (word1() >> s_shelfBit) & s_shelfMask;
123  }
124 
127  if (etXTOB() == 0) return TOB;
128  else return xTOB;
129  }
130 
132  unsigned int eFexEMRoI_v1::fpga() const {
133  return (word0() >> s_fpgaBit) & s_fpgaMask;
134  }
135 
136  unsigned int eFexEMRoI_v1::fpgaEta() const {
137  return (word0() >> s_etaBit) & s_etaMask;
138  }
139 
140  unsigned int eFexEMRoI_v1::fpgaPhi() const {
141  return (word0() >> s_phiBit) & s_phiMask;
142  }
143 
144  unsigned int eFexEMRoI_v1::UpNotDown() const {
145  return (word0() >> s_updownBit) & s_updownMask;
146  }
147 
148  unsigned int eFexEMRoI_v1::seed() const {
149  return (word0() >> s_seedBit) & s_seedMask;
150  }
151 
152  unsigned int eFexEMRoI_v1::seedMax() const {
153  return (word0() >> s_maxBit) & s_maxMask;
154  }
155 
157  unsigned int eFexEMRoI_v1::etTOB() const {
158  // Data content = TOB
159  if (etXTOB() == 0) {
160  return (word0() >> s_etBit) & s_etMask;
161  }
162  // Data Content = xTOB. Need to remove lower bits and cap range
163  else {
164  unsigned int etWord = (etXTOB() >> s_etBitXTOB);
165  if (etWord > s_etMask) etWord = s_etMask;
166  return etWord;
167  }
168  }
169 
171  unsigned int eFexEMRoI_v1::etXTOB() const {
173  return (word1() >> s_etBit) & s_etFullMask;
174  }
175 
177  unsigned int eFexEMRoI_v1::RetaThresholds() const {
178  return (word0() >> s_veto1Bit) & s_veto1Mask;
179  }
180 
181  unsigned int eFexEMRoI_v1::RhadThresholds() const {
182  return (word0() >> s_veto3Bit) & s_veto3Mask;
183  }
184 
185  unsigned int eFexEMRoI_v1::WstotThresholds() const {
186  return (word0() >> s_veto2Bit) & s_veto2Mask;
187  }
188 
189  unsigned int eFexEMRoI_v1::bcn4() const {
190  return (word1() >> s_bcn4Bit) & s_bcn4Mask;
191  }
192 
195  // Do something sensible if called for a TOB
196  if (etXTOB() == 0) return word0();
197  // When called for xTOB
198  else {
199  uint32_t word = word0() + etTOB();
200  return word;
201  }
202  }
203 
207  float eFexEMRoI_v1::Reta() const {
208  float sum = RetaCore() + RetaEnv();
209  if (sum > 0) return (1. - RetaCore()/sum);
210  else return -1.;
211  }
212 
213  float eFexEMRoI_v1::Rhad() const {
214  float sum = RhadEM() + RhadHad();
215  if (sum > 0) return (RhadHad()/sum);
216  else return -1.;
217  }
218 
219  float eFexEMRoI_v1::Wstot() const {
220  if (WstotDenominator() > 0) return (static_cast<float>(WstotNumerator())/WstotDenominator());
221  else return -1.;
222  }
223 
225 
227  int eFexEMRoI_v1::iPhi() const {
228 
230  unsigned int octant = int(eFexNumber()/3) + shelfNumber()*s_shelfPhiWidth;
231 
233  int index = s_eFexPhiWidth*octant + fpgaPhi() + s_eFexPhiOffset;
234  if (index >= s_numPhi) index -= s_numPhi;
235 
236  return index;
237  }
238 
243  int eFexEMRoI_v1::iEta() const {
244 
247 
249  return index;
250 
251  }
252 
255 
257  return iPhi()*2;
258 
259  }
260 
263 
266  return iEta()*4 + seed();
267 
268  }
269 
270 
271 } // namespace xAOD
xAOD::eFexEMRoI_v1::Rhad
float Rhad() const
Definition: eFexEMRoI_v1.cxx:213
xAOD::eFexEMRoI_v1::s_shelfPhiWidth
static const int s_shelfPhiWidth
Definition: eFexEMRoI_v1.h:204
xAOD::RetaEnv
setWord1 RetaEnv
Definition: eFexEMRoI_v1.cxx:88
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:243
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:262
xAOD::eFexEMRoI_v1::s_fpgaMask
static const int s_fpgaMask
Definition: eFexEMRoI_v1.h:179
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:82
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::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
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:207
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:116
M_PI
#define M_PI
Definition: ActiveFraction.h:11
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:171
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
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:227
xAOD::eFexEMRoI_v1::fpgaPhi
unsigned int fpgaPhi() const
phi index within FPGA
Definition: eFexEMRoI_v1.cxx:140
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:27
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
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:177
xAOD::eFexEMRoI_v1::type
ObjectType type() const
Data decoded from the TOB/RoI word and eFEX number.
Definition: eFexEMRoI_v1.cxx:126
xAOD::eFexEMRoI_v1::word1
uint32_t word1() const
xAOD::eFexEMRoI_v1::eFexEMRoI_v1
eFexEMRoI_v1()
Default constructor.
Definition: eFexEMRoI_v1.cxx:22
xAOD::eFexEMRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexEMRoI_v1.cxx:254
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:157
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:185
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:194
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:136
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:152
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:148
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:189
xAOD::eFexEMRoI_v1::shelfNumber
unsigned int shelfNumber() const
Shelf number.
Definition: eFexEMRoI_v1.cxx:121
xAOD::eFexEMRoI_v1::UpNotDown
unsigned int UpNotDown() const
Cluster up/down flag (1 = up, 0 = down)
Definition: eFexEMRoI_v1.cxx:144
xAOD::RhadHad
setWord1 setRetaEnv RhadHad
Definition: eFexEMRoI_v1.cxx:92
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:219
xAOD::WstotDenominator
setWord1 setRetaEnv setRhadHad WstotDenominator
Definition: eFexEMRoI_v1.cxx:96
xAOD::eFexEMRoI_v1::RhadThresholds
unsigned int RhadThresholds() const
Jet Discriminant 2 (R_had) results.
Definition: eFexEMRoI_v1.cxx:181
xAOD::eFexEMRoI_v1::fpga
unsigned int fpga() const
FPGA number.
Definition: eFexEMRoI_v1.cxx:132
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::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::eFexEMRoI_v1::s_phiBit
static const int s_phiBit
Definition: eFexEMRoI_v1.h:165