ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgSelectionAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
9
//
10
// includes
11
//
12
13
#include <
AsgAnalysisAlgorithms/AsgSelectionAlg.h
>
14
15
#include <
PATInterfaces/ISystematicsTool.h
>
16
17
//
18
// method implementations
19
//
20
21
namespace
CP
22
{
23
24
StatusCode AsgSelectionAlg ::
25
initialize ()
26
{
27
if
(!
m_selectionTool
.empty())
28
{
29
ANA_CHECK
(
m_selectionTool
.retrieve());
30
m_systematicsTool
=
dynamic_cast<
ISystematicsTool
*
>
(&*
m_selectionTool
);
31
if
(
m_systematicsTool
)
32
ANA_CHECK
(
m_systematicsList
.addSystematics (*
m_systematicsTool
));
33
}
34
35
ANA_CHECK
(
m_particlesHandle
.initialize (
m_systematicsList
));
36
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_particlesHandle
,
SG::AllowEmpty
));
37
ANA_CHECK
(
m_selectionHandle
.initialize (
m_systematicsList
,
m_particlesHandle
));
38
ANA_CHECK
(
m_systematicsList
.initialize());
39
40
if
(!
m_selectionTool
.empty())
41
{
42
asg::AcceptData
blankAccept (&
m_selectionTool
->getAcceptInfo());
43
// Just in case this isn't initially set up as a failure clear it this one
44
// time. This only calls reset on the bitset
45
blankAccept.
clear
();
46
m_setOnFail
=
selectionFromAccept
(blankAccept);
47
48
if
(!
m_nameSvc
.empty())
49
{
50
ANA_CHECK
(
m_nameSvc
.retrieve());
51
ANA_CHECK
(
m_nameSvc
->addAcceptInfo (
m_particlesHandle
.getNamePattern(),
m_selectionHandle
.getLabel(),
52
m_selectionTool
->getAcceptInfo()));
53
}
54
}
55
56
return
StatusCode::SUCCESS;
57
}
58
59
60
61
StatusCode AsgSelectionAlg ::
62
execute (
const
EventContext& ctx)
63
{
64
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
65
{
66
if
(
m_systematicsTool
)
67
ANA_CHECK
(
m_systematicsTool
->applySystematicVariation (sys));
68
69
const
xAOD::IParticleContainer
*particles =
nullptr
;
70
ANA_CHECK
(
m_particlesHandle
.retrieve (particles, sys, ctx));
71
for
(
const
xAOD::IParticle
*particle : *particles)
72
{
73
if
(
m_preselection
.getBool (*particle, sys))
74
{
75
if
(!
m_selectionTool
.empty())
76
{
77
m_selectionHandle
.setBits
78
(*particle,
selectionFromAccept
(
m_selectionTool
->accept (particle)), sys);
79
}
80
else
81
{
82
m_selectionHandle
.setBool (*particle,
true
, sys);
83
}
84
}
85
else
86
{
87
if
(!
m_selectionTool
.empty())
88
{
89
m_selectionHandle
.setBits (*particle,
m_setOnFail
, sys);
90
}
91
else
92
{
93
m_selectionHandle
.setBool (*particle,
false
, sys);
94
}
95
}
96
}
97
}
98
99
return
StatusCode::SUCCESS;
100
}
101
}
AsgSelectionAlg.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ISystematicsTool.h
CP::AsgSelectionAlg::m_setOnFail
SelectionType m_setOnFail
the bits to set for an object failing the preselection
Definition
AsgSelectionAlg.h:91
CP::AsgSelectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition
AsgSelectionAlg.h:72
CP::AsgSelectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
AsgSelectionAlg.h:68
CP::AsgSelectionAlg::m_selectionHandle
SysWriteSelectionHandle m_selectionHandle
the decoration for the asg selection
Definition
AsgSelectionAlg.h:82
CP::AsgSelectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
AsgSelectionAlg.h:77
CP::AsgSelectionAlg::m_systematicsTool
ISystematicsTool * m_systematicsTool
the smearing tool cast to an ISystematicsTool
Definition
AsgSelectionAlg.h:64
CP::AsgSelectionAlg::m_nameSvc
ServiceHandle< ISelectionNameSvc > m_nameSvc
the ISelectionNameSvc
Definition
AsgSelectionAlg.h:87
CP::AsgSelectionAlg::m_selectionTool
ToolHandle< IAsgSelectionTool > m_selectionTool
the smearing tool
Definition
AsgSelectionAlg.h:56
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition
ISystematicsTool.h:32
asg::AcceptData
Definition
AcceptData.h:31
asg::AcceptData::clear
void clear()
Clear all bits.
Definition
AcceptData.h:55
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::selectionFromAccept
SelectionType selectionFromAccept(const asg::AcceptData &accept)
the selection decoration made from the given AcceptData object
Definition
SelectionHelpers.cxx:32
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
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