ATLAS Offline Software
EventAnalysis.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/ITHistSvc.h"
7 #include "GaudiKernel/ServiceHandle.h"
8 #include "TH1.h"
9 #include "TH2.h"
10 #include "TProfile.h"
11 #include "TProfile2D.h"
12 
13 
14 namespace{
15  template <class HistoArrayType>
16  void registerHistogramType
17  (ITHistSvc& histSvc,
18  const HistoArrayType & h, const std::string &sampleName, const std::string & suffix){
19  unsigned int u = 1;
20  const std::string titleRoot{"/ESD/" + sampleName + suffix};
21  for ( auto & thisHisto:h ){
22  histSvc.regHist( titleRoot + std::to_string(u), thisHisto.second ).ignore();
23  ++u;
24  }
25  }
26 }
27 
28 //=============================================================================
29 // Constructors & Destructors
30 //=============================================================================
31 
33 {
34  m_uPassedEvents = 0;
35 }
36 
38 {
39 }
40 
41 //=============================================================================
42 // Public Accessors
43 //=============================================================================
45 {
46  // This must be called by an inheriting class in order to book
47  // & register histograms.
49  Register();
50 }
51 
52 //=============================================================================
53 // Protected Accessors
54 //=============================================================================
56 {
57  // This must be overriden by an inheriting class.
58 }
59 
60 //=============================================================================
61 // Private Accessors
62 //=============================================================================
64 {
65  ServiceHandle<ITHistSvc> histSvc ("THistSvc", "EventAnalysis");
66 
67  // Register histograms in monitoring tool
68  registerHistogramType(*histSvc, m_x1DHistograms, m_xSampleName, "/1dhisto_");
69  registerHistogramType(*histSvc, m_x2DHistograms, m_xSampleName, "/2dhisto_");
70 
71  registerHistogramType(*histSvc, m_x1DProfHistograms, m_xSampleName, "/1dprof_");
72  registerHistogramType(*histSvc, m_x2DProfHistograms, m_xSampleName, "/2dprof_");
73 }
74 
75 
76 //=============================================================================
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
EventAnalysis.h
EventAnalysis::~EventAnalysis
virtual ~EventAnalysis()
Definition: EventAnalysis.cxx:37
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
EventAnalysis::m_x1DHistograms
std::map< unsigned int, TH1F * > m_x1DHistograms
Definition: EventAnalysis.h:75
EventAnalysis::EventAnalysis
EventAnalysis()
Definition: EventAnalysis.cxx:32
EventAnalysis::m_uPassedEvents
unsigned int m_uPassedEvents
Definition: EventAnalysis.h:74
EventAnalysis::m_x2DHistograms
std::map< unsigned int, TH2F * > m_x2DHistograms
Definition: EventAnalysis.h:76
EventAnalysis::BookHistograms
virtual void BookHistograms()
Definition: EventAnalysis.cxx:55
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
EventAnalysis::m_x1DProfHistograms
std::map< unsigned int, TProfile * > m_x1DProfHistograms
Definition: EventAnalysis.h:77
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
EventAnalysis::Register
void Register()
Definition: EventAnalysis.cxx:63
EventAnalysis::m_x2DProfHistograms
std::map< unsigned int, TProfile2D * > m_x2DProfHistograms
Definition: EventAnalysis.h:78
h
EventAnalysis::Init
virtual void Init()
Definition: EventAnalysis.cxx:44
EventAnalysis::m_xSampleName
std::string m_xSampleName
Definition: EventAnalysis.h:80
ServiceHandle< ITHistSvc >