11 using SimHitVec_t = std::vector<const xAOD::MuonSimHit*>;
12 using MCPartSimMap_t = std::unordered_map<HepMC::ConstGenParticlePtr, SimHitVec_t>;
22 return StatusCode::SUCCESS;
29 MCPartSimMap_t hitIdMap{};
31 if (!hit->genParticleLink().isValid()){
34 const auto& pl{hit->genParticleLink()};
35 hitIdMap[pl].push_back(hit);
42 std::vector<unsigned long long>& hitIds{idDecorator(*muon)};
44 for (
const auto& [pl, hits] : hitIdMap) {
46 if (std::ranges::any_of(history,[&linkId](
const auto uniqueId){
47 return linkId == uniqueId;
49 std::ranges::transform(hits, std::back_inserter(hitIds),
56 return StatusCode::SUCCESS;
#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.
value_type get_compact() const
Get the compact id.
virtual StatusCode initialize() override final
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_hitDecorKey
Decoration to the hit identifier vector.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Data dependency on the truth input container to decorate.
SG::ReadHandleKey< xAOD::MuonSimHitContainer > m_simHitKey
Data dependency on the sim hit container.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc for Identifier printing / manipulation.
virtual StatusCode execute(const EventContext &ctx) const override final
Handle class for adding a decoration to an object.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
std::deque< int > simulation_history(const T &p, const int direction)
Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.
This header ties the generic definitions in this package.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
TruthParticle_v1 TruthParticle
Typedef to implementation.
MuonSimHitContainer_v1 MuonSimHitContainer
Define the version of the pixel cluster container.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.