ATLAS Offline Software
Loading...
Searching...
No Matches
eFEXtauBDTAlgo.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// eFEXtauBDTAlgo - description
7// --------------------
8// begin : 05 06 2020
9// email : david.reikher@cern.ch
10//*************************************************************************
11
12#include <iostream>
13
14#include "eFEXtauBDTAlgo.h"
16#include "L1CaloFEXSim/eTower.h"
17#include <stdio.h> /* defines FILENAME_MAX */
18
19// default constructor for persistency
21 const std::string &name,
22 const IInterface *parent)
23 : eFEXtauAlgoBase(type, name, parent) {}
24
27
29 ATH_CHECK(m_eTowerContainerKey.initialize());
30 if (m_bdtJsonConfigPath.size() == 0) {
31 ATH_MSG_ERROR("eFEX tau BDT json config file path not set in configuration");
32 return StatusCode::FAILURE;
33 }
34 ATH_MSG_INFO("Using BDT config file " << m_bdtJsonConfigPath);
35
36 m_bdtAlgoImpl = std::make_unique<eFEXtauBDT>(this, m_bdtJsonConfigPath);
37
38 try {
41 m_bdtAlgoImpl->initBDTVars();
42 m_bdtAlgoImpl->initETPointers();
43 m_bdtAlgoImpl->initEMETPointers();
44 m_bdtAlgoImpl->initHADETPointers();
45 m_bdtAlgoImpl->initTowersPointers();
46 } catch (const std::domain_error &ex) {
47 ATH_MSG_ERROR(ex.what());
48 return StatusCode::FAILURE;
49 }
50
51 ATH_MSG_INFO("tau Algorithm version: BDT");
52 return StatusCode::SUCCESS;
53}
54
55void LVL1::eFEXtauBDTAlgo::setup(int inputTable[3][3], int efex_id, int fpga_id,
56 int central_eta) {
57
58 std::copy(&inputTable[0][0], &inputTable[0][0] + 9, &m_eFexalgoTowerID[0][0]);
59
60 buildLayers(efex_id, fpga_id, central_eta);
61}
62
64
65std::unique_ptr<LVL1::eFEXtauTOB> LVL1::eFEXtauBDTAlgo::getTauTOB() const {
66 std::unique_ptr<eFEXtauTOB> tob = std::make_unique<eFEXtauTOB>();
67 unsigned int et = getEt();
68 tob->setEt(et);
69 tob->setRcoreCore(rCoreCore());
70 tob->setRcoreEnv(rCoreEnv());
71 tob->setRhadCore(rHadCore());
72 tob->setRhadEnv(rHadEnv());
73 tob->setBitwiseEt(getBitwiseEt());
74 tob->setIso(getRealRCore());
75 tob->setSeedUnD(0);
76 tob->setBDTScore(m_bdtAlgoImpl->getBDTScore());
77 tob->setIsBDTAlgo(1);
78 return tob;
79}
80
82 for (int phi = 0; phi < 3; phi++) {
83 for (int eta = 0; eta < 3; eta++) {
84 // Coarse layers
85 m_bdtAlgoImpl->setPointerToSCell(eta, phi, 0, &m_em0cells[eta][phi]);
86 m_bdtAlgoImpl->setPointerToSCell(eta, phi, 3, &m_em3cells[eta][phi]);
87 m_bdtAlgoImpl->setPointerToSCell(eta, phi, 4, &m_hadcells[eta][phi]);
88 }
89 for (int eta = 0; eta < 12; eta++) {
90 // Fine layers
91 m_bdtAlgoImpl->setPointerToSCell(eta, phi, 1, &m_em1cells[eta][phi]);
92 m_bdtAlgoImpl->setPointerToSCell(eta, phi, 2, &m_em2cells[eta][phi]);
93 }
94 }
95}
96
98 for (int i = 0; i < 3; i++) {
99 m_bdtAlgoImpl->setPointerToFracMultipliersParam(i,
101 }
102
103 for (int i = 0; i < 3; i++) {
104 m_bdtAlgoImpl->setPointerToBDTThresholdsParam(i, &(m_bdtThresholds[i]));
105 }
106
107 m_bdtAlgoImpl->setPointerToMaxETParam(&m_maxEtThreshold);
108 m_bdtAlgoImpl->setPointerToMaxETParamFrac(&m_maxEtThresholdFrac);
109 m_bdtAlgoImpl->setPointerToETThresholdParam(&m_etThreshold);
110 m_bdtAlgoImpl->setPointerToBDTMinETParam(&m_bdtMinEtThreshold);
111}
112
113// Calculate reconstructed ET value
114unsigned int LVL1::eFEXtauBDTAlgo::getEt() const {
115 if (m_cellsSet == false) {
116 ATH_MSG_DEBUG("Layers not built, cannot accurately calculate Et.");
117 }
118
119 return m_bdtAlgoImpl->getETEstimate();
120}
121
122unsigned int LVL1::eFEXtauBDTAlgo::rHadCore() const {
123 if (m_cellsSet == false) {
124 ATH_MSG_DEBUG("Layers not built, cannot calculate rHad core value");
125 }
126
127 return m_bdtAlgoImpl->getHADETEstimate();
128}
129
130unsigned int LVL1::eFEXtauBDTAlgo::rHadEnv() const {
131 if (m_cellsSet == false) {
132 ATH_MSG_DEBUG("Layers not built, cannot calculate rHad environment value");
133 }
134
135 return m_bdtAlgoImpl->getEMETEstimate();
136}
137
138// Return the bitwise value of the given Et
139// See eFEXtauBaseAlgo for a first attempt at this
141 if (m_cellsSet == false) {
142 ATH_MSG_DEBUG("Layers not built, cannot accurately calculate Et.");
143 }
144
145 return m_bdtAlgoImpl->getET();
146}
147
149 return m_bdtAlgoImpl->getBDTScore();
150}
151
153 return m_bdtAlgoImpl->getBDTCondition();
154}
155
157 return m_bdtAlgoImpl->getFracCondition();
158}
159
160bool LVL1::eFEXtauBDTAlgo::isBDT() const { return true; }
161
163 const std::vector<unsigned int> &rHadThreshold,
164 const std::vector<unsigned int> &bdtThreshold, unsigned int etThreshold,
165 unsigned int maxEtThreshold, unsigned int bdtMinEtThreshold, unsigned int maxEtThresholdFrac) {
166 for (int i = 0; i < 3; i++) {
167 m_hadFracMultipliers[i] = rHadThreshold[i];
168 m_bdtThresholds[i] = bdtThreshold[i];
169 }
170 m_etThreshold = etThreshold;
171 m_maxEtThreshold = maxEtThreshold;
172 m_maxEtThresholdFrac = maxEtThresholdFrac;
173 m_bdtMinEtThreshold = bdtMinEtThreshold;
174}
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)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
virtual unsigned int rCoreEnv() const
unsigned int m_em1cells[12][3]
SG::ReadHandleKey< LVL1::eTowerContainer > m_eTowerContainerKey
unsigned int m_hadcells[3][3]
eFEXtauAlgoBase(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
unsigned int m_em0cells[3][3]
unsigned int m_em2cells[12][3]
virtual unsigned int rCoreCore() const
virtual float getRealRCore() const
void buildLayers(int efex_id, int fpga_id, int central_eta)
unsigned int m_em3cells[3][3]
Gaudi::Property< std::string > m_bdtJsonConfigPath
eFEXtauBDTAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
unsigned int m_etThreshold
unsigned int m_maxEtThresholdFrac
std::unique_ptr< eFEXtauBDT > m_bdtAlgoImpl
virtual StatusCode initialize() override
standard Athena-Algorithm method
virtual ~eFEXtauBDTAlgo()
Destructor.
unsigned int m_bdtMinEtThreshold
unsigned int m_maxEtThreshold
virtual std::unique_ptr< eFEXtauTOB > getTauTOB() const override
virtual void setup(int inputTable[3][3], int efex_id, int fpga_id, int central_eta) override
virtual void setThresholds(const std::vector< unsigned int > &rHadThreshold, const std::vector< unsigned int > &bdtThreshold, unsigned int etThreshold, unsigned int etThresholdForRHad, unsigned int bdtMinEtThreshold, unsigned int etThresholdForRHadFrac) override
virtual unsigned int getBDTScore() const override
virtual unsigned int getBDTHadFracCondition() const override
virtual bool isBDT() const override
unsigned int m_hadFracMultipliers[3]
virtual unsigned int rHadEnv() const override
virtual unsigned int getBitwiseEt() const override
virtual unsigned int getBDTCondition() const override
unsigned int m_bdtThresholds[3]
virtual unsigned int rHadCore() const override
virtual void compute() override
virtual unsigned int getEt() const override
Extra patterns decribing particle interation process.