Skip to content

Commit

Permalink
Set the edm4hep momentum as doubles once it becomes possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Feb 1, 2024
1 parent 24ed01b commit c11833b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions DDG4/edm4hep/Geant4Output2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <edm4hep/SimTrackerHitCollection.h>
#include <edm4hep/CaloHitContributionCollection.h>
#include <edm4hep/SimCalorimeterHitCollection.h>
#include <edm4hep/EDM4hepVersion.h>
/// podio include files
#include <podio/Frame.h>
#include <podio/ROOTFrameWriter.h>
Expand Down Expand Up @@ -342,12 +343,13 @@ void Geant4Output2EDM4hep::saveParticles(Geant4ParticleMap* particles) {
auto mcp = m_particles.create();
mcp.setPDG(p->pdgID);

float ps_fa[3] = {float(p->psx/CLHEP::GeV),float(p->psy/CLHEP::GeV),float(p->psz/CLHEP::GeV)};
mcp.setMomentum( ps_fa );

float pe_fa[3] = {float(p->pex/CLHEP::GeV),float(p->pey/CLHEP::GeV),float(p->pez/CLHEP::GeV)};
mcp.setMomentumAtEndpoint( pe_fa );

#if edm4hep_VERSION < EDM4HEP_VERSION(0, 10, 3)
mcp.setMomentum( {float(p->psx/CLHEP::GeV),float(p->psy/CLHEP::GeV),float(p->psz/CLHEP::GeV)} );
mcp.setMomentumAtEndpoint( {float(p->pex/CLHEP::GeV),float(p->pey/CLHEP::GeV),float(p->pez/CLHEP::GeV)} );
#else
mcp.setMomentum( {p->psx/CLHEP::GeV, p->psy/CLHEP::GeV, p->psz/CLHEP::GeV} );
mcp.setMomentumAtEndpoint( {p->pex/CLHEP::GeV, p->pey/CLHEP::GeV, p->pez/CLHEP::GeV} );
#endif
double vs_fa[3] = { p->vsx/CLHEP::mm, p->vsy/CLHEP::mm, p->vsz/CLHEP::mm } ;
mcp.setVertex( vs_fa );

Expand Down

0 comments on commit c11833b

Please sign in to comment.