ATLAS Offline Software
|
Wrapper around a histogram which allows for some additional filling patterns and data manipulation. More...
#include <Variable.h>
Public Member Functions | |
Variable ()=delete | |
Forbid default constructor. More... | |
Variable (const std::string &name, TH1 *cacheHistoPtr, VariableType type=kPerCall) | |
Construct Variable. More... | |
~Variable ()=default | |
Default destructor. More... | |
Variable & | operator= (const Variable &)=delete |
Forbid copy. More... | |
Variable (const Variable &)=delete | |
Forbid copy. More... | |
const std::string & | getName () const |
Getter for Variable's name. More... | |
size_t | getCalls () const |
Getter for how many times fill() has already been called on this Variable in this event. More... | |
float | getAccumulator () const |
Getter for accumulated value of a kPerEvent Variable. More... | |
StatusCode | fill (float value, float weight=1.0) |
Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be filled at the end of the event. More... | |
StatusCode | fill (float xvalue, float yvalue, float weight) |
Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be filled at the end of the event. More... | |
StatusCode | fill (const std::string &label, float weight=1.0) |
Fill histogram's bin (per-Call Variable) with given label. More... | |
StatusCode | increment (float weight=1.0) |
Convenience function. More... | |
StatusCode | setBinLabel (int bin, const std::string &label) |
Set label on given bin in cached histogram. More... | |
StatusCode | setYBinLabel (int bin, const std::string &label) |
Set label on given bin in cached histogram on y axis. More... | |
void | setDenominator (float value) |
Sets, until the end of the event, a denominator which will be used to normalise every Fill. More... | |
StatusCode | endEvent () |
Called by the framework. More... | |
Private Attributes | |
const std::string | m_name |
const VariableType | m_variableType |
TH1 * | m_cacheHistoPtr |
size_t | m_calls |
float | m_xaccumulator |
float | m_yaccumulator |
float | m_weight |
Cache of the event weight. More... | |
float | m_oneOverDenominator |
Cache of the reciprocal of the denominator used to normalise when filling the histogram. More... | |
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.
Behaviour based on type parameter. per-Call directly fills underlying histogram for each call of fill. per-Event fills the underlying histogram exactly once in events where fill was called one or more times. The filled value is accumulated from all calls to fill during the event in per-Event mode.
Definition at line 39 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
delete |
Forbid default constructor.
Variable::Variable | ( | const std::string & | name, |
TH1 * | cacheHistoPtr, | ||
VariableType | type = kPerCall |
||
) |
Construct Variable.
[in] | name | Variable's name |
[in] | cacheHistoPtr | Cached non-owning pointer to the histogram which this Variable wraps. |
[in] | type | If the Variable should operate in per-Call mode (direct fill) or per-Event mode (accumulate and fill at the end of the event). |
Definition at line 12 of file Variable.cxx.
|
default |
Default destructor.
StatusCode Variable::endEvent | ( | ) |
Called by the framework.
Triggers actual histogram fill for a per-Event variable. Resets internals.
Definition at line 120 of file Variable.cxx.
StatusCode Variable::fill | ( | const std::string & | label, |
float | weight = 1.0 |
||
) |
Fill histogram's bin (per-Call Variable) with given label.
[in] | label | Label of bin to fill |
[in] | weight | Global event weight |
Definition at line 96 of file Variable.cxx.
StatusCode Variable::fill | ( | float | value, |
float | weight = 1.0 |
||
) |
Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be filled at the end of the event.
[in] | value | The payload. |
[in] | weight | Global event weight |
Definition at line 49 of file Variable.cxx.
StatusCode Variable::fill | ( | float | xvalue, |
float | yvalue, | ||
float | weight | ||
) |
Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be filled at the end of the event.
[in] | xvalue | The x-axis payload. |
[in] | yvalue | The y-axis payload. |
[in] | weight | Global event weight |
Definition at line 68 of file Variable.cxx.
float Variable::getAccumulator | ( | ) | const |
Getter for accumulated value of a kPerEvent Variable.
Definition at line 34 of file Variable.cxx.
size_t Variable::getCalls | ( | ) | const |
Getter for how many times fill() has already been called on this Variable in this event.
Definition at line 29 of file Variable.cxx.
const std::string & Variable::getName | ( | ) | const |
Getter for Variable's name.
Definition at line 24 of file Variable.cxx.
StatusCode Variable::increment | ( | float | weight = 1.0 | ) |
Convenience function.
Equivalent of fill(1.0, weight). For use with per-Event counting type variables.
[in] | weight | Global event weight |
Definition at line 102 of file Variable.cxx.
StatusCode Variable::setBinLabel | ( | int | bin, |
const std::string & | label | ||
) |
Set label on given bin in cached histogram.
[in] | bin | Bin number |
[in] | label | Label to set |
Definition at line 108 of file Variable.cxx.
void Variable::setDenominator | ( | float | value | ) |
Sets, until the end of the event, a denominator which will be used to normalise every Fill.
@pram[in] value The denominator to normalise Fill operations.
Definition at line 39 of file Variable.cxx.
StatusCode Variable::setYBinLabel | ( | int | bin, |
const std::string & | label | ||
) |
Set label on given bin in cached histogram on y axis.
[in] | bin | Bin number |
[in] | label | Label to set |
Definition at line 114 of file Variable.cxx.
|
private |
Definition at line 144 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Definition at line 145 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Definition at line 142 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Cache of the reciprocal of the denominator used to normalise when filling the histogram.
Definition at line 149 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Definition at line 143 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Cache of the event weight.
Assumed to be the same for every call to fill with per-Event monitoring!
Definition at line 148 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Definition at line 146 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.
|
private |
Definition at line 147 of file Trigger/TrigCost/TrigCostAnalysis/src/Variable.h.