ATLAS Offline Software
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 
10 #include "NtracksPlots.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 doTrigger, bool doGlobalPlots, bool doTruthMuPlots ) :
22  PlotMgr( dirName, anaTag, pParent ),
23  m_trackType( trackType ),
24  m_doTrigger( doTrigger ),
25  m_doGlobalPlots( doGlobalPlots ),
26  m_doTruthMuPlots( doTruthMuPlots ) { }
27 
28 
33 {
34  StatusCode sc = bookPlots();
35  if( sc.isFailure() ) {
36  ATH_MSG_ERROR( "Failed to book track multiplicity plots" );
37  }
38 }
39 
40 
42 {
43  ATH_MSG_DEBUG( "Booking track multiplicity plots in " << getDirectory() );
44 
45  for( size_t i=0; i<NCOUNTERS; i++ ) {
47  if( not m_doTrigger and i == INROI ) continue;
48 
50  ATH_CHECK( retrieveAndBook( m_nTracks[i], "num_"+m_trackType+"_"+m_counterName[i] ) );
51 
53  ATH_CHECK( retrieveAndBook(
54  m_nTracks_vs_nVertices[i],
55  "num_"+m_trackType+"_"+m_counterName[i]+"_vs_num_vtx_"+m_trackType+"_"+m_counterName[i] ) );
56  }
57 
58  if( m_doGlobalPlots ) {
63  ATH_CHECK( retrieveAndBook(
64  m_nTracks_vs_actualMu, "num_"+m_trackType+"_"+m_counterName[ SELECTED ]+"_vs_actualMu" ) );
65  if( m_doTruthMuPlots ) ATH_CHECK( retrieveAndBook(
66  m_nTracks_vs_truthMu, "num_"+m_trackType+"_"+m_counterName[ SELECTED ]+"_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  ATH_CHECK( fill( m_nTracks[i], trackCounts[i], weight ) );
94  ATH_CHECK( fill( m_nTracks_vs_nVertices[i], vertexCounts[i], trackCounts[i], weight ) );
95  }
96 
97  if( m_doGlobalPlots ) {
98  ATH_CHECK( fill( m_nTracks_vs_actualMu, actualMu, trackCounts[ INROI ], weight ) );
99  if( m_doTruthMuPlots ) ATH_CHECK( fill( m_nTracks_vs_truthMu, truthMu, trackCounts[ INROI ], weight ) );
100  }
101 
102  return StatusCode::SUCCESS;
103 }
104 
105 
110 {
111  ATH_MSG_DEBUG( "Finalising track multiplicity plots" );
113 }
DoubleEventSelectorOverlayTest.doTrigger
doTrigger
Definition: DoubleEventSelectorOverlayTest.py:46
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
NtracksPlots.h
IDTPM::PlotMgr
Definition: PlotMgr.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IDTPM::NtracksPlots::bookPlots
StatusCode bookPlots()
Definition: NtracksPlots.cxx:41
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
IDTPM::NtracksPlots::initializePlots
void initializePlots()
Book the histograms.
Definition: NtracksPlots.cxx:32
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
IDTPM::NtracksPlots::NtracksPlots
NtracksPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, const std::string &trackType, bool doTrigger=false, bool doGlobalPlots=false, bool doTruthMuPlots=false)
Constructor.
Definition: NtracksPlots.cxx:18
IDTPM::NtracksPlots::fillPlots
StatusCode fillPlots(const std::vector< size_t > &trackCounts, const std::vector< size_t > &vertexCounts, float truthMu, float actualMu, float weight)
Dedicated fill method.
Definition: NtracksPlots.cxx:76
IDTPM::NtracksPlots::finalizePlots
void finalizePlots()
Print out final stats on histograms.
Definition: NtracksPlots.cxx:109