ATLAS Offline Software
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 
11 #include "OfflineElectronPlots.h"
13 #include "../TrackParametersHelper.h"
14 #include "../OfflineObjectDecorHelper.h"
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 }
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
IDTPM::OfflineElectronPlots::finalizePlots
void finalizePlots()
Print out final stats on histograms.
Definition: OfflineElectronPlots.cxx:97
IDTPM::OfflineElectronPlots::initializePlots
void initializePlots()
Book the histograms.
Definition: OfflineElectronPlots.cxx:30
IDTPM::getLinkedElectron
const xAOD::Electron * getLinkedElectron(const xAOD::TrackParticle &track, const std::string &quality)
getLinkedElectron
Definition: OfflineObjectDecorHelper.cxx:18
InDetSecVtxTruthMatchUtils::isMatched
bool isMatched(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:48
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
IDTPM::PlotMgr
Definition: PlotMgr.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IDTPM::eT
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
Definition: TrackParametersHelper.h:120
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
IDTPM::OfflineElectronPlots::bookPlots
StatusCode bookPlots()
Definition: OfflineElectronPlots.cxx:39
IDTPM::pT
float pT(const U &p)
Accessor utility function for getting the value of pT.
Definition: TrackParametersHelper.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IDTPM::OfflineElectronPlots::fillPlots
StatusCode fillPlots(const xAOD::TrackParticle &track, bool isMatched, float weight)
Dedicated fill methods.
Definition: OfflineElectronPlots.cxx:58
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
xAOD::Electron_v1
Definition: Electron_v1.h:34
OfflineElectronPlots.h
GlobalMonitoring_CA.doEfficiency
doEfficiency
Definition: GlobalMonitoring_CA.py:343
IDTPM::OfflineElectronPlots::OfflineElectronPlots
OfflineElectronPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, bool doEfficiency=false)
Constructor.
Definition: OfflineElectronPlots.cxx:20
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43