ATLAS Offline Software
FakeRatePlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "FakeRatePlots.h"
12 #include "../TrackParametersHelper.h"
13 
14 
19  PlotMgr* pParent, const std::string& dirName,
20  const std::string& anaTag, const std::string& trackType,
21  bool doGlobalPlots, bool doTruthMuPlots ) :
22  PlotMgr( dirName, anaTag, pParent ),
23  m_trackType( trackType ),
24  m_doGlobalPlots( doGlobalPlots ),
25  m_doTruthMuPlots( doTruthMuPlots ) { }
26 
27 
32 {
33  StatusCode sc = bookPlots();
34  if( sc.isFailure() ) {
35  ATH_MSG_ERROR( "Failed to book fake rate plots" );
36  }
37 }
38 
39 
41 {
42  ATH_MSG_DEBUG( "Booking efficiency plots in " << getDirectory() );
43 
44  ATH_CHECK( retrieveAndBook( m_fakerate_vs_pt, "fakerate_vs_"+m_trackType+"_pt" ) );
45  ATH_CHECK( retrieveAndBook( m_fakerate_vs_eta, "fakerate_vs_"+m_trackType+"_eta" ) );
46  ATH_CHECK( retrieveAndBook( m_fakerate_vs_phi, "fakerate_vs_"+m_trackType+"_phi" ) );
47  ATH_CHECK( retrieveAndBook( m_fakerate_vs_d0, "fakerate_vs_"+m_trackType+"_d0" ) );
48  ATH_CHECK( retrieveAndBook( m_fakerate_vs_z0, "fakerate_vs_"+m_trackType+"_z0" ) );
49  if( m_doGlobalPlots ) {
50  ATH_CHECK( retrieveAndBook( m_fakerate_vs_actualMu, "fakerate_vs_actualMu" ) );
51  if( m_doTruthMuPlots ) ATH_CHECK( retrieveAndBook( m_fakerate_vs_truthMu, "fakerate_vs_truthMu" ) );
52  }
53  return StatusCode::SUCCESS;
54 }
55 
56 
60 template< typename PARTICLE >
62  const PARTICLE& particle, bool isFake, float truthMu, float actualMu, float weight )
63 {
65  float ppt = pT( particle ) / Gaudi::Units::GeV;
66  float peta = eta( particle );
67  float pphi = phi( particle );
68  float pd0 = d0( particle );
69  float pz0 = z0( particle );
70 
72  ATH_CHECK( fill( m_fakerate_vs_pt, ppt, isFake, weight ) );
73  ATH_CHECK( fill( m_fakerate_vs_eta, peta, isFake, weight ) );
74  ATH_CHECK( fill( m_fakerate_vs_phi, pphi, isFake, weight ) );
75  ATH_CHECK( fill( m_fakerate_vs_d0, pd0, isFake, weight ) );
76  ATH_CHECK( fill( m_fakerate_vs_z0, pz0, isFake, weight ) );
77 
78  if( m_doGlobalPlots ) {
79  ATH_CHECK( fill( m_fakerate_vs_actualMu, actualMu, isFake, weight ) );
80  if( m_doTruthMuPlots ) ATH_CHECK( fill( m_fakerate_vs_truthMu, truthMu, isFake, weight ) );
81  }
82 
83  return StatusCode::SUCCESS;
84 }
85 
87  const xAOD::TrackParticle&, bool isFake, float truthMu, float actualMu, float weight );
88 
90  const xAOD::TruthParticle&, bool isFake, float truthMu, float actualMu, float weight );
91 
92 
97 {
98  ATH_MSG_DEBUG( "Finalising fake rate plots" );
100 }
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
InDetSecVtxTruthMatchUtils::isFake
bool isFake(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:60
IDTPM::z0
float z0(const U &p)
Definition: TrackParametersHelper.h:70
FakeRatePlots.h
IDTPM::FakeRatePlots::initializePlots
void initializePlots()
Book the histograms.
Definition: FakeRatePlots.cxx:31
IDTPM::phi
float phi(const U &p)
Definition: TrackParametersHelper.h:59
fillPlots< xAOD::TrackParticle >
template StatusCode IDTPM::FakeRatePlots::fillPlots< xAOD::TrackParticle >(const xAOD::TrackParticle &, bool isFake, float truthMu, float actualMu, float weight)
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::eta
float eta(const U &p)
Accessor utility function for getting the value of eta.
Definition: TrackParametersHelper.h:41
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::d0
float d0(const U &p)
Definition: TrackParametersHelper.h:82
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
fillPlots< xAOD::TruthParticle >
template StatusCode IDTPM::FakeRatePlots::fillPlots< xAOD::TruthParticle >(const xAOD::TruthParticle &, bool isFake, float truthMu, float actualMu, float weight)
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
IDTPM::FakeRatePlots::bookPlots
StatusCode bookPlots()
Definition: FakeRatePlots.cxx:40
IDTPM::FakeRatePlots::FakeRatePlots
FakeRatePlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, const std::string &trackType, bool doGlobalPlots=false, bool doTruthMuPlots=false)
Constructor.
Definition: FakeRatePlots.cxx:18
IDTPM::FakeRatePlots::fillPlots
StatusCode fillPlots(const PARTICLE &particle, bool isFake, float truthMu, float actualMu, float weight)
Dedicated fill method (for tracks and/or truth particles)
Definition: FakeRatePlots.cxx:61
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
IDTPM::FakeRatePlots::finalizePlots
void finalizePlots()
Print out final stats on histograms.
Definition: FakeRatePlots.cxx:96