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