44 #include "CLHEP/Units/GlobalSystemOfUnits.h" 45 #include "CLHEP/Units/GlobalPhysicalConstants.h" 46 #include "CLHEP/Random/RandGaussQ.h" 47 #include "CLHEP/Random/RandPoisson.h" 48 #include "CLHEP/Random/RandFlat.h" 51 #include <gsl/gsl_fit.h> 67 :minNumberInteractionsBohr(10.0),
68 theBohrBeta2(50.0*keV/proton_mass_c2),
103 const double meanLoss)
110 if(meanLoss <
minLoss)
return meanLoss;
121 double beta2 = 1.0 - 1.0/gam2;
129 siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
134 loss = CLHEP::RandGaussQ::shoot(meanLoss,siga);
135 }
while (loss < 0. || loss > 2.*meanLoss);
141 double suma,w1,
w2,
C,lossc,
w;
145 double corrfac, na,alfa,rfac,namean,sa,alfa1,ea,sea;
149 w2 =
log(2.*electron_mass_c2*(gam2 - 1.0));
175 p3 =
std::max(0,
int(CLHEP::RandGaussQ::shoot(a3,siga)+0.5));
178 p3 = CLHEP::RandPoisson::shoot(a3);
185 loss += (1.-2.*CLHEP::RandFlat::shoot())*e0 ;
191 a3 = meanLoss*(tmax-
e0)/(tmax*e0*
log(tmax/e0));
197 p3 =
std::max(0,
int(CLHEP::RandGaussQ::shoot(a3,siga)+0.5));
200 p3 = CLHEP::RandPoisson::shoot(a3);
216 for(
int i=0;
i<
p3;
i++) loss += 1./(1.-w*CLHEP::RandFlat::shoot()) ;
229 p1 =
std::max(0,
int(CLHEP::RandGaussQ::shoot(a1,siga)+0.5));
232 p1 = CLHEP::RandPoisson::shoot(a1);
240 p2 =
std::max(0,
int(CLHEP::RandGaussQ::shoot(a2,siga)+0.5));
243 p2 = CLHEP::RandPoisson::shoot(a2);
251 loss += (1.-2.*CLHEP::RandFlat::shoot())*e2Fluct;
253 loss += (1.-2.*CLHEP::RandFlat::shoot())*
e1Fluct;
261 p3 =
std::max(0,
int(CLHEP::RandGaussQ::shoot(a3,siga)+0.5));
264 p3 = CLHEP::RandPoisson::shoot(a3);
275 namean =
float(p3)*rfac;
277 na = CLHEP::RandGaussQ::shoot(namean,sa);
282 alfa1 = alfa*
log(alfa)/(alfa-1.);
285 lossc += CLHEP::RandGaussQ::shoot(ea,sea);
289 nb =
int(
float(p3)-na);
294 for (
int k=0;
k<nb;
k++) lossc += w2/(1.-w*CLHEP::RandFlat::shoot());
common ppss p3p6s2 common epss epspn46 common const1 w2
static const double tmax[3]
double minNumberInteractionsBohr
double SampleFluctuations(const double momentum, const double mass, double &tmax, const double length, const double meanLoss)