ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysisExample
TrigInDetAnalysisExample
TIDAHistogram.h
Go to the documentation of this file.
1
10
11
12
#ifndef TIDA_HISTOGRAM_H
13
#define TIDA_HISTOGRAM_H
14
15
#include "GaudiKernel/ToolHandle.h"
16
#include "
AthenaMonitoringKernel/GenericMonitoringTool.h
"
17
18
#include "
AthenaMonitoringKernel/Monitored.h
"
19
20
#include <string>
21
#include <stdexcept>
22
23
namespace
TIDA
{
24
25
class
HistogramBase
{
26
27
public
:
28
29
HistogramBase
() :
m_monTool
(0),
m_name
(
"UNINITIALISED"
),
m_varname
(),
m_initialised
(false) { }
30
31
HistogramBase
( ToolHandle<GenericMonitoringTool>* m,
const
std::string&
name
,
const
std::string&
domain
=
""
) :
32
m_monTool
(m),
m_name
(
name
),
m_varname
(
domain
.
empty
() ?
name
:
domain
+
"_"
+
name
),
m_initialised
(false) {
33
if
( !
m_name
.empty() &&
m_monTool
)
m_initialised
=
true
;
34
}
35
36
const
std::string&
name
()
const
{
return
m_name
; }
37
const
std::string&
varname
()
const
{
return
m_varname
; }
38
39
bool
initialised
()
const
{
return
m_initialised
; }
40
41
const
ToolHandle<GenericMonitoringTool>*
monTool
()
const
{
return
m_monTool
; };
42
43
private
:
44
45
ToolHandle<GenericMonitoringTool>*
m_monTool
;
46
47
std::string
m_name
;
48
std::string
m_varname
;
49
50
bool
m_initialised
;
51
52
};
53
54
55
template
<
typename
T>
56
class
Histogram
:
public
HistogramBase
{
57
58
public
:
59
60
using
HistogramBase::HistogramBase
;
61
62
void
Fill
( T d )
const
{
63
if
( !
initialised
() )
throw
std::runtime_error(
"TIDA::Histogram not initialised: "
+
name
());
64
auto
s =
Monitored::Scalar<T>
(
varname
(), d );
65
Monitored::Group
( *
monTool
(), s );
66
}
67
68
void
Fill
( T d, T w )
const
{
69
if
( !
initialised
() )
throw
std::runtime_error(
"TIDA::Histogram not initialised: "
+
name
());
70
auto
s =
Monitored::Scalar<T>
(
varname
(), d );
71
auto
sw =
Monitored::Scalar<T>
(
varname
()+
"_weight"
, w );
72
Monitored::Group
( *
monTool
(), s, sw );
73
}
74
75
const
Histogram
*
operator->
()
const
{
return
this
; }
76
77
};
78
79
80
template
<
typename
T,
typename
U=T>
81
class
Histogram2D
:
public
HistogramBase
{
82
83
public
:
84
85
using
HistogramBase::HistogramBase
;
86
87
void
Fill
( T
x
, U
y
)
const
{
88
if
( !
initialised
() )
throw
std::runtime_error(
"TIDA::Histogram not initialised: "
+
name
());
89
auto
sx =
Monitored::Scalar<T>
(
varname
()+
"__x"
,
x
);
90
auto
sy =
Monitored::Scalar<T>
(
varname
()+
"__y"
,
y
);
91
Monitored::Group
( *
monTool
(), sx, sy );
92
}
93
94
void
Fill
( T
x
, U
y
, T w)
const
{
95
if
( !
initialised
() )
throw
std::runtime_error(
"TIDA::Histogram not initialised: "
+
name
());
96
auto
sx =
Monitored::Scalar<T>
(
varname
()+
"__x"
,
x
);
97
auto
sy =
Monitored::Scalar<T>
(
varname
()+
"__y"
,
y
);
98
auto
sw =
Monitored::Scalar<T>
(
varname
()+
"_weight"
, w );
99
Monitored::Group
( *
monTool
(), sx, sy, sw );
100
}
101
102
const
Histogram2D
*
operator->
()
const
{
return
this
; }
103
104
};
105
106
107
}
108
109
110
#endif
/* TIDA_HISTOGRAM_H */
111
112
113
114
115
116
117
118
119
120
GenericMonitoringTool.h
domain
int domain(int argc, char *argv[])
Definition
MakeUncertaintyPlots.cxx:1556
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
y
#define y
x
#define x
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
TIDA::Histogram2D
Definition
TIDAHistogram.h:81
TIDA::Histogram2D::HistogramBase
HistogramBase()
Definition
TIDAHistogram.h:29
TIDA::Histogram2D::Fill
void Fill(T x, U y, T w) const
Definition
TIDAHistogram.h:94
TIDA::Histogram2D::Fill
void Fill(T x, U y) const
Definition
TIDAHistogram.h:87
TIDA::Histogram2D::operator->
const Histogram2D * operator->() const
Definition
TIDAHistogram.h:102
TIDA::HistogramBase::m_initialised
bool m_initialised
Definition
TIDAHistogram.h:50
TIDA::HistogramBase::m_varname
std::string m_varname
Definition
TIDAHistogram.h:48
TIDA::HistogramBase::HistogramBase
HistogramBase()
Definition
TIDAHistogram.h:29
TIDA::HistogramBase::m_name
std::string m_name
Definition
TIDAHistogram.h:47
TIDA::HistogramBase::HistogramBase
HistogramBase(ToolHandle< GenericMonitoringTool > *m, const std::string &name, const std::string &domain="")
Definition
TIDAHistogram.h:31
TIDA::HistogramBase::m_monTool
ToolHandle< GenericMonitoringTool > * m_monTool
Definition
TIDAHistogram.h:45
TIDA::HistogramBase::varname
const std::string & varname() const
Definition
TIDAHistogram.h:37
TIDA::HistogramBase::name
const std::string & name() const
Definition
TIDAHistogram.h:36
TIDA::HistogramBase::monTool
const ToolHandle< GenericMonitoringTool > * monTool() const
Definition
TIDAHistogram.h:41
TIDA::HistogramBase::initialised
bool initialised() const
Definition
TIDAHistogram.h:39
TIDA::Histogram
Definition
TIDAHistogram.h:56
TIDA::Histogram::HistogramBase
HistogramBase()
Definition
TIDAHistogram.h:29
TIDA::Histogram::operator->
const Histogram * operator->() const
Definition
TIDAHistogram.h:75
TIDA::Histogram::Fill
void Fill(T d) const
Definition
TIDAHistogram.h:62
TIDA::Histogram::Fill
void Fill(T d, T w) const
Definition
TIDAHistogram.h:68
TIDA
Test for xAOD.
Definition
Filter_AcceptAll.h:22
Generated on
for ATLAS Offline Software by
1.17.0