56 #include "CLHEP/Units/GlobalSystemOfUnits.h"
57 #include "CLHEP/Units/GlobalPhysicalConstants.h"
58 #include "CLHEP/Random/RandGaussQ.h"
59 #include "CLHEP/Random/RandPoisson.h"
60 #include "CLHEP/Random/RandFlat.h"
76 gaussQDistribution(0),
77 poissonDistribution(0),
79 minNumberInteractionsBohr(10.0),
80 theBohrBeta2(50.0*keV/proton_mass_c2),
130 const double meanLoss)
139 if (meanLoss <
minLoss)
return meanLoss;
149 double beta2 = 1.0 - 1.0/gam2;
152 double loss(0.), siga(0.);
158 if ((particleMass > electron_mass_c2) &&
162 double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
163 (1.+massrate*(2.*gam+massrate)) ;
164 if (tmaxkine <= 2.*tmax)
167 siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
170 double twomeanLoss = meanLoss + meanLoss;
171 if (twomeanLoss < siga) {
175 x = (loss - meanLoss)/siga;
176 }
while (1.0 - 0.5*x*x < flatDistribution->fire());
180 }
while (loss < 0. || loss > twomeanLoss);
201 double a1 = 0. , a2 = 0., a3 = 0. ;
206 double w2 =
log(2.*electron_mass_c2*beta2*gam2)-beta2;
227 double suma = a1+a2+a3;
259 if (loss < 0.) loss = 0.0;
276 double namean = p3*rfac;
281 double alfa1 = alfa*
log(alfa)/(alfa-1.);
290 double w = (tmax-
w2)/tmax;
304 a3 = meanLoss*(tmax-
e0)/(tmax*
e0*
log(tmax/
e0));
313 double w = (tmax-
e0)/tmax;
common ppss p3p6s2 common epss epspn46 common const1 w2
CLHEP::RandFlat * flatDistribution
SiG4UniversalFluctuation(CLHEP::HepRandomEngine &)
~SiG4UniversalFluctuation()
double SampleFluctuations(const double momentum, const double mass, double &tmax, const double length, const double meanLoss)
const T & max(const T &a, const T &b)
static const double tmax[3]
CLHEP::RandGaussQ * gaussQDistribution
CLHEP::RandPoisson * poissonDistribution
double minNumberInteractionsBohr
CLHEP::HepRandomEngine & rndEngine