ATLAS Offline Software
cTauInputAlgTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./cTauInputAlgTool.h"
7 
8 
9 #include "L1TopoEvent/eTauTOB.h"
10 #include "L1TopoEvent/jTauTOB.h"
11 #include "../IO/cTauTOBArray.h"
12 #include <sstream>
13 
14 namespace GlobalSim {
15 
17  const std::string& name,
18  const IInterface* parent):
19  base_class(type, name, parent){
20  }
21 
23  CHECK(m_eTauRoIKey.initialize());
24  CHECK(m_jTauRoIKey.initialize());
26 
27  return StatusCode::SUCCESS;
28  }
29 
30  StatusCode cTauInputAlgTool::run(const EventContext& ctx) const {
31 
32  auto cTaus = std::make_unique<GlobalSim::cTauTOBArray>("InputcTaus", 120);
33 
34  CHECK(eFex_cTaus(*cTaus, ctx));
35  CHECK(jFex_cTaus(*cTaus, ctx));
36 
38  ctx);
39  CHECK(h_write.record(std::move(cTaus)));
40 
41  return StatusCode::SUCCESS;
42  }
43 
46  const EventContext& ctx) const {
47 
49  eTauContainer(m_eTauRoIKey, ctx);
50 
51  CHECK(eTauContainer.isValid());
52 
53  for(const auto eFexTauRoI : *eTauContainer){
54 
55 
56  /*
57  * eFexNumber() : 8 bit unsigned integer eFEX number
58  * et() : et value of the Tau cluster in MeV
59  * etTOB() : et value of the Tau cluster in units of 100 MeV
60  * eta() : floating point global eta
61  * phi() : floating point global phi
62  * iEtaTopo() : 40 x eta (custom function for L1Topo)
63  * iPhiTopo() : 20 x phi (custom function for L1Topo)
64  * tauOneThresholds() : rCore or BDT working point
65  * (eTau algo agnostic accessor)
66  * tauTwoThresholds() : rHad
67  */
68 
69  ATH_MSG_DEBUG( "EDM eFex Number: "
71  << " et: "
72  << eFexTauRoI->et()
73  << " etTOB: "
74  << eFexTauRoI->etTOB()
75  << " eta: "
76  << eFexTauRoI->eta()
77  << " phi: "
78  << eFexTauRoI->phi()
79  << " iEtaTopo: "
80  << eFexTauRoI->iEtaTopo()
81  << " iPhiTopo: "
82  << eFexTauRoI->iPhiTopo()
83  << " rCore: "
85  << " rHad: "
87  );
88 
89 
90  unsigned int EtTopo = eFexTauRoI->etTOB();
91  int etaTopo = eFexTauRoI->iEtaTopo();
92  int phiTopo = eFexTauRoI->iPhiTopo();
93  unsigned int rCore = eFexTauRoI->tauOneThresholds();
94  unsigned int rHad = eFexTauRoI->tauTwoThresholds();
95 
96  //Tau TOB
97  TCS::eTauTOB eTau(EtTopo,
98  etaTopo,
99  static_cast<unsigned int>(phiTopo),
100  TCS::ETAU);
101 
102  eTau.setEtDouble(static_cast<double>(EtTopo * s_EtDouble_conversion));
103  eTau.setEtaDouble(static_cast<double>(etaTopo * s_etaDouble_conversion));
104  eTau.setPhiDouble(static_cast<double>(phiTopo * s_phiDouble_conversion));
105  eTau.setRCore(rCore);
106  eTau.setRHad(rHad);
107 
108  TCS::cTauTOB cTau(eTau.Et(), eTau.eta(), eTau.phi(), TCS::ETAU);
109  cTau.setEtDouble( eTau.EtDouble() );
110  cTau.setEtaDouble( eTau.etaDouble() );
111  cTau.setPhiDouble( eTau.phiDouble() );
112  cTau.setRCore( eTau.rCore() );
113  cTau.setRHad( eTau.rHad() );
114 
115  cTaus.push_back(cTau);
116  }
117  return StatusCode::SUCCESS;
118  }
119 
121  const EventContext& ctx) const {
122 
124  jTauRoIContainer(m_jTauRoIKey, ctx);
125 
126  CHECK(jTauRoIContainer.isValid());
127 
128 
129  for(const auto jFexTauRoI : *jTauRoIContainer){
130 
131 
132  /*
133  * jFexNumber() 8 bit unsigned integer jFEX number
134  * et() et value of the Tau cluster in MeV
135  * tobEt() et value of the Tau cluster in units of 200 MeV
136  * globalEta() simplified global eta in units of 0.1
137  * (fcal straightened out, not suitable for use
138  * in L1TopoSim)
139  * globalPhi() simplified global phi in units of 0.1
140  * (fcal straightened out,
141  * not suitable for use in L1TopoSim)
142  * isolation isolation value in units of 200 MeV
143  */
144 
145  ATH_MSG_DEBUG( "EDM jFex Number: "
146  << jFexTauRoI->jFexNumber()
147  << " et: "
148  << jFexTauRoI->et()
149  << " topEt: "
150  << jFexTauRoI->tobEt()
151  << " globalEta: "
152  << jFexTauRoI->globalEta()
153  << " globalPhi: "
154  << jFexTauRoI->globalPhi()
155  << " isolation: "
156  << jFexTauRoI->tobIso()
157  );
158 
159 
160  unsigned int EtTopo = jFexTauRoI->tobEt() * s_Et_conversion;
161  unsigned int phiTopo = TSU::toTopoPhi(jFexTauRoI->phi());
162  int etaTopo = TSU::toTopoEta(jFexTauRoI->eta());
163  unsigned int isolation = jFexTauRoI->tobIso() * s_Et_conversion;
164 
165  if (EtTopo == 0) {continue;}
166 
167  TCS::jTauTOB jTau(EtTopo, etaTopo, phiTopo);
168  jTau.setEtDouble(static_cast<double>(EtTopo * s_EtDouble_conversion));
169  jTau.setEtaDouble(static_cast<double>(etaTopo * s_etaDouble_conversion));
170  jTau.setPhiDouble(static_cast<double>(phiTopo * s_phiDouble_conversion));
171  jTau.setEtIso(isolation);
172 
173  TCS::cTauTOB cTau(jTau.Et(), jTau.eta(), jTau.phi(), TCS::JTAU);
174  cTau.setEtDouble( jTau.EtDouble() );
175  cTau.setEtaDouble( jTau.etaDouble() );
176  cTau.setPhiDouble( jTau.phiDouble() );
177  cTau.setEtIso( jTau.EtIso() );
178  cTaus.push_back(cTau);
179  }
180  return StatusCode::SUCCESS;
181 
182  }
183 
184  std::string cTauInputAlgTool::toString() const {
185  std::stringstream ss;
186  ss << "cTauInputAlgTool: '" << name() << '\n'
187  << m_jTauRoIKey << '\n'
188  << m_eTauRoIKey << '\n'
189  << m_cTauTOBArrayWriteKey << '\n';
190  return ss.str();
191  }
192 
193 
194 
195 }
196 
TCS::eTauTOB::rHad
unsigned int rHad() const
Definition: eTauTOB.h:42
xAOD::eFexTauRoI_v1::iEtaTopo
int iEtaTopo() const
Getter for integer phi index (0-63)
Definition: eFexTauRoI_v1.cxx:280
xAOD::eFexTauRoI_v1::et
float et() const
TOB ET (decoded from TOB, stored for convenience)
GlobalSim::cTauTOBArray
Definition: Global/GlobalSimulation/src/IO/cTauTOBArray.h:17
GlobalSim::cTauInputAlgTool::m_jTauRoIKey
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jTauRoIKey
Definition: cTauInputAlgTool.h:53
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
xAOD::jFexTauRoI_v1::eta
float eta() const
TCS::eTauTOB::setEtaDouble
void setEtaDouble(double eta)
Definition: eTauTOB.h:50
TCS::eTauTOB::EtDouble
double EtDouble() const
Definition: eTauTOB.h:37
xAOD::jFexTauRoI_v1::jFexNumber
uint8_t jFexNumber() const
TCS::eTauTOB::eta
int eta() const
Definition: eTauTOB.h:34
xAOD::eFexTauRoI_v1::eta
float eta() const
setter for the above
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::eFexTauRoI_v1::tauTwoThresholds
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
Definition: eFexTauRoI_v1.cxx:205
GlobalSim::cTauInputAlgTool::s_EtDouble_conversion
static constexpr double s_EtDouble_conversion
Definition: cTauInputAlgTool.h:67
TSU::toTopoEta
int toTopoEta(float eta)
Definition: Conversions.cxx:27
xAOD::jFexTauRoI_v1::globalPhi
uint globalPhi() const
xAOD::jFexTauRoI_v1::tobIso
uint16_t tobIso() const
GlobalSim::cTauInputAlgTool::m_cTauTOBArrayWriteKey
SG::WriteHandleKey< GlobalSim::cTauTOBArray > m_cTauTOBArrayWriteKey
Definition: cTauInputAlgTool.h:57
xAOD::jFexTauRoI_v1::globalEta
int globalEta() const
TCS::jTauTOB::EtIso
unsigned int EtIso() const
Definition: jTauTOB.h:40
GlobalSim::cTauInputAlgTool::toString
virtual std::string toString() const override
Definition: cTauInputAlgTool.cxx:184
TCS::jTauTOB::Et
unsigned int Et() const
Definition: jTauTOB.h:32
TCS::cTauTOB::setPhiDouble
void setPhiDouble(double phi)
Definition: cTauTOB.h:53
xAOD::jFexTauRoI_v1::et
unsigned int et() const
Methods that require combining results or applying scales.
Definition: jFexTauRoI_v1.cxx:114
TCS::jTauTOB::EtDouble
double EtDouble() const
Definition: jTauTOB.h:36
xAOD::eFexTauRoI
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition: eFexTauRoI.h:16
Conversions.h
TCS::cTauTOB::setRCore
void setRCore(unsigned int rCore)
Definition: cTauTOB.h:55
TCS::eTauTOB::setRCore
void setRCore(unsigned int th)
Definition: eTauTOB.h:53
GlobalSim::cTauInputAlgTool::jFex_cTaus
StatusCode jFex_cTaus(GlobalSim::cTauTOBArray &, const EventContext &) const
Definition: cTauInputAlgTool.cxx:120
xAOD::eFexTauRoI_v1::tauOneThresholds
unsigned int tauOneThresholds() const
Tau Condition 1 (generic) results.
Definition: eFexTauRoI_v1.cxx:201
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
GlobalSim::cTauInputAlgTool::s_etaDouble_conversion
static constexpr double s_etaDouble_conversion
Definition: cTauInputAlgTool.h:69
TCS::cTauTOB::setEtIso
void setEtIso(unsigned int etIso)
Definition: cTauTOB.h:58
xAOD::eFexTauRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexTauRoI_v1.cxx:272
xAOD::jFexTauRoI_v1::tobEt
uint16_t tobEt() const
TCS::jTauTOB::eta
int eta() const
Definition: jTauTOB.h:33
TCS::eTauTOB
Definition: eTauTOB.h:13
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
GlobalSim::cTauInputAlgTool::eFex_cTaus
StatusCode eFex_cTaus(GlobalSim::cTauTOBArray &, const EventContext &) const
Definition: cTauInputAlgTool.cxx:45
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TCS::jTauTOB::setEtIso
void setEtIso(unsigned int etIso)
Definition: jTauTOB.h:51
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TCS::cTauTOB::setEtDouble
void setEtDouble(double et)
Definition: cTauTOB.h:51
TCS::jTauTOB
Definition: jTauTOB.h:16
GlobalSim::cTauInputAlgTool::s_Et_conversion
static constexpr int s_Et_conversion
Definition: cTauInputAlgTool.h:64
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::jFexTauRoI_v1::phi
float phi() const
GlobalSim::cTauInputAlgTool::cTauInputAlgTool
cTauInputAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: cTauInputAlgTool.cxx:16
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
GlobalSim::cTauInputAlgTool::s_phiDouble_conversion
static constexpr double s_phiDouble_conversion
Definition: cTauInputAlgTool.h:68
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TCS::jTauTOB::phi
unsigned phi() const
Definition: jTauTOB.h:34
TCS::jTauTOB::etaDouble
double etaDouble() const
Definition: jTauTOB.h:37
xAOD::eFexTauRoI_v1::phi
float phi() const
Seed supercell index within central tower (0 -> 3)
TCS::eTauTOB::phi
unsigned int phi() const
Definition: eTauTOB.h:35
xAOD::eFexTauRoI_v1::eFexNumber
unsigned int eFexNumber() const
eFEX number
Definition: eFexTauRoI_v1.cxx:114
TCS::jTauTOB::setPhiDouble
void setPhiDouble(double phi)
Definition: jTauTOB.h:49
TCS::eTauTOB::rCore
unsigned int rCore() const
Definition: eTauTOB.h:41
TCS::eTauTOB::setEtDouble
void setEtDouble(double et)
Definition: eTauTOB.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TCS::cTauTOB::setRHad
void setRHad(unsigned int rHad)
Definition: cTauTOB.h:56
jTauTOB.h
eTauTOB.h
GlobalSim::cTauInputAlgTool::m_eTauRoIKey
SG::ReadHandleKey< xAOD::eFexTauRoIContainer > m_eTauRoIKey
Definition: cTauInputAlgTool.h:61
TCS::jTauTOB::setEtDouble
void setEtDouble(double et)
Definition: jTauTOB.h:47
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
xAOD::eFexTauRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexTauRoI_v1.cxx:155
TCS::jTauTOB::phiDouble
double phiDouble() const
Definition: jTauTOB.h:38
TCS::eTauTOB::setRHad
void setRHad(unsigned int th)
Definition: eTauTOB.h:54
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
cTauInputAlgTool.h
TCS::eTauTOB::Et
unsigned int Et() const
Definition: eTauTOB.h:33
TCS::eTauTOB::etaDouble
double etaDouble() const
Definition: eTauTOB.h:38
TCS::ETAU
@ ETAU
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:22
xAOD::jFexTauRoI
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class
Definition: jFexTauRoI.h:13
TCS::cTauTOB::setEtaDouble
void setEtaDouble(double eta)
Definition: cTauTOB.h:52
TCS::DataArrayImpl::push_back
virtual void push_back(const DATA &tob)
Definition: DataArrayImpl.h:57
TCS::JTAU
@ JTAU
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:13
GlobalSim::cTauInputAlgTool::run
virtual StatusCode run(const EventContext &ctx) const override
Definition: cTauInputAlgTool.cxx:30
TCS::eTauTOB::setPhiDouble
void setPhiDouble(double phi)
Definition: eTauTOB.h:51
TCS::cTauTOB
Definition: cTauTOB.h:13
GlobalSim::cTauInputAlgTool::initialize
StatusCode initialize() override
Definition: cTauInputAlgTool.cxx:22
TCS::eTauTOB::phiDouble
double phiDouble() const
Definition: eTauTOB.h:39
TSU::toTopoPhi
unsigned int toTopoPhi(float phi)
Definition: Conversions.cxx:20
TCS::jTauTOB::setEtaDouble
void setEtaDouble(double eta)
Definition: jTauTOB.h:48