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);
93 preKinEnergy = tPathLength = zPathLength = lambdaeff = currentRange
95 currentMaterialIndex = 0;
96 cosThetaMax = cosTetMaxNuc = 1.0;
142 if(p != particle) { SetupParticle(p); }
143 if(kinEnergy < lowEnergyLimit) {
return cross; }
145 G4Exception(
"G4WentzelVIModel::ComputeCrossSectionPerAtom",
"em0011",
151 if(cosTetMaxNuc < 1.0) {
153 if(fixedCut > 0.0) { cut = fixedCut; }
180 G4double tlimit = currentMinimalStep;
184 singleScatteringMode =
false;
193 currentRange =
GetRange(particle,preKinEnergy,currentCouple);
194 cosTetMaxNuc = wokvi->
SetupKinematic(preKinEnergy, currentMaterial);
201 if(tlimit > currentRange) { tlimit = currentRange; }
204 if(inside || tlimit < tlimitminfix) {
211 if(currentRange < presafety) {
218 if(stepStatus !=
fGeomBoundary && presafety < tlimitminfix) {
220 if(currentRange < presafety) {
236 0.7*(1.0 - cosTetMaxNuc)*lambdaeff);
239 if(cosThetaMax > cosTetMaxNuc) {
248 if(rcut > rlimit) { rlimit =
std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
250 if(rlimit < tlimit) { tlimit = rlimit; }
252 tlimit =
std::max(tlimit, tlimitminfix);
278 tPathLength = truelength;
279 zPathLength = tPathLength;
281 if(lambdaeff > 0.0 && lambdaeff !=
DBL_MAX) {
282 G4double tau = tPathLength/lambdaeff;
287 zPathLength *= (1.0 - 0.5*tau + tau*tau/6.0);
292 if(currentRange > tPathLength) {
293 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
295 e1 = 0.5*(e1 + preKinEnergy);
298 zPathLength = lambdaeff*(1.0 -
G4Exp(-tPathLength/lambdaeff));
300 }
else { lambdaeff =
DBL_MAX; }
311 cosThetaMin = cosTetMaxNuc;
319 singleScatteringMode =
true;
320 zPathLength = geomStepLength;
321 tPathLength = geomStepLength;
328 static const G4double singleScatLimit = 1.0e-7;
329 if(geomStepLength < lambdaeff*singleScatLimit*(1.0 - cosTetMaxNuc)) {
330 singleScatteringMode =
true;
332 zPathLength = geomStepLength;
333 tPathLength = geomStepLength;
336 }
else if(geomStepLength != zPathLength) {
339 zPathLength = geomStepLength;
340 G4double tau = geomStepLength/lambdaeff;
341 tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0);
346 if(currentRange > tPathLength) {
347 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
349 e1 = 0.5*(e1 + preKinEnergy);
352 tau = zPathLength/lambdaeff;
354 if(tau < 0.999999) { tPathLength = -lambdaeff*
G4Log(1.0 - tau); }
355 else { tPathLength = currentRange; }
362 if(!singleScatteringMode) { cosThetaMin = 1.0 - 1.5*tPathLength/lambdaeff; }
366 if(cosThetaMin > cosTetMaxNuc) {
369 G4double cross = ComputeXSectionPerVolume();
372 singleScatteringMode =
true;
373 tPathLength = zPathLength;
376 }
else if(xtsec > 0.0) {
378 lambdaeff = 1./cross;
381 tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0);
383 else if(tau < 0.999999) { tPathLength = -lambdaeff*
G4Log(1.0 - tau); }
384 else { tPathLength = currentRange; }
386 if(tPathLength > currentRange) { tPathLength = currentRange; }
412 if(preKinEnergy < lowEnergyLimit || tPathLength <= 0.0)
416 if(lambdaeff <
DBL_MAX) { invlambda = 0.5/lambdaeff; }
419 G4double cut = (*currentCuts)[currentMaterialIndex];
420 if(fixedCut > 0.0) { cut = fixedCut; }
436 if(!singleScatteringMode) {
438 if(z0 > zzmin && safety > tlimitminfix) {
443 if(z0 > zzmin) { zzz =
G4Exp(-1.0/z0); }
451 if(singleScatteringMode && x1 > tPathLength)
468 G4double mscfac = zPathLength/tPathLength;
483 if(singleScatteringMode && x1 > x2) {
break; }
505 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
532 if(cost > 1.0) { cost = 1.0; }
533 else if(cost < -1.0) { cost =-1.0; }
534 sint = sqrt((1.0 - cost)*(1.0 + cost));
540 temp.
set(vx1,vy1,cost);
546 G4double rms = invsqrt12*sqrt(2*z0);
562 }
while (0 < nMscSteps);
591 G4double G4WentzelVIModel::ComputeXSectionPerVolume()
595 const G4double* theAtomNumDensityVector =
598 if(nelm > nelments) {
603 G4double cut = (*currentCuts)[currentMaterialIndex];
604 if(fixedCut > 0.0) { cut = fixedCut; }
609 if(cosTetMaxNuc > cosThetaMin) {
return 0.0; }
613 for (
G4int i=0; i<nelm; ++i) {
619 if(costm < cosThetaMin) {
622 if(1.0 > cosThetaMin) {
629 if(nucsec > 0.0) { esec /= nucsec; }
void set(double x, double y, double z)
virtual ~G4WentzelVIModel()
ThreeVector shoot(const G4int Ap, const G4int Af)
static G4LossTableManager * Instance()
G4WentzelVIModel(const G4String &nam="WentzelVIUni")
std::vector< G4Element * > G4ElementVector
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4ThreeVector SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)
G4double GetProductionCut(G4int index) const
G4StepStatus GetStepStatus() const
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)
G4double ConvertTrueToGeom(G4double &tLength, G4double &gLength)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4ParticleDefinition * GetDefinition() const
const G4Step * GetStep() const
const G4ElementVector * GetElementVector() const
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double ¤tMinimalStep)
G4StepPoint * GetPreStepPoint() const
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
const G4double * GetVecNbOfAtomsPerVolume() const
const G4MaterialCutsCouple * CurrentCouple() const
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=DBL_MAX, G4double emax=DBL_MAX)
const G4ThreeVector & GetPosition() const
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=0)
G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
Hep3Vector & rotateUz(const Hep3Vector &)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
G4double ComputeGeomLimit(const G4Track &, G4double &presafety, G4double limit)
G4ThreeVector fDisplacement
G4double GetTransportMeanFreePath(const G4ParticleDefinition *part, G4double kinEnergy)
G4double GetRadlen() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double ComputeSafety(const G4ThreeVector &position, G4double limit)
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
G4double ComputeElectronCrossSection(G4double CosThetaMin, G4double CosThetaMax)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void StartTracking(G4Track *)
G4double ComputeNuclearCrossSection(G4double CosThetaMin, G4double CosThetaMax)
G4double PolarAngleLimit() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetSafety() const
G4MscStepLimitType steppingAlgorithm
size_t GetNumberOfElements() const
virtual G4double ComputeTrueStepLength(G4double geomStepLength)
G4ProductionCuts * GetProductionCuts() const
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
virtual G4double ComputeGeomPathLength(G4double truePathLength)