38 return StatusCode::SUCCESS;
50 assert(truthPart !=
nullptr);
51 assert(truthMuon != truthPart);
52 ATH_CHECK(truthPartToMuonMap.insert(std::make_pair(truthPart, truthMuon)).second);
58 using enum xAOD::Muon::TrackParticleType;
60 Link_t& truthLink = truthLinkDecor(*muon);
64 if (idTrack !=
nullptr) {
66 truth = truthPartToMuonMap.insert(std::make_pair(truth, truth)).first->second;
67 truthLink = createLink(truth);
68 if (truth !=
nullptr ){
72 std::unordered_map<const xAOD::TruthParticle*, unsigned> counts{};
73 for (
unsigned seg =0 ; seg < muon->nMuonSegments(); ++ seg) {
80 const auto* truth = std::ranges::max_element(counts, [](
const auto&
a,
const auto& b){
81 return a.second < b.second;
83 truthLink = createLink(truth);
86 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
ElementLink< xAOD::TruthParticleContainer > Link_t
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
ElementLink implementation for ROOT usage.
SG::ReadHandleKey< xAOD::MuonContainer > m_muonKey
the actual muon container that we want to decorate
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trkKeys
Additional track container dependencies.
virtual StatusCode execute(const EventContext &ctx) const override final
virtual StatusCode initialize() override final
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Declare the dependency on the truth particle container.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Declare the dependency on the reconstructed segment container to establish the reco -> truth link fro...
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_truthPartLinkKey
Explicitly declare the truth particle link decoration.
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_decorKeys
Collector of all the decoration dependencies what are implicitly needed.
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
This header ties the generic definitions in this package.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.