ATLAS Offline Software
Loading...
Searching...
No Matches
CounterBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCOSTANALYSIS_COUNTERBASE_H
6#define TRIGCOSTANALYSIS_COUNTERBASE_H 1
7
8#include "GaudiKernel/StatusCode.h"
11
12#include "CostData.h"
13#include "Variable.h"
14
15class MonitorBase;
16class TH1;
17
26 public:
30 CounterBase() = delete;
31
37 CounterBase(const std::string& name, const MonitorBase* parent);
38
42 virtual ~CounterBase() = default;
43
48
52 CounterBase(const CounterBase&) = delete;
53
58 const std::string& getName() const;
59
64 const MonitorBase* getParent() const;
65
71 bool variableExists(const std::string& name) const;
72
79 Variable& getVariable(const std::string& name);
80
87 StatusCode fill(const std::string& name, float value, float weight = 1.0);
88
96 StatusCode fill(const std::string& name, float xvalue, float yvalue, float weight);
97
103 StatusCode increment(const std::string& name, float weight = 1.0);
104
110 StatusCode setDenominator(const std::string& name, float value);
111
115 virtual StatusCode endEvent(float weight = 1.0);
116
123 virtual StatusCode newEvent(const CostData& data, size_t index, float weight = 1.0) = 0;
124
125 protected:
126
136 void regHistogram(const std::string& name,
137 const std::string& title,
139 const LogType xaxis = kLog,
140 const float min = 0.1,
141 const float max = 1000000.,
142 const size_t bins = 70);
143
153 void regTProfile(const std::string& name,
154 const std::string& title,
156 const LogType xaxis = kLog,
157 const float min = 0.1,
158 const float max = 1000000.,
159 const size_t bins = 70);
160
174 void regHistogram(const std::string& name,
175 const std::string& title,
176 const VariableType type,
177 const LogType xaxis,
178 const float xmin,
179 const float xmax,
180 const size_t xbins,
181 const LogType yaxis,
182 const float ymin,
183 const float ymax,
184 const size_t ybins);
185
186
193 TH1* bookGetPointer(TH1* hist, const std::string& tDir = "") const;
194
199 float timeToMilliSec(const uint64_t start, const uint64_t stop) const;
200
201 private:
202
203 const std::string m_name;
205 std::unordered_map< std::string, Variable > m_variables;
206};
207
208#endif // TRIGCOSTANALYSIS_COUNTERBASE_H
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static const std::vector< std::string > bins
VariableType
Behaviour of Variable.
@ kPerCall
Variable should fill underlying histogram on each fill.
LogType
Histogram x-axis type flag.
@ kLog
Logarithmic x-binning.
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
Caches and propagates event data to be used by monitoring algorithms.
Definition CostData.h:26
StatusCode fill(const std::string &name, float value, float weight=1.0)
Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Vari...
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
CounterBase()=delete
Forbid default constructor.
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Appends Counter name (to histogram path) and forwards histogram book request to parent Monitor.
const MonitorBase * getParent() const
Return cached non-owning const ptr to this Counter's parent Monitor.
std::unordered_map< std::string, Variable > m_variables
Store of Counter's Variables.
void regTProfile(const std::string &name, const std::string &title, const VariableType type=VariableType::kPerCall, const LogType xaxis=kLog, const float min=0.1, const float max=1000000., const size_t bins=70)
Book a TProfile for this Counter, to be filled in per-event monitoring.
void regHistogram(const std::string &name, const std::string &title, const VariableType type=VariableType::kPerCall, const LogType xaxis=kLog, const float min=0.1, const float max=1000000., const size_t bins=70)
Book a histogram for this Counter, to be filled in per-event monitoring.
const std::string & getName() const
Getter for Counter's name.
virtual StatusCode endEvent(float weight=1.0)
Called by the framework.
bool variableExists(const std::string &name) const
Check if a variable of a given name exists.
const MonitorBase * m_parent
Counter's parent Monitor.
const std::string m_name
Counter's name.
virtual StatusCode newEvent(const CostData &data, size_t index, float weight=1.0)=0
Pure virtual interface called by Monitor to instruct this Counter to perform its analysis.
Variable & getVariable(const std::string &name)
Returns a mutable reference to a named Variable.
StatusCode setDenominator(const std::string &name, float value)
Optional for per-Event Variables.
CounterBase(const CounterBase &)=delete
Forbid copy.
CounterBase & operator=(const CounterBase &)=delete
Forbid assignment.
StatusCode increment(const std::string &name, float weight=1.0)
Convenience function.
virtual ~CounterBase()=default
Default destructor.
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.
double xmax
Definition listroot.cxx:61
double ymin
Definition listroot.cxx:63
double xmin
Definition listroot.cxx:60
double ymax
Definition listroot.cxx:64
Definition index.py:1