ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
Root
ParticleLevelChargeDecoratorAlg.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
#include "
TruthParticleLevelAnalysisAlgorithms/ParticleLevelChargeDecoratorAlg.h
"
8
9
#include <
AsgDataHandles/ReadHandle.h
>
10
#include <
AsgDataHandles/WriteDecorHandle.h
>
11
12
namespace
CP
{
13
14
StatusCode
ParticleLevelChargeDecoratorAlg::initialize
() {
15
16
ANA_CHECK
(
m_particlesKey
.initialize());
17
ANA_CHECK
(
m_decChargeKey
.initialize());
18
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
ParticleLevelChargeDecoratorAlg::execute
(
const
EventContext &ctx)
const
{
23
24
SG::ReadHandle<xAOD::TruthParticleContainer>
particles(
m_particlesKey
, ctx);
25
26
// decorators
27
SG::WriteDecorHandle<xAOD::TruthParticleContainer, float>
dec_charge(
m_decChargeKey
, ctx);
28
29
for
(
const
auto
* particle : *particles) {
30
31
// decorate the charge so we can save it later
32
dec_charge(*particle) = particle->charge();
33
}
34
return
StatusCode::SUCCESS;
35
}
36
37
}
// namespace CP
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
ParticleLevelChargeDecoratorAlg.h
CP::ParticleLevelChargeDecoratorAlg::initialize
virtual StatusCode initialize() final
Definition
ParticleLevelChargeDecoratorAlg.cxx:14
CP::ParticleLevelChargeDecoratorAlg::m_decChargeKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_decChargeKey
Definition
ParticleLevelChargeDecoratorAlg.h:29
CP::ParticleLevelChargeDecoratorAlg::m_particlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
Definition
ParticleLevelChargeDecoratorAlg.h:27
CP::ParticleLevelChargeDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
ParticleLevelChargeDecoratorAlg.cxx:22
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
Generated on
for ATLAS Offline Software by
1.17.0