In case a user uses many GeneratePrimaryVertex events in his PrimaryGeneratorAction and for each PrimaryVertex he uses SetParticleMomentum() with different momenta every time, then the warning message "Kinetic Energy is overwritten" is shown for most events after the first one. This is because the particle_energy left from the first GeneratePrimaryVertex() (in PrimaryGeneratorAction) is not reset (to zero) after the GeneratePrimaryVertex (in G4ParticleGun) has finished. I propose to add a SetInitialValues() at the end of GeneratePrimaryVertex like that . . . . particle->SetCharge( particle_charge ); particle->SetPolarization(particle_polarization.x(), particle_polarization.y(), particle_polarization.z()); vertex->SetPrimary( particle ); } evt->AddPrimaryVertex( vertex ); SetInitialValues(); }
If you specify the particle before setting its momentum, or set kinetic energy instead of momentum, this message should not appear.