ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgClassificationDecorationAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
#include <
AsgAnalysisAlgorithms/AsgClassificationDecorationAlg.h
>
9
#include <
xAODBase/IParticleHelpers.h
>
10
11
#include <unordered_map>
12
13
namespace
CP
14
{
15
16
StatusCode
AsgClassificationDecorationAlg::initialize
()
17
{
18
19
ANA_CHECK
(
m_particlesHandle
.initialize (
m_systematicsList
));
20
ANA_CHECK
(
m_classificationDecorator
.initialize (
m_systematicsList
,
m_particlesHandle
));
21
ANA_CHECK
(
m_systematicsList
.initialize());
22
23
ANA_CHECK
(
m_tool
.retrieve());
24
25
return
StatusCode::SUCCESS;
26
}
27
28
29
30
StatusCode
AsgClassificationDecorationAlg::execute
(
const
EventContext& ctx)
31
{
32
33
std::unordered_map<const xAOD::IParticle *, unsigned int> classifications;
34
35
for
(
const
auto
& sys :
m_systematicsList
.systematicsVector())
36
{
37
const
xAOD::IParticleContainer
*particles =
nullptr
;
38
ANA_CHECK
(
m_particlesHandle
.retrieve(particles, sys, ctx));
39
40
for
(
const
xAOD::IParticle
*particle : *particles)
41
{
42
const
xAOD::IParticle
*key =
xAOD::getOriginalObject
(*particle);
43
if
(key ==
nullptr
)
44
key = particle;
45
46
auto
iter = classifications.find (key);
47
if
(iter == classifications.end())
48
{
49
unsigned
int
classification = 0;
50
ANA_CHECK
(
m_tool
->classify (*particle, classification));
51
iter = classifications.emplace (key, classification).first;
52
}
53
m_classificationDecorator
.set (*particle, iter->second, sys);
54
}
55
}
56
57
return
StatusCode::SUCCESS;
58
}
59
60
}
// namespace CP
AsgClassificationDecorationAlg.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
IParticleHelpers.h
CP::AsgClassificationDecorationAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list we run
Definition
AsgClassificationDecorationAlg.h:39
CP::AsgClassificationDecorationAlg::m_classificationDecorator
CP::SysWriteDecorHandle< int > m_classificationDecorator
the decoration for the truth classification
Definition
AsgClassificationDecorationAlg.h:48
CP::AsgClassificationDecorationAlg::m_particlesHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
particles container handle
Definition
AsgClassificationDecorationAlg.h:43
CP::AsgClassificationDecorationAlg::m_tool
ToolHandle< IClassificationTool > m_tool
truth classifier tool handle
Definition
AsgClassificationDecorationAlg.h:35
CP::AsgClassificationDecorationAlg::initialize
virtual StatusCode initialize() override
Definition
AsgClassificationDecorationAlg.cxx:16
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::getOriginalObject
const IParticle * getOriginalObject(const IParticle ©)
This function can be used to conveniently get a pointer back to the original object from which a copy...
Definition
IParticleHelpers.cxx:140
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