ATLAS Offline Software
Loading...
Searching...
No Matches
jFEXSmallRJetAlgo.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
29{
30 ATH_CHECK(m_jTowerContainerKey.initialize());
31
32 return StatusCode::SUCCESS;
33
34}
35
36//calls container for TT
38
40 if(! m_jTowerContainer.isValid()) {
41 ATH_MSG_ERROR("Could not retrieve jTowerContainer " << m_jTowerContainerKey.key());
42 return StatusCode::FAILURE;
43 }
44
45 return StatusCode::SUCCESS;
46}
47
48void LVL1::jFEXSmallRJetAlgo::setup(int inputTable[7][7], int inputTableDisplaced[7][7]) {
49
50 for(int phi=0; phi<7; phi++) {
51 for (int eta=0; eta<7; eta++) {
52 m_jFEXalgoTowerID[phi][eta] = inputTable[6-phi][eta];
53 }
54 }
55
56 for(int phi=0; phi<7; phi++) {
57 for (int eta=0; eta<7; eta++) {
58 m_jFEXalgoTowerID_displaced[phi][eta] = inputTableDisplaced[6-phi][eta];
59 }
60 }
61}
62
63//Gets the ET for the TT. This ET is EM + HAD
64unsigned int LVL1::jFEXSmallRJetAlgo::getTTowerET(unsigned int TTID ) const {
65 if(TTID == 0) {
66 return 0;
67 }
68
69 if(m_map_Etvalues.find(TTID) != m_map_Etvalues.end()) {
70 return m_map_Etvalues.at(TTID).at(0);
71 }
72
73 //we shouldn't arrive here
74 return 0;
75}
76
77//this function calculates seed for a given TT
79{
80
81 for(int mphi = 1; mphi < 6; mphi++) {
82 for(int meta = 1; meta< 6; meta++) {
83
84 int seedTotalET = 0;
85 int seedTotalET_displaced = 0;
86 for(int iphi = -1; iphi < 2; iphi++) {
87 for(int ieta = -1; ieta < 2; ieta++) {
88 //for that TT, build the seed
89 //here we sum TT ET to calculate seed
90 seedTotalET += getTTowerET(m_jFEXalgoTowerID [mphi + iphi][meta + ieta]);
91 seedTotalET_displaced += getTTowerET(m_jFEXalgoTowerID_displaced[mphi + iphi][meta + ieta]);
92 }
93 }
94 m_jFEXalgoSearchWindowSeedET[mphi -1][meta -1] = seedTotalET;
95 m_jFEXalgoSearchWindowSeedET_displaced[mphi -1][meta -1] = seedTotalET_displaced;
96 }
97 }
98}
99
100
101bool LVL1::jFEXSmallRJetAlgo::CalculateLM(int mymatrix[5][5]) {
102
103 //here put the 24 conditions to determine if the TT seed is a local maxima.
104 int central_seed = mymatrix[2][2];
105 for (int iphi = 0; iphi < 5; iphi++) {
106 for (int ieta = 0; ieta < 5; ieta++) {
107 //avoid comparing central seed to itself
108 if ((ieta == 2) && (iphi == 2)) {
109 continue;
110 }
111 //strictly less than central
112 if( (iphi > ieta) || (iphi == 0 && ieta == 0) || (iphi == 1 && ieta == 1) ) {
113 if(central_seed < mymatrix[iphi][ieta]) {
114 return false;
115 }
116 }
117 //less than or equal to central
118 if((iphi < ieta) || (iphi == 3 && ieta == 3) || (iphi == 4 && ieta == 4)) {
119 if(central_seed <= mymatrix[iphi][ieta]) {
120 return false;
121 }
122 }
123 }
124 }
125
126 return true;
127}
128
129//check if central TT is a local maxima
131
132 bool isCentralLM = CalculateLM(m_jFEXalgoSearchWindowSeedET) &&
134
137
138 if(isCentralLM || isDisplacedLM ){
140 return m_jFEXalgoSearchWindowSeedET[2][2] > seedThreshold;
141 }
142 return false;
143}
144
146 // only valid after calling buildSeeds() !
147 return m_jFEXalgoSearchWindowSeedET[2][2];
148}
149
150
151//in this clustering func, the central TT in jet is the parameters
153
154 int SRJetClusterET = 0;
155 for(int nphi = -3; nphi< 4; nphi++) {
156 for(int neta = -3; neta< 4; neta++) {
157 int DeltaRSquared = std::pow(nphi,2)+std::pow(neta,2);
158 if(DeltaRSquared < 16) {
159 SRJetClusterET += getTTowerET(m_jFEXalgoTowerID[3+nphi][3+neta]);
160 }
161 }
162 }
163 return SRJetClusterET;
164}
165
167
168 m_JetSaturation = false;
169 for(int nphi = -3; nphi< 4; nphi++) {
170 for(int neta = -3; neta< 4; neta++) {
171 int DeltaRSquared = std::pow(nphi,2)+std::pow(neta,2);
172 if(DeltaRSquared < 16) {
174 }
175 }
176 }
177}
178
182
184 int SmallETRing = getSmallClusterET() - m_jFEXalgoSearchWindowSeedET[3][3];
185 return SmallETRing;
186}
187
189 return m_jFEXalgoTowerID[3][3];
190}
191
192
193void LVL1::jFEXSmallRJetAlgo::setFPGAEnergy(const std::unordered_map<int,std::vector<int> >& et_map){
194 m_map_Etvalues=et_map;
195}
196
197//getter for tower saturation
199 if(TTID == 0) {
200 return false;
201 }
202
203 const LVL1::jTower * tmpTower = m_jTowerContainer->findTower(TTID);
204 return tmpTower->getTowerSat();
205}
206
207}// 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
virtual ~jFEXSmallRJetAlgo()
Destructor.
SG::ReadHandle< jTowerContainer > m_jTowerContainer
virtual unsigned int getSmallETRing() const override
virtual unsigned int getTTIDcentre() const override
bool CalculateLM(int mymatrix[5][5])
virtual StatusCode safetyTest() override
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