ATLAS Offline Software
jFexSRJetRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // System include(s):
7 #include <stdexcept>
8 // xAOD include(s):
10 
11 // Local include(s):
13 #include "getQuadrant.h"
14 
15 namespace xAOD {
16 
17  // globalEta/Phi calculation in the FCAL varies depending on position in eta space due to TT granularity change.
18  //| Region | eta region | TT (eta x phi)
19  //---------------------------------------------------------
20  // Region 1 EMB | |eta| < 25 | (1 x 1)
21  // Region 2 EMIE | 25 < |eta| < 31 | (2 x 2)
22  // Region 3 TRANS | 31 < |eta| < 32 | (1 x 2)
23  // Region 4 FCAL | |eta| > 32 | (2 x 4)
24 
25  //eta position in FCAL FPGAs
26  const std::vector<int> jFexSRJetRoI_v1::s_FWD_EtaPosition = {0, 8, //Region 1
27  9, 11, //Region 2
28  12, //Region 3
29  13, 24}; //Region 4
30  //eta position of FCAL EM layer as an integer
31  //Needs to be modified with firmware values
32  const std::vector<int> jFexSRJetRoI_v1::s_FCAL_EtaPosition = {32,34,35,37,38,40,41,43,44,46,47,49};
33 
35  : SG::AuxElement() {
36  }
37 
38  void jFexSRJetRoI_v1::initialize(uint8_t jFexNumber, uint8_t fpgaNumber, uint32_t tobWord, char istob, int resolution, float_t eta, float_t phi ) {
39 
40 
50  setEta( eta );
51  setPhi( phi );
53  setIsTOB(istob);
54 
55  return;
56  }
57 
59  // adapted from TSU::toTopoInteger
60  static const unsigned int RESOLUTION = 40;
61  float tmp = eta()*RESOLUTION;
62  int index;
63  if ( (abs(tmp)-0.5)/2. == std::round((abs(tmp)-0.5)/2.) ) {
64  if ( tmp>0 ) { index = std::floor(tmp); }
65  else { index = std::ceil(tmp); }
66  } else {
67  index = std::round(tmp);
68  }
69  return std::abs(index/4);
70  }
71 
72  //----------------
74  //----------------
75 
77  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, uint8_t , jFexNumber , setjFexNumber )
78  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, uint8_t , fpgaNumber , setfpgaNumber )
79 
80 
81  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, char, isTOB, setIsTOB )
82 
83 
85  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, uint8_t , tobLocalEta , setTobLocalEta )
86  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, uint8_t , tobLocalPhi , setTobLocalPhi )
88 
89  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexSRJetRoI_v1, int , globalEta, setGlobalEta )
91 
92 
95 
96 
98 
99  //-----------------
101  //-----------------
102 
103  //include in future when xTOB in jFEX has been implemented.
104 
105 
106  //jFexSRJetRoI_v1::ObjectType jFexSRJetRoI_v1::type() const {
107  //if (Word1() == 0) return TOB;
108  //else return xTOB;
109  //}
110 
111  //Hardware coordinate elements
112 
113  //Raw ET on TOB scale (200 MeV/count)
114 
115  unsigned int jFexSRJetRoI_v1::unpackEtTOB() const{
116  //Data content = TOB
117  return (tobWord() >> s_etBit) & s_etMask;
118  }
119 
120 
121  //Return an eta index
122  unsigned int jFexSRJetRoI::unpackEtaIndex() const {
123  return (tobWord() >> s_etaBit) & s_etaMask;
124  }
125  //Return a phi index
126  unsigned int jFexSRJetRoI::unpackPhiIndex() const {
127  return (tobWord() >> s_phiBit) & s_phiMask;
128  }
129 
130  //Return sat flag
132  return (tobWord() >> s_satBit) & s_satMask;
133  }
134 
136 
138  unsigned int jFexSRJetRoI_v1::et() const {
139  // Returns the TOB Et in a 1 MeV scale
140  return tobEt()*tobEtScale();
141  }
142 
143  // Global coords
144  // As the Trigger towers are 1x1 in Eta - Phi coords (x10). This changes in the FCAL, and depends on the eta position
146  int globalEta = 0;
147 
148  // this is covering from -2.5 to 2.5 in eta, which means half module 0 and 5 and modules 1, 2, 3 and 4
149  if(tobLocalEta()<9){
150  if(jFexNumber()<3){
151  globalEta= 8*(jFexNumber()-2) - (tobLocalEta()+1);
152  }
153  else if(jFexNumber()<6){
154  globalEta= 8*(jFexNumber()-3) + (tobLocalEta());
155  }
156  }
157  else{
158  if(jFexNumber()==5 ) {
159 
160  if(tobLocalEta() <=s_FWD_EtaPosition[4]) { //Region 2 and 3
161  globalEta = 25 +2*(tobLocalEta()-9);
162  }
163  else if(tobLocalEta() <= s_FWD_EtaPosition[6]) { //Region 4
165  }
166 
167  }
168  else if(jFexNumber()==0) {
169 
170  if(tobLocalEta() <=s_FWD_EtaPosition[4]) { //Region 2 and 3
171  globalEta = -(25 +2*(tobLocalEta()-9))-1;
172  }
173  else if(tobLocalEta() <= s_FWD_EtaPosition[6]) { //Region 4
175  }
176  }
177  }
178 
179  return globalEta;
180  }
181 
183  uint globalPhi = 0;
184  const unsigned int quadrant = ::getQuadrant(fpgaNumber());
185 
186  //16 is the phi height of an FPGA
187  if(jFexNumber() == 0 || jFexNumber() == 5) {
188 
189  if(tobLocalEta() <=s_FWD_EtaPosition[1]) { //Region 1
190  globalPhi = tobLocalPhi() + (quadrant * 16);
191  }
192  else if(tobLocalEta() <=s_FWD_EtaPosition[4]) {//Region 2 and Region 3 have the same granularity
193  globalPhi = (16*quadrant) + 2*(tobLocalPhi());
194  }
195  else if(tobLocalEta() <=s_FWD_EtaPosition[6]) {//Region 4
196  globalPhi = (16*quadrant) + 4*(tobLocalPhi())+1;
197  }
198  }
199  else { //Modules 1-4
200  globalPhi = tobLocalPhi() + (quadrant * 16);
201  }
202 
203  return globalPhi;
204  }
205 
206 } // namespace xAOD
207 
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::jFexSRJetRoI_v1::unpackEtaIndex
unsigned int unpackEtaIndex() const
Eta coordinates.
Definition: jFexSRJetRoI_v1.cxx:122
xAOD::jFexSRJetRoI_v1::setIsTOB
void setIsTOB(char value)
Set the isTOB variable (TOB or xTOB)
xAOD::jFexSRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSRJetRoI_v1.h:23
xAOD::jFexSRJetRoI_v1::setTobSat
void setTobSat(uint8_t value)
xAOD::jFexSRJetRoI_v1::setjFexNumber
void setjFexNumber(uint8_t jFexNumber)
xAOD::jFexSRJetRoI_v1::setTobEt
void setTobEt(uint16_t value)
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::jFexSRJetRoI_v1::unpackEtTOB
unsigned int unpackEtTOB() const
TOB ET (decoded from TOB, stored for convenience)
Definition: jFexSRJetRoI_v1.cxx:115
xAOD::jFexSRJetRoI_v1::setResolution
void setResolution(int value)
index
Definition: index.py:1
xAOD::jFexSRJetRoI_v1::s_FCAL_EtaPosition
static const std::vector< int > s_FCAL_EtaPosition
Definition: jFexSRJetRoI_v1.h:92
xAOD::jFexSRJetRoI_v1::globalEta
int globalEta() const
xAOD::jFexSRJetRoI_v1::s_phiMask
static const int s_phiMask
Definition: jFexSRJetRoI_v1.h:104
xAOD::jFexSRJetRoI_v1::jFexSRJetRoI_v1
jFexSRJetRoI_v1()
Default constructor.
Definition: jFexSRJetRoI_v1.cxx:34
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::jFexSRJetRoI_v1::setGlobalPhi
void setGlobalPhi(uint value)
xAOD::jFexSRJetRoI_v1::eta
float eta() const
xAOD::jFexSRJetRoI_v1::phi
float phi() const
xAOD::jFexSRJetRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
tobEt
uint16_t tobEt(const T *tob)
Definition: JfexSimMonitorAlgorithm.cxx:102
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::jFexSRJetRoI_v1::setfpgaNumber
void setfpgaNumber(uint8_t fpgaNumber)
xAOD::jFexSRJetRoI_v1::s_phiBit
static const int s_phiBit
Definition: jFexSRJetRoI_v1.h:98
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::jFexSRJetRoI_v1::setTobWord
void setTobWord(uint32_t tobWord)
Set the "raw" 32-bit words describing the object candidate.
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
xAOD::jFexSRJetRoI_v1::s_satBit
static const int s_satBit
Definition: jFexSRJetRoI_v1.h:99
xAOD::jFexSRJetRoI_v1::tobEtScale
int tobEtScale() const
jFexSRJetRoI.h
xAOD::jFexSRJetRoI_v1::menuEta
int menuEta() const
the eta index to use for looking up thresholds in the menu the current jFex fw only supports symmetri...
Definition: jFexSRJetRoI_v1.cxx:58
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
xAOD::jFexSRJetRoI_v1::tobEt
uint16_t tobEt() const
xAOD::jFexSRJetRoI_v1::s_satMask
static const int s_satMask
Definition: jFexSRJetRoI_v1.h:106
xAOD::jFexSRJetRoI_v1::s_etaBit
static const int s_etaBit
Definition: jFexSRJetRoI_v1.h:97
xAOD::jFexSRJetRoI_v1::globalPhi
uint globalPhi() const
xAOD::jFexSRJetRoI_v1::setTobLocalEta
void setTobLocalEta(uint8_t value)
xAOD::jFexSRJetRoI_v1::unpackPhiIndex
unsigned int unpackPhiIndex() const
Phi coordinates.
Definition: jFexSRJetRoI_v1.cxx:126
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
xAOD::jFexSRJetRoI_v1::unpackSaturationIndex
unsigned int unpackSaturationIndex() const
Definition: jFexSRJetRoI_v1.cxx:131
xAOD::jFexSRJetRoI_v1::unpackGlobalPhi
uint unpackGlobalPhi() const
Definition: jFexSRJetRoI_v1.cxx:182
TRT::Hit::globalPhi
@ globalPhi
Definition: HitInfo.h:38
xAOD::jFexSRJetRoI_v1::setEta
void setEta(float value)
xAOD::jFexSRJetRoI_v1::unpackGlobalEta
int unpackGlobalEta() const
Definition: jFexSRJetRoI_v1.cxx:145
xAOD::jFexSRJetRoI_v1::initialize
void initialize(uint8_t jFexNumber, uint8_t fpgaNumber, uint32_t tobWord, char istob, int resolution, float_t eta, float_t phi)
In future initialze the EDM.
Definition: jFexSRJetRoI_v1.cxx:38
xAOD::jFexSRJetRoI_v1::s_FWD_EtaPosition
static const std::vector< int > s_FWD_EtaPosition
Definition: jFexSRJetRoI_v1.h:91
xAOD::jFexSRJetRoI_v1::setTobLocalPhi
void setTobLocalPhi(uint8_t value)
xAOD::jFexSRJetRoI_v1::setPhi
void setPhi(float value)
xAOD::jFexSRJetRoI_v1::s_etaMask
static const int s_etaMask
Definition: jFexSRJetRoI_v1.h:103
xAOD::jFexSRJetRoI_v1::setGlobalEta
void setGlobalEta(int value)
xAOD::jFexSRJetRoI_v1::tobLocalEta
uint8_t tobLocalEta() const
xAOD::jFexSRJetRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
xAOD::tobEtScale
tobEtScale
Definition: gFexJetRoI_v1.cxx:64
xAOD::jFexSRJetRoI_v1::tobLocalPhi
uint8_t tobLocalPhi() const
xAOD::jFexSRJetRoI_v1::jFexNumber
uint8_t jFexNumber() const
getQuadrant.h
xAOD::jFexSRJetRoI_v1::et
unsigned int et() const
Methods that require combining results or applying scales.
Definition: jFexSRJetRoI_v1.cxx:138