80 singleScatteringMode(false)
82 invsqrt12 = 1./sqrt(12.);
83 tlimitminfix = 1.e-6*
mm;
84 lowEnergyLimit = 1.0*
eV;
87 xsecn.resize(nelments);
88 prob.resize(nelments);
94 preKinEnergy = tPathLength = zPathLength = lambdaeff = currentRange = xtsec = 0;
95 currentMaterialIndex = 0;
96 cosThetaMax = cosTetMaxNuc = 1.0;
141 if(p != particle) { SetupParticle(p); }
142 if(kinEnergy < lowEnergyLimit) {
return cross; }
144 G4Exception(
"G4WentzelVIModel::ComputeCrossSectionPerAtom",
"em0011",
150 if(cosTetMaxNuc < 1.0) {
177 G4double tlimit = currentMinimalStep;
181 singleScatteringMode =
false;
189 currentRange =
GetRange(particle,preKinEnergy,currentCouple);
190 cosTetMaxNuc = wokvi->
SetupKinematic(preKinEnergy, currentMaterial);
197 if(tlimit > currentRange) { tlimit = currentRange; }
200 if(inside || tlimit < tlimitminfix) {
207 if(currentRange < presafety) {
214 if(stepStatus !=
fGeomBoundary && presafety < tlimitminfix) {
216 if(currentRange < presafety) {
232 0.7*(1.0 - cosTetMaxNuc)*lambdaeff);
235 if(cosThetaMax > cosTetMaxNuc) {
236 rlimit = std::min(rlimit,
facsafety*presafety);
244 if(rcut > rlimit) { rlimit = std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
246 if(rlimit < tlimit) { tlimit = rlimit; }
248 tlimit = std::max(tlimit, tlimitminfix);
258 tlimit = std::min(tlimit, geomlimit/
facgeom);
274 tPathLength = truelength;
275 zPathLength = tPathLength;
277 if(lambdaeff > 0.0 && lambdaeff !=
DBL_MAX) {
278 G4double tau = tPathLength/lambdaeff;
283 zPathLength *= (1.0 - 0.5*tau + tau*tau/6.0);
288 if(currentRange > tPathLength) {
289 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
291 e1 = 0.5*(e1 + preKinEnergy);
294 zPathLength = lambdaeff*(1.0 - exp(-tPathLength/lambdaeff));
296 }
else { lambdaeff =
DBL_MAX; }
307 cosThetaMin = cosTetMaxNuc;
315 singleScatteringMode =
true;
316 zPathLength = geomStepLength;
317 tPathLength = geomStepLength;
324 const G4double singleScatLimit = 1.0e-7;
325 if(geomStepLength < lambdaeff*singleScatLimit*(1.0 - cosTetMaxNuc)) {
326 singleScatteringMode =
true;
328 zPathLength = geomStepLength;
329 tPathLength = geomStepLength;
332 }
else if(geomStepLength != zPathLength) {
335 zPathLength = geomStepLength;
336 G4double tau = geomStepLength/lambdaeff;
337 tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0);
342 if(currentRange > tPathLength) {
343 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
345 e1 = 0.5*(e1 + preKinEnergy);
348 tau = zPathLength/lambdaeff;
350 if(tau < 0.999999) { tPathLength = -lambdaeff*log(1.0 - tau); }
351 else { tPathLength = currentRange; }
358 if(!singleScatteringMode) { cosThetaMin = 1.0 - 1.5*tPathLength/lambdaeff; }
362 if(cosThetaMin > cosTetMaxNuc) {
365 G4double cross = ComputeXSectionPerVolume();
368 singleScatteringMode =
true;
369 tPathLength = zPathLength;
372 }
else if(xtsec > 0.0) {
374 lambdaeff = 1./cross;
376 if(tau < numlimit) { tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0); }
377 else if(tau < 0.999999) { tPathLength = -lambdaeff*log(1.0 - tau); }
378 else { tPathLength = currentRange; }
380 if(tPathLength > currentRange) { tPathLength = currentRange; }
406 if(preKinEnergy < lowEnergyLimit || tPathLength <= 0.0)
410 if(lambdaeff <
DBL_MAX) { invlambda = 0.5/lambdaeff; }
413 G4double cut = (*currentCuts)[currentMaterialIndex];
427 if(!singleScatteringMode && tPathLength*invlambda > thinlimit
428 && safety > tlimitminfix) {
438 if(singleScatteringMode && x1 > tPathLength)
455 G4double mscfac = zPathLength/tPathLength;
469 if(singleScatteringMode || x1 <= x2) {
486 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
500 if(singleScatteringMode && x1 > x2) {
break; }
514 if(z0 > 0.1) { zzz = exp(-1.0/z0); }
518 if(cost > 1.0) { cost = 1.0; }
519 else if(cost < -1.0) { cost =-1.0; }
520 sint = sqrt((1.0 - cost)*(1.0 + cost));
526 temp.
set(vx1,vy1,cost);
532 G4double rms = invsqrt12*sqrt(2*z0);
534 G4double dx = r*(0.5*vx1 + rms*G4RandGauss::shoot(0.0,1.0));
535 G4double dy = r*(0.5*vy1 + rms*G4RandGauss::shoot(0.0,1.0));
538 if(d >= 0.0) { dz = sqrt(d) -
r; }
539 else { dx = dy = dz = 0.0; }
547 }
while (0 < nMscSteps);
576 G4double G4WentzelVIModel::ComputeXSectionPerVolume()
580 const G4double* theAtomNumDensityVector =
583 if(nelm > nelments) {
588 G4double cut = (*currentCuts)[currentMaterialIndex];
593 if(cosTetMaxNuc > cosThetaMin) {
return 0.0; }
597 for (
G4int i=0; i<nelm; ++i) {
603 if(costm < cosThetaMin) {
606 if(1.0 > cosThetaMin) {
613 if(nucsec > 0.0) { esec /= nucsec; }