ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaMonitoringKernel
src
HistogramFiller
HistogramFiller2DProfile.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_HistogramFiller2DProfile_h
6
#define AthenaMonitoringKernel_HistogramFiller_HistogramFiller2DProfile_h
7
8
#include "TProfile2D.h"
9
10
#include "
HistogramFiller.h
"
11
12
namespace
Monitored
{
16
class
HistogramFiller2DProfile
:
public
HistogramFiller
{
17
public
:
18
HistogramFiller2DProfile
(
const
HistogramDef
& definition, std::shared_ptr<IHistogramProvider> provider)
19
:
HistogramFiller
(definition,
std
::move(provider)) {}
20
21
22
virtual
unsigned
fill
(
const
HistogramFiller::VariablesPack
& vars )
const override
{
23
if
( vars.
size
() != 3) {
24
return
0;
25
}
26
27
if
(vars.
cut
) {
28
const
size_t
maskSize = vars.
cut
->
size
();
29
// Abort if no cut entries or first (and only) entry is false
30
if
(maskSize == 0 || (maskSize == 1 && !vars.
cut
->
get
(0))) {
return
0; }
31
}
32
33
// Accessor for cut mask in case one is defined
34
auto
cutMaskAccessor = [&](
size_t
i) {
return
static_cast<
bool
>
(vars.
cut
->
get
(i)); };
35
36
if
(vars.
weight
) {
37
// Weighted fill
38
auto
weightAccessor = [&](
size_t
i){
return
vars.
weight
->
get
(i); };
39
const
size_t
size0 = vars[0]->
size
();
40
const
size_t
size1 = vars[1]->
size
();
41
const
size_t
size2 = vars[2]->
size
();
42
const
size_t
sizeWeight = vars.
weight
->
size
();
43
if
(
ATH_UNLIKELY
(size0 > 1 && size1 > 1 && size2 > 1 &&
44
sizeWeight > 1 && size0 != sizeWeight)) {
45
MsgStream log(
Athena::getMessageSvc
(),
"HistogramFiller2DProfile"
);
46
log << MSG::ERROR <<
"Weight does not match the size of plotted variable: "
47
<< vars.
weight
->
size
() <<
" "
<< size0 <<
endmsg
;
48
return
0;
49
}
50
// Need to fill here while weightVector is still in scope
51
if
(not vars.
cut
)
return
HistogramFiller::fill<TProfile2D>
(weightAccessor,
detail::noCut
, *vars[0], *vars[1], *vars[2]);
52
else
return
HistogramFiller::fill<TProfile2D>
(weightAccessor, cutMaskAccessor, *vars[0], *vars[1], *vars[2]);
53
}
54
// Unweighted fill
55
if
(not vars.
cut
)
return
HistogramFiller::fill<TProfile2D>
(
detail::noWeight
,
detail::noCut
, *vars[0], *vars[1], *vars[2]);
56
else
return
HistogramFiller::fill<TProfile2D>
(
detail::noWeight
, cutMaskAccessor, *vars[0], *vars[1], *vars[2]);
57
}
58
};
59
61
typedef
HistogramFillerRebinableAxis<HistogramFiller2DProfile, Axis::X>
HistogramFiller2DProfileRebinable
;
62
63
}
64
65
#endif
/* AthenaMonitoringKernel_HistogramFiller_HistogramFiller2DProfile_h */
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition
AthUnlikelyMacros.h:17
HistogramFiller.h
Monitored::HistogramFiller2DProfile::fill
virtual unsigned fill(const HistogramFiller::VariablesPack &vars) const override
Method that actually fills the ROOT object.
Definition
HistogramFiller2DProfile.h:22
Monitored::HistogramFiller2DProfile::HistogramFiller2DProfile
HistogramFiller2DProfile(const HistogramDef &definition, std::shared_ptr< IHistogramProvider > provider)
Definition
HistogramFiller2DProfile.h:18
Monitored::HistogramFillerRebinableAxis
Mixin class for rebinning of histogram axis.
Definition
HistogramFillerRebinable.h:24
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
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
Monitored::HistogramFiller2DProfileRebinable
HistogramFillerRebinableAxis< HistogramFiller2DProfile, Axis::X > HistogramFiller2DProfileRebinable
TProfile2D filler with rebinable x-axis.
Definition
HistogramFiller2DProfile.h:61
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