ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTruthAlgs/src/TruthHitSummaryAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
4 ** @brief This alg receives the container of truth muons and decorates them
5 * with hit counts and coincidences in different positions of the detector,
6 * as well as hits'ID classified by chamber technology.
7*/
8
9#ifndef MUONTRUTHALGS_TruthHitSummaryAlg_H
10#define MUONTRUTHALGS_TruthHitSummaryAlg_H
11
12
13
20
22
24
25#include <map>
26
27namespace Muon {
28
30 public:
31
32 // Constructor with parameters:
33 using AthReentrantAlgorithm::AthReentrantAlgorithm;
34
35 // Basic algorithm methods:
36 virtual StatusCode initialize() override;
37 virtual StatusCode execute(const EventContext& ctx) const override;
38
43 using ChamberIdMap = std::map<Muon::MuonStationIndex::ChIndex, std::vector<Identifier>>;
44
45 private:
53 using llvec = std::vector<unsigned long long>;
55 friend struct summaryDecors;
57
58 explicit summaryDecors(const TruthHitSummaryAlg* parent,
59 const EventContext& ctx) :
60 m_parent{parent},
61 m_ctx{ctx} {}
62
64 const EventContext& m_ctx;
65
85
92
93 };
94
117 StatusCode addHitCounts(const EventContext& ctx,
118 const xAOD::TruthParticle& truthParticle,
119 ChamberIdMap& ids,
120 summaryDecors& myDecors) const;
121
128 StatusCode addHitIDVectors(const xAOD::TruthParticle& truthParticle,
129 const ChamberIdMap& ids,
130 summaryDecors& myDecors) const;
131
133 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_muonTruth{this, "muonTruth", "MuonTruthParticles"};
134
140 this, "PRD_TruthMaps", {"CSC_TruthMap", "RPC_TruthMap", "TGC_TruthMap", "MDT_TruthMap"}, "remove NSW by default for now, can always be changed in the configuration"};
141
152 WriteDecorKey_t m_nprecLayersKey{this, "nprecLayersKey", m_muonTruth, "nprecLayers", ""};
153 WriteDecorKey_t m_nphiLayersKey{this, "nphiLayersKey", m_muonTruth, "nphiLayers", ""};
154 WriteDecorKey_t m_ntrigEtaLayersKey{this, "ntrigEtaLayersKey", m_muonTruth, "ntrigEtaLayers", ""};
155 WriteDecorKey_t m_innerSmallHitsKey{this, "innerSmallHitsKey", m_muonTruth, "innerSmallHits", ""};
156 WriteDecorKey_t m_innerLargeHitsKey{this, "innerLargeHitsKey", m_muonTruth, "innerLargeHits", ""};
157 WriteDecorKey_t m_middleSmallHitsKey{this, "middleSmallHitsKey", m_muonTruth, "middleSmallHits", ""};
158 WriteDecorKey_t m_middleLargeHitsKey{this, "middleLargeHitsKey", m_muonTruth, "middleLargeHits", ""};
159 WriteDecorKey_t m_outerSmallHitsKey{this, "outerSmallHitsKey", m_muonTruth, "outerSmallHits", ""};
160 WriteDecorKey_t m_outerLargeHitsKey{this, "outerLargeHitsKey", m_muonTruth, "outerLargeHits", ""};
161 WriteDecorKey_t m_extendedSmallHitsKey{this, "extendedSmallHitsKey", m_muonTruth, "extendedSmallHits", ""};
162 WriteDecorKey_t m_extendedLargeHitsKey{this, "extendedLargeHitsKey", m_muonTruth, "extendedLargeHits", ""};
163 WriteDecorKey_t m_phiLayer1HitsKey{this, "phiLayer1HitsKey", m_muonTruth, "phiLayer1Hits", ""};
164 WriteDecorKey_t m_phiLayer2HitsKey{this, "phiLayer2HitsKey", m_muonTruth, "phiLayer2Hits", ""};
165 WriteDecorKey_t m_phiLayer3HitsKey{this, "phiLayer3HitsKey", m_muonTruth, "phiLayer3Hits", ""};
166 WriteDecorKey_t m_phiLayer4HitsKey{this, "phiLayer4HitsKey", m_muonTruth, "phiLayer4Hits", ""};
167 WriteDecorKey_t m_etaLayer1HitsKey{this, "etaLayer1HitsKey", m_muonTruth, "etaLayer1Hits", ""};
168 WriteDecorKey_t m_etaLayer2HitsKey{this, "etaLayer2HitsKey", m_muonTruth, "etaLayer2Hits", ""};
169 WriteDecorKey_t m_etaLayer3HitsKey{this, "etaLayer3HitsKey", m_muonTruth, "etaLayer3Hits", ""};
170 WriteDecorKey_t m_etaLayer4HitsKey{this, "etaLayer4HitsKey", m_muonTruth, "etaLayer4Hits", ""};
171
172 WriteDecorKey_t m_truthMdtHitsKey{this, "truthMdtHitsKey", m_muonTruth, "truthMdtHits", ""};
173 WriteDecorKey_t m_truthTgcHitsKey{this, "truthTgcHitsKey", m_muonTruth, "truthTgcHits", ""};
174 WriteDecorKey_t m_truthRpcHitsKey{this, "truthRpcHitsKey", m_muonTruth, "truthRpcHits", ""};
175 WriteDecorKey_t m_truthCscHitsKey{this, "truthCscHitskey", m_muonTruth, "truthCscHits", ""};
176 WriteDecorKey_t m_truthStgcHitsKey{this, "truthStgcHitsKey", m_muonTruth, "truthStgcHits", ""};
177 WriteDecorKey_t m_truthMMHitsKey{this, "truthMMHitsKey", m_muonTruth, "truthMMHits", ""};
178
180 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
181
182 };
183
184} // namespace Muon
185
186#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
std::map< Muon::MuonStationIndex::ChIndex, std::vector< Identifier > > ChamberIdMap
This map contains all the hits corresponding to truth muons classified by chamber layer that recorded...
virtual StatusCode execute(const EventContext &ctx) const override
StatusCode addHitIDVectors(const xAOD::TruthParticle &truthParticle, const ChamberIdMap &ids, summaryDecors &myDecors) const
This function collapses the information given by the ChamberIdMap, which contains all hits from a tru...
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_muonTruth
Key of the container of truth muons.
xAOD::ContainerDecorator< xAOD::TruthParticleContainer, std::uint8_t > WriteDecor_uint8_t
Struct object encapsulating all write-decorators.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle for muonIdHelper service.
std::vector< unsigned long long > llvec
SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_PRD_TruthNames
Keys for the containers of truth hits, grouped by detector technology.
xAOD::ContainerDecorator< xAOD::TruthParticleContainer, llvec > WriteDecor_llvec
StatusCode addHitCounts(const EventContext &ctx, const xAOD::TruthParticle &truthParticle, ChamberIdMap &ids, summaryDecors &myDecors) const
This is the actual function that decorates truth muons with hit counts.
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > WriteDecorKey_t
Key for each write-decorator.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
TruthParticle_v1 TruthParticle
Typedef to implementation.
summaryDecors(const TruthHitSummaryAlg *parent, const EventContext &ctx)