875 fIsNoScatteringInMSC =
false;
877 G4double kineticEnergy = currentKinEnergy;
883 eloss = kineticEnergy -
884 GetEnergy(particle,currentRange-fTheTrueStepLenght,currentCouple);
898 G4double efStep = fTheTrueStepLenght;
900 G4double kineticEnergy0 = kineticEnergy;
901 if(fgIsUseAccurate) {
902 kineticEnergy -= 0.5*eloss;
907 eps0 = eloss/kineticEnergy0;
908 epsm = eloss/kineticEnergy;
910 efEnergy = kineticEnergy * (1. - epsm*epsm*(6.+10.*tau+5.*tau2)/(24.*tau2+48.*tau+72.));
911 G4double dum = 0.166666*(4.+tau*(6.+tau*(7.+tau*(4.+tau))))*
912 (epsm/((tau+1.)*(tau+2.)))*(epsm/((tau+1.)*(tau+2.)));
913 efStep =fTheTrueStepLenght*(1.-dum);
915 kineticEnergy -= 0.5*eloss;
916 efEnergy = kineticEnergy;
917 G4double factor = 1./(1. + 0.9784671*kineticEnergy);
918 eps0= eloss/kineticEnergy0;
919 epsm= eps0/(1.-0.5*eps0);
920 G4double temp = 0.3*(1. - factor*(1. - 0.333333*factor))*eps0*eps0;
921 efStep = fTheTrueStepLenght*(1. + temp);
930 if(fLambda0>0.0) { lambdan=efStep/fLambda0; }
931 if(lambdan<=1.0e-12) {
932 if(fIsEverythingWasDone)
933 fTheZPathLenght = fTheTrueStepLenght;
934 fIsNoScatteringInMSC =
true;
939 if(!fIsUsePWATotalXsecData)
940 lambdan = lambdan/(1.+fScrA);
947 G4double cosTheta1 =1.0,sinTheta1 =0.0, cosTheta2 =1.0, sinTheta2 =0.0;
948 G4double cosPhi1=1.0,sinPhi1=0.0, cosPhi2 =1.0, sinPhi2 =0.0;
949 G4double uss=0.0,vss=0.0,wss=1.0,x_coord=0.0,y_coord=0.0,z_coord=1.0;
957 cosTheta1 = 1.-2.*vrand[0];
958 sinTheta1 = std::sqrt((1.-cosTheta1)*(1.+cosTheta1));
959 cosTheta2 = 1.-2.*vrand[1];
960 sinTheta2 = std::sqrt((1.-cosTheta2)*(1.+cosTheta2));
963 fgGSTable->
Sampling(0.5*lambdan, 0.5*Qn1, fScrA, cosTheta1, sinTheta1);
964 fgGSTable->
Sampling(0.5*lambdan, 0.5*Qn1, fScrA, cosTheta2, sinTheta2);
965 if(cosTheta1 + cosTheta2 == 2.) {
966 if(fIsEverythingWasDone)
967 fTheZPathLenght = fTheTrueStepLenght;
968 fIsNoScatteringInMSC =
true;
976 sinPhi1 = std::sin(phi1);
977 cosPhi1 = std::cos(phi1);
979 sinPhi2 = std::sin(phi2);
980 cosPhi2 = std::cos(phi2);
983 u2 = sinTheta2*cosPhi2;
984 v2 = sinTheta2*sinPhi2;
985 G4double u2p = cosTheta1*u2 + sinTheta1*cosTheta2;
986 uss = u2p*cosPhi1 - v2*sinPhi1;
987 vss = u2p*sinPhi1 + v2*cosPhi1;
988 wss = cosTheta1*cosTheta2 - sinTheta1*u2;
991 fTheNewDirection.
set(uss,vss,wss);
995 if(fIsNoDisplace && fIsEverythingWasDone)
996 fTheZPathLenght = fTheTrueStepLenght;
1004 if(fgIsUseAccurate) {
1007 if(Qn1<0.7) par = 1.;
1008 else if (Qn1<7.0) par = -0.031376*Qn1+1.01356;
1015 G4double gamma = 6.0*fScrA*(1.0 + fScrA)*(loga*(1.0 + 2.0*fScrA) - 2.0)/fG1;
1023 G4double delta = 0.9082483-(0.1020621-0.0263747*gamma)*Qn1;
1027 G4double temp = (2.0+tau*temp1)/((tau+1.0)*temp1);
1029 temp = temp - (tau+1.0)/((tau+2.0)*(loga*(1.0+fScrA)-1.0));
1032 delta = delta + 0.40824829*(eps0*(tau+1.0)/((tau+2.0)*
1033 (loga*(1.0+fScrA)-1.0)*(loga*(1.0+2.0*fScrA)-2.0)) - 0.25*temp*temp);
1040 G4double ut = b*sinTheta1*cosPhi1 + c*(cosPhi1*u2 - sinPhi1*w1v2) + eta1*uss*temp1;
1041 G4double vt = b*sinTheta1*sinPhi1 + c*(sinPhi1*u2 + cosPhi1*w1v2) + eta1*vss*temp1;
1042 G4double wt = eta1*(1+temp) + b*cosTheta1 + c*cosTheta2 + eta1*wss*temp1;
1051 x_coord = ut*fTheTrueStepLenght;
1052 y_coord = vt*fTheTrueStepLenght;
1053 z_coord = wt*fTheTrueStepLenght;
1055 if(fIsEverythingWasDone){
1059 G4double transportDistance = std::sqrt(x_coord*x_coord+y_coord*y_coord+z_coord*z_coord);
1061 if(transportDistance>fTheTrueStepLenght)
1062 transportDistance = fTheTrueStepLenght;
1063 fTheZPathLenght = transportDistance;
1067 fTheDisplacementVector.
set(x_coord,y_coord,z_coord-fTheZPathLenght);
1074 if(fIsEverythingWasDone){
1078 zz = 1.0 - Qn1*(0.5 - Qn1*(0.166666667 - 0.041666667*Qn1));
1080 zz = (1.-
G4Exp(-Qn1))/Qn1;
1085 zz = fTheZPathLenght/fTheTrueStepLenght;
1088 G4double rr = (1.-zz*zz)/(1.-wss*wss);
1089 if(rr >= 0.25) rr = 0.25;
1090 G4double rperp = fTheTrueStepLenght*std::sqrt(rr);
1091 x_coord = rperp*uss;
1092 y_coord = rperp*vss;
1093 z_coord = zz*fTheTrueStepLenght;
1095 if(fIsEverythingWasDone){
1096 G4double transportDistance = std::sqrt(x_coord*x_coord + y_coord*y_coord + z_coord*z_coord);
1097 fTheZPathLenght = transportDistance;
1100 fTheDisplacementVector.
set(x_coord,y_coord,z_coord- fTheZPathLenght);
void set(double x, double y, double z)
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
void Sampling(G4double, G4double, G4double, G4double &, G4double &)
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double GetTransportMeanFreePath(const G4ParticleDefinition *, G4double)
virtual void flatArray(const int size, double *vect)=0
static constexpr double twopi