ATLAS Offline Software
Loading...
Searching...
No Matches
OfflineElectronPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10
15
16
21 PlotMgr* pParent, const std::string& dirName,
22 const std::string& anaTag, bool doEfficiency ) :
23 PlotMgr( dirName, anaTag, pParent ),
24 m_doEfficiency( doEfficiency ) { }
25
26
31{
32 StatusCode sc = bookPlots();
33 if( sc.isFailure() ) {
34 ATH_MSG_ERROR( "Failed to book offline electron plots" );
35 }
36}
37
38
40{
41 ATH_MSG_DEBUG( "Booking offline electron plots in " << getDirectory() );
42
43 if( not m_doEfficiency ) {
44 ATH_CHECK( retrieveAndBook( m_Et, "offEle_Et" ) );
45 ATH_CHECK( retrieveAndBook( m_EtOverPt, "offEle_EtOverPt" ) );
46 } else {
47 ATH_CHECK( retrieveAndBook( m_eff_vs_Et, "eff_vs_offEle_Et" ) );
48 ATH_CHECK( retrieveAndBook( m_eff_vs_EtOverPt, "eff_vs_offEle_EtOverPt" ) );
49 }
50
51 return StatusCode::SUCCESS;
52}
53
54
59 const xAOD::TrackParticle& track,
60 bool isMatched, float weight )
61{
62 const xAOD::Electron* ele = getLinkedElectron( track );
63
64 if( not ele ) {
65 ATH_MSG_ERROR( "Electron not found" );
66 return StatusCode::FAILURE;
67 }
68
70 float ppt = pT( track ) / Gaudi::Units::GeV;
71 float pet = eT( *ele ) / Gaudi::Units::GeV;
72
74 if( not m_doEfficiency ) {
75 ATH_CHECK( fill( m_Et, pet, weight ) );
76 ATH_CHECK( fill( m_EtOverPt, (pet/ppt), weight ) );
77 } else {
78 ATH_CHECK( fill( m_eff_vs_Et, pet, isMatched, weight ) );
79 ATH_CHECK( fill( m_eff_vs_EtOverPt, (pet/ppt), isMatched, weight ) );
80 }
81
82 return StatusCode::SUCCESS;
83}
84
85
87 const xAOD::TruthParticle&, bool, float )
88{
89 ATH_MSG_ERROR( "Fill method disabled for truth particles" );
90 return StatusCode::FAILURE;
91}
92
93
98{
99 ATH_MSG_DEBUG( "Finalising offline electron plots" );
101}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
Utility methods to access offline object decorations.
Utility methods to access track/truth particles parmeters in a consitent way in this package.
void finalizePlots()
Print out final stats on histograms.
OfflineElectronPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, bool doEfficiency=false)
Constructor.
StatusCode fillPlots(const xAOD::TrackParticle &track, bool isMatched, float weight)
Dedicated fill methods.
void initializePlots()
Book the histograms.
TEfficiency * m_eff_vs_Et
TODO - include more plots.
StatusCode retrieveAndBook(P *&pHisto, const std::string &identifier, const std::string &folderOverride="", const std::string &nameOverride="")
Definition PlotMgr.h:64
PlotMgr(const std::string &dirName, const std::string &anaTag, PlotMgr *pParent=nullptr)
Constructor taking parent node and directory name for plots pParent = nullptr by default to book plot...
Definition PlotMgr.cxx:25
const std::string & getDirectory()
Definition PlotBase.h:88
float pT(const U &p)
Accessor utility function for getting the value of pT.
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
const xAOD::Electron * getLinkedElectron(const xAOD::TrackParticle &track, const std::string &quality)
getLinkedElectron
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
Electron_v1 Electron
Definition of the current "egamma version".
void fill(H5::Group &out_file, size_t iterations)