ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaMonitoringKernel
src
HistogramFiller
HistogramFiller1D.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef AthenaMonitoringKernel_HistogramFiller_HistogramFiller1D_h
6
#define AthenaMonitoringKernel_HistogramFiller_HistogramFiller1D_h
7
8
#include "TH1.h"
9
10
#include "
HistogramFiller.h
"
11
#include "
HistogramFillerUtils.h
"
12
13
#include "
AthenaKernel/getMessageSvc.h
"
14
#include "
CxxUtils/AthUnlikelyMacros.h
"
15
#include "GaudiKernel/MsgStream.h"
16
17
namespace
Monitored
{
18
22
class
HistogramFiller1D
:
public
HistogramFiller
{
23
public
:
24
HistogramFiller1D
(
const
HistogramDef
& definition, std::shared_ptr<IHistogramProvider> provider)
25
:
HistogramFiller
(definition,
std
::move(provider)) {
26
}
27
28
virtual
unsigned
fill
(
const
HistogramFiller::VariablesPack
& vars )
const override
{
29
30
if
( vars.
cut
) {
31
const
size_t
maskSize = vars.
cut
->
size
();
32
// Abort if no cut entries or first (and only) entry is false
33
if
(maskSize == 0 || (maskSize == 1 && !vars.
cut
->
get
(0))) {
return
0; }
34
if
(
ATH_UNLIKELY
(maskSize > 1 && maskSize != vars[0]->
size
())) {
35
MsgStream log(
Athena::getMessageSvc
(),
"HistogramFiller1D"
);
36
log << MSG::ERROR <<
"CutMask does not match the size of plotted variable: "
37
<< maskSize <<
" "
<< vars[0]->
size
() <<
endmsg
;
38
}
39
}
40
41
// Accessor for cut mask in case one is defined
42
auto
cutMaskAccessor = [&](
size_t
i) {
return
static_cast<
bool
>
(vars.
cut
->
get
(i)); };
43
44
if
(vars.
weight
) {
45
auto
weightAccessor = [&](
size_t
i){
return
vars.
weight
->
get
(i); };
46
47
if
(
ATH_UNLIKELY
(vars.
weight
->
size
() != vars[0]->
size
())) {
48
MsgStream log(
Athena::getMessageSvc
(),
"HistogramFiller1D"
);
49
log << MSG::ERROR <<
"Weight does not match the size of plotted variable: "
50
<< vars.
weight
->
size
() <<
" "
<< vars[0]->
size
() <<
endmsg
;
51
}
52
// Need to fill here while weightVector is still in scope
53
if
(not vars.
cut
)
return
HistogramFiller::fill<TH1>
(weightAccessor,
detail::noCut
, *vars[0]);
54
else
return
HistogramFiller::fill<TH1>
(weightAccessor, cutMaskAccessor, *vars[0]);
55
}
56
57
if
(not vars.
cut
)
return
HistogramFiller::fill<TH1>
(
detail::noWeight
,
detail::noCut
, *vars[0]);
58
else
return
HistogramFiller::fill<TH1>
(
detail::noWeight
, cutMaskAccessor, *vars[0]);
59
}
60
};
61
}
62
63
#endif
/* AthenaMonitoringKernel_HistogramFiller_HistogramFiller1D_h */
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
AthUnlikelyMacros.h
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition
AthUnlikelyMacros.h:17
HistogramFillerUtils.h
HistogramFiller.h
size
size_t size() const
Number of registered mappings.
Monitored::HistogramFiller1D::HistogramFiller1D
HistogramFiller1D(const HistogramDef &definition, std::shared_ptr< IHistogramProvider > provider)
Definition
HistogramFiller1D.h:24
Monitored::HistogramFiller1D::fill
virtual unsigned fill(const HistogramFiller::VariablesPack &vars) const override
Method that actually fills the ROOT object.
Definition
HistogramFiller1D.h:28
Monitored::HistogramFiller::HistogramFiller
HistogramFiller(const HistogramDef &histDef, std::shared_ptr< IHistogramProvider > histogramProvider)
Default constructor.
Definition
HistogramFiller.h:51
Monitored::HistogramFiller::fill
virtual unsigned fill(const VariablesPack &) const =0
Method that actually fills the ROOT object.
Monitored::IMonitoredVariable::get
virtual double get(size_t) const =0
Monitored::IMonitoredVariable::size
virtual size_t size() const =0
gives size of vector representation
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
Monitored::detail::noWeight
auto noWeight
no weight for filling
Definition
HistogramFillerUtils.h:28
Monitored::detail::noCut
auto noCut
no cut for filling
Definition
HistogramFillerUtils.h:29
Monitored
Generic monitoring tool for athena components.
Definition
GenericMonitoringTool.h:28
std
STL namespace.
Monitored::HistogramDef
the internal class used to keep parsed Filler properties
Definition
HistogramDef.h:15
Monitored::HistogramFiller::VariablesPack
helper class to pass variables to fillers
Definition
HistogramFiller.h:72
Monitored::HistogramFiller::VariablesPack::cut
const Monitored::IMonitoredVariable * cut
pointer to cut mask variable, typically absent
Definition
HistogramFiller.h:113
Monitored::HistogramFiller::VariablesPack::size
size_t size() const
number of variables in the pack ( not counting the weight and mask )
Definition
HistogramFiller.h:87
Monitored::HistogramFiller::VariablesPack::weight
const Monitored::IMonitoredVariable * weight
pointer to weight variable, typically absent
Definition
HistogramFiller.h:112
Generated on
for ATLAS Offline Software by
1.17.0