ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
CopyNominalSelectionAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
9
//
10
// includes
11
//
12
13
#include <
AsgAnalysisAlgorithms/CopyNominalSelectionAlg.h
>
14
15
#include <
PATInterfaces/ISystematicsTool.h
>
16
17
//
18
// method implementations
19
//
20
21
namespace
CP
22
{
23
CopyNominalSelectionAlg ::
24
CopyNominalSelectionAlg (
const
std::string&
name
,
25
ISvcLocator* pSvcLocator)
26
:
AnaAlgorithm
(
name
, pSvcLocator)
27
{}
28
29
30
31
StatusCode CopyNominalSelectionAlg ::
32
initialize ()
33
{
34
ANA_CHECK
(
m_particlesHandle
.initialize (
m_systematicsList
));
35
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_particlesHandle
,
SG::AllowEmpty
));
36
ANA_CHECK
(
m_selectionHandle
.initialize (
m_systematicsList
,
m_particlesHandle
));
37
ANA_CHECK
(
m_systematicsList
.initialize());
38
39
ANA_CHECK
(
makeSelectionReadAccessor
(
m_selectionHandle
.getSelection(),
m_readAccessor
));
40
ANA_CHECK
(
m_readAccessor
->fillSystematics (
m_systematicsList
.service(),
m_systematicsList
.systematicsVector(),
m_particlesHandle
));
41
42
return
StatusCode::SUCCESS;
43
}
44
45
46
47
StatusCode CopyNominalSelectionAlg ::
48
execute (
const
EventContext& ctx)
49
{
50
static
const
SystematicSet
emptySys;
51
const
xAOD::IParticleContainer
*nominal =
nullptr
;
52
53
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
54
{
55
if
(sys.empty())
56
{
57
ANA_CHECK
(
m_particlesHandle
.retrieve (nominal, sys, ctx));
58
}
else
59
{
60
const
xAOD::IParticleContainer
*particles =
nullptr
;
61
ANA_CHECK
(
m_particlesHandle
.retrieve (particles, sys, ctx));
62
for
(std::size_t
index
= 0u;
index
!= particles->size(); ++
index
)
63
{
64
const
xAOD::IParticle
*particle = particles->at (
index
);
65
if
(
m_preselection
.getBool (*particle, sys))
66
{
67
bool
passedNominal =
m_readAccessor
->getBool (*nominal->
at
(
index
), &emptySys);
68
m_selectionHandle
.setBool (*particle, passedNominal, sys);
69
}
70
else
71
{
72
m_selectionHandle
.setBool (*particle,
false
, sys);
73
}
74
}
75
}
76
}
77
78
return
StatusCode::SUCCESS;
79
}
80
}
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CopyNominalSelectionAlg.h
ISystematicsTool.h
CP::CopyNominalSelectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
CopyNominalSelectionAlg.h:65
CP::CopyNominalSelectionAlg::m_selectionHandle
SysWriteSelectionHandle m_selectionHandle
the decoration for the asg selection
Definition
CopyNominalSelectionAlg.h:70
CP::CopyNominalSelectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition
CopyNominalSelectionAlg.h:60
CP::CopyNominalSelectionAlg::m_readAccessor
std::unique_ptr< ISelectionReadAccessor > m_readAccessor
the accessor we use
Definition
CopyNominalSelectionAlg.h:75
CP::CopyNominalSelectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
CopyNominalSelectionAlg.h:56
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition
SystematicSet.h:31
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
CP::makeSelectionReadAccessor
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
Definition
ISelectionAccessor.cxx:53
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
index
Definition
index.py:1
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0