ATLAS Offline Software
Loading...
Searching...
No Matches
JetPileupLabelingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11
13
14 ATH_MSG_INFO("Initializing " << name());
15 print();
16
19
20 ATH_CHECK(m_truthJetsKey.initialize());
21#ifndef XAOD_STANDALONE
23 // For analysis applications, may not enforce scheduling via data deps
26 }
27#endif
28 ATH_CHECK(m_decIsHSKey.initialize());
29 ATH_CHECK(m_decIsPUKey.initialize());
30
31 return StatusCode::SUCCESS;
32}
33
35
36 ATH_MSG_INFO("Parameters for " << name() << " :");
37 ATH_MSG_INFO("HS Truth Jet Container: " << m_truthJetsKey.key());
38 ATH_MSG_INFO("Name of isHS Label Decoration: " << m_decIsHSKey.key());
39 ATH_MSG_INFO("Name of isPU Label Decoration: " << m_decIsPUKey.key());
40}
41
42
44
45 // Get collection of HS Truth Jets
47 if (!truthHSJetsHandle.isValid()){
48 ATH_MSG_ERROR("Invalid JetContainer datahandle: " << m_truthJetsKey.key());
49 return StatusCode::FAILURE;
50 }
51 const xAOD::JetContainer* truthHSJets = truthHSJetsHandle.cptr();
52
55
56 for (const xAOD::Jet* jet : jets){
57 bool isHS = false;
58 bool isPU = true;
59 for (const xAOD::Jet *truthJet : *truthHSJets) {
60 float dr = jet->p4().DeltaR(truthJet->p4());
61 if (dr < m_hsMaxDR && truthJet->pt() > m_hsMinPt)
62 isHS = true;
63 if (dr < m_puMinDR && truthJet->pt() > m_puMinPt)
64 isPU = false;
65 if (isHS && !isPU)
66 break;
67 }
68 isHSJetHandle(*jet) = isHS;
69 isPUJetHandle(*jet) = isPU;
70 }
71
72 return StatusCode::SUCCESS;
73}
74
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(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.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Gaudi::Property< float > m_hsMinPt
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetsKey
void print() const override
Print configured parameters.
Gaudi::Property< float > m_puMinPt
StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate hard-scatter and pileup labels to a jet collection.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decIsPUKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decIsHSKey
Gaudi::Property< std::string > m_jetContainerName
Gaudi::Property< bool > m_suppressOutputDeps
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Handle class for adding a decoration to an object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".