5#ifndef TRIGCOSTANALYSIS_COUNTERBASE_H
6#define TRIGCOSTANALYSIS_COUNTERBASE_H 1
8#include "GaudiKernel/StatusCode.h"
19#include <unordered_map>
65 const std::string&
getName()
const;
94 StatusCode
fill(std::string_view name,
float value,
float weight = 1.0);
103 StatusCode
fill(std::string_view name,
float xvalue,
float yvalue,
float weight);
110 StatusCode
increment(std::string_view name,
float weight = 1.0);
122 virtual StatusCode
endEvent(
float weight = 1.0);
144 const std::string& title,
147 const float min = 0.1,
148 const float max = 1000000.,
149 const size_t bins = 70);
161 const std::string& title,
164 const float min = 0.1,
165 const float max = 1000000.,
166 const size_t bins = 70);
182 const std::string& title,
200 TH1*
bookGetPointer(TH1* hist,
const std::string& tDir =
"")
const;
206 float timeToMilliSec(
const uint64_t start,
const uint64_t stop)
const;
212 std::unordered_map< std::string, Variable, CxxUtils::TransparentStringHash, std::equal_to<> >
m_variables;
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.
Caches and propagates event data to be used by monitoring algorithms.
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.
StatusCode increment(std::string_view name, float weight=1.0)
Convenience function.
const MonitorBase * getParent() const
Return cached non-owning const ptr to this Counter's parent Monitor.
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.
Variable & getVariable(std::string_view name)
Returns a mutable reference to a named Variable.
StatusCode fill(std::string_view 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...
std::unordered_map< std::string, Variable, CxxUtils::TransparentStringHash, std::equal_to<> > m_variables
Store of Counter's Variables.
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.
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.
virtual ~CounterBase()=default
Default destructor.
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.