ATLAS Offline Software
MuonTruthSegmentCreationAlg.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, selects good muons according to
5  * their origin, creates segments, and store them into a new container. Segments are
6  * decorated with number and type of hits available, link to the
7  * corresponding truth muon, position and direction of the truth segment, and
8  * sector, chamber layer, station eta, and technology of the chamber where the
9  * segment has been recorded.
10 */
11 
12 #pragma once
13 
14 #include <map>
15 #include <string>
16 #include <vector>
17 
19 #include "GaudiKernel/ServiceHandle.h"
20 #include "Identifier/Identifier.h"
28 
31 
32 namespace MuonGM {
33  class MuonDetectorManager;
34 }
35 
36 namespace Muon {
37 
39  public:
40 
41  // Constructor with parameters:
42  using AthReentrantAlgorithm::AthReentrantAlgorithm;
43 
44  // Basic algorithm methods:
45  virtual StatusCode initialize() override;
46  virtual StatusCode execute(const EventContext& ctx) const override;
47 
52  using ChamberIdMap = std::map<Muon::MuonStationIndex::ChIndex, std::vector<Identifier>>;
53 
54  private:
55 
63  StatusCode fillChamberIdMap(const EventContext& ctx, const xAOD::TruthParticle& truthParticle, ChamberIdMap& ids) const;
64 
84  StatusCode createSegments(const EventContext& ctx,
86  const ChamberIdMap& ids,
87  xAOD::MuonSegmentContainer& segmentContainer) const;
88 
90  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_muonTruth{this, "muonTruth", "MuonTruthParticles"};
92 
96 
98  SG::WriteHandleKey<xAOD::MuonSegmentContainer> m_muonTruthSegmentContainerName{this, "MuonTruthSegmentName", "MuonTruthSegments"};
99 
102  this, "SDOs", {"RPC_SDO", "TGC_SDO", "MDT_SDO" }, "remove NSW by default for now, can always be changed in the configuration"};
104 
106  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
107 
109  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_detMgrKey{this, "DetectorManagerKey", "MuonDetectorManager",
110  "Key of input MuonDetectorManager condition data"};
111 
112  };
113 
114 } // namespace Muon
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
Muon::MuonTruthSegmentCreationAlg::m_truthHitsKeyArray
SG::ReadDecorHandleKeyArray< xAOD::TruthParticleContainer, std::vector< unsigned long long > > m_truthHitsKeyArray
Keys of the truth muon decorations that we need to read to (re-)fill the chamberIdMap.
Definition: MuonTruthSegmentCreationAlg.h:95
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Muon::MuonTruthSegmentCreationAlg::m_CSC_SDO_TruthNames
SG::ReadHandleKey< CscSimDataCollection > m_CSC_SDO_TruthNames
Definition: MuonTruthSegmentCreationAlg.h:103
Muon::MuonTruthSegmentCreationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: MuonTruthSegmentCreationAlg.cxx:59
TruthParticleContainer.h
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
Muon::MuonTruthSegmentCreationAlg::m_truthOriginKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_truthOriginKey
Definition: MuonTruthSegmentCreationAlg.h:91
Muon::MuonTruthSegmentCreationAlg::initialize
virtual StatusCode initialize() override
Definition: MuonTruthSegmentCreationAlg.cxx:37
SG::ReadHandleKey< xAOD::TruthParticleContainer >
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
MuonSegmentContainer.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
Muon::MuonTruthSegmentCreationAlg::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
Definition: MuonTruthSegmentCreationAlg.h:109
SG::WriteHandleKey< xAOD::MuonSegmentContainer >
Muon::MuonTruthSegmentCreationAlg
Definition: MuonTruthSegmentCreationAlg.h:38
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
MuonSimDataCollection
Definition: MuonSimDataCollection.h:21
Muon::MuonTruthSegmentCreationAlg::createSegments
StatusCode createSegments(const EventContext &ctx, const ElementLink< xAOD::TruthParticleContainer > &truthLink, const ChamberIdMap &ids, xAOD::MuonSegmentContainer &segmentContainer) const
This function performs, for each truth muon, the actual segment creation and stores segments into a n...
Definition: MuonTruthSegmentCreationAlg.cxx:119
Muon::MuonTruthSegmentCreationAlg::m_muonTruthSegmentContainerName
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_muonTruthSegmentContainerName
Key for segment container that will be populated with segments.
Definition: MuonTruthSegmentCreationAlg.h:98
CscSimDataCollection
Definition: CscSimDataCollection.h:29
Muon::MuonTruthSegmentCreationAlg::m_muonTruth
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_muonTruth
Key for the truth muon container and muon origin decoration.
Definition: MuonTruthSegmentCreationAlg.h:90
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Muon::MuonTruthSegmentCreationAlg::m_SDO_TruthNames
SG::ReadHandleKeyArray< MuonSimDataCollection > m_SDO_TruthNames
Keys for all çontainers of muon hit simulation data, classified by detector technology.
Definition: MuonTruthSegmentCreationAlg.h:101
Muon::MuonTruthSegmentCreationAlg::fillChamberIdMap
StatusCode fillChamberIdMap(const EventContext &ctx, const xAOD::TruthParticle &truthParticle, ChamberIdMap &ids) const
This function uses the 6 vectors, contained in.
Definition: MuonTruthSegmentCreationAlg.cxx:96
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager >
Muon::MuonTruthSegmentCreationAlg::ChamberIdMap
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...
Definition: MuonTruthSegmentCreationAlg.h:52
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer >
Muon::MuonTruthSegmentCreationAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle for the muonIdHelper service.
Definition: MuonTruthSegmentCreationAlg.h:106
ReadDecorHandleKeyArray.h
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >