Skip to content

Commit

Permalink
Fix warnings after the change from Association to Link
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 29, 2024
1 parent 1a66dc9 commit d3eef4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions SimG4Components/src/SimG4SaveSmearedParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// datamodel
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/MCRecoParticleAssociationCollection.h"
#include "edm4hep/RecoMCParticleLinkCollection.h"

// DD4hep
#include "DD4hep/Segmentations.h"
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions SimG4Components/src/SimG4SaveSmearedParticles.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "k4FWCore/DataHandle.h"
#include "SimG4Interface/ISimG4SaveOutputTool.h"

#include "edm4hep/MCRecoParticleAssociationCollection.h"
#include "edm4hep/RecoMCParticleLinkCollection.h"

// datamodel
namespace edm4hep {
Expand Down Expand Up @@ -45,7 +45,7 @@ class SimG4SaveSmearedParticles : public AlgTool, virtual public ISimG4SaveOutpu
/// Handle for the particles to be written
mutable DataHandle<edm4hep::ReconstructedParticleCollection> m_particles{"RecParticlesSmeared", Gaudi::DataHandle::Writer, this};
/// Handle for the associations between particles and MC particles to be written
mutable DataHandle<edm4hep::MCRecoParticleAssociationCollection> m_particlesMCparticles{"SmearedParticlesToParticles",
mutable DataHandle<edm4hep::RecoMCParticleLinkCollection> m_particlesMCparticles{"SmearedParticlesToParticles",
Gaudi::DataHandle::Writer, this};
};

Expand Down
8 changes: 4 additions & 4 deletions SimG4Fast/src/components/SimG4FastSimHistograms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions SimG4Fast/src/components/SimG4FastSimHistograms.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "k4FWCore/DataHandle.h"
class ITHistSvc;

#include "edm4hep/MCRecoParticleAssociationCollection.h"
#include "edm4hep/RecoMCParticleLinkCollection.h"

// datamodel
namespace edm4hep {
Expand Down Expand Up @@ -45,7 +45,7 @@ class SimG4FastSimHistograms : public Gaudi::Algorithm {

private:
/// Handle for the EDM particles and MC particles associations to be read
mutable DataHandle<edm4hep::MCRecoParticleAssociationCollection> m_particlesMCparticles{"ParticlesMCparticles",
mutable DataHandle<edm4hep::RecoMCParticleLinkCollection> m_particlesMCparticles{"ParticlesMCparticles",
Gaudi::DataHandle::Reader, this};
/// Pointer to the interface of histogram service
SmartIF<ITHistSvc> m_histSvc;
Expand Down

0 comments on commit d3eef4a

Please sign in to comment.