ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetValidation
InDetPhysValMonitoring
src
TruthParticleIndexDecoratorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TruthParticleIndexDecoratorAlg.h
"
6
#include "
StoreGate/WriteDecorHandle.h
"
7
8
TruthParticleIndexDecoratorAlg::TruthParticleIndexDecoratorAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
9
AthReentrantAlgorithm
(name, pSvcLocator)
10
{
11
}
12
13
StatusCode
14
TruthParticleIndexDecoratorAlg::initialize
() {
15
16
ATH_CHECK
(
m_truthParticleName
.initialize());
17
if
(
m_indexDecor
.key().empty()) {
18
ATH_MSG_FATAL
(
"Empty truth index name."
);
19
return
StatusCode::FAILURE;
20
}
21
ATH_CHECK
(
m_indexDecor
.initialize() );
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
26
TruthParticleIndexDecoratorAlg::execute
(
const
EventContext &ctx)
const
{
27
SG::ReadHandle<xAOD::TruthParticleContainer>
ptruth(
m_truthParticleName
, ctx);
28
if
((not ptruth.
isValid
())) {
29
return
StatusCode::FAILURE;
30
}
31
SG::WriteDecorHandle<xAOD::TruthParticleContainer,unsigned int>
index_decorator(
m_indexDecor
, ctx);
32
33
for
(
const
xAOD::TruthParticle
*truth_particle : *ptruth) {
34
index_decorator(*truth_particle) = truth_particle->index();
35
}
36
return
StatusCode::SUCCESS;
37
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
WriteDecorHandle.h
Handle class for adding a decoration to an object.
TruthParticleIndexDecoratorAlg.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
TruthParticleIndexDecoratorAlg::m_truthParticleName
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name needed to create decorators.
Definition
TruthParticleIndexDecoratorAlg.h:26
TruthParticleIndexDecoratorAlg::initialize
virtual StatusCode initialize()
Definition
TruthParticleIndexDecoratorAlg.cxx:14
TruthParticleIndexDecoratorAlg::TruthParticleIndexDecoratorAlg
TruthParticleIndexDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TruthParticleIndexDecoratorAlg.cxx:8
TruthParticleIndexDecoratorAlg::m_indexDecor
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_indexDecor
Definition
TruthParticleIndexDecoratorAlg.h:29
TruthParticleIndexDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition
TruthParticleIndexDecoratorAlg.cxx:26
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
Generated on
for ATLAS Offline Software by
1.17.0