ATLAS Offline Software
HistogramFactory.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef AthenaMonitoringKernel_HistogramFiller_HistogramFactory_h
6 #define AthenaMonitoringKernel_HistogramFiller_HistogramFactory_h
7 
8 #include "TH1.h"
9 #include "TEfficiency.h"
10 
11 #include "GaudiKernel/ServiceHandle.h"
12 #include "GaudiKernel/ITHistSvc.h"
13 
15 
16 #include "HistogramException.h"
17 
18 #include <mutex>
19 
20 namespace Monitored {
27  public:
34  HistogramFactory(const ServiceHandle<ITHistSvc>& histSvc, const std::string& groupName);
38  virtual ~HistogramFactory() {}
39 
48  virtual TNamed* create(const HistogramDef& def);
49 
61  std::string getFullName(const HistogramDef& def) const;
62 
66  virtual void remove(const HistogramDef& def);
67 
69 
70  private:
83  template<class H, class HBASE, typename... Types>
84  HBASE* create(const HistogramDef& def, Types&&... hargs);
92  template<class H>
93  TH1* create1D(const HistogramDef& def);
101  template<class H>
102  TH1* create1DProfile(const HistogramDef& def);
110  template<class H>
111  TH2* create2D(const HistogramDef& def);
119  template<class H>
120  TH2* create2DProfile(const HistogramDef& def);
129  TEfficiency* createEfficiency(const HistogramDef& def);
138  TTree* createTree(const HistogramDef& def);
139 
148  static void setOpts(TH1* hist, const HistogramDef& def);
149 
156  static void setLabels(TH1* hist, const HistogramDef& def);
157 
164  static void setLabels(TAxis* axis, const std::vector<std::string>& labels);
165 
167  std::string m_streamName;
168  std::string m_groupName;
169 
170  bool m_deleteOnRemove{true};
172  inline static std::mutex s_histDirMutex;
173  };
174 }
175 
176 #endif /* AthenaMonitoringKernel_HistogramFiller_HistogramFactory_h */
Monitored::HistogramFactory::m_createLock
std::mutex m_createLock
Definition: HistogramFactory.h:171
Monitored::HistogramFactory::create
virtual TNamed * create(const HistogramDef &def)
Book and register ROOT object for given definition.
Definition: HistogramFactory.cxx:58
HistogramException.h
Monitored::HistogramFactory::m_streamName
std::string m_streamName
defines the stream for THistSvc
Definition: HistogramFactory.h:167
Monitored::HistogramFactory::m_groupName
std::string m_groupName
defines location of group of histograms
Definition: HistogramFactory.h:168
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
HistogramDef.h
plotmaker.hist
hist
Definition: plotmaker.py:148
RunTileMonitoring.groupName
groupName
Definition: RunTileMonitoring.py:158
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
Monitored::HistogramFactory::create1D
TH1 * create1D(const HistogramDef &def)
Helper for generic 'create' method for 1D histograms.
Definition: HistogramFactory.cxx:102
Monitored::HistogramDef
the internal class used to keep parsed Filler properties
Definition: HistogramDef.h:15
D3PD::Types
std::tuple< WrapType< TYPES >... > Types
A simple tuple of multiple types.
Definition: PhysicsAnalysis/D3PDMaker/D3PDMakerUtils/D3PDMakerUtils/Types.h:61
Monitored::HistogramFactory::s_histDirMutex
static std::mutex s_histDirMutex
Definition: HistogramFactory.h:172
Monitored::HistogramFactory::setOpts
static void setOpts(TH1 *hist, const HistogramDef &def)
Setup various histogram options.
Definition: HistogramFactory.cxx:266
Monitored::HistogramFactory::create2DProfile
TH2 * create2DProfile(const HistogramDef &def)
Helper for generic 'create' method for 2DProfile histograms.
Definition: HistogramFactory.cxx:139
Monitored::HistogramFactory::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: HistogramFactory.h:166
beamspotnt.labels
list labels
Definition: bin/beamspotnt.py:1447
H
#define H(x, y, z)
Definition: MD5.cxx:114
Monitored::HistogramFactory::setLabels
static void setLabels(TH1 *hist, const HistogramDef &def)
Set labels for all axes.
Definition: HistogramFactory.cxx:275
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
Monitored::HistogramFactory::getFullName
std::string getFullName(const HistogramDef &def) const
Invent path name.
Definition: HistogramFactory.cxx:293
Monitored::HistogramFactory::HistogramFactory
HistogramFactory(const ServiceHandle< ITHistSvc > &histSvc, const std::string &groupName)
Default constructor.
Definition: HistogramFactory.cxx:19
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
Monitored::HistogramFactory::create1DProfile
TH1 * create1DProfile(const HistogramDef &def)
Helper for generic 'create' method for 1DProfile histograms.
Definition: HistogramFactory.cxx:111
Monitored::HistogramFactory::create2D
TH2 * create2D(const HistogramDef &def)
Helper for generic 'create' method for 2D histograms.
Definition: HistogramFactory.cxx:122
Monitored::HistogramFactory::m_deleteOnRemove
bool m_deleteOnRemove
delete histogram during remove
Definition: HistogramFactory.h:170
Monitored::HistogramFactory::createTree
TTree * createTree(const HistogramDef &def)
Create and register tree.
Definition: HistogramFactory.cxx:240
Monitored::HistogramFactory::globalROOTMutex
static std::mutex & globalROOTMutex()
Definition: HistogramFactory.h:68
sim_check_batch.hargs
list hargs
Definition: sim_check_batch.py:226
Monitored::HistogramFactory::~HistogramFactory
virtual ~HistogramFactory()
Virtual destructor.
Definition: HistogramFactory.h:38
Monitored::HistogramFactory::remove
virtual void remove(const HistogramDef &def)
Removes histogram (used to get rid of old LB tagged histograms)
Definition: HistogramFactory.cxx:315
Monitored::HistogramFactory
Bridge between ROOT framework and monitoring code.
Definition: HistogramFactory.h:26
ServiceHandle< ITHistSvc >
Monitored::HistogramFactory::createEfficiency
TEfficiency * createEfficiency(const HistogramDef &def)
Create and register efficiency graph.
Definition: HistogramFactory.cxx:156