ATLAS Offline Software
Loading...
Searching...
No Matches
NtracksPlots.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
11#include "NtracksPlots.h"
13
14
19 PlotMgr* pParent, const std::string& dirName,
20 const std::string& anaTag, const std::string& trackType,
21 bool doTrigger, bool doTruthMuPlots ) :
22 PlotMgr( dirName, anaTag, pParent ),
23 m_trackType( trackType ),
24 m_doTrigger( doTrigger ),
25 m_doTruthMuPlots( doTruthMuPlots ) { }
26
27
32{
33 StatusCode sc = bookPlots();
34 if( sc.isFailure() ) {
35 ATH_MSG_ERROR( "Failed to book track multiplicity plots" );
36 }
37}
38
39
41{
42 ATH_MSG_DEBUG( "Booking track multiplicity plots in " << getDirectory() );
43
44 for( size_t i=0; i<NCOUNTERS; i++ ) {
46 if( not m_doTrigger and i == INROI ) continue;
47
50
54 "num_"+m_trackType+"_"+m_counterName[i]+"_vs_num_vtx_"+m_trackType+"_"+m_counterName[i] ) );
55
58 m_nTracks_vs_actualMu[i], "num_"+m_trackType+"_"+m_counterName[i]+"_vs_actualMu" ) );
60 m_nTracks_vs_truthMu[i], "num_"+m_trackType+"_"+m_counterName[i]+"_vs_truthMu" ) );
61
64 m_avg_nTracks_vs_actualMu[i], "avgNum_"+m_trackType+"_"+m_counterName[i]+"_vs_actualMu" ) );
66 m_avg_nTracks_vs_truthMu[i], "avgNum_"+m_trackType+"_"+m_counterName[i]+"_vs_truthMu" ) );
67 }
68
69 return StatusCode::SUCCESS;
70}
71
72
77 const std::vector< size_t >& trackCounts,
78 const std::vector< size_t >& vertexCounts,
79 float truthMu,
80 float actualMu,
81 float weight )
82{
84 if( trackCounts.size() != NCOUNTERS or vertexCounts.size() != NCOUNTERS ) {
85 ATH_MSG_ERROR( "Counts vectors sizes are invalid" );
86 return StatusCode::FAILURE;
87 }
88
90 for( size_t i=0; i<NCOUNTERS; i++ ) {
92 if( not m_doTrigger and i == INROI ) continue;
93
95 ATH_CHECK( fill( m_nTracks[i], trackCounts[i], weight ) );
96
98 ATH_CHECK( fill( m_nTracks_vs_nVertices[i], vertexCounts[i], trackCounts[i], weight ) );
99
101 ATH_CHECK( fill( m_nTracks_vs_actualMu[i], actualMu, trackCounts[i], weight ) );
102 if( m_doTruthMuPlots ) ATH_CHECK( fill( m_nTracks_vs_truthMu[i], truthMu, trackCounts[i], weight ) );
103
105 ATH_CHECK( fill( m_avg_nTracks_vs_actualMu[i], actualMu, trackCounts[i], weight ) );
106 if( m_doTruthMuPlots ) ATH_CHECK( fill( m_avg_nTracks_vs_truthMu[i], truthMu, trackCounts[i], weight ) );
107 }
108
109 return StatusCode::SUCCESS;
110}
111
112
117{
118 ATH_MSG_DEBUG( "Finalising track multiplicity plots" );
120}
#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 track/truth particles parmeters in a consitent way in this package.
TH2 * m_nTracks_vs_truthMu[NCOUNTERS]
void finalizePlots()
Print out final stats on histograms.
void initializePlots()
Book the histograms.
StatusCode bookPlots()
TProfile * m_avg_nTracks_vs_actualMu[NCOUNTERS]
NtracksPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, const std::string &trackType, bool doTrigger=false, bool doTruthMuPlots=false)
Constructor.
TH1 * m_nTracks[NCOUNTERS]
std::string m_counterName[NCOUNTERS]
TH2 * m_nTracks_vs_nVertices[NCOUNTERS]
StatusCode fillPlots(const std::vector< size_t > &trackCounts, const std::vector< size_t > &vertexCounts, float truthMu, float actualMu, float weight)
Dedicated fill method.
std::string m_trackType
TProfile * m_avg_nTracks_vs_truthMu[NCOUNTERS]
TH2 * m_nTracks_vs_actualMu[NCOUNTERS]
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
void fill(H5::Group &out_file, size_t iterations)