From 2e155ff9239eec470342fb9e068798528ac88679 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:59:18 +0200 Subject: [PATCH] Fix warnings after the change from Association to Link (#73) Co-authored-by: jmcarcell --- SimG4Components/src/SimG4SaveSmearedParticles.cpp | 6 +++--- SimG4Components/src/SimG4SaveSmearedParticles.h | 4 ++-- SimG4Fast/src/components/SimG4FastSimHistograms.cpp | 8 ++++---- SimG4Fast/src/components/SimG4FastSimHistograms.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/SimG4Components/src/SimG4SaveSmearedParticles.cpp b/SimG4Components/src/SimG4SaveSmearedParticles.cpp index 495c329..c4b6272 100644 --- a/SimG4Components/src/SimG4SaveSmearedParticles.cpp +++ b/SimG4Components/src/SimG4SaveSmearedParticles.cpp @@ -9,7 +9,7 @@ // datamodel #include "edm4hep/ReconstructedParticleCollection.h" -#include "edm4hep/MCRecoParticleAssociationCollection.h" +#include "edm4hep/RecoMCParticleLinkCollection.h" // DD4hep #include "DD4hep/Segmentations.h" @@ -43,8 +43,8 @@ StatusCode SimG4SaveSmearedParticles::saveOutput(const G4Event& aEvent) { auto & MCparticle = info->mcParticle(); auto particle = particles->create(); auto association = associations->create(); - association.setRec(particle); - association.setSim(MCparticle); + association.setFrom(particle); + association.setTo(MCparticle); particle.setCharge(g4particle->GetCharge()); particle.setMomentum({ (float) (info->endMomentum().x() * sim::g42edm::energy), diff --git a/SimG4Components/src/SimG4SaveSmearedParticles.h b/SimG4Components/src/SimG4SaveSmearedParticles.h index 4fdd0ee..ba7e652 100644 --- a/SimG4Components/src/SimG4SaveSmearedParticles.h +++ b/SimG4Components/src/SimG4SaveSmearedParticles.h @@ -8,7 +8,7 @@ #include "k4FWCore/DataHandle.h" #include "SimG4Interface/ISimG4SaveOutputTool.h" -#include "edm4hep/MCRecoParticleAssociationCollection.h" +#include "edm4hep/RecoMCParticleLinkCollection.h" // datamodel namespace edm4hep { @@ -45,7 +45,7 @@ class SimG4SaveSmearedParticles : public AlgTool, virtual public ISimG4SaveOutpu /// Handle for the particles to be written mutable DataHandle m_particles{"RecParticlesSmeared", Gaudi::DataHandle::Writer, this}; /// Handle for the associations between particles and MC particles to be written - mutable DataHandle m_particlesMCparticles{"SmearedParticlesToParticles", + mutable DataHandle m_particlesMCparticles{"SmearedParticlesToParticles", Gaudi::DataHandle::Writer, this}; }; diff --git a/SimG4Fast/src/components/SimG4FastSimHistograms.cpp b/SimG4Fast/src/components/SimG4FastSimHistograms.cpp index c41a975..945715b 100644 --- a/SimG4Fast/src/components/SimG4FastSimHistograms.cpp +++ b/SimG4Fast/src/components/SimG4FastSimHistograms.cpp @@ -6,7 +6,7 @@ // datamodel #include "edm4hep/MCParticleCollection.h" #include "edm4hep/ReconstructedParticleCollection.h" -#include "edm4hep/MCRecoParticleAssociationCollection.h" +#include "edm4hep/RecoMCParticleLinkCollection.h" #include "CLHEP/Vector/ThreeVector.h" #include "TH1F.h" @@ -49,12 +49,12 @@ StatusCode SimG4FastSimHistograms::initialize() { StatusCode SimG4FastSimHistograms::execute(const EventContext&) const { const auto associations = m_particlesMCparticles.get(); for (const auto& assoc : *associations) { - auto mom_edm = assoc.getRec().getMomentum(); + auto mom_edm = assoc.getFrom().getMomentum(); CLHEP::Hep3Vector mom(mom_edm.x, mom_edm.y, mom_edm.z); m_eta->Fill(mom.eta()); m_p->Fill(mom.mag()); - m_pdg->Fill(assoc.getSim().getPDG()); - auto mom_edm_mc = assoc.getSim().getMomentum(); + m_pdg->Fill(assoc.getTo().getPDG()); + auto mom_edm_mc = assoc.getTo().getMomentum(); CLHEP::Hep3Vector momMC(mom_edm_mc.x, mom_edm_mc.y, mom_edm_mc.z); m_diffP->Fill((momMC.mag() - mom.mag()) / momMC.mag()); } diff --git a/SimG4Fast/src/components/SimG4FastSimHistograms.h b/SimG4Fast/src/components/SimG4FastSimHistograms.h index 7f27ec8..b2a6f83 100644 --- a/SimG4Fast/src/components/SimG4FastSimHistograms.h +++ b/SimG4Fast/src/components/SimG4FastSimHistograms.h @@ -8,7 +8,7 @@ #include "k4FWCore/DataHandle.h" class ITHistSvc; -#include "edm4hep/MCRecoParticleAssociationCollection.h" +#include "edm4hep/RecoMCParticleLinkCollection.h" // datamodel namespace edm4hep { @@ -45,7 +45,7 @@ class SimG4FastSimHistograms : public Gaudi::Algorithm { private: /// Handle for the EDM particles and MC particles associations to be read - mutable DataHandle m_particlesMCparticles{"ParticlesMCparticles", + mutable DataHandle m_particlesMCparticles{"ParticlesMCparticles", Gaudi::DataHandle::Reader, this}; /// Pointer to the interface of histogram service SmartIF m_histSvc;