ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgPriorityDecorationAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
#include <
AsgAnalysisAlgorithms/AsgPriorityDecorationAlg.h
>
9
10
11
namespace
CP
12
{
13
14
StatusCode
AsgPriorityDecorationAlg::initialize
()
15
{
16
if
(
m_priorityDecoration
.empty())
17
{
18
ANA_MSG_ERROR
(
"Priority decoration name should not be empty."
);
19
return
StatusCode::FAILURE;
20
}
21
22
if
(
m_priorities
.size() !=
m_preselections
.size())
23
{
24
ANA_MSG_ERROR
(
"Preselections and priority values need to be of the same size."
);
25
return
StatusCode::FAILURE;
26
}
27
28
if
(!std::is_sorted(std::rbegin(
m_priorities
.value()), std::rend(
m_priorities
.value())))
29
{
30
ANA_MSG_ERROR
(
"Priorities need to be provided in reverse order."
);
31
return
StatusCode::FAILURE;
32
}
33
34
m_priorityDecorator
= std::make_unique<SG::Decorator<char> > (
m_priorityDecoration
);
35
36
ANA_CHECK
(
m_particlesHandle
.initialize (
m_systematicsList
));
37
ANA_CHECK
(
m_preselections
.initialize (
m_systematicsList
,
m_particlesHandle
));
38
ANA_CHECK
(
m_systematicsList
.initialize());
39
40
return
StatusCode::SUCCESS;
41
}
42
43
44
45
StatusCode
AsgPriorityDecorationAlg::execute
(
const
EventContext& ctx)
46
{
47
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
48
{
49
const
xAOD::IParticleContainer
*particles{};
50
ANA_CHECK
(
m_particlesHandle
.retrieve(particles, sys, ctx));
51
52
for
(
const
xAOD::IParticle
*particle : *particles)
53
{
54
bool
passed
{};
55
for
(
size_t
i{}; i <
m_preselections
.size(); i++)
56
{
57
if
(
m_preselections
.at(i).getBool (*particle, sys))
58
{
59
(*m_priorityDecorator)(*particle) =
m_priorities
[i];
60
passed
=
true
;
61
break
;
62
}
63
}
64
65
// decorate default priority
66
if
(!
passed
)
67
{
68
(*m_priorityDecorator)(*particle) = 0;
69
}
70
}
71
}
72
return
StatusCode::SUCCESS;
73
}
74
75
}
// namespace CP
AsgPriorityDecorationAlg.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
passed
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
CP::AsgPriorityDecorationAlg::m_priorities
Gaudi::Property< std::vector< int > > m_priorities
the values of the priorities
Definition
AsgPriorityDecorationAlg.h:47
CP::AsgPriorityDecorationAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
AsgPriorityDecorationAlg.h:33
CP::AsgPriorityDecorationAlg::initialize
virtual StatusCode initialize() override
Definition
AsgPriorityDecorationAlg.cxx:14
CP::AsgPriorityDecorationAlg::m_preselections
SysReadSelectionHandleArray m_preselections
the preselection we apply to our input
Definition
AsgPriorityDecorationAlg.h:37
CP::AsgPriorityDecorationAlg::m_priorityDecorator
std::unique_ptr< const SG::Decorator< char > > m_priorityDecorator
the accessor for m_priorityDecoration
Definition
AsgPriorityDecorationAlg.h:55
CP::AsgPriorityDecorationAlg::m_priorityDecoration
Gaudi::Property< std::string > m_priorityDecoration
the decoration for the priority
Definition
AsgPriorityDecorationAlg.h:51
CP::AsgPriorityDecorationAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
particles container handle
Definition
AsgPriorityDecorationAlg.h:42
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
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
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