78 currentCouple(nullptr),
79 singleScatteringMode(false),
82 fSecondMoments(nullptr),
86 useSecondMoment(false)
89 invsqrt12 = 1./sqrt(12.);
91 lowEnergyLimit = 1.0*
eV;
94 xsecn.resize(nelments);
95 prob.resize(nelments);
105 fParticleChange =
nullptr;
106 currentCuts =
nullptr;
116 delete fSecondMoments;
132 if(tet <= 0.0) { cosThetaMax = 1.0; }
133 else if(tet <
CLHEP::pi) { cosThetaMax = cos(tet); }
151 if(useSecondMoment &&
IsMaster() && table) {
169 *
G4lrint(std::log10(emax/emin));
172 for(
size_t i=0; i<numOfCouples; ++i) {
176 if(fSecondMoments->
GetFlag(i)) {
179 delete (*fSecondMoments)[i];
186 for(
size_t j=0; j<
n; ++j) {
188 bVector->
PutValue(j, ComputeSecondMoment(p, e)*e*e);
191 (*fSecondMoments)[i] = bVector;
217 if(p !=
particle) { SetupParticle(p); }
218 if(kinEnergy < lowEnergyLimit) {
return cross; }
220 G4Exception(
"G4WentzelVIModel::ComputeCrossSectionPerAtom",
"em0011",
228 if(fixedCut > 0.0) { cut = fixedCut; }
254 G4double tlimit = currentMinimalStep;
321 if(rcut > rlimit) { rlimit =
std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
353 ComputeTransportXSectionPerVolume(cosThetaMin);
410 if(
G4int(geomStepLength*xtsec) < minNCollisions) {
418 if(geomStepLength < numlimit*
lambdaeff) {
420 tPathLength = geomStepLength*(1.0 + 0.5*tau + tau*tau/3.0);
451 G4double cross = ComputeTransportXSectionPerVolume(cosThetaMin);
459 }
else if(xtsec > 0.0) {
465 }
else if(tau < 0.999999) {
504 if(fixedCut > 0.0) { cut = fixedCut; }
523 if(useSecondMoment) {
526 prob2 = (z2 - z1)/(1.5*z1 - z2);
537 zzz =
G4Exp(-1.0/z0);
541 prob2 /= (1 + prob2);
546 if(0.0 < xtsec) { x1 = -
G4Log(rndmEngine->
flat())/xtsec; }
606 for (; i<nelm; ++i) {
if(xsecn[i] >= qsec) {
break; } }
631 if(prob2 > 0.0 && rndmEngine->
flat() < prob2) { isFirst =
false; }
634 if(isFirst) { z = -
G4Log(rndmEngine->
flat()); }
641 if(cost > 1.0) { cost = 1.0; }
642 else if(cost < -1.0) { cost =-1.0; }
643 sint = sqrt((1.0 - cost)*(1.0 + cost));
650 G4double rms = invsqrt12*sqrt(2*z0);
658 temp.
set(dx,dy,sqrt(d) - r);
664 temp.
set(vx1,vy1,cost);
669 }
while (0 < nMscSteps);
698 G4double G4WentzelVIModel::ComputeTransportXSectionPerVolume(
G4double cosTheta)
702 const G4double* theAtomNumDensityVector =
705 if(nelm > nelments) {
716 if(fixedCut > 0.0) { cut = fixedCut; }
720 for (
G4int i=0; i<nelm; ++i) {
723 G4double density = theAtomNumDensityVector[i];
726 if(costm < cosTheta) {
736 if(nucsec > 0.0) { esec /= nucsec; }
737 xtsec += nucsec*density;
764 const G4double* theAtomNumDensityVector =
769 if(fixedCut > 0.0) { cut = fixedCut; }
772 for (
G4int i=0; i<nelm; ++i) {
775 xs += theAtomNumDensityVector[i]
void set(double x, double y, double z)
G4double LowEnergyActivationLimit() const
G4double HighEnergyActivationLimit() const
virtual ~G4WentzelVIModel()
G4int NumberOfBinsPerDecade() const
void SetSingleScatteringFactor(G4double)
ThreeVector shoot(const G4int Ap, const G4int Af)
G4WentzelOKandVIxSection * wokvi
G4double LowEnergyLimit() const
virtual G4double ComputeGeomPathLength(G4double truePathLength) override
static constexpr double mm
std::vector< G4Element * > G4ElementVector
G4double GetKineticEnergy() const
G4double HighEnergyLimit() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetProductionCut(G4int index) const
G4bool singleScatteringMode
G4StepStatus GetStepStatus() const
G4double ComputeSecondTransportMoment(G4double CosThetaMax)
void DefineMaterial(const G4MaterialCutsCouple *)
G4double ConvertTrueToGeom(G4double &tLength, G4double &gLength)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4MaterialCutsCouple * currentCouple
G4PhysicsTable * GetCrossSectionTable()
G4ParticleDefinition * GetDefinition() const
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double ¤tMinimalStep) override
const G4Material * currentMaterial
G4WentzelVIModel(G4bool comb=true, const G4String &nam="WentzelVIUni")
const G4Step * GetStep() const
G4double ComputeSafety(const G4ThreeVector &position, G4double limit=DBL_MAX)
const G4ElementVector * GetElementVector() const
void FillSecondDerivatives()
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
static constexpr double twopi
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
size_t GetTableSize() const
const G4ThreeVector & GetPosition() const
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double SecondMoment(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double kineticEnergy)
G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
Hep3Vector & rotateUz(const Hep3Vector &)
void PutValue(size_t index, G4double theValue)
static constexpr double eV
G4double Energy(size_t index) const
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)
static const G4double emax
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=nullptr)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
static G4ProductionCutsTable * GetProductionCutsTable()
G4double ComputeElectronCrossSection(G4double CosThetaMin, G4double CosThetaMax)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4PhysicsTable * GetSecondMomentTable()
G4double ComputeNuclearCrossSection(G4double CosThetaMin, G4double CosThetaMax)
static G4EmParameters * Instance()
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=DBL_MAX, G4double emax=DBL_MAX) override
G4double PolarAngleLimit() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
const G4ParticleDefinition * particle
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety) override
G4double GetSafety() const
G4MscStepLimitType steppingAlgorithm
virtual G4double ComputeTrueStepLength(G4double geomStepLength) override
size_t GetNumberOfElements() const
G4bool GetFlag(size_t i) const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
virtual void StartTracking(G4Track *) override
G4ProductionCuts * GetProductionCuts() const
G4int currentMaterialIndex
static constexpr double pi
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel) override
G4ThreeVector & SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)