33 #include "Randomize.hh" 35 #include "G4ParticleTable.hh" 36 #include "G4PrimaryVertex.hh" 38 using namespace CLHEP;
52 sourcePosition(G4ThreeVector()),
81 G4double sin0= dr/
SSD;
82 G4double cos0= std::sqrt(1.-
sqr(sin0));
84 G4double dcos, dsin, dphi,
z;
94 xmax= ymax= DBL_MAX-1.;
97 while(! (std::abs(x)< xmax && std::abs(y)< ymax) ) {
98 dcos= RandFlat::shoot(cos0, 1.);
99 dsin= std::sqrt(1.-
sqr(dcos));
100 dphi= RandFlat::shoot(0., twopi);
102 x= std::cos(dphi)*dsin*dcos;
103 y= std::sin(dphi)*dsin*dcos;
107 return G4ThreeVector(x,y,z);
121 G4double mass=
particle-> GetPDGMass();
124 G4PrimaryParticle* primary=
new G4PrimaryParticle(
particle,
129 vertex-> SetPrimary(primary);
132 anEvent-> AddPrimaryVertex(vertex);
G4ParticleDefinition * particle
virtual void GeneratePrimaries(G4Event *anEvent)
G4ThreeVector sourcePosition
G4ThreeVector GenerateBeamDirection() const