ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::JetMatchingTool Class Reference

#include <JetMatchingTool.h>

Inheritance diagram for DerivationFramework::JetMatchingTool:
Collaboration diagram for DerivationFramework::JetMatchingTool:

Public Member Functions

 JetMatchingTool (const std::string &t, const std::string &n, const IInterface *p)
virtual ~JetMatchingTool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
void jetPtCut (float a)
void jetEtaCut (float a)
void drCut (float a)
std::map< const xAOD::Jet *, std::vector< xAOD::TruthParticleContainer::const_iterator > > matchHadronsToJets (const xAOD::TruthParticleContainer *hadrons, const xAOD::JetContainer *jets) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< float > m_jetPtCut {this, "jetPtCut", 15000., "Cut on the jets pt that are considered for the hadron-jet matching."}
Gaudi::Property< float > m_jetEtaCut {this, "jetEtaCut", 2.5, "Cut on the jets eta that are considered for the hadron-jet matching."}
Gaudi::Property< float > m_drCut {this, "drCut", 0.4, "Cut on the delta R between an hadron and the closest jet to consider them matched."}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 30 of file JetMatchingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetMatchingTool()

DerivationFramework::JetMatchingTool::JetMatchingTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 23 of file JetMatchingTool.cxx.

23 : AthAlgTool(t,n,p){
24 }
AthAlgTool()
Default constructor:

◆ ~JetMatchingTool()

DerivationFramework::JetMatchingTool::~JetMatchingTool ( )
virtual

Definition at line 26 of file JetMatchingTool.cxx.

26 {
27 }

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ drCut()

void DerivationFramework::JetMatchingTool::drCut ( float a)
inline

Definition at line 57 of file JetMatchingTool.h.

57{m_drCut=a;}
static Double_t a

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode DerivationFramework::JetMatchingTool::finalize ( )
overridevirtual

Definition at line 48 of file JetMatchingTool.cxx.

48 {
49 return StatusCode::SUCCESS;
50 }

◆ initialize()

StatusCode DerivationFramework::JetMatchingTool::initialize ( )
overridevirtual

Definition at line 35 of file JetMatchingTool.cxx.

35 {
36
37 ATH_MSG_INFO("Initialize");
38
39 // Print the cuts.
40
41 ATH_MSG_INFO("Cut on the pt of the jets: " << m_jetPtCut);
42 ATH_MSG_INFO("Cut on the eta of the jets: " << m_jetEtaCut);
43 ATH_MSG_INFO("Cut for deltaR to consider a match: " << m_drCut);
44
45 return StatusCode::SUCCESS;
46 }
#define ATH_MSG_INFO(x)
Gaudi::Property< float > m_jetEtaCut
Gaudi::Property< float > m_jetPtCut

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ jetEtaCut()

void DerivationFramework::JetMatchingTool::jetEtaCut ( float a)
inline

Definition at line 56 of file JetMatchingTool.h.

◆ jetPtCut()

void DerivationFramework::JetMatchingTool::jetPtCut ( float a)
inline

Definition at line 55 of file JetMatchingTool.h.

◆ matchHadronsToJets()

std::map< const xAOD::Jet *, std::vector< xAOD::TruthParticleContainer::const_iterator > > DerivationFramework::JetMatchingTool::matchHadronsToJets ( const xAOD::TruthParticleContainer * hadrons,
const xAOD::JetContainer * jets ) const

Definition at line 58 of file JetMatchingTool.cxx.

58 {
59
60 // NOTE (not from Adria): The matching is unique for hadrons but not for jets
61 // Need to cut on jets before matching, not for hadrons where we can do it later.
62 // However, the current HFClassification is matching hadrons to the closest jet before the cuts and then cut on jets later - was this studied
63
64 // Declare a map variable to store the list of truth particles that are matched to each jet.
65
66 std::map<const xAOD::Jet*, std::vector<xAOD::TruthParticleContainer::const_iterator>> particleMatch;
67
68 // Match each truth particle to a jet.
69 // Use a for to go through the truth particles.
70
72
73 // Create a jet object to store the closest one to the truth particle that is being considered.
74
75 const xAOD::Jet* holder = nullptr;
76
77 // Define a variable to store the smallest deltaR between the jets and the hadron.
78
79 float drmin=999999;
80
81 // Use a for to go through the jets.
82
83 for(const xAOD::Jet* jet : *jets){
84
85 // Check if cuts are applied on jets.
86
87 if(m_jetPtCut>0 || m_jetEtaCut>=0){
88
89 // In this case, cuts should be applied.
90 // The jet is not considered if the cuts are not satisfied.
91
92 if(jet->p4().Pt()<m_jetPtCut) continue;
93 if(fabs(jet->p4().Eta())>m_jetEtaCut) continue;
94 }
95
96 // Compute deltaR between the jet and the hadron and check if it is smaller than drmin.
97 // If it is smaller, save the jet in holder and dr in drmin.
98
99 float dr = jet->p4().DeltaR((*hadron)->p4());
100
101 if(dr<drmin){
102 drmin=dr;
103 holder=jet;
104 }
105
106 }
107
108 // If the smallest drmin is smaller than drcut, then the truth particle is matched to the jet holder.
109 // Hence, save truth particle in particleMatch to the position that corresponds to jet holder.
110
111 if(drmin<m_drCut){
112 particleMatch[holder].push_back(hadron);
113 }
114
115 }
116
117 // Return the map particleMatch
118
119 return particleMatch;
120 }
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Jet_v1 Jet
Definition of the current "jet version".

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

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 > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_drCut

Gaudi::Property<float> DerivationFramework::JetMatchingTool::m_drCut {this, "drCut", 0.4, "Cut on the delta R between an hadron and the closest jet to consider them matched."}
private

Definition at line 80 of file JetMatchingTool.h.

80{this, "drCut", 0.4, "Cut on the delta R between an hadron and the closest jet to consider them matched."};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jetEtaCut

Gaudi::Property<float> DerivationFramework::JetMatchingTool::m_jetEtaCut {this, "jetEtaCut", 2.5, "Cut on the jets eta that are considered for the hadron-jet matching."}
private

Definition at line 79 of file JetMatchingTool.h.

79{this, "jetEtaCut", 2.5, "Cut on the jets eta that are considered for the hadron-jet matching."};

◆ m_jetPtCut

Gaudi::Property<float> DerivationFramework::JetMatchingTool::m_jetPtCut {this, "jetPtCut", 15000., "Cut on the jets pt that are considered for the hadron-jet matching."}
private

Definition at line 78 of file JetMatchingTool.h.

78{this, "jetPtCut", 15000., "Cut on the jets pt that are considered for the hadron-jet matching."};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: