32 #include "Randomize.hh" 34 #include "G4ParticleTable.hh" 35 #include "G4PrimaryVertex.hh" 37 using namespace CLHEP;
51 sourcePosition(G4ThreeVector()),
80 G4double sin0= dr/
SSD;
81 G4double cos0= std::sqrt(1.-
sqr(sin0));
83 G4double dcos, dsin, dphi,
z;
93 xmax= ymax= DBL_MAX-1.;
97 dcos= RandFlat::shoot(cos0, 1.);
98 dsin= std::sqrt(1.-
sqr(dcos));
99 dphi= RandFlat::shoot(0., twopi);
101 x= std::cos(dphi)*dsin*dcos;
102 y= std::sin(dphi)*dsin*dcos;
106 return G4ThreeVector(x,y,z);
120 G4double mass=
particle-> GetPDGMass();
123 G4PrimaryParticle* primary=
new G4PrimaryParticle(
particle,
128 vertex-> SetPrimary(primary);
131 anEvent-> AddPrimaryVertex(vertex);
G4ParticleDefinition * particle
virtual void GeneratePrimaries(G4Event *anEvent)
constexpr auto abs(T v)
Returns the absolute value of the argument.
G4ThreeVector sourcePosition
G4ThreeVector GenerateBeamDirection() const