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
24StatusCode LVL1::eFEXtauAlgoBase::safetyTest(const EventContext& ctx) {
25
27 if (!eTowerContainer.isValid()) {
28 ATH_MSG_FATAL("Could not retrieve eTowerContainer "
29 << m_eTowerContainerKey.key());
30 return StatusCode::FAILURE;
31 }
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
40
41 for (unsigned int ieta = 0; ieta < 3; ieta++) {
42 for (unsigned int iphi = 0; iphi < 3; iphi++) {
43 if (((efex_id % 3 == 0) && (fpga_id == 0) && (central_eta == 0) &&
44 (ieta == 0)) ||
45 ((efex_id % 3 == 2) && (fpga_id == 3) && (central_eta == 5) &&
46 (ieta == 2))) {
47 m_twrcells[ieta][iphi] = 0;
48 m_em0cells[ieta][iphi] = 0;
49 m_em3cells[ieta][iphi] = 0;
50 m_hadcells[ieta][iphi] = 0;
51 for (unsigned int i = 0; i < 4; i++) {
52 m_em1cells[4 * ieta + i][iphi] = 0;
53 m_em2cells[4 * ieta + i][iphi] = 0;
54 }
55 } else {
56 const LVL1::eTower *tmpTower =
57 m_eTowers->findTower(m_eFexalgoTowerID[iphi][ieta]);
58 m_twrcells[ieta][iphi] = tmpTower->getTotalET();
59 m_em0cells[ieta][iphi] = tmpTower->getLayerTotalET(0);
60 m_em3cells[ieta][iphi] = tmpTower->getLayerTotalET(3);
61 m_hadcells[ieta][iphi] = tmpTower->getLayerTotalET(4);
62 for (unsigned int i = 0; i < 4; i++) {
63 m_em1cells[4 * ieta + i][iphi] = tmpTower->getET(1, i);
64 m_em2cells[4 * ieta + i][iphi] = tmpTower->getET(2, i);
65 }
66 }
67 }
68 }
69 m_cellsSet = true;
70}
71
72// Utility function to calculate and return jet discriminant sums for specified
73// location Intended to allow xAOD TOBs to be decorated with this information
74void LVL1::eFEXtauAlgoBase::getSums(unsigned int /*seed*/, bool /*UnD*/,
75 std::vector<unsigned int> &RcoreSums,
76 std::vector<unsigned int> &RemSums) {
77 // Set seed parameters to supplied values
78
79 // Now just call the 2 discriminant calculation methods
80 getRCore(RcoreSums);
81 getRHad(RemSums);
82}
83
84// Calculate the hadronic fraction isolation variable
85void LVL1::eFEXtauAlgoBase::getRHad(std::vector<unsigned int> &rHadVec) const {
86 unsigned int core = rHadCore();
87 unsigned int env = rHadEnv();
88
89 rHadVec.push_back(core);
90 rHadVec.push_back(env);
91}
92
93// Calculate float isolation variable
95 unsigned int core = rCoreCore();
96 unsigned int env = rCoreEnv();
97
98 unsigned int num = core;
99 unsigned int denom = core + env;
100
101 float out = denom ? static_cast<float>(num) / static_cast<float>(denom) : 0;
102
103 return out;
104}
105
107 unsigned int core = rHadCore();
108 unsigned int env = rHadEnv();
109
110 unsigned int num = core;
111 unsigned int denom = core + env;
112
113 float out = denom ? static_cast<float>(num) / static_cast<float>(denom) : 0;
114
115 return out;
116}
117
119 std::vector<unsigned int> &rCoreVec) const {
120 unsigned int core = rCoreCore();
121 unsigned int env = rCoreEnv();
122
123 rCoreVec.push_back(core);
124 rCoreVec.push_back(env);
125}
126
127// Check if central tower qualifies as a seed tower for the tau algorithm
129 // Need layer cell ET arrays to be built
130 if (m_cellsSet == false) {
132 "Layers not built, cannot accurately determine if a seed tower.");
133 }
134
135 bool out = true;
136
137 // Get central tower ET
138 unsigned int centralET = m_twrcells[1][1];
139
140 // Loop over all cells and check that the central tower is a local maximum
141 for (unsigned int beta = 0; beta < 3; beta++) {
142 for (unsigned int bphi = 0; bphi < 3; bphi++) {
143 // Don't need to compare central cell with itself
144 if ((beta == 1) && (bphi == 1)) {
145 continue;
146 }
147
148 // Cells to the up and right must have strictly lesser ET
149 if (beta == 2 || (beta == 1 && bphi == 2)) {
150 if (centralET <= m_twrcells[beta][bphi]) {
151 out = false;
152 }
153 }
154 // Cells down and to the left must have lesser or equal ET. If strictly
155 // lesser would create zero TOB if two adjacent cells had equal energy
156 else if (beta == 0 || (beta == 1 && bphi == 0)) {
157 if (centralET < m_twrcells[beta][bphi]) {
158 out = false;
159 }
160 }
161 }
162 }
163
164 return out;
165}
#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
const LVL1::eTowerContainer * m_eTowers
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 StatusCode safetyTest(const EventContext &ctx)
virtual float getRealRHad() const
unsigned int m_em3cells[3][3]
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