ATLAS Offline Software
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 
10 JetHistoMatchedFiller::JetHistoMatchedFiller( const std::string& type, const std::string & name ,const IInterface* 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 
40 StatusCode 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 
JetHistoMatchedFiller::processJetContainer
virtual StatusCode processJetContainer(const JetMonitoringAlg &parentAlg, const xAOD::JetContainer &jets, const EventContext &ctx) const
Definition: JetHistoMatchedFiller.cxx:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetHistoMatchedFiller::m_ptdiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptdiffKey
Definition: JetHistoMatchedFiller.h:28
JetHistoMatchedFiller::m_group
Gaudi::Property< std::string > m_group
Definition: JetHistoMatchedFiller.h:26
JetHistoMatchedFiller::m_ptrefKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptrefKey
Definition: JetHistoMatchedFiller.h:34
JetHistoMatchedFiller::m_energydiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_energydiffKey
Definition: JetHistoMatchedFiller.h:29
JetHistoMatchedFiller::m_ptrespKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ptrespKey
Definition: JetHistoMatchedFiller.h:31
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
JetHistoMatchedFiller::m_massdiffKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_massdiffKey
Definition: JetHistoMatchedFiller.h:30
GenericMonitoringTool.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetHistoMatchedFiller::JetHistoMatchedFiller
JetHistoMatchedFiller(const std::string &type, const std::string &name, const IInterface *parent)
Definition: JetHistoMatchedFiller.cxx:10
JetHistoMatchedFiller::m_massrespKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_massrespKey
Definition: JetHistoMatchedFiller.h:33
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthMonitorAlgorithm::fill
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.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
JetHistoMatchedFiller::m_etarefKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_etarefKey
Definition: JetHistoMatchedFiller.h:35
JetHistoMatchedFiller.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.ElectronD3PDObject.matched
matched
Definition: ElectronD3PDObject.py:138
JetMonitoringAlg
Definition: JetMonitoringAlg.h:26
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetHistoMatchedFiller::m_matchedKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_matchedKey
Definition: JetHistoMatchedFiller.h:27
JetMonitoringAlg.h
JetHistoMatchedFiller::initialize
virtual StatusCode initialize()
Definition: JetHistoMatchedFiller.cxx:26
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ReadDecorHandle.h
Handle class for reading a decoration on an object.
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthAlgTool
Definition: AthAlgTool.h:26
JetHistoMatchedFiller::m_energyrespKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_energyrespKey
Definition: JetHistoMatchedFiller.h:32