28 #include "MedicalBeam.hh"
34 using namespace CLHEP;
41 SSD(1.*
m), fieldShape(MedicalBeam::SQUARE), fieldR(10.*
cm)
45 particle = particleTable-> FindParticle(
"proton");
64 dr = std::sqrt(
sqr(fieldXY[0]/2.) +
sqr(fieldXY[1]/2.));
80 xmax = fieldXY[0]/2./SSD;
81 ymax = fieldXY[1]/2./SSD;
86 while(! (std::abs(x) < xmax && std::abs(y) < ymax) ) {
87 dcos = RandFlat::shoot(cos0, 1.);
88 dsin = std::sqrt(1.-
sqr(dcos));
89 dphi = RandFlat::shoot(0.,
twopi);
91 x = std::cos(dphi)*dsin*dcos;
92 y = std::sin(dphi)*dsin*dcos;
102 if ( particle == 0 )
return;
108 G4double mass = particle-> GetPDGMass();
115 vertex-> SetPrimary(primary);
118 anEvent-> AddPrimaryVertex(vertex);