ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
SelectionHelpers
Root
SelectionAccessorList.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
SelectionHelpers/SelectionAccessorList.h
>
13
14
#include <
PATInterfaces/SystematicSet.h
>
15
16
//
17
// method implementations
18
//
19
20
namespace
CP
21
{
22
SelectionAccessorList ::
23
SelectionAccessorList (std::vector<std::unique_ptr<ISelectionReadAccessor> > val_list)
24
:
m_list
(
std
::move (val_list))
25
{
26
for
(
const
std::unique_ptr<ISelectionReadAccessor> &
acc
:
m_list
)
27
{
28
if
(!
m_label
.empty())
29
m_label
.append(
" && "
);
30
31
m_label
.append(
acc
->label());
32
}
33
34
m_label
=
"( "
+
m_label
+
" )"
;
35
}
36
37
38
39
SelectionType
SelectionAccessorList ::
40
getBits (
const
SG::AuxElement
& element,
41
const
CP::SystematicSet
*sys)
const
42
{
43
// total number of bits in SelectionType
44
constexpr
size_t
SelectionTotalBits = 8 *
sizeof
(
SelectionType
);
45
46
// if we have more cuts than bits, just return true/false
47
if
(
m_list
.size() > SelectionTotalBits)
48
{
49
if
(
getBool
(element, sys))
50
return
selectionAccept
();
51
else
52
return
0;
53
}
54
55
SelectionType
result =
selectionAccept
();
56
for
(std::size_t iter = 0; iter !=
m_list
.size(); ++ iter)
57
{
58
if
(
m_list
[iter]->
getBool
(element, sys) ==
false
)
59
{
60
result = result & ~(
SelectionType
(1) << iter);
61
}
62
}
63
return
result;
64
}
65
66
67
68
bool
SelectionAccessorList ::
69
getBool (
const
SG::AuxElement
& element,
70
const
CP::SystematicSet
*sys)
const
71
{
72
for
(
auto
& accessor :
m_list
)
73
{
74
if
(!accessor->getBool (element, sys))
75
return
false
;
76
}
77
return
true
;
78
}
79
80
81
std::string SelectionAccessorList ::
82
label ()
const
83
{
84
return
m_label
;
85
}
86
87
88
89
bool
SelectionAccessorList ::
90
isBool ()
const
91
{
92
return
false
;
93
}
94
95
96
97
CP::SystematicSet
SelectionAccessorList ::
98
getInputAffecting (
const
ISystematicsSvc
& svc,
99
const
std::string& objectName)
const
100
{
101
CP::SystematicSet
result;
102
103
for
(
auto
&
base
:
m_list
)
104
result.insert (
base
->getInputAffecting (svc, objectName));
105
return
result;
106
}
107
108
109
110
StatusCode SelectionAccessorList ::
111
fillSystematics (
const
ISystematicsSvc
& svc,
112
const
std::vector<CP::SystematicSet>& sysList,
113
ISysObjectHandleBase
& objectHandle)
114
{
115
using namespace
msgSelectionHelpers;
116
117
for
(
auto
&
base
:
m_list
)
118
ANA_CHECK
(
base
->fillSystematics (svc, sysList, objectHandle));
119
return
StatusCode::SUCCESS;
120
}
121
}
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
SelectionAccessorList.h
SystematicSet.h
CP::ISysObjectHandleBase
a ISysHandleBase for a handle to a specific object/container
Definition
ISysHandleBase.h:58
CP::ISystematicsSvc
the interface for the central systematics service
Definition
ISystematicsSvc.h:26
CP::SelectionAccessorList::m_label
std::string m_label
the label of the accessor
Definition
SelectionAccessorList.h:68
CP::SelectionAccessorList::m_list
std::vector< std::unique_ptr< ISelectionReadAccessor > > m_list
the list of selection accessors I rely on
Definition
SelectionAccessorList.h:64
CP::SelectionAccessorList::getBool
virtual bool getBool(const SG::AuxElement &element, const CP::SystematicSet *sys) const override
get the selection decoration
Definition
SelectionAccessorList.cxx:69
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition
SystematicSet.h:31
base
std::string base
Definition
hcg.cxx:83
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
CP::SelectionType
uint32_t SelectionType
the type for selection decorations that are meant to hold a asg::AcceptData
Definition
SelectionHelpers.h:26
CP::selectionAccept
constexpr SelectionType selectionAccept()
the selection decoration to apply for objects that are selected
Definition
SelectionHelpers.h:35
SG::AuxElement
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
std
STL namespace.
xAOD::acc
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
Generated on
for ATLAS Offline Software by
1.17.0