16 #include "G4ParticleGun.hh"
17 #include "G4GeneralParticleSource.hh"
18 #include "G4ParticleTable.hh"
19 #include "G4ParticleDefinition.hh"
20 #include "G4SystemOfUnits.hh"
21 #include "Randomize.hh"
23 #ifdef eAST_USE_HepMC3
25 #endif // eAST_USE_HepMC3
28 G4bool useParticleGun, G4bool useParticleSource,
29 G4bool useHepMC3Interface)
30 : G4VUserPrimaryGeneratorAction()
36 auto particleTable = G4ParticleTable::GetParticleTable();
37 auto fPion = particleTable->FindParticle(
"pi+");
41 fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
42 fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
49 #ifdef eAST_USE_HepMC3
50 if(useHepMC3Interface)
52 #endif // eAST_USE_HepMC3
62 #ifdef eAST_USE_HepMC3
64 {
delete fHepMC3Interface; }
65 #endif // eAST_USE_HepMC3
74 #ifdef eAST_USE_HepMC3
75 if(fHepMC3Interface) fHepMC3Interface->GeneratePrimaryVertex(event);
76 #endif // eAST_USE_HepMC3
78 G4int evId =
event->GetEventID();
79 G4double tVtx =
deltaT * (G4double)evId +
T0;
80 auto* pv =
event->GetPrimaryVertex();
83 pv->SetT0(pv->GetT0() + tVtx);