Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
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)
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 {
39  setSCellPointers();
40  setThresholdPointers();
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 
55 void 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 
63 void LVL1::eFEXtauBDTAlgo::compute() { m_bdtAlgoImpl->next(); }
64 
65 std::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,
100  &(m_hadFracMultipliers[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->setPointerToETThresholdParam(&m_etThreshold);
109  m_bdtAlgoImpl->setPointerToBDTMinETParam(&m_bdtMinEtThreshold);
110 }
111 
112 // Calculate reconstructed ET value
113 unsigned int LVL1::eFEXtauBDTAlgo::getEt() const {
114  if (m_cellsSet == false) {
115  ATH_MSG_DEBUG("Layers not built, cannot accurately calculate Et.");
116  }
117 
118  return m_bdtAlgoImpl->getETEstimate();
119 }
120 
121 unsigned int LVL1::eFEXtauBDTAlgo::rHadCore() const {
122  if (m_cellsSet == false) {
123  ATH_MSG_DEBUG("Layers not built, cannot calculate rHad core value");
124  }
125 
126  return m_bdtAlgoImpl->getHADETEstimate();
127 }
128 
129 unsigned int LVL1::eFEXtauBDTAlgo::rHadEnv() const {
130  if (m_cellsSet == false) {
131  ATH_MSG_DEBUG("Layers not built, cannot calculate rHad environment value");
132  }
133 
134  return m_bdtAlgoImpl->getEMETEstimate();
135 }
136 
137 // Return the bitwise value of the given Et
138 // See eFEXtauBaseAlgo for a first attempt at this
140  if (m_cellsSet == false) {
141  ATH_MSG_DEBUG("Layers not built, cannot accurately calculate Et.");
142  }
143 
144  return m_bdtAlgoImpl->getET();
145 }
146 
147 unsigned int LVL1::eFEXtauBDTAlgo::getBDTScore() const {
148  return m_bdtAlgoImpl->getBDTScore();
149 }
150 
152  return m_bdtAlgoImpl->getBDTCondition();
153 }
154 
156  return m_bdtAlgoImpl->getFracCondition();
157 }
158 
159 bool LVL1::eFEXtauBDTAlgo::isBDT() const { return true; }
160 
162  const std::vector<unsigned int> &rHadThreshold,
163  const std::vector<unsigned int> &bdtThreshold, unsigned int etThreshold,
164  unsigned int maxEtThreshold, unsigned int bdtMinEtThreshold) {
165  for (int i = 0; i < 3; i++) {
166  m_hadFracMultipliers[i] = rHadThreshold[i];
167  m_bdtThresholds[i] = bdtThreshold[i];
168  }
169  m_etThreshold = etThreshold;
170  m_maxEtThreshold = maxEtThreshold;
171  m_bdtMinEtThreshold = bdtMinEtThreshold;
172 }
LVL1::eFEXtauBDTAlgo::isBDT
virtual bool isBDT() const override
Definition: eFEXtauBDTAlgo.cxx:159
LVL1::eFEXtauBDTAlgo::compute
virtual void compute() override
Definition: eFEXtauBDTAlgo.cxx:63
et
Extra patterns decribing particle interation process.
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LVL1::eFEXtauBDTAlgo::setup
virtual void setup(int inputTable[3][3], int efex_id, int fpga_id, int central_eta) override
Definition: eFEXtauBDTAlgo.cxx:55
eFEXtauTOB.h
LVL1::eFEXtauBDTAlgo::getBDTCondition
virtual unsigned int getBDTCondition() const override
Definition: eFEXtauBDTAlgo.cxx:151
LVL1::eFEXtauBDTAlgo::getTauTOB
virtual std::unique_ptr< eFEXtauTOB > getTauTOB() const override
Definition: eFEXtauBDTAlgo.cxx:65
LVL1::eFEXtauBDTAlgo::getBDTScore
virtual unsigned int getBDTScore() const override
Definition: eFEXtauBDTAlgo.cxx:147
LVL1::eFEXtauBDTAlgo::rHadCore
virtual unsigned int rHadCore() const override
Definition: eFEXtauBDTAlgo.cxx:121
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
LVL1::eFEXtauBDTAlgo::getEt
virtual unsigned int getEt() const override
Definition: eFEXtauBDTAlgo.cxx:113
LVL1::eFEXtauBDTAlgo::~eFEXtauBDTAlgo
virtual ~eFEXtauBDTAlgo()
Destructor.
Definition: eFEXtauBDTAlgo.cxx:26
LVL1::eFEXtauTOB::setEt
void setEt(unsigned int)
Definition: eFEXtauTOB.cxx:26
eFEXtauBDTAlgo.h
LVL1::eFEXtauAlgoBase
The eFEXtauBDTAlgo class calculates the tau BDT TOB variables.
Definition: eFEXtauAlgoBase.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LVL1::eFEXtauTOB::setSeedUnD
void setSeedUnD(bool)
Definition: eFEXtauTOB.cxx:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1::eFEXtauTOB::setRhadEnv
void setRhadEnv(unsigned int)
Definition: eFEXtauTOB.cxx:76
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::eFEXtauBDTAlgo::setThresholdPointers
void setThresholdPointers()
Definition: eFEXtauBDTAlgo.cxx:97
TrigConf::name
Definition: HLTChainList.h:35
LVL1::eFEXtauTOB::setRcoreCore
void setRcoreCore(unsigned int)
Definition: eFEXtauTOB.cxx:61
LVL1::eFEXtauBDTAlgo::setThresholds
virtual void setThresholds(const std::vector< unsigned int > &rHadThreshold, const std::vector< unsigned int > &bdtThreshold, unsigned int etThreshold, unsigned int etThresholdForRHad, unsigned int bdtMinEtThreshold) override
Definition: eFEXtauBDTAlgo.cxx:161
LVL1::eFEXtauBDTAlgo::setSCellPointers
void setSCellPointers()
Definition: eFEXtauBDTAlgo.cxx:81
LVL1::eFEXtauBDTAlgo::eFEXtauBDTAlgo
eFEXtauBDTAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition: eFEXtauBDTAlgo.cxx:20
LVL1::eFEXtauBDTAlgo::rHadEnv
virtual unsigned int rHadEnv() const override
Definition: eFEXtauBDTAlgo.cxx:129
LVL1::eFEXtauBDTAlgo::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: eFEXtauBDTAlgo.cxx:28
LVL1::eFEXtauBDTAlgo::getBDTHadFracCondition
virtual unsigned int getBDTHadFracCondition() const override
Definition: eFEXtauBDTAlgo.cxx:155
LVL1::eFEXtauTOB::setBitwiseEt
void setBitwiseEt(unsigned int)
Definition: eFEXtauTOB.cxx:31
LVL1::eFEXtauTOB::setRcoreEnv
void setRcoreEnv(unsigned int)
Definition: eFEXtauTOB.cxx:66
LVL1::eFEXtauTOB::setIso
void setIso(unsigned int)
Definition: eFEXtauTOB.cxx:36
LVL1::eFEXtauBDTAlgo::getBitwiseEt
virtual unsigned int getBitwiseEt() const override
Definition: eFEXtauBDTAlgo.cxx:139
LVL1::eFEXtauTOB::setIsBDTAlgo
void setIsBDTAlgo(unsigned int)
Definition: eFEXtauTOB.cxx:86
calibdata.copy
bool copy
Definition: calibdata.py:27
LVL1::eFEXtauTOB::setRhadCore
void setRhadCore(unsigned int)
Definition: eFEXtauTOB.cxx:71
eTower.h
LVL1::eFEXtauTOB::setBDTScore
void setBDTScore(unsigned int)
Definition: eFEXtauTOB.cxx:81