ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
Root
ParticleLevelPtEtaPhiDecoratorAlg.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/ParticleLevelPtEtaPhiDecoratorAlg.h
"
8
9
#include <
AsgDataHandles/ReadHandle.h
>
10
#include <
AsgDataHandles/WriteDecorHandle.h
>
11
12
namespace
CP
{
13
14
StatusCode
ParticleLevelPtEtaPhiDecoratorAlg::initialize
() {
15
16
ANA_CHECK
(
m_particlesKey
.initialize());
17
ANA_CHECK
(
m_decPtKey
.initialize());
18
ANA_CHECK
(
m_decEtaKey
.initialize());
19
ANA_CHECK
(
m_decPhiKey
.initialize());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
ParticleLevelPtEtaPhiDecoratorAlg::execute
(
const
EventContext &ctx)
const
{
25
26
SG::ReadHandle<xAOD::TruthParticleContainer>
particles(
m_particlesKey
, ctx);
27
28
// decorators
29
SG::WriteDecorHandle<xAOD::TruthParticleContainer, float>
dec_pt(
m_decPtKey
, ctx);
30
SG::WriteDecorHandle<xAOD::TruthParticleContainer, float>
dec_eta(
m_decEtaKey
, ctx);
31
SG::WriteDecorHandle<xAOD::TruthParticleContainer, float>
dec_phi(
m_decPhiKey
, ctx);
32
33
for
(
const
auto
* particle : *particles) {
34
35
// decorate pT/eta/phi of the truth particle
36
// (Energy is already decorated at DAOD-level!)
37
dec_pt(*particle) = particle->pt();
38
dec_eta(*particle) = particle->eta();
39
dec_phi(*particle) = particle->phi();
40
}
41
return
StatusCode::SUCCESS;
42
}
43
44
}
// 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
ParticleLevelPtEtaPhiDecoratorAlg.h
CP::ParticleLevelPtEtaPhiDecoratorAlg::m_particlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
Definition
ParticleLevelPtEtaPhiDecoratorAlg.h:27
CP::ParticleLevelPtEtaPhiDecoratorAlg::m_decPhiKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_decPhiKey
Definition
ParticleLevelPtEtaPhiDecoratorAlg.h:33
CP::ParticleLevelPtEtaPhiDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
ParticleLevelPtEtaPhiDecoratorAlg.cxx:24
CP::ParticleLevelPtEtaPhiDecoratorAlg::m_decPtKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_decPtKey
Definition
ParticleLevelPtEtaPhiDecoratorAlg.h:29
CP::ParticleLevelPtEtaPhiDecoratorAlg::initialize
virtual StatusCode initialize() final
Definition
ParticleLevelPtEtaPhiDecoratorAlg.cxx:14
CP::ParticleLevelPtEtaPhiDecoratorAlg::m_decEtaKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_decEtaKey
Definition
ParticleLevelPtEtaPhiDecoratorAlg.h:31
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