ATLAS Offline Software
Loading...
Searching...
No Matches
JetResponseTool.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
7// JetResponseTool.cxx
8// Implementation file for class JetResponseTool
10
11#include <iomanip>
12
19
20JetResponseTool::JetResponseTool(const std::string& name)
21 : asg::AsgTool( name ){ }
22
23
24
26// Public methods:
28
56
57
58StatusCode JetResponseTool::decorate(const xAOD::JetContainer& jets) const {
64
66 for(const xAOD::Jet* jet : jets) {
67 jetResponseHandle(*jet) = -1.; // Invalid initialisation
68 jetIsolatedHandle(*jet) = false;
69 if(jet->pt() > m_recoJetMinPt) {
70 sel_jets.push_back(jet);
71 }
72 }
73
74 ATH_MSG_DEBUG("Selected " << sel_jets.size() << " reco jets above " << m_recoJetMinPt.value() << " MeV");
75
76 for(const xAOD::Jet* jet : sel_jets) {
77 if(jetMatchedTruthJetHandle(*jet).isValid()) {
78 const xAOD::Jet* matched_truthjet = *jetMatchedTruthJetHandle(*jet);
79 float Eresponse = jet->e() / matched_truthjet->e();
80 ATH_MSG_VERBOSE(" Jet energy response : " << std::setprecision(3) << Eresponse);
81 jetResponseHandle(*jet) = Eresponse;
82 }
83
84 bool isIsol = isIsolated(jetRecoIsolHandle(*jet),jetTruthIsolHandle(*jet));
85 jetIsolatedHandle(*jet) = isIsol;
86 ATH_MSG_VERBOSE(" Jet " << jet->index() << " with pt " << std::setprecision(3) << jet->pt() << " isolated? " << isIsol);
87 ATH_MSG_VERBOSE(" Isolation fractions: Truth " << std::setprecision(3) << jetTruthIsolHandle(*jet) << ", Reco " << jetRecoIsolHandle(*jet));
88 }
89
90 return StatusCode::SUCCESS;
91}
92
93
94bool JetResponseTool::isIsolated(float recoIsolFrac, float truthIsolFrac) const {
95 return (recoIsolFrac < m_recoIsolMaxFrac) && (truthIsolFrac < m_truthIsolMaxFrac);
96}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
DataVector adapter that acts like it holds const pointers.
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jetRecoIsolKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jetMatchedTruthJetKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetIsolatedKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetResponseKey
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Gaudi::Property< float > m_recoJetMinPt
Gaudi::Property< float > m_recoIsolMaxFrac
bool isIsolated(float recoIsolFrac, float truthIsolFrac) const
JetResponseTool(const std::string &name="JetResponseTool")
Constructor with parameters:
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jetTruthIsolKey
Gaudi::Property< float > m_truthIsolMaxFrac
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetContainerKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
virtual double e() const
The total energy of the particle.
Definition Jet_v1.cxx:63
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".