|
ATLAS Offline Software
|
Concrete implimentation of Counter to monitor all properties of a given Sequence instance.
More...
#include <CounterSequence.h>
|
| CounterSequence ()=delete |
| Forbid default constructor. More...
|
|
| CounterSequence (const std::string &name, const MonitorBase *parent) |
| Construct counter. More...
|
|
virtual | ~CounterSequence ()=default |
| Default destructor. More...
|
|
CounterSequence & | operator= (const CounterSequence &)=delete |
| Forbid assignment. More...
|
|
| CounterSequence (const CounterSequence &)=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 Sequence instance.
Definition at line 14 of file CounterSequence.h.
◆ CounterSequence() [1/3]
CounterSequence::CounterSequence |
( |
| ) |
|
|
delete |
Forbid default constructor.
◆ CounterSequence() [2/3]
Construct counter.
- Parameters
-
[in] | name | Counter's name |
[in] | parent | Counter's parent monitor, cached non-owning pointer. |
Definition at line 11 of file CounterSequence.cxx.
◆ ~CounterSequence()
virtual CounterSequence::~CounterSequence |
( |
| ) |
|
|
virtualdefault |
◆ CounterSequence() [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 CounterSequence::newEvent |
( |
const CostData & |
data, |
|
|
size_t |
index, |
|
|
const float |
weight = 1. |
|
) |
| |
|
overridevirtual |
Concrete implimentation.
Monitores Sequence 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 26 of file CounterSequence.cxx.
35 if (slot !=
data.onlineSlot()) {
48 if (!
data.algToRequestMap().count(algIndex))
continue;
50 for (
size_t requestIdx :
data.algToRequestMap().at(algIndex)) {
52 const std::vector<unsigned> robs_history = request->
getDetail<std::vector<unsigned>>(
"robs_history");
53 const std::vector<uint32_t> robs_size = request->
getDetail<std::vector<uint32_t>>(
"robs_size");
55 bool networkRequestIncremented =
false;
56 for (
size_t i = 0;
i < robs_size.size(); ++
i) {
61 networkRequestIncremented =
true;
71 if (networkRequestIncremented) {
82 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]
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...
CounterBase()=delete
Forbid default constructor.
const std::string & getName() const
Getter for Counter's name.
const std::string & getName() const
Getter for Range's name.
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.
std::string to_string(const DetectorType &type)
const MonitorBase * getParent() const
Return cached non-owning const ptr to this Counter's parent Monitor.
@ 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.
const std::string m_name
Counter's name.