ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgUnionPreselectionAlg.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
// includes
9
//
10
11
#include <
AsgAnalysisAlgorithms/AsgUnionPreselectionAlg.h
>
12
13
#include <
xAODBase/IParticle.h
>
14
15
//
16
// method implementations
17
//
18
19
namespace
CP
20
{
21
22
StatusCode AsgUnionPreselectionAlg ::
23
initialize ()
24
{
25
if
(
m_selectionDecoration
.empty())
26
{
27
ANA_MSG_ERROR
(
"Selection decoration can not be empty."
);
28
return
StatusCode::FAILURE;
29
}
30
if
(
m_preselection
.empty())
31
{
32
ANA_MSG_ERROR
(
"Preselection can not be empty."
);
33
return
StatusCode::FAILURE;
34
}
35
36
ANA_CHECK
(
m_particlesHandle
.initialize(
m_systematicsList
));
37
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_particlesHandle
));
38
ANA_CHECK
(
m_systematicsList
.initialize());
39
40
m_decorator
.emplace (
m_selectionDecoration
);
41
42
return
StatusCode::SUCCESS;
43
}
44
45
46
47
StatusCode AsgUnionPreselectionAlg ::
48
execute (
const
EventContext& ctx)
49
{
50
// first loop through systematics and set the default selection
51
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
52
{
53
const
xAOD::IParticleContainer
*particles =
nullptr
;
54
ANA_CHECK
(
m_particlesHandle
.retrieve (particles, sys, ctx));
55
for
(
auto
*particle : *particles)
56
{
57
(*m_decorator) (*particle) =
false
;
58
}
59
}
60
61
// second loop through systematics, and set the selection to true if
62
// particle passes the selection
63
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
64
{
65
const
xAOD::IParticleContainer
*particles =
nullptr
;
66
ANA_CHECK
(
m_particlesHandle
.retrieve (particles, sys, ctx));
67
for
(
auto
*particle : *particles)
68
{
69
if
(!(*
m_decorator
) (*particle) &&
m_preselection
.getBool (*particle, sys))
70
(*m_decorator) (*particle) =
true
;
71
}
72
}
73
74
return
StatusCode::SUCCESS;
75
}
76
77
}
// namespace CP
AsgUnionPreselectionAlg.h
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
IParticle.h
CP::AsgUnionPreselectionAlg::m_decorator
std::optional< SG::Decorator< char > > m_decorator
the accessor for m_selectionDecoration
Definition
AsgUnionPreselectionAlg.h:71
CP::AsgUnionPreselectionAlg::m_selectionDecoration
Gaudi::Property< std::string > m_selectionDecoration
the decoration of the selection
Definition
AsgUnionPreselectionAlg.h:67
CP::AsgUnionPreselectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition
AsgUnionPreselectionAlg.h:57
CP::AsgUnionPreselectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run and have containers
Definition
AsgUnionPreselectionAlg.h:53
CP::AsgUnionPreselectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
AsgUnionPreselectionAlg.h:62
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.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