diff --git a/MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/src/TruthSegToTruthPartAssocAlg.cxx b/MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/src/TruthSegToTruthPartAssocAlg.cxx index 429887b312bdb0b4201eae8af8dd50782d501029..81c92d489ad4dbea5e921721d11a58b69b138325 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/src/TruthSegToTruthPartAssocAlg.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/src/TruthSegToTruthPartAssocAlg.cxx @@ -10,6 +10,7 @@ #include "Identifier/Identifier.h" #include "MuonTruthHelpers/MuonSimHitHelpers.h" #include "MuonPatternEvent/SegmentFitterEventData.h" +#include "TruthUtils/HepMCHelpers.h" #include <unordered_set> @@ -58,7 +59,7 @@ namespace MuonR4{ segLinkDecor(*truthMuon).clear(); IdSet_t assocIds{}; ATH_MSG_DEBUG("Truth muon "<<truthMuon->pt()<<", eta: "<<truthMuon->eta()<<", "<<truthMuon->phi() - <<", barcode: "<<truthMuon->barcode()); + <<", barcode: "<<HepMC::barcode(truthMuon)); for (const IdDecorHandle_t& hitDecor : idDecorHandles) { std::ranges::transform(hitDecor(*truthMuon), std::inserter(assocIds, assocIds.begin()), [this](unsigned long long rawId){ @@ -121,7 +122,7 @@ namespace MuonR4{ } if (!counts) continue; ATH_MSG_VERBOSE("Truth muon "<<truthMuon->pt()<<", eta: "<<truthMuon->eta()<<", "<<truthMuon->phi() - <<", barcode: "<<truthMuon->barcode()<<", matched hits: "<<counts<<", unmatched: "<<std::endl<<unMatchedStr.str()); + <<", barcode: "<<HepMC::barcode(truthMuon)<<", matched hits: "<<counts<<", unmatched: "<<std::endl<<unMatchedStr.str()); } } continue; diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.cxx index 9a405b0a3a9a8c0f83004405f8c31576cccd76c3..a7038ca425b09897dd066ec2456fb2a07107e969 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.cxx +++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.cxx @@ -1,7 +1,12 @@ +/* + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration +*/ #include "TruthParentDecoratorAlg.h" #include "StoreGate/WriteDecorHandle.h" +#include "TruthUtils/HepMCHelpers.h" + #include <format> // structure to hold info on a matched parent particle @@ -333,8 +338,8 @@ StatusCode TruthParentDecoratorAlg::execute(const EventContext& cxt) const unsigned int n_parents = 0; for (const auto* p: psort) { unsigned int parent_index = n_parents++; - ATH_MSG_VERBOSE("pdgid: " << p->pdgId() << ", barcode: " << p->barcode()); - for (auto& [cbar, histbars]: findAllDescendants(p->barcode(), barcodex)) { + ATH_MSG_VERBOSE("pdgid: " << p->pdgId() << ", barcode: " << HepMC::barcode(p)); + for (auto& [cbar, histbars]: findAllDescendants(HepMC::barcode(p), barcodex)) { IPMap::mapped_type& barkids = ipmap.at(cbar); const xAOD::TruthParticle* child = selectChild(barkids); std::vector<std::pair<float, const J*>> drs; @@ -465,8 +470,8 @@ void TruthParentDecoratorAlg::addTruthContainer(Barcodex& barcodex,IPMap& ipmap, // insert a particle into the record, return the child set auto insert = [&barcodex, &ipmap](const xAOD::TruthParticle* p) -> auto& { - ipmap[p->barcode()].insert(p); - return barcodex[p->barcode()]; + ipmap[HepMC::barcode(p)].insert(p); + return barcodex[HepMC::barcode(p)]; }; for (const xAOD::TruthParticle* p: container) { @@ -488,7 +493,7 @@ void TruthParentDecoratorAlg::addTruthContainer(Barcodex& barcodex,IPMap& ipmap, } else { auto problem = std::format( "null truth child [barcode={},pdg_id={},child={}of{}]", - p->barcode(), p->pdgId(), child_n, p->nChildren()); + HepMC::barcode(p), p->pdgId(), child_n, p->nChildren()); const auto& warn_missing = m_warn_missing_children_pdgids.value(); if (warn_missing.contains(p->pdgId())) { m_missing_n_warned++; @@ -499,7 +504,7 @@ void TruthParentDecoratorAlg::addTruthContainer(Barcodex& barcodex,IPMap& ipmap, } } else if (cascadeWants(c)) { insert(c); - child_set.insert(c->barcode()); + child_set.insert(HepMC::barcode(c)); } }; } diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.h b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.h index f932d9d5a7898bb480d7772f7a5ff8c38b6db58c..d7a66801de3a48e59ea86f01ac76f5f8df79847a 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/TruthParentDecoratorAlg.h @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration +*/ #ifndef TRUTH_PARENT_DECORATOR_ALG #define TRUTH_PARENT_DECORATOR_ALG diff --git a/Tracking/Acts/ActsObjectDecoration/src/PixelClusterTruthDecorator.cxx b/Tracking/Acts/ActsObjectDecoration/src/PixelClusterTruthDecorator.cxx index bd5ab781781a521c86473259dcc027eb1b1008be..db271e24f225dc937303c37e002b13ab3fcd7625 100644 --- a/Tracking/Acts/ActsObjectDecoration/src/PixelClusterTruthDecorator.cxx +++ b/Tracking/Acts/ActsObjectDecoration/src/PixelClusterTruthDecorator.cxx @@ -1,9 +1,13 @@ +/* + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration +*/ #include "PixelClusterTruthDecorator.h" //output #include "xAODTracking/TrackMeasurementValidation.h" #include "xAODTracking/TrackMeasurementValidationContainer.h" #include "xAODTracking/TrackMeasurementValidationAuxContainer.h" +#include "TruthUtils/HepMCHelpers.h" #define AUXDATA(OBJ, TYP, NAME) \ static const SG::AuxElement::Accessor<TYP> acc_##NAME (#NAME); acc_##NAME(*(OBJ)) @@ -98,7 +102,7 @@ StatusCode PixelClusterTruthDecorator::execute(const EventContext& ctx) const { std::vector<unsigned int> tp_barcodes; for (auto tp : tps) { tp_indices.push_back(tp->index()); - tp_barcodes.push_back(tp->barcode()); + tp_barcodes.push_back(HepMC::barcode(tp)); } //TODO change how to decorate diff --git a/Tracking/Acts/ActsObjectDecoration/src/StripClusterTruthDecorator.cxx b/Tracking/Acts/ActsObjectDecoration/src/StripClusterTruthDecorator.cxx index 8b5d63a5a248b09419b50dc408bcffe1690d2e69..ae25e9398aa872a5d67fd7c9691c141f14684e43 100644 --- a/Tracking/Acts/ActsObjectDecoration/src/StripClusterTruthDecorator.cxx +++ b/Tracking/Acts/ActsObjectDecoration/src/StripClusterTruthDecorator.cxx @@ -1,9 +1,14 @@ +/* + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration +*/ +#include "PixelClusterTruthDecorator.h" #include "StripClusterTruthDecorator.h" //output #include "xAODTracking/TrackMeasurementValidation.h" #include "xAODTracking/TrackMeasurementValidationContainer.h" #include "xAODTracking/TrackMeasurementValidationAuxContainer.h" +#include "TruthUtils/HepMCHelpers.h" #define AUXDATA(OBJ, TYP, NAME) \ static const SG::AuxElement::Accessor<TYP> acc_##NAME (#NAME); acc_##NAME(*(OBJ)) @@ -109,7 +114,7 @@ namespace ActsTrk { std::vector<unsigned int> tp_barcodes; for (auto tp : tps) { tp_indices.push_back(tp->index()); - tp_barcodes.push_back(tp->barcode()); + tp_barcodes.push_back(HepMC::barcode(tp)); } //TODO move vectors