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) {
205 G4double presafety = sp->GetSafety();
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; }
407 if(tkin < lowEnergyLimit || tPathLength <= 0.0)
411 if(lambdaeff <
DBL_MAX) { invlambda = 0.5/lambdaeff; }
414 G4double cut = (*currentCuts)[currentMaterialIndex];
428 if(!singleScatteringMode && tPathLength*invlambda > thinlimit
429 && safety > tlimitminfix) {
439 if(singleScatteringMode && x1 > tPathLength)
457 G4double mscfac = zPathLength/tPathLength;
471 if(singleScatteringMode || x1 <= x2) {
488 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
502 if(singleScatteringMode && x1 > x2) {
break; }
516 if(z0 > 0.1) { zzz = exp(-1.0/z0); }
520 if(cost > 1.0) { cost = 1.0; }
521 else if(cost < -1.0) { cost =-1.0; }
522 sint = sqrt((1.0 - cost)*(1.0 + cost));
528 temp.
set(vx1,vy1,cost);
534 G4double rms = invsqrt12*sqrt(2*z0);
536 G4double dx = r*(0.5*vx1 + rms*G4RandGauss::shoot(0.0,1.0));
537 G4double dy = r*(0.5*vy1 + rms*G4RandGauss::shoot(0.0,1.0));
540 if(d >= 0.0) { dz = sqrt(d) - r; }
541 else { dx = dy = dz = 0.0; }
549 }
while (0 < nMscSteps);
578G4double G4WentzelVIModel::ComputeXSectionPerVolume()
582 const G4double* theAtomNumDensityVector =
585 if(nelm > nelments) {
590 G4double cut = (*currentCuts)[currentMaterialIndex];
595 if(cosTetMaxNuc > cosThetaMin) {
return 0.0; }
599 for (
G4int i=0; i<nelm; ++i) {
602 G4double density = theAtomNumDensityVector[i];
605 if(costm < cosThetaMin) {
608 if(1.0 > cosThetaMin) {
615 if(nucsec > 0.0) { esec /= nucsec; }
616 xtsec += nucsec*density;
std::vector< G4Element * > G4ElementVector
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4LossTableManager * Instance()
G4ProductionCuts * GetProductionCuts() const
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
G4double GetRadlen() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4NistManager * Instance()
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
static G4Pow * GetInstance()
G4double GetProductionCut(G4int index) const
G4StepPoint * GetPreStepPoint() const
const G4DynamicParticle * GetDynamicParticle() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Step * GetStep() const
G4double PolarAngleLimit() const
const G4MaterialCutsCouple * CurrentCouple() const
G4double ComputeGeomLimit(const G4Track &, G4double &presafety, G4double limit)
G4double GetTransportMeanFreePath(const G4ParticleDefinition *part, G4double kinEnergy)
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double ComputeSafety(const G4ThreeVector &position, G4double limit)
G4MscStepLimitType steppingAlgorithm
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=0)
G4double ConvertTrueToGeom(G4double &tLength, G4double &gLength)
G4ThreeVector fDisplacement
G4double ComputeElectronCrossSection(G4double CosThetaMin, G4double CosThetaMax)
G4ThreeVector SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
G4double ComputeNuclearCrossSection(G4double CosThetaMin, G4double CosThetaMax)
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=DBL_MAX, G4double emax=DBL_MAX)
virtual G4double ComputeGeomPathLength(G4double truePathLength)
void StartTracking(G4Track *)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double ¤tMinimalStep)
virtual G4ThreeVector & SampleScattering(const G4DynamicParticle *, G4double safety)
virtual G4double ComputeTrueStepLength(G4double geomStepLength)
virtual ~G4WentzelVIModel()
G4WentzelVIModel(const G4String &nam="WentzelVIUni")
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)