ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace 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
37
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
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
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
Scalar eta() const
pseudorapidity method
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
uint16_t tobEt(const T *tob)
unsigned int uint
AuxElement()
Default constructor.
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
uint8_t fpgaNumber() const
void setResolution(int value)
static const int s_etBit
int menuEta() const
the eta index to use for looking up thresholds in the menu the current jFex fw only supports symmetri...
void setPhi(float value)
jFexSRJetRoI_v1()
Default constructor.
uint16_t tobEt() const
uint8_t tobLocalEta() const
static const std::vector< int > s_FCAL_EtaPosition
static const int s_satMask
void setIsTOB(char value)
Set the isTOB variable (TOB or xTOB)
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
void setEta(float value)
void setTobSat(uint8_t value)
uint8_t jFexNumber() const
void setjFexNumber(uint8_t jFexNumber)
void setTobLocalEta(uint8_t value)
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.
static const int s_phiBit
unsigned int et() const
Methods that require combining results or applying scales.
static const int s_satBit
void setfpgaNumber(uint8_t fpgaNumber)
unsigned int unpackSaturationIndex() const
static const std::vector< int > s_FWD_EtaPosition
void setGlobalEta(int value)
void setTobWord(uint32_t tobWord)
Set the "raw" 32-bit words describing the object candidate.
void setTobLocalPhi(uint8_t value)
void setGlobalPhi(uint value)
unsigned int unpackEtTOB() const
TOB ET (decoded from TOB, stored for convenience)
static const int s_etMask
unsigned int unpackEtaIndex() const
Eta coordinates.
static const int s_etaMask
uint8_t tobLocalPhi() const
uint globalPhi() const
void setTobEt(uint16_t value)
static const int s_etaBit
int tobEtScale() const
static const int s_phiMask
unsigned int unpackPhiIndex() const
Phi coordinates.
Forward declaration.
Definition index.py:1
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setWord1 uint16_t
setEventNumber uint32_t