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_incl, "fakerate_vs_"+m_trackType+"_inclusive" ) );
45  ATH_CHECK( retrieveAndBook( m_fakerate_vs_pt, "fakerate_vs_"+m_trackType+"_pt" ) );
46  ATH_CHECK( retrieveAndBook( m_fakerate_vs_logPt,"fakerate_vs_"+m_trackType+"_logPt" ) );
47  ATH_CHECK( retrieveAndBook( m_fakerate_vs_eta, "fakerate_vs_"+m_trackType+"_eta" ) );
48  ATH_CHECK( retrieveAndBook( m_fakerate_vs_phi, "fakerate_vs_"+m_trackType+"_phi" ) );
49  ATH_CHECK( retrieveAndBook( m_fakerate_vs_d0, "fakerate_vs_"+m_trackType+"_d0" ) );
50  ATH_CHECK( retrieveAndBook( m_fakerate_vs_z0, "fakerate_vs_"+m_trackType+"_z0" ) );
51  if( m_doGlobalPlots ) {
52  ATH_CHECK( retrieveAndBook( m_fakerate_vs_actualMu, "fakerate_vs_actualMu" ) );
53  if( m_doTruthMuPlots ) ATH_CHECK( retrieveAndBook( m_fakerate_vs_truthMu, "fakerate_vs_truthMu" ) );
54  }
55  return StatusCode::SUCCESS;
56 }
57 
58 
62 template< typename PARTICLE >
64  const PARTICLE& particle, bool isFake, float truthMu, float actualMu, float weight )
65 {
67  float ppt = pT( particle ) / Gaudi::Units::GeV;
68  float peta = eta( particle );
69  float pphi = phi( particle );
70  float pd0 = d0( particle );
71  float pz0 = z0( particle );
72 
74  ATH_CHECK( fill( m_fakerate_vs_incl, 1, isFake, weight ) );
75  ATH_CHECK( fill( m_fakerate_vs_pt, ppt, isFake, weight ) );
76  ATH_CHECK( fill( m_fakerate_vs_logPt, ppt, isFake, weight ) );
77  ATH_CHECK( fill( m_fakerate_vs_eta, peta, isFake, weight ) );
78  ATH_CHECK( fill( m_fakerate_vs_phi, pphi, isFake, weight ) );
79  ATH_CHECK( fill( m_fakerate_vs_d0, pd0, isFake, weight ) );
80  ATH_CHECK( fill( m_fakerate_vs_z0, pz0, isFake, weight ) );
81 
82  if( m_doGlobalPlots ) {
83  ATH_CHECK( fill( m_fakerate_vs_actualMu, actualMu, isFake, weight ) );
84  if( m_doTruthMuPlots ) ATH_CHECK( fill( m_fakerate_vs_truthMu, truthMu, isFake, weight ) );
85  }
86 
87  return StatusCode::SUCCESS;
88 }
89 
91  const xAOD::TrackParticle&, bool isFake, float truthMu, float actualMu, float weight );
92 
94  const xAOD::TruthParticle&, bool isFake, float truthMu, float actualMu, float weight );
95 
96 
101 {
102  ATH_MSG_DEBUG( "Finalising fake rate plots" );
104 }
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:18
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
InDetSecVtxTruthMatchUtils::isFake
bool isFake(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:87
IDTPM::z0
float z0(const U &p)
Definition: TrackParametersHelper.h:72
FakeRatePlots.h
IDTPM::FakeRatePlots::initializePlots
void initializePlots()
Book the histograms.
Definition: FakeRatePlots.cxx:31
PrintTrkAnaSummary.dirName
dirName
Definition: PrintTrkAnaSummary.py:275
IDTPM::phi
float phi(const U &p)
Definition: TrackParametersHelper.h:61
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:190
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:43
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:84
IDTPM::pT
float pT(const U &p)
Accessor utility function for getting the value of pT.
Definition: TrackParametersHelper.h:33
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)
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:63
lumiFormat.fill
fill
Definition: lumiFormat.py:104
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:100