|
ATLAS Offline Software
|
Concrete implimentation of Counter to monitor all properties of a given Algorithm class. The new event logic is the same as in CounterAlgorithm, only histogram definition differs.
More...
#include <CounterAlgorithmClass.h>
|
| CounterAlgorithmClass ()=delete |
| Forbid default constructor. More...
|
|
| CounterAlgorithmClass (const std::string &name, const MonitorBase *parent) |
| Construct counter. More...
|
|
virtual | ~CounterAlgorithmClass ()=default |
| Default destructor. More...
|
|
CounterAlgorithmClass & | operator= (const CounterAlgorithmClass &)=delete |
| Forbid assignment. More...
|
|
| CounterAlgorithmClass (const CounterAlgorithmClass &)=delete |
| Forbid copy. More...
|
|
virtual StatusCode | newEvent (const CostData &data, size_t index, const float weight=1.) override |
| Concrete implimentation. More...
|
|
const std::string & | getName () const |
| Getter for Counter's name. More...
|
|
const MonitorBase * | getParent () const |
| Return cached non-owning const ptr to this Counter's parent Monitor. More...
|
|
bool | variableExists (const std::string &name) const |
| Check if a variable of a given name exists. More...
|
|
Variable & | getVariable (const std::string &name) |
| Returns a mutable reference to a named Variable. More...
|
|
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 Variable. More...
|
|
StatusCode | fill (const std::string &name, float xvalue, float yvalue, float weight) |
| Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Variable. More...
|
|
StatusCode | increment (const std::string &name, float weight=1.0) |
| Convenience function. More...
|
|
StatusCode | setDenominator (const std::string &name, float value) |
| Optional for per-Event Variables. More...
|
|
virtual StatusCode | endEvent (float weight=1.0) |
| Called by the framework. More...
|
|
|
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. More...
|
|
void | regHistogram (const std::string &name, const std::string &title, const VariableType type, const LogType xaxis, const float xmin, const float xmax, const size_t xbins, const LogType yaxis, const float ymin, const float ymax, const size_t ybins) |
| Book a 2D histogram for this Counter, to be filled in per-event monitoring. More...
|
|
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. More...
|
|
TH1 * | bookGetPointer (TH1 *hist, const std::string &tDir="") const |
| Appends Counter name (to histogram path) and forwards histogram book request to parent Monitor. More...
|
|
float | timeToMilliSec (const uint64_t start, const uint64_t stop) const |
| Helper function. More...
|
|
Concrete implimentation of Counter to monitor all properties of a given Algorithm class. The new event logic is the same as in CounterAlgorithm, only histogram definition differs.
Definition at line 15 of file CounterAlgorithmClass.h.
◆ CounterAlgorithmClass() [1/3]
CounterAlgorithmClass::CounterAlgorithmClass |
( |
| ) |
|
|
delete |
Forbid default constructor.
◆ CounterAlgorithmClass() [2/3]
Construct counter.
- Parameters
-
[in] | name | Counter's name |
[in] | parent | Counter's parent monitor, cached non-owning pointer. |
Definition at line 7 of file CounterAlgorithmClass.cxx.
◆ ~CounterAlgorithmClass()
virtual CounterAlgorithmClass::~CounterAlgorithmClass |
( |
| ) |
|
|
virtualdefault |
◆ CounterAlgorithmClass() [3/3]
◆ bookGetPointer()
TH1 * CounterBase::bookGetPointer |
( |
TH1 * |
hist, |
|
|
const std::string & |
tDir = "" |
|
) |
| const |
|
protectedinherited |
Appends Counter name (to histogram path) and forwards histogram book request to parent Monitor.
- Parameters
-
[in] | hist | Bare pointer to histogram. Ownership transferred to THistSvc. |
[in] | tDir | Histogram name & directory. |
- Returns
- Cached pointer to histogram. Used to fill histogram without having to perform THishSvc lookup.
Definition at line 233 of file CounterBase.cxx.
◆ endEvent()
StatusCode CounterBase::endEvent |
( |
float |
weight = 1.0 | ) |
|
|
virtualinherited |
Called by the framework.
Causes per-Event Variables to fill their histograms with their accumulated data.
Definition at line 225 of file CounterBase.cxx.
227 ATH_CHECK( nameVariablePair.second.endEvent() );
229 return StatusCode::SUCCESS;
◆ fill() [1/2]
StatusCode CounterBase::fill |
( |
const std::string & |
name, |
|
|
float |
value, |
|
|
float |
weight = 1.0 |
|
) |
| |
|
inherited |
Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Variable.
- Parameters
-
[in] | name | Variable to increment |
[in] | value | The payload value |
[in] | weight | Global event weight |
Definition at line 191 of file CounterBase.cxx.
194 return StatusCode::FAILURE;
197 return StatusCode::SUCCESS;
◆ fill() [2/2]
StatusCode CounterBase::fill |
( |
const std::string & |
name, |
|
|
float |
xvalue, |
|
|
float |
yvalue, |
|
|
float |
weight |
|
) |
| |
|
inherited |
Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Variable.
- Parameters
-
[in] | name | Variable to increment |
[in] | xvalue | The payload x-axis value |
[in] | yvalue | The payload y-axis value |
[in] | weight | Global event weight |
Definition at line 200 of file CounterBase.cxx.
203 return StatusCode::FAILURE;
206 return StatusCode::SUCCESS;
◆ getName()
const std::string & CounterBase::getName |
( |
| ) |
const |
|
inherited |
Getter for Counter's name.
- Returns
- Counter's name const string reference.
Definition at line 17 of file CounterBase.cxx.
◆ getParent()
Return cached non-owning const ptr to this Counter's parent Monitor.
- Returns
- Cached pointer parent Monitor.
Definition at line 22 of file CounterBase.cxx.
◆ getVariable()
Returns a mutable reference to a named Variable.
Throws if no such Variable exists. Used when more complicated logic is needed on a Variable than simply using the fill() method.
- Parameters
-
- Returns
- Mutable reference to Variable
Definition at line 182 of file CounterBase.cxx.
185 throw std::runtime_error(
"CounterBase::getVariable: No varialbe with name " +
name );
◆ increment()
StatusCode CounterBase::increment |
( |
const std::string & |
name, |
|
|
float |
weight = 1.0 |
|
) |
| |
|
inherited |
Convenience function.
Equivalent to fill(name, 1.0, weight);
- Parameters
-
[in] | name | Variable to increment |
[in] | weight | Global event weight |
Definition at line 220 of file CounterBase.cxx.
◆ newEvent()
StatusCode CounterAlgorithm::newEvent |
( |
const CostData & |
data, |
|
|
size_t |
index, |
|
|
const float |
weight = 1. |
|
) |
| |
|
overridevirtualinherited |
Concrete implimentation.
Monitores algorithm at specified index. Expected to match this instances name().
- Parameters
-
[in] | data | Access to event data |
[in] | index | Index within appropriate event data container which is to be analysed by this Counter |
[in] | weight | Global event weight |
Implements CounterBase.
Definition at line 30 of file CounterAlgorithm.cxx.
42 if (firstTime_perEvent.
getCalls() == 0) {
57 if (
data.algToRequestMap().count(
index)) {
58 for (
size_t requestIdx :
data.algToRequestMap().at(
index)) {
60 const std::vector<unsigned> robs_history = request->
getDetail<std::vector<unsigned>>(
"robs_history");
61 const std::vector<uint32_t> robs_size = request->
getDetail<std::vector<uint32_t>>(
"robs_size");
63 bool networkRequestIncremented =
false;
64 for (
size_t i = 0;
i < robs_size.size(); ++
i) {
69 networkRequestIncremented =
true;
79 if (networkRequestIncremented) {
88 return StatusCode::SUCCESS;
◆ operator=()
◆ regHistogram() [1/2]
void CounterBase::regHistogram |
( |
const std::string & |
name, |
|
|
const std::string & |
title, |
|
|
const VariableType |
type, |
|
|
const LogType |
xaxis, |
|
|
const float |
xmin, |
|
|
const float |
xmax, |
|
|
const size_t |
xbins, |
|
|
const LogType |
yaxis, |
|
|
const float |
ymin, |
|
|
const float |
ymax, |
|
|
const size_t |
ybins |
|
) |
| |
|
protectedinherited |
Book a 2D histogram for this Counter, to be filled in per-event monitoring.
- Parameters
-
[in] | name | The name of the histogram (and corresponding Variable) |
[in] | title | ROOT histogram title string in format "title;xaxis;yaxis" |
[in] | xaxis | Controls if the x-axis should use fixed-width or logarithmic bin boundaries. |
[in] | xmin | X-axis minimum bound. |
[in] | xmax | X-axis maximum bound. |
[in] | xbins | Number of histogram bins. |
[in] | yaxis | Controls if the y-axis should use fixed-width or logarithmic bin boundaries. |
[in] | ymin | Y-axis minimum bound. |
[in] | ymax | Y-axis maximum bound. |
[in] | ybins | Number of histogram bins. |
Definition at line 109 of file CounterBase.cxx.
122 std::unique_ptr<TH2F>
hist;
125 throw std::runtime_error(
"CounterBase::regHistogram: Cannot have max <= min or bins == 0");
130 }
else if (xaxis ==
kLog || yaxis ==
kLog) {
132 throw std::runtime_error(
"CounterBase::regHistogram: Cannot have min <= 0 with log binning");
134 std::unique_ptr<double[]> xlogbins = std::make_unique<double[]>(
xbins+1);
135 std::unique_ptr<double[]> ylogbins = std::make_unique<double[]>(
ybins+1);
137 const double xlogmin = log10(
xmin);
138 const double xlogmax = log10(
xmax);
139 const double dlogx = (xlogmax-xlogmin)/((
double)
xbins);
140 for (
size_t i = 0;
i <=
xbins; ++
i) {
141 const double xlog = xlogmin +
i*dlogx;
142 xlogbins[
i] =
exp(
log(10) * xlog );
146 for (
size_t i = 0;
i <=
xbins; ++
i) {
152 const double ylogmin = log10(
ymin);
153 const double ylogmax = log10(
ymax);
154 const double dlogy = (ylogmax-ylogmin)/((
double)
ybins);
155 for (
size_t i = 0;
i <=
ybins; ++
i) {
156 const double ylog = ylogmin +
i*dlogy;
157 ylogbins[
i] =
exp(
log(10) * ylog );
161 for (
size_t i = 0;
i <=
ybins; ++
i) {
166 hist = std::make_unique<TH2F>(hisSvcName.c_str(),
title.c_str(),
xbins, xlogbins.get(),
ybins, ylogbins.get());
168 throw std::runtime_error(
"CounterBase::regHistogram: Unknown logarithm flag");
172 std::forward_as_tuple(
name),
◆ regHistogram() [2/2]
Book a histogram for this Counter, to be filled in per-event monitoring.
- Parameters
-
[in] | name | The name of the histogram (and corresponding Variable) |
[in] | title | ROOT histogram title string in format "title;xaxis;yaxis" |
[in] | xaxis | Controls if the x-axis should use fixed-width or logarithmic bin boundaries. |
[in] | min | X-axis minimum bound. |
[in] | max | X-axis maximum bound. |
[in] | bins | Number of histogram bins. |
Definition at line 27 of file CounterBase.cxx.
36 std::unique_ptr<TH1F>
hist;
39 throw std::runtime_error(
"CounterBase::regHistogram: Cannot have max <= min or bins == 0");
44 }
else if (xaxis ==
kLog) {
46 throw std::runtime_error(
"CounterBase::regHistogram: Cannot have min <= 0 with log binning");
48 std::unique_ptr<double[]>
xbins = std::make_unique<double[]>(
bins+1);
49 const double xlogmin = log10(
min);
50 const double xlogmax = log10(
max);
51 const double dlogx = (xlogmax-xlogmin)/((
double)
bins);
52 for (
size_t i = 0;
i <=
bins; ++
i) {
53 const double xlog = xlogmin +
i*dlogx;
58 throw std::runtime_error(
"CounterBase::regHistogram: Unknown logarithm flag");
62 std::forward_as_tuple(
name),
◆ regTProfile()
Book a TProfile for this Counter, to be filled in per-event monitoring.
- Parameters
-
[in] | name | The name of the histogram (and corresponding Variable) |
[in] | title | ROOT histogram title string in format "title;xaxis;yaxis" |
[in] | xaxis | Controls if the x-axis should use fixed-width or logarithmic bin boundaries. |
[in] | min | X-axis minimum bound. |
[in] | max | X-axis maximum bound. |
[in] | bins | Number of histogram bins. |
Definition at line 68 of file CounterBase.cxx.
77 std::unique_ptr<TProfile>
hist;
80 throw std::runtime_error(
"CounterBase::regTProfile: Cannot have max <= min or bins == 0");
85 }
else if (xaxis ==
kLog) {
87 throw std::runtime_error(
"CounterBase::regTProfile: Cannot have min <= 0 with log binning");
89 std::unique_ptr<double[]>
xbins = std::make_unique<double[]>(
bins+1);
90 const double xlogmin = log10(
min);
91 const double xlogmax = log10(
max);
92 const double dlogx = (xlogmax-xlogmin)/((
double)
bins);
93 for (
size_t i = 0;
i <=
bins; ++
i) {
94 const double xlog = xlogmin +
i*dlogx;
97 hist = std::make_unique<TProfile>(hisSvcName.c_str(),
title.c_str(),
bins,
xbins.get());
99 throw std::runtime_error(
"CounterBase::regTProfile: Unknown logarithm flag");
103 std::forward_as_tuple(
name),
◆ setDenominator()
StatusCode CounterBase::setDenominator |
( |
const std::string & |
name, |
|
|
float |
value |
|
) |
| |
|
inherited |
Optional for per-Event Variables.
Sets a denominator to divide the value through by before filling.
- Parameters
-
[in] | name | Variable to set the denominator for. |
[in] | value | The denominator |
Definition at line 210 of file CounterBase.cxx.
213 return StatusCode::FAILURE;
215 it->second.setDenominator(
value);
216 return StatusCode::SUCCESS;
◆ timeToMilliSec()
float CounterBase::timeToMilliSec |
( |
const uint64_t |
start, |
|
|
const uint64_t |
stop |
|
) |
| const |
|
protectedinherited |
Helper function.
Compute the time difference in discreet microseconds and covert to fractional milliseconds.
- Returns
- Time difference in milliseconds, floating point.
Definition at line 243 of file CounterBase.cxx.
248 return (difference * 1
e-3);
◆ variableExists()
bool CounterBase::variableExists |
( |
const std::string & |
name | ) |
const |
|
inherited |
Check if a variable of a given name exists.
- Parameters
-
- Returns
- True if variable already exists.
Definition at line 178 of file CounterBase.cxx.
◆ m_name
const std::string CounterBase::m_name |
|
privateinherited |
◆ m_parent
Counter's parent Monitor.
Cached non-owning const pointer.
Definition at line 204 of file CounterBase.h.
◆ m_variables
std::unordered_map< std::string, Variable > CounterBase::m_variables |
|
privateinherited |
Store of Counter's Variables.
These wrap a histogram pointer. Keyed by name.
Definition at line 205 of file CounterBase.h.
The documentation for this class was generated from the following files:
char data[hepevt_bytes_allocation_ATLAS]
StatusCode setDenominator(const std::string &name, float value)
Optional for per-Event Variables.
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.
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Appends Monitor name (to histogram path) and forwards histogram book request to parent Range.
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...
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
size_t getCalls() const
Getter for how many times fill() has already been called on this Variable in this event.
const std::string & getName() const
Getter for Counter's name.
const std::string & getName() const
Getter for Range's name.
CounterAlgorithm()=delete
Forbid default constructor.
const MonitoredRange * getParent() const
Return cached non-owning const ptr to this Monitor's parent Range.
@ kLog
Logarithmic x-binning.
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Appends Counter name (to histogram path) and forwards histogram book request to parent Monitor.
const std::string & getName() const
Getter for Monitor's name.
Class used to describe composite objects in the HLT.
const MonitorBase * m_parent
Counter's parent Monitor.
@ kPerCall
Variable should fill underlying histogram on each fill.
Variable & getVariable(const std::string &name)
Returns a mutable reference to a named Variable.
std::string to_string(const DetectorType &type)
const MonitorBase * getParent() const
Return cached non-owning const ptr to this Counter's parent Monitor.
static const std::string hash2string(HLTHash, const std::string &category="TE")
hash function translating identifiers into names (via internal dictionary)
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.
@ kLinear
Linear x-binning.
StatusCode increment(const std::string &name, float weight=1.0)
Convenience function.
std::unordered_map< std::string, Variable > m_variables
Store of Counter's Variables.
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
StatusCode fill(float value, float weight=1.0)
Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be f...
const std::string m_name
Counter's name.