56 #include "CLHEP/Units/GlobalSystemOfUnits.h"
57 #include "CLHEP/Units/GlobalPhysicalConstants.h"
58 #include "CLHEP/Random/RandGaussQ.h"
59 #include "CLHEP/Random/RandPoissonQ.h"
60 #include "CLHEP/Random/RandFlat.h"
77 gaussQDistribution(0),
78 poissonQDistribution(0),
80 minNumberInteractionsBohr(10.0),
81 theBohrBeta2(50.0*keV/proton_mass_c2),
131 const double meanLoss)
140 if (meanLoss <
minLoss)
return meanLoss;
150 double beta2 = 1.0 - 1.0/gam2;
151 double gam =
sqrt(gam2);
153 double loss(0.), siga(0.);
159 if ((particleMass > electron_mass_c2) &&
163 double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
164 (1.+massrate*(2.*gam+massrate)) ;
165 if (tmaxkine <= 2.*tmax)
168 siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
171 double twomeanLoss = meanLoss + meanLoss;
172 if (twomeanLoss < siga) {
176 x = (loss - meanLoss)/siga;
177 }
while (1.0 - 0.5*x*x < flatDistribution->fire());
181 }
while (loss < 0. || loss > twomeanLoss);
202 double a1 = 0. , a2 = 0., a3 = 0. ;
207 double w2 = vdt::fast_log(2.*electron_mass_c2*beta2*gam2)-beta2;
230 double suma = a1+a2+a3;
262 if (loss < 0.) loss = 0.0;
279 double namean = p3*rfac;
284 double alfa1 = alfa*vdt::fast_log(alfa)/(alfa-1.);
293 double w = (tmax-
w2)/tmax;
307 a3 = meanLoss*(tmax-
e0)/(tmax*
e0*vdt::fast_log(tmax/
e0));
316 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)
CLHEP::RandPoissonQ * poissonQDistribution
static const double tmax[3]
CLHEP::RandGaussQ * gaussQDistribution
double minNumberInteractionsBohr
CLHEP::HepRandomEngine & rndEngine