diff --git a/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc b/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc index ea55ab190aa90..685185d8b5155 100644 --- a/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc +++ b/IOMC/ParticleGuns/src/FlatRandomPtAndDxyGunProducer.cc @@ -109,7 +109,9 @@ void FlatRandomPtAndDxyGunProducer::produce(Event& e, const EventSetup& es) { break; } - HepMC::GenVertex* Vtx1 = new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz)); + float time = sqrt(vx * vx + vy * vy + vz * vz); + + HepMC::GenVertex* Vtx1 = new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz, time)); int PartID = fPartIDs[ip]; const HepPDT::ParticleData* PData = fPDGTable->particle(HepPDT::ParticleID(abs(PartID))); @@ -124,7 +126,7 @@ void FlatRandomPtAndDxyGunProducer::produce(Event& e, const EventSetup& es) { fEvt->add_vertex(Vtx1); if (fAddAntiParticle) { - HepMC::GenVertex* Vtx2 = new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz)); + HepMC::GenVertex* Vtx2 = new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz, time)); HepMC::FourVector ap(-px, -py, -pz, energy); int APartID = -PartID; if (PartID == 22 || PartID == 23) {