79 singleScatteringMode(false)
81 invsqrt12 = 1./sqrt(12.);
82 tlimitminfix = 1.e-6*
mm;
83 lowEnergyLimit = 1.0*
eV;
86 xsecn.resize(nelments);
87 prob.resize(nelments);
93 preKinEnergy = tPathLength = zPathLength = lambdaeff = currentRange = xtsec = 0;
94 currentMaterialIndex = 0;
95 cosThetaMax = cosTetMaxNuc = 1.0;
140 if(p != particle) { SetupParticle(p); }
141 if(kinEnergy < lowEnergyLimit) {
return cross; }
143 G4Exception(
"G4WentzelVIRelModel::ComputeCrossSectionPerAtom",
"em0011",
149 if(cosTetMaxNuc < 1.0) {
176 G4double tlimit = currentMinimalStep;
180 singleScatteringMode =
false;
189 currentRange =
GetRange(particle,preKinEnergy,currentCouple);
190 cosTetMaxNuc = wokvi->
SetupKinematic(preKinEnergy, currentMaterial);
194 if(tlimit > currentRange) { tlimit = currentRange; }
197 if(inside || tlimit < tlimitminfix) {
204 if(currentRange < presafety) {
211 if(stepStatus !=
fGeomBoundary && presafety < tlimitminfix) {
213 if(currentRange < presafety) {
229 0.7*(1.0 - cosTetMaxNuc)*lambdaeff);
232 if(cosThetaMax > cosTetMaxNuc) {
241 if(rcut > rlimit) { rlimit =
std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
243 if(rlimit < tlimit) { tlimit = rlimit; }
245 tlimit =
std::max(tlimit, tlimitminfix);
270 tPathLength = truelength;
271 zPathLength = tPathLength;
273 if(lambdaeff > 0.0 && lambdaeff !=
DBL_MAX) {
274 G4double tau = tPathLength/lambdaeff;
279 zPathLength *= (1.0 - 0.5*tau + tau*tau/6.0);
284 if(currentRange > tPathLength) {
285 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
287 e1 = 0.5*(e1 + preKinEnergy);
290 zPathLength = lambdaeff*(1.0 -
G4Exp(-tPathLength/lambdaeff));
292 }
else { lambdaeff =
DBL_MAX; }
303 cosThetaMin = cosTetMaxNuc;
309 singleScatteringMode =
true;
310 zPathLength = geomStepLength;
311 tPathLength = geomStepLength;
318 static const G4double singleScatLimit = 1.0e-7;
319 if(geomStepLength < lambdaeff*singleScatLimit*(1.0 - cosTetMaxNuc)) {
320 singleScatteringMode =
true;
322 zPathLength = geomStepLength;
323 tPathLength = geomStepLength;
326 }
else if(geomStepLength != zPathLength) {
329 zPathLength = geomStepLength;
330 G4double tau = geomStepLength/lambdaeff;
331 tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0);
336 if(currentRange > tPathLength) {
337 e1 =
GetEnergy(particle,currentRange-tPathLength,currentCouple);
339 e1 = 0.5*(e1 + preKinEnergy);
342 tau = zPathLength/lambdaeff;
344 if(tau < 0.999999) { tPathLength = -lambdaeff*
G4Log(1.0 - tau); }
345 else { tPathLength = currentRange; }
352 if(!singleScatteringMode) { cosThetaMin = 1.0 - 1.5*tPathLength/lambdaeff; }
356 if(cosThetaMin > cosTetMaxNuc) {
359 G4double cross = ComputeXSectionPerVolume();
362 singleScatteringMode =
true;
363 tPathLength = zPathLength;
365 }
else if(xtsec > 0.0) {
367 lambdaeff = 1./cross;
369 if(tau < numlimit) { tPathLength = zPathLength*(1.0 + 0.5*tau + tau*tau/3.0); }
370 else if(tau < 0.999999) { tPathLength = -lambdaeff*
G4Log(1.0 - tau); }
371 else { tPathLength = currentRange; }
373 if(tPathLength > currentRange) { tPathLength = currentRange; }
398 if(preKinEnergy < lowEnergyLimit || tPathLength <= 0.0)
402 if(lambdaeff <
DBL_MAX) { invlambda = 0.5/lambdaeff; }
405 G4double cut = (*currentCuts)[currentMaterialIndex];
415 static const G4double thinlimit = 0.1;
418 if(tPathLength*invlambda > thinlimit && safety > tlimitminfix) {
440 G4double mscfac = zPathLength/tPathLength;
471 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
485 if(x2 <= 0.0) { --nMscSteps; }
494 if(!singleScatteringMode) {
503 if(z0 > 0.01) { zzz =
G4Exp(-1.0/z0); }
509 if(cost > 1.0) { cost = 1.0; }
510 else if(cost < -1.0) { cost =-1.0; }
511 sint = sqrt((1.0 - cost)*(1.0 + cost));
517 temp.
set(vx1,vy1,cost);
523 G4double rms = invsqrt12*sqrt(2*z0);
529 if(d >= 0.0) { dz = sqrt(d) -
r; }
530 else { dx = dy = dz = 0.0; }
539 }
while (0 < nMscSteps);
568 G4double G4WentzelVIRelModel::ComputeXSectionPerVolume()
572 const G4double* theAtomNumDensityVector =
575 if(nelm > nelments) {
580 G4double cut = (*currentCuts)[currentMaterialIndex];
585 if(cosTetMaxNuc > cosThetaMin) {
return 0.0; }
589 for (
G4int i=0; i<nelm; ++i) {
595 if(costm < cosThetaMin) {
598 if(1.0 > cosThetaMin) {
605 if(nucsec > 0.0) { esec /= nucsec; }
void set(double x, double y, double z)
static G4Pow * GetInstance()
void StartTracking(G4Track *)
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double ComputeNuclearCrossSection(G4double CosThetaMin, G4double CosThetaMax)
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double ¤tMinimalStep)
G4ThreeVector SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)
static G4LossTableManager * Instance()
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)
std::vector< G4Element * > G4ElementVector
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetProductionCut(G4int index) const
G4StepStatus GetStepStatus() const
G4double ConvertTrueToGeom(G4double &tLength, G4double &gLength)
G4WentzelVIRelModel(const G4String &nam="WentzelVIUni")
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
virtual G4double ComputeGeomPathLength(G4double truePathLength)
G4ParticleDefinition * GetDefinition() const
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=DBL_MAX, G4double emax=DBL_MAX)
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
const G4Step * GetStep() const
const G4ElementVector * GetElementVector() const
static G4NistManager * Instance()
G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
G4StepPoint * GetPreStepPoint() const
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
const G4double * GetVecNbOfAtomsPerVolume() const
const G4MaterialCutsCouple * CurrentCouple() const
const G4ThreeVector & GetPosition() const
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=0)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
Hep3Vector & rotateUz(const Hep3Vector &)
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)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual ~G4WentzelVIRelModel()
virtual G4double ComputeTrueStepLength(G4double geomStepLength)
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
G4double ComputeElectronCrossSection(G4double CosThetaMin, G4double CosThetaMax)
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
G4ProductionCuts * GetProductionCuts() const