ATLAS Offline Software
Loading...
Searching...
No Matches
JetHistoMatchedFiller.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10JetHistoMatchedFiller::JetHistoMatchedFiller( const std::string& type, const std::string & name ,const IInterface* parent):
11 AthAlgTool( type, name, parent )
12{
13 declareInterface<IJetHistoFiller>(this);
14 declareProperty("JetMatchedKey",m_matchedKey="NONE");
15 declareProperty("JetPtDiffKey", m_ptdiffKey="NONE");
16 declareProperty("JetEnergyDiffKey", m_energydiffKey="NONE");
17 declareProperty("JetMassDiffKey", m_massdiffKey="NONE");
18 declareProperty("JetPtRespKey", m_ptrespKey="NONE");
19 declareProperty("JetEnergyRespKey", m_energyrespKey="NONE");
20 declareProperty("JetMassRespKey", m_massrespKey="NONE");
21 declareProperty("JetPtRefKey", m_ptrefKey="NONE");
22 declareProperty("JetEtaRefKey", m_etarefKey="NONE");
23}
24
25
27 ATH_CHECK( m_matchedKey.initialize() );
28 ATH_CHECK( m_ptdiffKey.initialize() );
29 ATH_CHECK( m_energydiffKey.initialize() );
30 ATH_CHECK( m_massdiffKey.initialize() );
31 ATH_CHECK( m_ptrespKey.initialize() );
32 ATH_CHECK( m_energyrespKey.initialize() );
33 ATH_CHECK( m_massrespKey.initialize() );
34 ATH_CHECK( m_ptrefKey.initialize() );
35 ATH_CHECK( m_etarefKey.initialize() );
36 return StatusCode::SUCCESS;
37}
38
39
40StatusCode JetHistoMatchedFiller::processJetContainer(const JetMonitoringAlg& parentAlg, const xAOD::JetContainer & jets, const EventContext& ctx ) const {
41 if(jets.empty()) return StatusCode::SUCCESS;
42
52
53 auto matched = Monitored::Collection("matched", jets, [matchedHandle](const xAOD::Jet * jet) {return matchedHandle(*jet);});
54 auto dPt = Monitored::Scalar("ptdiff",0.0);
55 auto dEnergy = Monitored::Scalar("energydiff",0.0);
56 auto dMass = Monitored::Scalar("massdiff",0.0);
57 auto rPt = Monitored::Scalar("ptresp",0.0);
58 auto rEnergy = Monitored::Scalar("energyresp",0.0);
59 auto rMass = Monitored::Scalar("massresp",0.0);
60 auto ptRef = Monitored::Scalar("ptref",0.0);
61 auto etaRef = Monitored::Scalar("etaref",0.0);
62
63 // Loop over jets and fill pt, energy, mass differences and responses between matched jets, plus reference pT and eta
64
65 for(const xAOD::Jet* jet : jets){
66 bool matched = matchedHandle(*jet);
67 if(matched){
68 dPt = ptdiffHandle(*jet);
69 dEnergy = energydiffHandle(*jet);
70 dMass = massdiffHandle(*jet);
71 rPt = ptrespHandle(*jet);
72 rEnergy = energyrespHandle(*jet);
73 rMass = massrespHandle(*jet);
74 ptRef = ptrefHandle(*jet);
75 etaRef = etarefHandle(*jet);
76 parentAlg.fill(m_group, dPt, dEnergy, dMass, rPt, rEnergy, rMass, ptRef, etaRef);
77 }
78 }
79 parentAlg.fill(m_group,matched);
80
81 return StatusCode::SUCCESS;
82}
83
84
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
JetHistoMatchedFiller(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_group
virtual StatusCode processJetContainer(const JetMonitoringAlg &parentAlg, const xAOD::JetContainer &jets, const EventContext &ctx) const
SG::ReadDecorHandleKey< xAOD::JetContainer > m_massrespKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptdiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_etarefKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_massdiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_energyrespKey
virtual StatusCode initialize()
SG::ReadDecorHandleKey< xAOD::JetContainer > m_matchedKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptrefKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_energydiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptrespKey
A monitoring algorithm in charge of filling histogram for a JetContainer.
Declare a monitored scalar variable.
Handle class for reading a decoration on an object.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".