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 ) :
22  PlotMgr( dirName, anaTag, pParent ),
23  m_trackType( trackType ),
24  m_doTrigger( doTrigger ),
25  m_doGlobalPlots( doGlobalPlots ) { }
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( unsigned int i=0; i<NCOUNTERS; i++ ) {
46  if( not m_doTrigger and i == INROI ) continue;
47 
49  ATH_CHECK( retrieveAndBook( m_nTracks[i], "num_"+m_trackType+"_"+m_counterName[i] ) );
50  }
51 
52  if( m_doGlobalPlots ) {
57  ATH_CHECK( retrieveAndBook( m_nTracks_vs_truthMu, "num_"+m_trackType+"_"+m_counterName[ FS ]+"_vs_truthMu" ) );
58  ATH_CHECK( retrieveAndBook( m_nTracks_vs_actualMu, "num_"+m_trackType+"_"+m_counterName[ FS ]+"_vs_actualMu" ) );
59  }
60 
61  return StatusCode::SUCCESS;
62 }
63 
64 
69  const std::vector< unsigned int >& counts,
70  float truthMu,
71  float actualMu,
72  float weight )
73 {
75  if( counts.size() != NCOUNTERS ) {
76  ATH_MSG_ERROR( "Counts vecotor size is invalid" );
77  return StatusCode::FAILURE;
78  }
79 
81  for( unsigned int i=0; i<NCOUNTERS; i++ ) {
83  if( not m_doTrigger and i == INROI ) continue;
84  ATH_CHECK( fill( m_nTracks[i], counts[i], weight ) );
85  }
86 
87  if( m_doGlobalPlots ) {
88  ATH_CHECK( fill( m_nTracks_vs_truthMu, truthMu, counts[ INROI ], weight ) );
89  ATH_CHECK( fill( m_nTracks_vs_actualMu, actualMu, counts[ INROI ], weight ) );
90  }
91 
92  return StatusCode::SUCCESS;
93 }
94 
95 
100 {
101  ATH_MSG_DEBUG( "Finalising track multiplicity plots" );
103 }
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:40
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:31
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)
Constructor.
Definition: NtracksPlots.cxx:18
IDTPM::NtracksPlots::finalizePlots
void finalizePlots()
Print out final stats on histograms.
Definition: NtracksPlots.cxx:99
IDTPM::NtracksPlots::fillPlots
StatusCode fillPlots(const std::vector< unsigned int > &counts, float truthMu, float actualMu, float weight)
Dedicated fill method.
Definition: NtracksPlots.cxx:68