581 {
582 fIsNoScatteringInMSC = false;
583
584
585
586
587
588 const G4double eloss = currentKinEnergy -
GetEnergy(particle, currentRange - fTheTrueStepLenght, currentCouple);
589 const G4double midEkin = currentKinEnergy - 0.5*eloss;
590 const G4double tau = midEkin/electron_mass_c2;
592 const G4double eps0 = eloss/currentKinEnergy;
593 const G4double epsm = eloss/midEkin;
595 const G4double effEner = midEkin*(1.0 - epsm2*(6.0 + 10.0*tau + 5.0*tau2)/(24.0*tau2 + 72.0*tau + 48.0));
596 const G4double dum = 1.0/((tau + 1.0)*(tau + 2.0));
597 const G4double effStep = fTheTrueStepLenght*(1.0 - 0.166666*epsm2*dum*dum*(4.0 + tau*(6.0 + tau*(7.0 + tau*(4.0 + tau)))));
598
599
601
602
603 const G4double lambdan = fLambda0 > 0.0 ? effStep/fLambda0 : 0.0;
604
605 if (lambdan <= 1.0E-12) {
606 fTheZPathLenght = fTheTrueStepLenght;
607 fIsNoScatteringInMSC = true;
608 return;
609 }
610
611
613
614
615
616
617
618
619
620
621
622
623
624 G4double cosTheta1 = 1.0, sinTheta1 = 0.0, cosTheta2 = 1.0, sinTheta2 = 0.0;
625 if (0.5*Qn1 < 7.0) {
626
627
629 const G4double pt2 = effEner*(effEner + 2.0*CLHEP::electron_mass_c2);
630 const G4double beta2 = pt2/(pt2 + CLHEP::electron_mass_c2*CLHEP::electron_mass_c2);
631
632
633 G4GoudsmitSaundersonTable::GSMSCAngularDtr *gsDtr = nullptr;
634 G4int mcEkinIdx = -1;
635 G4int mcDeltIdx = -1;
637 G4bool isMsc = fGSTable->Sampling(0.5*lambdan, 0.5*Qn1, fScrA, cosTheta1, sinTheta1, lekin, beta2,
638 currentMaterialIndex, &gsDtr, mcEkinIdx, mcDeltIdx, transfPar,
639 true);
640 fGSTable->Sampling(0.5*lambdan, 0.5*Qn1, fScrA, cosTheta2, sinTheta2, lekin, beta2,
641 currentMaterialIndex, &gsDtr, mcEkinIdx, mcDeltIdx, transfPar, !isMsc);
642 if (cosTheta1 + cosTheta2 == 2.0) {
643 fTheZPathLenght = fTheTrueStepLenght;
644 fIsNoScatteringInMSC = true;
645 return;
646 }
647 } else {
648
650 sinTheta1 = std::sqrt((1.-cosTheta1)*(1.+cosTheta1));
652 sinTheta2 = std::sqrt((1.-cosTheta2)*(1.+cosTheta2));
653 }
654
656 const G4double sinPhi1 = std::sin(phi1);
657 const G4double cosPhi1 = std::cos(phi1);
659 const G4double sinPhi2 = std::sin(phi2);
660 const G4double cosPhi2 = std::cos(phi2);
661
662 const G4double u2 = sinTheta2*cosPhi2;
663 const G4double v2 = sinTheta2*sinPhi2;
664 const G4double tm = cosTheta1*u2 + sinTheta1*cosTheta2;
667 const G4double wf = cosTheta1*cosTheta2 - sinTheta1*u2;
668
669 fTheNewDirection.set(uf, vf, wf);
670
671
672 if (fIsSimplified) {
673 return;
674 }
675
676
677
678
679 Qn1 *= fMCtoQ1;
680
681
682
683
687 const G4double lgf1 = loga*(1.0 + fScrA) - 1.0;
688 const G4double lgf2 = loga*(1.0 + 2.0*fScrA) - 2.0;
689
690 const G4double alpha1 = ((2.0 + tau*tp2)/tp1 - tp1/lgf1)*epsm/tp2;
691
692 const G4double alpha2 = 0.4082483*(eps0*tp1/(tp2*lgf1*lgf2) - 0.25*alpha1*alpha1);
693
694 const G4double gamma = (6.0*fScrA*lgf2*(1.0 + fScrA)/fG1)*fMCtoG2PerG1;
695
696 const G4double delta = 0.9082483 - (0.1020621 - 0.0263747*gamma)*Qn1 +
alpha2;
697
698
699
701 const G4double eta0 = 0.5*(1 - eta)*(1.0 + alpha1);
703 const G4double eta2 = eta*(1.0 - delta);
704
705
706
707 const G4double a1 = 0.5*(1 - eta)*(1.0 - alpha1);
709 const G4double dum1 = eta1*sinTheta1;
710 const G4double xf = dum1*cosPhi1 + eta2*(cosPhi1*u2 - sinPhi1*w1v2) + a1*uf;
711 const G4double yf = dum1*sinPhi1 + eta2*(sinPhi1*u2 + cosPhi1*w1v2) + a1*vf;
712 const G4double zf = eta0 + eta1*cosTheta1 + eta2*cosTheta2 + a1*wf;
713
714
715 const G4double rx = xf*fTheTrueStepLenght;
716 const G4double ry = yf*fTheTrueStepLenght;
717 const G4double rz = zf*fTheTrueStepLenght;
718
719 const G4double transportDistance = std::min(std::sqrt(rx*rx + ry*ry + rz*rz), fTheTrueStepLenght);
720
721
722
723 fTheZPathLenght = transportDistance;
724 fTheDisplacementVector.set(rx, ry, rz - fTheZPathLenght);
725}
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)