ATLAS Offline Software
jFEXForwardElecInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 //***************************************************************************
5 // jFEXForwardElecInfo -
6 // -------------------
7 // begin : 12 05 2022
8 // email : ulla.blumenschein@cern.ch
9 //***************************************************************************
10 
11 #include <iostream>
12 #include <vector>
13 #include <string>
14 #include <map>
15 #include "L1CaloFEXSim/jTower.h"
23 #include "StoreGate/StoreGateSvc.h"
24 
25 
26 void LVL1::jFEXForwardElecInfo::setup(int jfex, uint ttid, int neta, int nphi){
27  m_jfex = jfex;
28  m_coreTTID = ttid;
29  m_ieta = neta;
30  m_iphi = nphi;
31 }
32 
33 
34 void LVL1::jFEXForwardElecInfo::setup(int *cval, uint reso){
35  m_reso = reso;
36  for(int i=0;i<9;i++) m_cval[i] = cval[i];
37 }
38 
39 
41  return m_coreTTID;
42 }
43 
45  return m_ieta;
46 }
47 
49  return m_iphi;
50 }
51 
53  m_coreTTfEta = fEta;
54 }
55 
56 
58  return m_coreTTfEta;
59 }
60 
62  return m_ieta;
63 }
64 
66  m_coreTTfPhi = fPhi;
67 }
68 
70  return m_coreTTfPhi;
71 }
72 
74  m_coreTTEtEM = ET_EM;
75 }
76 
78  return m_coreTTEtEM;
79 }
80 
82  m_coreTTsatEM = sat;
83 }
84 
86  return m_coreTTsatEM;
87 }
88 
90  m_nextTTID = TTID;
91 }
92 
94  return m_nextTTID;
95 }
96 
98  m_nextTTEtEM = nextEt;
99 }
100 
102  return m_nextTTEtEM;
103 }
104 
106  m_nextTTsatEM = sat;
107 }
108 
110  return m_nextTTsatEM;
111 }
112 
114  m_TTEtEMiso = iso_ET;
115 }
116 
118  m_TTEtEMiso += iso_ET;
119 }
120 
122  return m_TTEtEMiso;
123 }
124 
126  m_TTClusEtEM = m_coreTTEtEM + m_nextTTEtEM;
127  m_TTClusSatEM = m_coreTTsatEM || m_nextTTsatEM;
128 }
129 
131  return m_TTClusEtEM ;
132 }
133 
135  return m_TTClusSatEM ;
136 }
137 
139  m_TTEtHad1 = ET_HAD;
140 }
141 
143  m_TTEtHad1 += ET_HAD;
144 }
145 
147  return m_TTEtHad1;
148 }
149 
151  m_TTEtHad2 = ET_HAD;
152 }
153 
155  return m_TTEtHad2;
156 }
157 
159  return m_EtEMiso;
160 }
161 
163  return m_EtHad2;
164 }
165 
167  return m_EtHad1;
168 }
169 
171  return m_et ;
172 }
173 
175  return m_eta;
176 }
177 
179  return m_phi;
180 }
181 
183  return m_tob;
184 }
185 
187  m_TTsInSearchWindow.push_back(TT_ID);
188 }
189 
191  return m_TTsInSearchWindow;
192 }
193 
194 
195 
196 // Calculating Top quantities
197 
199  m_res = 0;
200  m_sat = 0;
201  m_emiso = 0;
202  m_emfr1 = 0;
203  m_emfr2 = 0;
204  m_eta = 0;
205  m_phi = 0;
206  m_et = 0;
207  m_tob = 0;
208  m_EtEMiso = 0;
209  m_EtHad1 = 0;
210  m_EtHad2 = 0;
211  m_EtEM = 0;
212 
213  if(m_jfex == 5) {
214  m_eta = m_ieta -8;
215  if(m_ieta < FEXAlgoSpaceDefs::jFEX_algoSpace_A_EMIE_eta) { // ieta lower than EMIE stats -> belong to EMB
216  m_phi = m_iphi-8;
217  }
218  else if(m_ieta < FEXAlgoSpaceDefs::jFEX_algoSpace_A_FCAL_start_eta) { // ieta lower than FCAL stats -> belong to EMIE
219  m_phi = m_iphi -4;
220  }
221  else { // rest ieta belongs to FCAL
222  m_phi = m_iphi -2;
223  }
224  }
225  else if(m_jfex == 0) {
226  m_eta = 36 - m_ieta;
227 
228  if(m_ieta < FEXAlgoSpaceDefs::jFEX_algoSpace_C_FCAL_end_eta) { // ieta lower than FCal ends -> FCAL
229  m_phi = m_iphi -2 ;
230  }
231  else if(m_ieta < FEXAlgoSpaceDefs::jFEX_algoSpace_C_EMIE_end_eta) {// ieta lower than EMIE ends -> EMIE
232  m_phi = m_iphi -4 ;
233  }
234  else {// rest of ieta -> EMB
235  m_phi = m_iphi -8 ;
236  }
237  }
238 
239  calcTTClusEtEM();
240 
241  if(m_reso > 0){
242  m_et = m_TTClusEtEM/m_reso;
243  m_EtEMiso = m_TTEtEMiso/m_reso;
244  m_EtHad1 = m_TTEtHad1/m_reso;
245  m_EtHad2 = m_TTEtHad2/m_reso;
246  m_EtEM = m_coreTTEtEM/m_reso;
247  }
248 
249  if (m_et > 0x7ff) { //0x7ff is 11 bits
250  m_et = 0x7ff;
251  //current FW convention is to NOT set the saturation bit on value overflow, but only to propagate cell saturation information from LAr
252  //m_sat=1;
253  }
254  m_sat = m_TTClusSatEM;
255 
256 
257  // jFEX internal values are at higher granularity (25MeV), not output granularity (200MeV).
258  // since we avoid divisions, MeV values are just as good (given that input granularity is already 25MeV)
259  if (m_TTClusEtEM > m_cval[2] * m_TTEtEMiso) {
260  m_emiso = 3;
261  } else if (m_TTClusEtEM > m_cval[1] * m_TTEtEMiso){
262  m_emiso = 2;
263  } else if (m_TTClusEtEM > m_cval[0] * m_TTEtEMiso){
264  m_emiso = 1;
265  }
266 
267  // hadronic fraction: only compare to core (=seed) tower
268  if (m_coreTTEtEM > m_cval[5] * m_TTEtHad1) {
269  m_emfr1 = 3;
270  } else if (m_coreTTEtEM > m_cval[4] * m_TTEtHad1){
271  m_emfr1 = 2;
272  } else if (m_coreTTEtEM > m_cval[3] * m_TTEtHad1){
273  m_emfr1 = 1;
274  }
275  if (m_coreTTEtEM > m_cval[8] * m_TTEtHad2) {
276  m_emfr2 = 3;
277  } else if (m_coreTTEtEM > m_cval[7] * m_TTEtHad2){
278  m_emfr2 = 2;
279  } else if (m_coreTTEtEM > m_cval[6] * m_TTEtHad2){
280  m_emfr2 = 1;
281  }
282 
283  m_tob = m_tob + (m_res << FEXAlgoSpaceDefs::jEM_resBit) + (m_emfr2 << FEXAlgoSpaceDefs::jEM_emf2Bit) + (m_emfr1 << FEXAlgoSpaceDefs::jEM_emf1Bit) + ( m_emiso << FEXAlgoSpaceDefs::jEM_isoBit) + (m_et << FEXAlgoSpaceDefs::jEM_etBit) + (m_eta << FEXAlgoSpaceDefs::jEM_etaBit) + (m_phi << FEXAlgoSpaceDefs::jEM_phiBit) + m_sat;
284 }
285 
286 
287 
288 std::unique_ptr<LVL1::jFEXForwardElecTOB> LVL1::jFEXForwardElecInfo::getFwdElTOBs(){
289 
290  std::unique_ptr<LVL1::jFEXForwardElecTOB> tob = std::make_unique<LVL1::jFEXForwardElecTOB>();
291 
292  calcFwdElEDM();
293 
294  tob->setET(m_et);
295  tob->setPhi(m_phi);
296  tob->setEta(m_eta);
297  tob->setIso(m_emiso);
298  tob->setEMf1(m_emfr1);
299  tob->setEMf2(m_emfr2);
300  tob->setSat(m_sat);
301  return tob;
302 }
303 
304 
LVL1::jFEXForwardElecInfo::calcFwdElEDM
void calcFwdElEDM()
Calculate variables for top word.
Definition: jFEXForwardElecInfo.cxx:198
LVL1::jFEXForwardElecInfo::getEtHad1
uint getEtHad1()
Definition: jFEXForwardElecInfo.cxx:166
LVL1::jFEXForwardElecInfo::includeTTinSearchWindow
void includeTTinSearchWindow(uint TT_ID)
Definition: jFEXForwardElecInfo.cxx:186
LVL1::jFEXForwardElecTOB::setET
void setET(unsigned int)
Definition: jFEXForwardElecTOB.cxx:44
LVL1::jFEXForwardElecInfo::getTTClusSatEM
bool getTTClusSatEM()
Definition: jFEXForwardElecInfo.cxx:134
LVL1::jFEXForwardElecInfo::m_iphi
int m_iphi
Definition: jFEXForwardElecInfo.h:105
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::jFEXForwardElecInfo::getTTEtHad2
int getTTEtHad2()
Definition: jFEXForwardElecInfo.cxx:154
LVL1::jFEXForwardElecInfo::getCoreIeta
uint getCoreIeta()
Definition: jFEXForwardElecInfo.cxx:44
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_C_EMIE_end_eta
constexpr static int jFEX_algoSpace_C_EMIE_end_eta
Definition: FEXAlgoSpaceDefs.h:66
LVL1::jFEXForwardElecInfo::setCoreTTEtEM
void setCoreTTEtEM(int ET_EM)
Definition: jFEXForwardElecInfo.cxx:73
LVL1::FEXAlgoSpaceDefs::jEM_resBit
constexpr static int jEM_resBit
Definition: FEXAlgoSpaceDefs.h:107
LVL1::jFEXForwardElecInfo::getTTinSearchWindow
std::vector< uint > getTTinSearchWindow()
Definition: jFEXForwardElecInfo.cxx:190
LVL1::jFEXForwardElecInfo::getCoreTTiEta
uint getCoreTTiEta()
Definition: jFEXForwardElecInfo.cxx:61
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_C_FCAL_end_eta
constexpr static int jFEX_algoSpace_C_FCAL_end_eta
Definition: FEXAlgoSpaceDefs.h:68
LVL1::jFEXForwardElecInfo::addTTEtEMiso
void addTTEtEMiso(int iso_ET)
Definition: jFEXForwardElecInfo.cxx:117
LVL1::jFEXForwardElecInfo::m_ieta
int m_ieta
Definition: jFEXForwardElecInfo.h:104
LVL1::jFEXForwardElecInfo::getNextTTSatEM
bool getNextTTSatEM()
Definition: jFEXForwardElecInfo.cxx:109
LVL1::FEXAlgoSpaceDefs::jEM_isoBit
constexpr static int jEM_isoBit
Definition: FEXAlgoSpaceDefs.h:110
LVL1::jFEXForwardElecInfo::setCoreTTSatEM
void setCoreTTSatEM(bool sat)
Definition: jFEXForwardElecInfo.cxx:81
LVL1::jFEXForwardElecInfo::setTTEtHad1
void setTTEtHad1(int ET_HAD)
Definition: jFEXForwardElecInfo.cxx:138
LVL1::jFEXForwardElecTOB::setEMf1
void setEMf1(unsigned int)
Definition: jFEXForwardElecTOB.cxx:54
LVL1::jFEXForwardElecInfo::getTTEtHad1
int getTTEtHad1()
Definition: jFEXForwardElecInfo.cxx:146
LVL1::jFEXForwardElecInfo::addTTEtHad1
void addTTEtHad1(int ET_HAD)
Definition: jFEXForwardElecInfo.cxx:142
LVL1::jFEXForwardElecInfo::getFwdElTOBs
std::unique_ptr< jFEXForwardElecTOB > getFwdElTOBs()
Calculate top word.
Definition: jFEXForwardElecInfo.cxx:288
LVL1::jFEXForwardElecInfo::setTTEtHad2
void setTTEtHad2(int ET_HAD)
Definition: jFEXForwardElecInfo.cxx:150
LVL1::jFEXForwardElecTOB::setPhi
void setPhi(unsigned int)
Definition: jFEXForwardElecTOB.cxx:39
LVL1::jFEXForwardElecInfo::setTTEtEMiso
void setTTEtEMiso(int iso_ET)
Definition: jFEXForwardElecInfo.cxx:113
LVL1::jFEXForwardElecInfo::getTTEtEMiso
int getTTEtEMiso()
Definition: jFEXForwardElecInfo.cxx:121
LVL1::jFEXForwardElecInfo::setNextTTEtEM
void setNextTTEtEM(int ET_EM)
Definition: jFEXForwardElecInfo.cxx:97
AthAlgorithm.h
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
LVL1::jFEXForwardElecInfo::setup
void setup(int jfex, uint ttid, int neta, int nphi)
Definition: jFEXForwardElecInfo.cxx:26
LVL1::jFEXForwardElecInfo::getEtEMiso
uint getEtEMiso()
Definition: jFEXForwardElecInfo.cxx:158
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1::jFEXForwardElecInfo::calcTTClusEtEM
void calcTTClusEtEM()
Definition: jFEXForwardElecInfo.cxx:125
LVL1::jFEXForwardElecInfo::m_coreTTID
uint m_coreTTID
Definition: jFEXForwardElecInfo.h:103
LVL1::jFEXForwardElecInfo::getNextTTEtEM
int getNextTTEtEM()
Definition: jFEXForwardElecInfo.cxx:101
LVL1::FEXAlgoSpaceDefs::jEM_phiBit
constexpr static int jEM_phiBit
Definition: FEXAlgoSpaceDefs.h:113
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
LVL1::FEXAlgoSpaceDefs::jEM_etaBit
constexpr static int jEM_etaBit
Definition: FEXAlgoSpaceDefs.h:112
LVL1::jFEXForwardElecInfo::getTTClusEtEM
int getTTClusEtEM()
Definition: jFEXForwardElecInfo.cxx:130
LVL1::jFEXForwardElecInfo::getEtHad2
uint getEtHad2()
Definition: jFEXForwardElecInfo.cxx:162
LVL1::jFEXForwardElecInfo::getCoreTTfPhi
float getCoreTTfPhi()
Definition: jFEXForwardElecInfo.cxx:69
LVL1::jFEXForwardElecInfo::getCoreTTfEta
float getCoreTTfEta()
Definition: jFEXForwardElecInfo.cxx:57
FEXAlgoSpaceDefs.h
LVL1::jFEXForwardElecInfo::getGlobalEta
int getGlobalEta()
Definition: jFEXForwardElecInfo.cxx:174
LVL1::jFEXForwardElecInfo::getCoreTTEtEM
int getCoreTTEtEM()
Definition: jFEXForwardElecInfo.cxx:77
LVL1::jFEXForwardElecInfo::getCoreTTID
uint getCoreTTID()
Definition: jFEXForwardElecInfo.cxx:40
LVL1::jFEXForwardElecTOB::setIso
void setIso(unsigned int)
Definition: jFEXForwardElecTOB.cxx:49
jTowerContainer.h
LVL1::jFEXForwardElecInfo::setNextTTSatEM
void setNextTTSatEM(bool sat)
Definition: jFEXForwardElecInfo.cxx:105
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_A_FCAL_start_eta
constexpr static int jFEX_algoSpace_A_FCAL_start_eta
Definition: FEXAlgoSpaceDefs.h:47
LVL1::jFEXForwardElecInfo::getEt
uint getEt()
Definition: jFEXForwardElecInfo.cxx:170
LVL1::jFEXForwardElecInfo::setNextTTID
void setNextTTID(uint TTID)
Definition: jFEXForwardElecInfo.cxx:89
LVL1::jFEXForwardElecInfo::getNextTTID
uint getNextTTID()
Definition: jFEXForwardElecInfo.cxx:93
CaloCellContainer.h
LVL1::jFEXForwardElecTOB::setSat
void setSat(unsigned int)
Definition: jFEXForwardElecTOB.cxx:65
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_A_EMIE_eta
constexpr static int jFEX_algoSpace_A_EMIE_eta
Definition: FEXAlgoSpaceDefs.h:46
LVL1::jFEXForwardElecInfo::setCoreTTfPhi
void setCoreTTfPhi(float fphi)
Definition: jFEXForwardElecInfo.cxx:65
LVL1::FEXAlgoSpaceDefs::jEM_emf2Bit
constexpr static int jEM_emf2Bit
Definition: FEXAlgoSpaceDefs.h:108
LVL1::jFEXForwardElecInfo::m_jfex
uint m_jfex
Definition: jFEXForwardElecInfo.h:106
jFEXForwardElecInfo.h
LVL1::jFEXForwardElecInfo::getGlobalPhi
uint getGlobalPhi()
Definition: jFEXForwardElecInfo.cxx:178
CaloIdManager.h
LVL1::jFEXForwardElecTOB::setEMf2
void setEMf2(unsigned int)
Definition: jFEXForwardElecTOB.cxx:59
LVL1::FEXAlgoSpaceDefs::jEM_emf1Bit
constexpr static int jEM_emf1Bit
Definition: FEXAlgoSpaceDefs.h:109
LVL1::jFEXForwardElecTOB::setEta
void setEta(unsigned int)
Definition: jFEXForwardElecTOB.cxx:34
LVL1::jFEXForwardElecInfo::setCoreTTfEta
void setCoreTTfEta(float feta)
Definition: jFEXForwardElecInfo.cxx:52
LVL1::jFEXForwardElecInfo::getCoreIphi
uint getCoreIphi()
Definition: jFEXForwardElecInfo.cxx:48
jTower.h
LVL1::FEXAlgoSpaceDefs::jEM_etBit
constexpr static int jEM_etBit
Definition: FEXAlgoSpaceDefs.h:111
StoreGateSvc.h
LVL1::jFEXForwardElecInfo::getCoreTTSatEM
bool getCoreTTSatEM()
Definition: jFEXForwardElecInfo.cxx:85
LVL1::jFEXForwardElecInfo::getTobWord
uint32_t getTobWord()
Definition: jFEXForwardElecInfo.cxx:182