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
19 for (const auto hitSumm :{
20 "innerSmallHits", "innerLargeHits", "middleSmallHits", "middleLargeHits",
21 "outerSmallHits", "outerLargeHits", "extendedSmallHits", "extendedLargeHits",
22 "etaLayer1Hits", "phiLayer1Hits", "etaLayer2Hits", "phiLayer2Hits",
23 "etaLayer3Hits", "phiLayer3Hits", "etaLayer4Hits", "phiLayer4Hits"}){
24 m_hitDecorKeys.emplace_back(m_readKey, hitSumm);
25 }
26 ATH_CHECK(m_hitDecorKeys.initialize());
27 return StatusCode::SUCCESS;
28 }
29 StatusCode TruthHitSummaryAlg::execute(const EventContext& ctx) const {
30 const xAOD::TruthParticleContainer* truthMuons{nullptr};
31 ATH_CHECK(SG::get(truthMuons, m_readKey, ctx));
32 for (const xAOD::TruthParticle* truth : *truthMuons){
33 m_summaryTool->copySummary(m_summaryTool->makeSummary(ctx,
34 getTruthSegments(*truth)), *truth);
35 }
36 return StatusCode::SUCCESS;
37 }
38
39}
#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::WriteDecorHandleKeyArray< xAOD::TruthParticleContainer > m_hitDecorKeys
Declare the decorations written by this algorithm.
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.