ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
TrigCostAnalysis
src
Variable.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TRIGCOSTANALYSIS_VARIABLE_H
6
#define TRIGCOSTANALYSIS_VARIABLE_H 1
7
8
#include "GaudiKernel/StatusCode.h"
9
#include "
AthenaBaseComps/AthCheckMacros.h
"
10
#include <string>
11
12
13
class
TH1;
//<! Forward declaration
14
19
enum
VariableType
{
20
kPerCall
,
21
kPerEvent
22
};
23
28
enum
LogType
{
29
kLinear
,
30
kLog
31
};
32
41
class
Variable
{
42
public
:
46
Variable
() =
delete
;
47
54
Variable
(
const
std::string& name, TH1* cacheHistoPtr,
VariableType
type
=
kPerCall
);
55
59
~Variable
() =
default
;
60
64
Variable
&
operator=
(
const
Variable
&) =
delete
;
65
69
Variable
(
const
Variable
&) =
delete
;
70
75
const
std::string&
getName
()
const
;
76
81
size_t
getCalls
()
const
;
82
87
float
getAccumulator
()
const
;
88
94
StatusCode
fill
(
float
value,
float
weight = 1.0);
95
102
StatusCode
fill
(
float
xvalue,
float
yvalue,
float
weight);
103
109
StatusCode
fill
(
const
std::string&
label
,
float
weight = 1.0);
110
115
StatusCode
increment
(
float
weight = 1.0);
116
122
StatusCode
setBinLabel
(
int
bin
,
const
std::string&
label
);
123
129
StatusCode
setYBinLabel
(
int
bin
,
const
std::string&
label
);
130
135
void
setDenominator
(
float
value);
136
140
StatusCode
endEvent
();
141
142
private
:
143
144
const
std::string
m_name
;
//<! Variable's name
145
const
VariableType
m_variableType
;
//<! Variable's type enumeration
146
TH1*
m_cacheHistoPtr
;
//<! Mutable cached non-owning ptr to this Variable's histogram.
147
size_t
m_calls
;
//<! Counter of how many times the Variable is Filled in an event.
148
float
m_xaccumulator
;
//<! For per-Event quantities, the accumulator buffers until the final quantity is known.
149
float
m_yaccumulator
;
//<! Buffer as xaccumulator, but for y axis, used of 2D histograms
150
float
m_weight
;
151
float
m_oneOverDenominator
;
152
};
153
154
#endif
// TRIGCOSTANALYSIS_VARIABLE_H
AthCheckMacros.h
VariableType
VariableType
Behaviour of Variable.
Definition
Variable.h:19
kPerEvent
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition
Variable.h:21
kPerCall
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition
Variable.h:20
LogType
LogType
Histogram x-axis type flag.
Definition
Variable.h:28
kLinear
@ kLinear
Linear x-binning.
Definition
Variable.h:29
kLog
@ kLog
Logarithmic x-binning.
Definition
Variable.h:30
Variable::m_xaccumulator
float m_xaccumulator
Definition
Variable.h:148
Variable::m_weight
float m_weight
Cache of the event weight.
Definition
Variable.h:150
Variable::endEvent
StatusCode endEvent()
Called by the framework.
Definition
Variable.cxx:126
Variable::Variable
Variable()=delete
Forbid default constructor.
Variable::increment
StatusCode increment(float weight=1.0)
Convenience function.
Definition
Variable.cxx:108
Variable::fill
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...
Definition
Variable.cxx:50
Variable::setDenominator
void setDenominator(float value)
Sets, until the end of the event, a denominator which will be used to normalise every Fill.
Definition
Variable.cxx:40
Variable::setYBinLabel
StatusCode setYBinLabel(int bin, const std::string &label)
Set label on given bin in cached histogram on y axis.
Definition
Variable.cxx:120
Variable::getName
const std::string & getName() const
Getter for Variable's name.
Definition
Variable.cxx:25
Variable::getCalls
size_t getCalls() const
Getter for how many times fill() has already been called on this Variable in this event.
Definition
Variable.cxx:30
Variable::m_variableType
const VariableType m_variableType
Definition
Variable.h:145
Variable::~Variable
~Variable()=default
Default destructor.
Variable::m_yaccumulator
float m_yaccumulator
Definition
Variable.h:149
Variable::Variable
Variable(const Variable &)=delete
Forbid copy.
Variable::getAccumulator
float getAccumulator() const
Getter for accumulated value of a kPerEvent Variable.
Definition
Variable.cxx:35
Variable::setBinLabel
StatusCode setBinLabel(int bin, const std::string &label)
Set label on given bin in cached histogram.
Definition
Variable.cxx:114
Variable::m_calls
size_t m_calls
Definition
Variable.h:147
Variable::m_name
const std::string m_name
Definition
Variable.h:144
Variable::m_cacheHistoPtr
TH1 * m_cacheHistoPtr
Definition
Variable.h:146
Variable::m_oneOverDenominator
float m_oneOverDenominator
Cache of the reciprocal of the denominator used to normalise when filling the histogram.
Definition
Variable.h:151
Variable::operator=
Variable & operator=(const Variable &)=delete
Forbid copy.
bin
Definition
BinsDiffFromStripMedian.h:43
label
std::string label(const std::string &format, int i)
Definition
label.h:19
type
Generated on
for ATLAS Offline Software by
1.17.0