ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/src/TruthHitSummaryAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
8
11
13namespace MuonR4{
15 ATH_CHECK(m_readKey.initialize());
16 ATH_CHECK(m_segLinkKey.initialize());
17 ATH_CHECK(m_summaryTool.retrieve());
18 return StatusCode::SUCCESS;
19 }
20 StatusCode TruthHitSummaryAlg::execute(const EventContext& ctx) const {
21 const xAOD::TruthParticleContainer* truthMuons{nullptr};
22 ATH_CHECK(SG::get(truthMuons, m_readKey, ctx));
23 for (const xAOD::TruthParticle* truth : *truthMuons){
24 m_summaryTool->copySummary(m_summaryTool->makeSummary(ctx,
25 getTruthSegments(*truth)), *truth);
26 }
27 return StatusCode::SUCCESS;
28 }
29
30}
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_readKey
input truth particle container
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool
The track summary tool filling the summary state from the associated segments.
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_segLinkKey
Dependency on the truth -> segment decoration.
virtual StatusCode execute(const EventContext &ctx) const override final
This header ties the generic definitions in this package.
std::vector< const xAOD::MuonSegment * > getTruthSegments(const xAOD::TruthParticle &truthMuon)
Returns the segments associated to the truth muon.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.