ATLAS Offline Software
Loading...
Searching...
No Matches
jFEXSmallRJetAlgo.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4//***************************************************************************
5// jFEXSmallRJetAlgo - Algorithm for small R jet Algorithm in jFEX
6// -------------------
7// begin : 03 11 2020
8// email : varsiha.sothilingam@cern.ch
9//***************************************************************************
10#include <vector>
11#include "jFEXSmallRJetAlgo.h"
12#include "L1CaloFEXSim/jTower.h"
14
15namespace LVL1{
16
17//Default Constructor
18LVL1::jFEXSmallRJetAlgo::jFEXSmallRJetAlgo(const std::string& type, const std::string& name, const IInterface* parent):
19 AthAlgTool(type, name, parent)
20 {
21 declareInterface<IjFEXSmallRJetAlgo>(this);
22 }
23
25{
26 ATH_CHECK(m_jTowerContainerKey.initialize());
27
28 return StatusCode::SUCCESS;
29
30}
31
32//calls container for TT
34
36 if(! m_jTowerContainer.isValid()) {
37 ATH_MSG_ERROR("Could not retrieve jTowerContainer " << m_jTowerContainerKey.key());
38 return StatusCode::FAILURE;
39 }
40
41 return StatusCode::SUCCESS;
42}
43
44void LVL1::jFEXSmallRJetAlgo::setup(int inputTable[7][7], int inputTableDisplaced[7][7]) {
45
46 for(int phi=0; phi<7; phi++) {
47 for (int eta=0; eta<7; eta++) {
48 m_jFEXalgoTowerID[phi][eta] = inputTable[6-phi][eta];
49 }
50 }
51
52 for(int phi=0; phi<7; phi++) {
53 for (int eta=0; eta<7; eta++) {
54 m_jFEXalgoTowerID_displaced[phi][eta] = inputTableDisplaced[6-phi][eta];
55 }
56 }
57}
58
59//Gets the ET for the TT. This ET is EM + HAD
60unsigned int LVL1::jFEXSmallRJetAlgo::getTTowerET(unsigned int TTID ) const {
61 if(TTID == 0) {
62 return 0;
63 }
64
65 if(m_map_Etvalues.find(TTID) != m_map_Etvalues.end()) {
66 return m_map_Etvalues.at(TTID).at(0);
67 }
68
69 //we shouldn't arrive here
70 return 0;
71}
72
73//this function calculates seed for a given TT
75{
76
77 for(int mphi = 1; mphi < 6; mphi++) {
78 for(int meta = 1; meta< 6; meta++) {
79
80 int seedTotalET = 0;
81 int seedTotalET_displaced = 0;
82 for(int iphi = -1; iphi < 2; iphi++) {
83 for(int ieta = -1; ieta < 2; ieta++) {
84 //for that TT, build the seed
85 //here we sum TT ET to calculate seed
86 seedTotalET += getTTowerET(m_jFEXalgoTowerID [mphi + iphi][meta + ieta]);
87 seedTotalET_displaced += getTTowerET(m_jFEXalgoTowerID_displaced[mphi + iphi][meta + ieta]);
88 }
89 }
90 m_jFEXalgoSearchWindowSeedET[mphi -1][meta -1] = seedTotalET;
91 m_jFEXalgoSearchWindowSeedET_displaced[mphi -1][meta -1] = seedTotalET_displaced;
92 }
93 }
94}
95
96
97bool LVL1::jFEXSmallRJetAlgo::CalculateLM(int mymatrix[5][5]) const {
98
99 //here put the 24 conditions to determine if the TT seed is a local maxima.
100 int central_seed = mymatrix[2][2];
101 for (int iphi = 0; iphi < 5; iphi++) {
102 for (int ieta = 0; ieta < 5; ieta++) {
103 //avoid comparing central seed to itself
104 if ((ieta == 2) && (iphi == 2)) {
105 continue;
106 }
107 //strictly less than central
108 if( (iphi > ieta) || (iphi == 0 && ieta == 0) || (iphi == 1 && ieta == 1) ) {
109 if(central_seed < mymatrix[iphi][ieta]) {
110 return false;
111 }
112 }
113 //less than or equal to central
114 if((iphi < ieta) || (iphi == 3 && ieta == 3) || (iphi == 4 && ieta == 4)) {
115 if(central_seed <= mymatrix[iphi][ieta]) {
116 return false;
117 }
118 }
119 }
120 }
121
122 return true;
123}
124
125//check if central TT is a local maxima
127
128 bool isCentralLM = CalculateLM(m_jFEXalgoSearchWindowSeedET) &&
130
133
134 if(isCentralLM || isDisplacedLM ){
136 return m_jFEXalgoSearchWindowSeedET[2][2] > seedThreshold;
137 }
138 return false;
139}
140
142 // only valid after calling buildSeeds() !
143 return m_jFEXalgoSearchWindowSeedET[2][2];
144}
145
146
147//in this clustering func, the central TT in jet is the parameters
149
150 int SRJetClusterET = 0;
151 for(int nphi = -3; nphi< 4; nphi++) {
152 for(int neta = -3; neta< 4; neta++) {
153 int DeltaRSquared = (nphi * nphi) + (neta * neta);
154 if(DeltaRSquared < 16) {
155 SRJetClusterET += getTTowerET(m_jFEXalgoTowerID[3+nphi][3+neta]);
156 }
157 }
158 }
159 return SRJetClusterET;
160}
161
163
164 m_JetSaturation = false;
165 for(int nphi = -3; nphi< 4; nphi++) {
166 for(int neta = -3; neta< 4; neta++) {
167 int DeltaRSquared = (nphi * nphi) + (neta * neta);
168 if(DeltaRSquared < 16) {
170 }
171 }
172 }
173}
174
178
180 int SmallETRing = getSmallClusterET() - m_jFEXalgoSearchWindowSeedET[3][3];
181 return SmallETRing;
182}
183
185 return m_jFEXalgoTowerID[3][3];
186}
187
188
189void LVL1::jFEXSmallRJetAlgo::setFPGAEnergy(const std::unordered_map<int,std::vector<int> >& et_map){
190 m_map_Etvalues=et_map;
191}
192
193//getter for tower saturation
195 if(TTID == 0) {
196 return false;
197 }
198
199 const LVL1::jTower * tmpTower = m_jTowerContainer->findTower(TTID);
200 return tmpTower->getTowerSat();
201}
202
203}// end of namespace LVL1
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual bool isSeedLocalMaxima(int seedThreshold) override
virtual bool getSRjetSat() const override
virtual unsigned int getTTowerET(unsigned int TTID) const override
virtual void setup(int inputTable[7][7], int inputTableDisplaced[7][7]) override
virtual void buildSeeds() override
SG::ReadHandle< jTowerContainer > m_jTowerContainer
virtual unsigned int getSmallETRing() const override
virtual unsigned int getTTIDcentre() const override
virtual StatusCode safetyTest() override
bool CalculateLM(int mymatrix[5][5]) const
virtual unsigned int getSmallClusterET() const override
std::unordered_map< int, std::vector< int > > m_map_Etvalues
virtual void setFPGAEnergy(const std::unordered_map< int, std::vector< int > > &et_map) override
virtual StatusCode initialize() override
standard Athena-Algorithm method
virtual unsigned int getSeedET() const override
SG::ReadHandleKey< LVL1::jTowerContainer > m_jTowerContainerKey
int m_jFEXalgoSearchWindowSeedET_displaced[5][5]
jFEXSmallRJetAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
bool getTTowerSat(unsigned int TTID)
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
Definition jTower.h:36
bool getTowerSat() const
Definition jTower.h:61
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
-diff