77 singleScatteringMode(false)
79 invsqrt12 = 1./sqrt(12.);
80 tlimitminfix = 1.e-6*
mm;
81 lowEnergyLimit = 1.0*
eV;
84 xsecn.resize(nelments);
85 prob.resize(nelments);
91 preKinEnergy = tPathLength = zPathLength = lambdaeff = currentRange = xtsec = 0;
92 currentMaterialIndex = 0;
93 cosThetaMax = cosTetMaxNuc = 1.0;
138 if(p != particle) { SetupParticle(p); }
139 if(kinEnergy < lowEnergyLimit) {
return cross; }
141 G4Exception(
"G4WentzelVIRelModel::ComputeCrossSectionPerAtom",
"em0011",
147 if(cosTetMaxNuc < 1.0) {
174 G4double tlimit = currentMinimalStep;
178 singleScatteringMode =
false;
187 currentRange =
GetRange(particle,preKinEnergy,currentCouple);
188 cosTetMaxNuc = wokvi->
SetupKinematic(preKinEnergy, currentMaterial);
192 if(tlimit > currentRange) { tlimit = currentRange; }
195 if(inside || tlimit < tlimitminfix) {
202 if(currentRange < presafety) {
209 if(stepStatus !=
fGeomBoundary && presafety < tlimitminfix) {
211 if(currentRange < presafety) {
227 0.7*(1.0 - cosTetMaxNuc)*lambdaeff);
230 if(cosThetaMax > cosTetMaxNuc) {
231 rlimit = std::min(rlimit,
facsafety*presafety);
239 if(rcut > rlimit) { rlimit = std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
241 if(rlimit < tlimit) { tlimit = rlimit; }
243 tlimit = std::max(tlimit, tlimitminfix);
252 tlimit = std::min(tlimit, geomlimit/
facgeom);
268 tPathLength = truelength;
269 zPathLength = tPathLength;
271 if(lambdaeff > 0.0 && lambdaeff !=
DBL_MAX) {
272 G4double tau = tPathLength/lambdaeff;
277 zPathLength *= (1.0 - 0.5*tau + tau*tau/6.0);
282 if(currentRange > tPathLength) {
283 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
285 e1 = 0.5*(e1 + preKinEnergy);
288 zPathLength = lambdaeff*(1.0 - exp(-tPathLength/lambdaeff));
290 }
else { lambdaeff =
DBL_MAX; }
301 cosThetaMin = cosTetMaxNuc;
307 singleScatteringMode =
true;
308 zPathLength = geomStepLength;
309 tPathLength = geomStepLength;
316 const G4double singleScatLimit = 1.0e-7;
317 if(geomStepLength < lambdaeff*singleScatLimit*(1.0 - cosTetMaxNuc)) {
318 singleScatteringMode =
true;
320 zPathLength = geomStepLength;
321 tPathLength = geomStepLength;
324 }
else if(geomStepLength != zPathLength) {
327 zPathLength = geomStepLength;
328 G4double tau = geomStepLength/lambdaeff;
329 tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0);
334 if(currentRange > tPathLength) {
335 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
337 e1 = 0.5*(e1 + preKinEnergy);
340 tau = zPathLength/lambdaeff;
342 if(tau < 0.999999) { tPathLength = -lambdaeff*log(1.0 - tau); }
343 else { tPathLength = currentRange; }
350 if(!singleScatteringMode) { cosThetaMin = 1.0 - 1.5*tPathLength/lambdaeff; }
354 if(cosThetaMin > cosTetMaxNuc) {
357 G4double cross = ComputeXSectionPerVolume();
360 singleScatteringMode =
true;
361 tPathLength = zPathLength;
363 }
else if(xtsec > 0.0) {
365 lambdaeff = 1./cross;
367 if(tau < numlimit) { tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0); }
368 else if(tau < 0.999999) { tPathLength = -lambdaeff*log(1.0 - tau); }
369 else { tPathLength = currentRange; }
371 if(tPathLength > currentRange) { tPathLength = currentRange; }
396 if(preKinEnergy < lowEnergyLimit || tPathLength <= 0.0)
400 if(lambdaeff <
DBL_MAX) { invlambda = 0.5/lambdaeff; }
403 G4double cut = (*currentCuts)[currentMaterialIndex];
416 if(tPathLength*invlambda > thinlimit && safety > tlimitminfix) {
438 G4double mscfac = zPathLength/tPathLength;
469 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
483 if(x2 <= 0.0) { --nMscSteps; }
492 if(!singleScatteringMode) {
501 if(z0 > 0.01) { zzz = exp(-1.0/z0); }
507 if(cost > 1.0) { cost = 1.0; }
508 else if(cost < -1.0) { cost =-1.0; }
509 sint = sqrt((1.0 - cost)*(1.0 + cost));
515 temp.
set(vx1,vy1,cost);
521 G4double rms = invsqrt12*sqrt(2*z0);
523 G4double dx = r*(0.5*vx1 + rms*G4RandGauss::shoot(0.0,1.0));
524 G4double dy = r*(0.5*vy1 + rms*G4RandGauss::shoot(0.0,1.0));
527 if(d >= 0.0) { dz = sqrt(d) -
r; }
528 else { dx = dy = dz = 0.0; }
537 }
while (0 < nMscSteps);
566 G4double G4WentzelVIRelModel::ComputeXSectionPerVolume()
570 const G4double* theAtomNumDensityVector =
573 if(nelm > nelments) {
578 G4double cut = (*currentCuts)[currentMaterialIndex];
583 if(cosTetMaxNuc > cosThetaMin) {
return 0.0; }
587 for (
G4int i=0; i<nelm; ++i) {
593 if(costm < cosThetaMin) {
596 if(1.0 > cosThetaMin) {
603 if(nucsec > 0.0) { esec /= nucsec; }