Bridge between ROOT framework and monitoring code.
More...
#include <HistogramFactory.h>
Bridge between ROOT framework and monitoring code.
Main purpose of this class is to properly register and retrieve histograms for specific definitions.
Definition at line 26 of file HistogramFactory.h.
◆ HistogramFactory()
Default constructor.
- Parameters
-
histSvc | ROOT framework histogramming service |
groupName | Name of the group to which produced histograms will belong |
Definition at line 19 of file HistogramFactory.cxx.
27 if (
hs &&
hs->hasProperty(
"IncludeName")) {
31 size_t whereToStart = 0;
33 if (! histoPath.empty() && histoPath[0] ==
'/') {
36 size_t split = histoPath.find(
'/', whereToStart);
41 TClass::GetClass(
"TH1F");
42 TClass::GetClass(
"TH1D");
43 TClass::GetClass(
"TH1C");
44 TClass::GetClass(
"TH1S");
45 TClass::GetClass(
"TH1I");
46 TClass::GetClass(
"TH2F");
47 TClass::GetClass(
"TH2D");
48 TClass::GetClass(
"TH2C");
49 TClass::GetClass(
"TH2S");
50 TClass::GetClass(
"TH2I");
51 TClass::GetClass(
"TProfile");
52 TClass::GetClass(
"TProfile2D");
53 TClass::GetClass(
"TEfficiency");
54 TClass::GetClass(
"TTree");
◆ ~HistogramFactory()
virtual Monitored::HistogramFactory::~HistogramFactory |
( |
| ) |
|
|
inlinevirtual |
◆ create() [1/2]
Book and register ROOT object for given definition.
Based on the histogram type, method will return proper kind of the ROOT object
- Parameters
-
- Returns
- ROOT object handler
Definition at line 58 of file HistogramFactory.cxx.
62 if (def.
type ==
"TH1F") {
64 }
else if (def.
type ==
"TH1D") {
66 }
else if (def.
type ==
"TH1C") {
68 }
else if (def.
type ==
"TH1S") {
70 }
else if (def.
type ==
"TH1I") {
72 }
else if (def.
type ==
"TH2F") {
74 }
else if (def.
type ==
"TH2D") {
76 }
else if (def.
type ==
"TH2C") {
78 }
else if (def.
type ==
"TH2S") {
80 }
else if (def.
type ==
"TH2I") {
82 }
else if (def.
type ==
"TProfile") {
83 rootObj = create1DProfile<TProfile>(def);
84 }
else if (def.
type ==
"TProfile2D") {
85 rootObj = create2DProfile<TProfile2D>(def);
86 }
else if (def.
type ==
"TEfficiency") {
88 }
else if (def.
type ==
"TTree") {
94 "Try one of: TH1[F,D,C,S,I], TH2[F,D,C,S,I], TProfile, TProfile2D, " +
95 "TEfficiency, TTree.");
◆ create() [2/2]
template<class H , class HBASE , typename... Types>
Create and register histogram.
If histogram already exists under that name, re-use it
- Template Parameters
-
H | Actual type of histogram to be created |
HBASE | Histogram base class (TH[1,2,3]) |
Types | Types of the remaining arguments for TH constructor (except name, title) |
- Parameters
-
def | Histogram definition |
hargs | Arguments that defines specific type of the histogram |
- Returns
- Histogram handler
Definition at line 208 of file HistogramFactory.cxx.
212 HBASE*
histo =
nullptr;
232 h->GetYaxis()->SetTitleOffset(1.25);
◆ create1D()
Helper for generic 'create' method for 1D histograms.
- Template Parameters
-
H | Actual type of histogram to be created |
- Parameters
-
- Returns
- Histogram handler
Definition at line 102 of file HistogramFactory.cxx.
103 if ( def.
xarray.size()!=0 ) {
104 return create<H,TH1>(def, def.
xbins, &(def.
xarray)[0]);
◆ create1DProfile()
Helper for generic 'create' method for 1DProfile histograms.
- Template Parameters
-
H | Actual type of histogram to be created |
- Parameters
-
- Returns
- Histogram handler
Definition at line 111 of file HistogramFactory.cxx.
112 if (def.
xarray.size()!=0) {
113 return create<H,TH1>(def, def.
xbins, &(def.
xarray)[0],
◆ create2D()
Helper for generic 'create' method for 2D histograms.
- Template Parameters
-
H | Actual type of histogram to be created |
- Parameters
-
- Returns
- Histogram handler
Definition at line 122 of file HistogramFactory.cxx.
124 return create<H,TH2>(def, def.
xbins, &(def.
xarray)[0],
126 }
else if (def.
yarray.size()!=0) {
129 }
else if (def.
xarray.size()!=0) {
130 return create<H,TH2>(def, def.
xbins, &(def.
xarray)[0],
◆ create2DProfile()
Helper for generic 'create' method for 2DProfile histograms.
- Template Parameters
-
H | Actual type of histogram to be created |
- Parameters
-
- Returns
- Histogram handler
Definition at line 139 of file HistogramFactory.cxx.
141 return create<H,TH2>(def, def.
xbins, &(def.
xarray)[0],
143 }
else if (def.
yarray.size()!=0) {
146 }
else if (def.
xarray.size()!=0) {
147 return create<H,TH2>(def, def.
xbins, &(def.
xarray)[0],
◆ createEfficiency()
Create and register efficiency graph.
If graph already exists under that name, re-use it
- Parameters
-
- Returns
- Efficiency graph handler
Definition at line 156 of file HistogramFactory.cxx.
160 TEfficiency*
e =
nullptr;
173 if (def.
xarray.size()!=0) {
174 e =
new TEfficiency(def.
alias.c_str(), def.
title.c_str(),
177 e =
new TEfficiency(def.
alias.c_str(), def.
title.c_str(),
182 e =
new TEfficiency(def.
alias.c_str(), def.
title.c_str(),
185 e =
new TEfficiency(def.
alias.c_str(), def.
title.c_str(),
189 e =
new TEfficiency(def.
alias.c_str(), def.
title.c_str(),
◆ createTree()
Create and register tree.
If tree already exists under that name, re-use it
- Parameters
-
- Returns
- Pointer to tree
Definition at line 239 of file HistogramFactory.cxx.
255 t =
new TTree(def.
alias.c_str(),def.
title.c_str());
◆ getFullName()
Invent path name.
If def path contains any of: EXPERT, SHIFT, DEBUG, RUNSTAT, EXPRESS this is online convention this becomes the first element of the path followed by the group name. Else if the def.path is DEFAULT then only the group name is used if the path yet different is concatenated with the group name.
- Parameters
-
- Returns
- Full path to histogram
Definition at line 292 of file HistogramFactory.cxx.
296 if ( onlinePaths.count( def.
path)!=0 ) {
298 }
else if ( def.
path==
"DEFAULT" ) {
307 [](
const char a,
const char b) {
308 return a == b and a ==
'/';
◆ globalROOTMutex()
static std::mutex& Monitored::HistogramFactory::globalROOTMutex |
( |
| ) |
|
|
inlinestatic |
◆ remove()
Removes histogram (used to get rid of old LB tagged histograms)
Definition at line 314 of file HistogramFactory.cxx.
317 TObject*
obj =
nullptr;
318 if (def.
type==
"TEfficiency") {
322 }
else if (def.
type==
"TGraph") {
326 }
else if (def.
type==
"TTree") {
◆ setLabels() [1/2]
void HistogramFactory::setLabels |
( |
TAxis * |
axis, |
|
|
const std::vector< std::string > & |
labels |
|
) |
| |
|
staticprivate |
Setup labels for histogram axes.
- Parameters
-
hist | Histogram handler |
labels | Histogram labels (from histogram definition) |
Definition at line 280 of file HistogramFactory.cxx.
282 const int nBin =
axis->GetNbins();
◆ setLabels() [2/2]
Set labels for all axes.
- Parameters
-
hist | Histogram pointer |
def | Histogram definition |
Definition at line 274 of file HistogramFactory.cxx.
◆ setOpts()
Setup various histogram options.
Available options: kCanRebin, Sumw2
- Parameters
-
hist | Histogram handler |
opt | Histogram options (from histogram definition) |
Definition at line 265 of file HistogramFactory.cxx.
267 const unsigned canExtendPolicy = def.
kCanRebin ? TH1::kAllAxes : TH1::kNoAxis;
268 hist->SetCanExtend(canExtendPolicy);
◆ m_createLock
std::mutex Monitored::HistogramFactory::m_createLock |
|
mutableprivate |
◆ m_deleteOnRemove
bool Monitored::HistogramFactory::m_deleteOnRemove {true} |
|
private |
◆ m_groupName
std::string Monitored::HistogramFactory::m_groupName |
|
private |
◆ m_histSvc
◆ m_streamName
std::string Monitored::HistogramFactory::m_streamName |
|
private |
◆ s_histDirMutex
std::mutex Monitored::HistogramFactory::s_histDirMutex |
|
inlinestaticprivate |
The documentation for this class was generated from the following files: