Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 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 
49  ATH_CHECK( retrieveAndBook( m_nTracks[i], "num_"+m_trackType+"_"+m_counterName[i] ) );
50 
52  ATH_CHECK( retrieveAndBook(
53  m_nTracks_vs_nVertices[i],
54  "num_"+m_trackType+"_"+m_counterName[i]+"_vs_num_vtx_"+m_trackType+"_"+m_counterName[i] ) );
55 
57  ATH_CHECK( retrieveAndBook(
58  m_nTracks_vs_actualMu[i], "num_"+m_trackType+"_"+m_counterName[i]+"_vs_actualMu" ) );
59  if( m_doTruthMuPlots ) ATH_CHECK( retrieveAndBook(
60  m_nTracks_vs_truthMu[i], "num_"+m_trackType+"_"+m_counterName[i]+"_vs_truthMu" ) );
61 
63  ATH_CHECK( retrieveAndBook(
64  m_avg_nTracks_vs_actualMu[i], "avgNum_"+m_trackType+"_"+m_counterName[i]+"_vs_actualMu" ) );
65  if( m_doTruthMuPlots ) ATH_CHECK( retrieveAndBook(
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 }
DoubleEventSelectorOverlayTest.doTrigger
doTrigger
Definition: DoubleEventSelectorOverlayTest.py:46
PrintTrkAnaSummary.dirName
dirName
Definition: PrintTrkAnaSummary.py:137
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
NtracksPlots.h
IDTPM::NtracksPlots::NtracksPlots
NtracksPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, const std::string &trackType, bool doTrigger=false, bool doTruthMuPlots=false)
Constructor.
Definition: NtracksPlots.cxx:18
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::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:116