ATLAS Offline Software
jJetInputAlgTool.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 "./jJetInputAlgTool.h"
7 
8 
9 #include <sstream>
10 
11 namespace GlobalSim {
12 
13 
15  const std::string& name,
16  const IInterface* parent):
17  base_class(type, name, parent){
18  }
19 
21  CHECK(m_jJetRoIKey.initialize());
23 
24  return StatusCode::SUCCESS;
25  }
26 
28  jJetInputAlgTool::run(const EventContext& ctx) const {
29 
31  ctx);
32  CHECK(jJetRoIContainer.isValid());
33 
34  auto jJets = std::make_unique<GlobalSim::jJetTOBArray>("InputjJets", 60);
35 
36  for(const xAOD::jFexSRJetRoI* jFexRoI : *jJetRoIContainer){
37 
38  /*
39  * jFexNumber(): 8 bit unsigned int
40  * et(): MeV
41  * tobEt(): et in units of 200 MeV
42  * globalEta(): simplified global eta in units of 0.1
43  * (fcal straightened out,
44  * not suitable for use in L1TopoSim)
45  * globalPhi(): simplified global phi in units of 0.1
46  * (fcal straightened out,
47  * not suitable for use in L1TopoSim)
48  */
49 
50  ATH_MSG_DEBUG( "EDM jFex Jet Number: "
51  << +jFexRoI->jFexNumber()
52  << " et: "
53  << jFexRoI->et()
54  << " tobEt: "
55  << jFexRoI->tobEt()
56  << " globalEta: "
57  << jFexRoI->globalEta()
58  << " globalPhi: "
59  << jFexRoI->globalPhi()
60  );
61 
62  unsigned int EtTopo = jFexRoI->tobEt() * s_Et_conversion;
63  unsigned int phiTopo = TSU::toTopoPhi(jFexRoI->phi());
64  int etaTopo = TSU::toTopoEta(jFexRoI->eta());
65 
66  // Avoid the events with 0 Et (events below threshold)
67  if (EtTopo==0) continue;
68 
69  TCS::jJetTOB jet( EtTopo, etaTopo, phiTopo );
70  jet.setEtDouble(static_cast<double>(EtTopo * s_EtDouble_conversion));
71  jet.setEtaDouble(static_cast<double>(etaTopo * s_etaDouble_conversion));
72  jet.setPhiDouble(static_cast<double>(phiTopo * s_phiDouble_conversion));
73 
74  jJets-> push_back(jet);
75  }
76 
78  ctx);
79  CHECK(h_write.record(std::move(jJets)));
80 
81 
82  return StatusCode::SUCCESS;
83  }
84 
85  std::string jJetInputAlgTool::toString() const {
86  std::stringstream ss;
87  ss << "jJetInputAlgTool. " << name() <<'\n'
88  << m_jJetRoIKey << '\n'
89  << m_jJetTOBArrayWriteKey << '\n';
90 
91  return ss.str();
92  }
93 
94 
95 
96 }
97 
xAOD::jFexSRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSRJetRoI_v1.h:22
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
GlobalSim::jJetInputAlgTool::s_EtDouble_conversion
static constexpr double s_EtDouble_conversion
Definition: jJetInputAlgTool.h:53
GlobalSim::jJetInputAlgTool::s_etaDouble_conversion
static constexpr double s_etaDouble_conversion
Definition: jJetInputAlgTool.h:55
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TSU::toTopoEta
int toTopoEta(float eta)
Definition: Conversions.cxx:27
GlobalSim::jJetInputAlgTool::initialize
StatusCode initialize() override
Definition: jJetInputAlgTool.cxx:20
Conversions.h
GlobalSim::jJetInputAlgTool::m_jJetTOBArrayWriteKey
SG::WriteHandleKey< GlobalSim::jJetTOBArray > m_jJetTOBArrayWriteKey
Definition: jJetInputAlgTool.h:48
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
TCS::jJetTOB
Definition: jJetTOB.h:16
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
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
GlobalSim::jJetInputAlgTool::m_jJetRoIKey
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jJetRoIKey
Definition: jJetInputAlgTool.h:44
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
GlobalSim::jJetInputAlgTool::toString
virtual std::string toString() const override
Definition: jJetInputAlgTool.cxx:85
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
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
GlobalSim::jJetInputAlgTool::s_Et_conversion
static constexpr int s_Et_conversion
Definition: jJetInputAlgTool.h:52
GlobalSim::jJetInputAlgTool::jJetInputAlgTool
jJetInputAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: jJetInputAlgTool.cxx:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
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
GlobalSim::jJetInputAlgTool::s_phiDouble_conversion
static constexpr double s_phiDouble_conversion
Definition: jJetInputAlgTool.h:54
GlobalSim::jJetInputAlgTool::run
virtual StatusCode run(const EventContext &ctx) const override
Definition: jJetInputAlgTool.cxx:28
jJetInputAlgTool.h
TSU::toTopoPhi
unsigned int toTopoPhi(float phi)
Definition: Conversions.cxx:20