ATLAS Offline Software
Loading...
Searching...
No Matches
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
20namespace 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
68 static std::mutex& globalROOTMutex() { return s_histDirMutex; }
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};
171 mutable std::mutex m_createLock;
172 inline static std::mutex s_histDirMutex;
173 };
174}
175
176#endif /* AthenaMonitoringKernel_HistogramFiller_HistogramFactory_h */
#define H(x, y, z)
Definition MD5.cxx:114
static void setLabels(TH1 *hist, const HistogramDef &def)
Set labels for all axes.
std::string getFullName(const HistogramDef &def) const
Invent path name.
TEfficiency * createEfficiency(const HistogramDef &def)
Create and register efficiency graph.
bool m_deleteOnRemove
delete histogram during remove
virtual TNamed * create(const HistogramDef &def)
Book and register ROOT object for given definition.
static std::mutex & globalROOTMutex()
TTree * createTree(const HistogramDef &def)
Create and register tree.
TH2 * create2D(const HistogramDef &def)
Helper for generic 'create' method for 2D histograms.
ServiceHandle< ITHistSvc > m_histSvc
TH1 * create1DProfile(const HistogramDef &def)
Helper for generic 'create' method for 1DProfile histograms.
TH1 * create1D(const HistogramDef &def)
Helper for generic 'create' method for 1D histograms.
std::string m_groupName
defines location of group of histograms
std::string m_streamName
defines the stream for THistSvc
virtual void remove(const HistogramDef &def)
Removes histogram (used to get rid of old LB tagged histograms)
static void setOpts(TH1 *hist, const HistogramDef &def)
Setup various histogram options.
HistogramFactory(const ServiceHandle< ITHistSvc > &histSvc, const std::string &groupName)
Default constructor.
TH2 * create2DProfile(const HistogramDef &def)
Helper for generic 'create' method for 2DProfile histograms.
virtual ~HistogramFactory()
Virtual destructor.
Generic monitoring tool for athena components.
the internal class used to keep parsed Filler properties