ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleLevelChargeDecoratorAlg.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
8
9namespace CP {
10
12
13 ANA_CHECK(m_particlesKey.initialize());
14
15 return StatusCode::SUCCESS;
16}
17
18StatusCode ParticleLevelChargeDecoratorAlg::execute(const EventContext &ctx) const {
19
21
22 // decorators
23 static const SG::Decorator<float> dec_charge("charge");
24
25 for (const auto* particle : *particles) {
26
27 // decorate the charge so we can save it later
28 dec_charge(*particle) = particle->charge();
29 }
30 return StatusCode::SUCCESS;
31}
32
33} // namespace CP
#define ANA_CHECK(EXP)
check whether the given expression was successful
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
virtual StatusCode execute(const EventContext &ctx) const final
Helper class to provide type-safe access to aux data.
Definition Decorator.h:59
Select isolated Photons, Electrons and Muons.