ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaMonitoringKernel
src
HistogramFiller
VecHistogramFiller1D.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_VecHistogramFiller1D_h
6
#define AthenaMonitoringKernel_HistogramFiller_VecHistogramFiller1D_h
7
8
#include "
HistogramFiller1D.h
"
9
10
namespace
Monitored
{
11
class
VecHistogramFiller1D
:
public
HistogramFiller1D
{
12
public
:
13
VecHistogramFiller1D
(
const
HistogramDef
& definition, std::shared_ptr<IHistogramProvider> provider)
14
:
HistogramFiller1D
(definition,
std
::move(provider)) {}
15
16
17
virtual
unsigned
fill
(
const
HistogramFiller::VariablesPack
& vars)
const override
{
18
if
(
ATH_UNLIKELY
(vars.
size
() == 0 or vars[0] ==
nullptr
) ) {
return
0; }
19
20
if
(vars.
cut
) {
21
const
size_t
maskSize = vars.
cut
->
size
();
22
// Abort if no cut entries or first (and only) entry is false
23
if
(maskSize == 0 || (maskSize == 1 && !vars.
cut
->
get
(0))) {
return
0; }
24
25
if
(
ATH_UNLIKELY
(maskSize > 1 && maskSize != vars[0]->
size
())) {
26
MsgStream log(
Athena::getMessageSvc
(),
"VecHistogramFiller1D"
);
27
log << MSG::ERROR <<
"CutMask does not match the size of plotted variable: "
28
<< maskSize <<
" "
<< vars[0]->
size
() <<
endmsg
;
29
}
30
}
31
32
auto
histogram
= this->
histogram<TH1>
();
33
34
if
(
ATH_UNLIKELY
(
static_cast<
size_t
>
(
histogram
->GetNbinsX()) + (
m_histDef
->kVecUO ? 2 : 0) != vars[0]->
size
() ) ) {
35
MsgStream log(
Athena::getMessageSvc
(),
"VecHistogramFiller1D"
);
36
log << MSG::WARNING <<
"Histogram "
<<
histogram
->GetName()
37
<<
" filled with kVec(UO) option with variable "
<< vars[0]->name()
38
<<
" have incompatible sizes (histogram) "
<<
histogram
->GetNbinsX()
39
<<
" (variable) "
<< vars[0]->
size
()
40
<<
" They ought to match exactly for kVec option or n. hist. bins +2 == var. size fro kVecOU"
<<
endmsg
;
41
return
0;
42
}
43
44
const
unsigned
offset =
m_histDef
->kVecUO ? 0 : 1;
45
for
(
unsigned
i = 0; i < vars[0]->
size
(); ++i) {
46
if
(vars.
cut
==
nullptr
or vars.
cut
->
get
(i)) {
47
const
double
value = vars[0]->get(i);
48
histogram
->AddBinContent(i+offset, value);
49
histogram
->SetEntries(
histogram
->GetEntries() + value);
50
}
51
}
52
53
return
vars[0]->
size
();
54
}
55
};
56
}
57
58
#endif
/* AthenaMonitoringKernel_HistogramFiller_VecHistogramFiller1D_h */
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition
AthUnlikelyMacros.h:17
HistogramFiller1D.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::HistogramFiller::m_histDef
std::shared_ptr< HistogramDef > m_histDef
Definition
HistogramFiller.h:180
Monitored::HistogramFiller::histogram
H * histogram() const
Definition
HistogramFiller.h:153
Monitored::IMonitoredVariable::get
virtual double get(size_t) const =0
Monitored::IMonitoredVariable::size
virtual size_t size() const =0
gives size of vector representation
Monitored::VecHistogramFiller1D::VecHistogramFiller1D
VecHistogramFiller1D(const HistogramDef &definition, std::shared_ptr< IHistogramProvider > provider)
Definition
VecHistogramFiller1D.h:13
Monitored::VecHistogramFiller1D::fill
virtual unsigned fill(const HistogramFiller::VariablesPack &vars) const override
Method that actually fills the ROOT object.
Definition
VecHistogramFiller1D.h:17
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
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
Generated on
for ATLAS Offline Software by
1.17.0