Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings after the change from Association to Link #73

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading