ATLAS Offline Software
Loading...
Searching...
No Matches
eFEXtauAlgoBase.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//***********************************************************************************
6// eFEXtauAlgoBase.cxx
7// -------------------
8// begin : 08 05 2023
9// email : david.reikher@cern.ch,
10// nicholas.andrew.luongo@cern.ch
11// *********************************************************************************/
12
14
16 const std::string &name,
17 const IInterface *parent)
18 : AthAlgTool(type, name, parent) {
19 declareInterface<eFEXtauAlgoBase>(this);
20}
21
23
25
27 m_eTowerContainerKey /*,ctx*/);
28 if (!eTowerContainer.isValid()) {
29 ATH_MSG_FATAL("Could not retrieve eTowerContainer "
30 << m_eTowerContainerKey.key());
31 return StatusCode::FAILURE;
32 }
33 return StatusCode::SUCCESS;
34}
35
36// Build arrays holding cell ETs for each layer plus entire tower
37void LVL1::eFEXtauAlgoBase::buildLayers(int efex_id, int fpga_id,
38 int central_eta) {
39
41 m_eTowerContainerKey /*,ctx*/);
42
43 for (unsigned int ieta = 0; ieta < 3; ieta++) {
44 for (unsigned int iphi = 0; iphi < 3; iphi++) {
45 if (((efex_id % 3 == 0) && (fpga_id == 0) && (central_eta == 0) &&
46 (ieta == 0)) ||
47 ((efex_id % 3 == 2) && (fpga_id == 3) && (central_eta == 5) &&
48 (ieta == 2))) {
49 m_twrcells[ieta][iphi] = 0;
50 m_em0cells[ieta][iphi] = 0;
51 m_em3cells[ieta][iphi] = 0;
52 m_hadcells[ieta][iphi] = 0;
53 for (unsigned int i = 0; i < 4; i++) {
54 m_em1cells[4 * ieta + i][iphi] = 0;
55 m_em2cells[4 * ieta + i][iphi] = 0;
56 }
57 } else {
58 const LVL1::eTower *tmpTower =
60 m_twrcells[ieta][iphi] = tmpTower->getTotalET();
61 m_em0cells[ieta][iphi] = tmpTower->getLayerTotalET(0);
62 m_em3cells[ieta][iphi] = tmpTower->getLayerTotalET(3);
63 m_hadcells[ieta][iphi] = tmpTower->getLayerTotalET(4);
64 for (unsigned int i = 0; i < 4; i++) {
65 m_em1cells[4 * ieta + i][iphi] = tmpTower->getET(1, i);
66 m_em2cells[4 * ieta + i][iphi] = tmpTower->getET(2, i);
67 }
68 }
69 }
70 }
71 m_cellsSet = true;
72}
73
74// Utility function to calculate and return jet discriminant sums for specified
75// location Intended to allow xAOD TOBs to be decorated with this information
76void LVL1::eFEXtauAlgoBase::getSums(unsigned int /*seed*/, bool /*UnD*/,
77 std::vector<unsigned int> &RcoreSums,
78 std::vector<unsigned int> &RemSums) {
79 // Set seed parameters to supplied values
80
81 // Now just call the 2 discriminant calculation methods
82 getRCore(RcoreSums);
83 getRHad(RemSums);
84}
85
86// Calculate the hadronic fraction isolation variable
87void LVL1::eFEXtauAlgoBase::getRHad(std::vector<unsigned int> &rHadVec) const {
88 unsigned int core = rHadCore();
89 unsigned int env = rHadEnv();
90
91 rHadVec.push_back(core);
92 rHadVec.push_back(env);
93}
94
95// Calculate float isolation variable
97 unsigned int core = rCoreCore();
98 unsigned int env = rCoreEnv();
99
100 unsigned int num = core;
101 unsigned int denom = core + env;
102
103 float out = denom ? static_cast<float>(num) / static_cast<float>(denom) : 0;
104
105 return out;
106}
107
109 unsigned int core = rHadCore();
110 unsigned int env = rHadEnv();
111
112 unsigned int num = core;
113 unsigned int denom = core + env;
114
115 float out = denom ? static_cast<float>(num) / static_cast<float>(denom) : 0;
116
117 return out;
118}
119
121 std::vector<unsigned int> &rCoreVec) const {
122 unsigned int core = rCoreCore();
123 unsigned int env = rCoreEnv();
124
125 rCoreVec.push_back(core);
126 rCoreVec.push_back(env);
127}
128
129// Check if central tower qualifies as a seed tower for the tau algorithm
131 // Need layer cell ET arrays to be built
132 if (m_cellsSet == false) {
134 "Layers not built, cannot accurately determine if a seed tower.");
135 }
136
137 bool out = true;
138
139 // Get central tower ET
140 unsigned int centralET = m_twrcells[1][1];
141
142 // Loop over all cells and check that the central tower is a local maximum
143 for (unsigned int beta = 0; beta < 3; beta++) {
144 for (unsigned int bphi = 0; bphi < 3; bphi++) {
145 // Don't need to compare central cell with itself
146 if ((beta == 1) && (bphi == 1)) {
147 continue;
148 }
149
150 // Cells to the up and right must have strictly lesser ET
151 if (beta == 2 || (beta == 1 && bphi == 2)) {
152 if (centralET <= m_twrcells[beta][bphi]) {
153 out = false;
154 }
155 }
156 // Cells down and to the left must have lesser or equal ET. If strictly
157 // lesser would create zero TOB if two adjacent cells had equal energy
158 else if (beta == 0 || (beta == 1 && bphi == 0)) {
159 if (centralET < m_twrcells[beta][bphi]) {
160 out = false;
161 }
162 }
163 }
164 }
165
166 return out;
167}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual unsigned int rCoreEnv() const
unsigned int m_em1cells[12][3]
virtual unsigned int rHadEnv() const =0
virtual StatusCode safetyTest()
virtual bool isCentralTowerSeed() const
SG::ReadHandleKey< LVL1::eTowerContainer > m_eTowerContainerKey
unsigned int m_twrcells[3][3]
unsigned int m_hadcells[3][3]
eFEXtauAlgoBase(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
virtual unsigned int rHadCore() const =0
virtual ~eFEXtauAlgoBase()
Destructor.
virtual void getRHad(std::vector< unsigned int > &rHadVec) const
unsigned int m_em0cells[3][3]
unsigned int m_em2cells[12][3]
virtual unsigned int rCoreCore() const
virtual void getSums(unsigned int seed, bool UnD, std::vector< unsigned int > &RcoreSums, std::vector< unsigned int > &Remums)
virtual float getRealRCore() const
virtual void getRCore(std::vector< unsigned int > &rCoreVec) const
void buildLayers(int efex_id, int fpga_id, int central_eta)
virtual float getRealRHad() const
unsigned int m_em3cells[3][3]
const LVL1::eTower * findTower(int towerID) const
fast find method given identifier.
The eTower class is an interface object for eFEX trigger algorithms The purposes are twofold:
Definition eTower.h:38
int getLayerTotalET(unsigned int layer) const
Get total ET sum of all cells in a given layer in MeV.
Definition eTower.cxx:249
int getET(unsigned int layer, int cell=0) const
Get ET of a specified cell in MeV.
Definition eTower.cxx:172
int getTotalET() const
Get ET sum of all cells in the eTower in MeV.
Definition eTower.cxx:194