57 #include "CLHEP/Units/GlobalSystemOfUnits.h"
58 #include "CLHEP/Units/GlobalPhysicalConstants.h"
59 #include "CLHEP/Random/RandGaussQ.h"
60 #include "CLHEP/Random/RandPoissonQ.h"
61 #include "CLHEP/Random/RandFlat.h"
78 gaussQDistribution(0),
79 poissonQDistribution(0),
81 minNumberInteractionsBohr(10.0),
82 theBohrBeta2(50.0*keV/proton_mass_c2),
132 const double meanLoss)
141 if (meanLoss <
minLoss)
return meanLoss;
151 double beta2 = 1.0 - 1.0/gam2;
154 double loss(0.), siga(0.);
160 if ((particleMass > electron_mass_c2) &&
164 double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
165 (1.+massrate*(2.*gam+massrate)) ;
166 if (tmaxkine <= 2.*tmax)
169 siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
172 double twomeanLoss = meanLoss + meanLoss;
173 if (twomeanLoss < siga) {
177 x = (loss - meanLoss)/siga;
178 }
while (1.0 - 0.5*x*x < flatDistribution->fire());
182 }
while (loss < 0. || loss > twomeanLoss);
203 double a1 = 0. , a2 = 0., a3 = 0. ;
208 double w2 = vdt::fast_log(2.*electron_mass_c2*beta2*gam2)-beta2;
231 double suma = a1+a2+a3;
263 if (loss < 0.) loss = 0.0;
280 double namean = p3*rfac;
285 double alfa1 = alfa*vdt::fast_log(alfa)/(alfa-1.);
294 double w = (tmax-
w2)/tmax;
308 a3 = meanLoss*(tmax-
e0)/(tmax*
e0*vdt::fast_log(tmax/
e0));
317 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