ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1CaloFEX
L1CaloFEXSim
src
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
"
13
#include "
L1CaloFEXSim/jTowerContainer.h
"
14
15
namespace
LVL1
{
16
17
//Default Constructor
18
LVL1::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
24
StatusCode
LVL1::jFEXSmallRJetAlgo::initialize
()
25
{
26
ATH_CHECK
(
m_jTowerContainerKey
.initialize());
27
28
return
StatusCode::SUCCESS;
29
30
}
31
32
//calls container for TT
33
StatusCode
LVL1::jFEXSmallRJetAlgo::safetyTest
(){
34
35
m_jTowerContainer
=
SG::ReadHandle<jTowerContainer>
(
m_jTowerContainerKey
);
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
44
void
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
60
unsigned
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
74
void
LVL1::jFEXSmallRJetAlgo::buildSeeds
()
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
97
bool
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
126
bool
LVL1::jFEXSmallRJetAlgo::isSeedLocalMaxima
(
int
seedThreshold) {
127
128
bool
isCentralLM =
CalculateLM
(
m_jFEXalgoSearchWindowSeedET
) &&
129
(
getTTowerET
(
m_jFEXalgoTowerID
[3][3]) >=
getTTowerET
(
m_jFEXalgoTowerID
[4][2]) ||
m_jFEXalgoSearchWindowSeedET
[2][2] >
m_jFEXalgoSearchWindowSeedET
[3][1]);
130
131
bool
isDisplacedLM =
CalculateLM
(
m_jFEXalgoSearchWindowSeedET_displaced
) &&
132
(
getTTowerET
(
m_jFEXalgoTowerID
[3][3]) >
getTTowerET
(
m_jFEXalgoTowerID
[2][4]) &&
m_jFEXalgoSearchWindowSeedET
[2][2] ==
m_jFEXalgoSearchWindowSeedET
[1][3]);
133
134
if
(isCentralLM || isDisplacedLM ){
135
calcSaturation
();
136
return
m_jFEXalgoSearchWindowSeedET
[2][2] > seedThreshold;
137
}
138
return
false
;
139
}
140
141
unsigned
int
LVL1::jFEXSmallRJetAlgo::getSeedET
()
const
{
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
148
unsigned
int
LVL1::jFEXSmallRJetAlgo::getSmallClusterET
()
const
{
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
162
void
LVL1::jFEXSmallRJetAlgo::calcSaturation
() {
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) {
169
m_JetSaturation
=
m_JetSaturation
||
getTTowerSat
(
m_jFEXalgoTowerID
[3+nphi][3+neta]);
170
}
171
}
172
}
173
}
174
175
bool
LVL1::jFEXSmallRJetAlgo::getSRjetSat
()
const
{
176
return
m_JetSaturation
;
177
}
178
179
unsigned
int
LVL1::jFEXSmallRJetAlgo::getSmallETRing
()
const
{
180
int
SmallETRing =
getSmallClusterET
() -
m_jFEXalgoSearchWindowSeedET
[3][3];
181
return
SmallETRing;
182
}
183
184
unsigned
int
LVL1::jFEXSmallRJetAlgo::getTTIDcentre
()
const
{
185
return
m_jFEXalgoTowerID
[3][3];
186
}
187
188
189
void
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
194
bool
LVL1::jFEXSmallRJetAlgo::getTTowerSat
(
unsigned
int
TTID ) {
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
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
LVL1::jFEXSmallRJetAlgo::isSeedLocalMaxima
virtual bool isSeedLocalMaxima(int seedThreshold) override
Definition
jFEXSmallRJetAlgo.cxx:126
LVL1::jFEXSmallRJetAlgo::getSRjetSat
virtual bool getSRjetSat() const override
Definition
jFEXSmallRJetAlgo.cxx:175
LVL1::jFEXSmallRJetAlgo::m_jFEXalgoTowerID_displaced
int m_jFEXalgoTowerID_displaced[7][7]
Definition
jFEXSmallRJetAlgo.h:57
LVL1::jFEXSmallRJetAlgo::m_jFEXalgoSearchWindowSeedET
int m_jFEXalgoSearchWindowSeedET[5][5]
Definition
jFEXSmallRJetAlgo.h:58
LVL1::jFEXSmallRJetAlgo::getTTowerET
virtual unsigned int getTTowerET(unsigned int TTID) const override
Definition
jFEXSmallRJetAlgo.cxx:60
LVL1::jFEXSmallRJetAlgo::setup
virtual void setup(int inputTable[7][7], int inputTableDisplaced[7][7]) override
Definition
jFEXSmallRJetAlgo.cxx:44
LVL1::jFEXSmallRJetAlgo::buildSeeds
virtual void buildSeeds() override
Definition
jFEXSmallRJetAlgo.cxx:74
LVL1::jFEXSmallRJetAlgo::m_jTowerContainer
SG::ReadHandle< jTowerContainer > m_jTowerContainer
Definition
jFEXSmallRJetAlgo.h:50
LVL1::jFEXSmallRJetAlgo::getSmallETRing
virtual unsigned int getSmallETRing() const override
Definition
jFEXSmallRJetAlgo.cxx:179
LVL1::jFEXSmallRJetAlgo::getTTIDcentre
virtual unsigned int getTTIDcentre() const override
Definition
jFEXSmallRJetAlgo.cxx:184
LVL1::jFEXSmallRJetAlgo::calcSaturation
void calcSaturation()
Definition
jFEXSmallRJetAlgo.cxx:162
LVL1::jFEXSmallRJetAlgo::safetyTest
virtual StatusCode safetyTest() override
Definition
jFEXSmallRJetAlgo.cxx:33
LVL1::jFEXSmallRJetAlgo::CalculateLM
bool CalculateLM(int mymatrix[5][5]) const
Definition
jFEXSmallRJetAlgo.cxx:97
LVL1::jFEXSmallRJetAlgo::getSmallClusterET
virtual unsigned int getSmallClusterET() const override
Definition
jFEXSmallRJetAlgo.cxx:148
LVL1::jFEXSmallRJetAlgo::m_map_Etvalues
std::unordered_map< int, std::vector< int > > m_map_Etvalues
Definition
jFEXSmallRJetAlgo.h:61
LVL1::jFEXSmallRJetAlgo::setFPGAEnergy
virtual void setFPGAEnergy(const std::unordered_map< int, std::vector< int > > &et_map) override
Definition
jFEXSmallRJetAlgo.cxx:189
LVL1::jFEXSmallRJetAlgo::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
jFEXSmallRJetAlgo.cxx:24
LVL1::jFEXSmallRJetAlgo::getSeedET
virtual unsigned int getSeedET() const override
Definition
jFEXSmallRJetAlgo.cxx:141
LVL1::jFEXSmallRJetAlgo::m_jFEXalgoTowerID
int m_jFEXalgoTowerID[7][7]
Definition
jFEXSmallRJetAlgo.h:56
LVL1::jFEXSmallRJetAlgo::m_jTowerContainerKey
SG::ReadHandleKey< LVL1::jTowerContainer > m_jTowerContainerKey
Definition
jFEXSmallRJetAlgo.h:49
LVL1::jFEXSmallRJetAlgo::m_JetSaturation
bool m_JetSaturation
Definition
jFEXSmallRJetAlgo.h:54
LVL1::jFEXSmallRJetAlgo::m_jFEXalgoSearchWindowSeedET_displaced
int m_jFEXalgoSearchWindowSeedET_displaced[5][5]
Definition
jFEXSmallRJetAlgo.h:59
LVL1::jFEXSmallRJetAlgo::jFEXSmallRJetAlgo
jFEXSmallRJetAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition
jFEXSmallRJetAlgo.cxx:18
LVL1::jFEXSmallRJetAlgo::getTTowerSat
bool getTTowerSat(unsigned int TTID)
Definition
jFEXSmallRJetAlgo.cxx:194
LVL1::jTower
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
Definition
jTower.h:36
LVL1::jTower::getTowerSat
bool getTowerSat() const
Definition
jTower.h:61
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
jFEXSmallRJetAlgo.h
jTowerContainer.h
jTower.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
meta
-diff
type
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0