107std::vector<double> G4GoudsmitSaundersonTable::gMoliereBc;
108std::vector<double> G4GoudsmitSaundersonTable::gMoliereXc2;
126 fMottCorrection =
nullptr;
150 if (fMottCorrection) {
151 delete fMottCorrection;
152 fMottCorrection =
nullptr;
187 if (!fMottCorrection) {
190 fMottCorrection->Initialise();
194 if (fMottCorrection) {
228 if (rand0<(1.+lambdaval)*expn) {
232 if (cost<-1.0) cost = -1.0;
233 if (cost>1.0) cost = 1.0;
236 sint = std::sqrt(dum0*(2.0-dum0));
255 prob = cumprob = expn;
260 for (
G4int iel=1; iel<10; ++iel) {
269 cursint = dum0*(2.0-dum0);
273 if (cursint>1.0e-20) {
274 cursint = std::sqrt(cursint);
276 cost = cost*curcost-sint*cursint*std::cos(curphi);
277 sint = std::sqrt(
std::max(0.0, (1.0-cost)*(1.0+cost)));
293 cost =
SampleCosTheta(lambdaval, qval, scra, lekin, beta2, matindx, gsDtr, mcekini, mcdelti, transfPar, isfirst);
295 if (cost<-1.0) cost = -1.0;
296 if (cost> 1.0) cost = 1.0;
299 sint = std::sqrt(dum0*(2.0-dum0));
318 static const G4int nlooplim = 1000;
322 G4double val = fMottCorrection->GetMottRejectionValue(lekin, beta2, qval, cost, matindx, mcekini, mcdelti);
326 val = fMottCorrection->GetMottRejectionValue(lekin, beta2, qval, cost, matindx, mcekini, mcdelti);
345 G4int indxl = rndm*ndatm1;
354 return 1.-(2.0*transfpar*sample)/(1.0-sample+transfpar);
397 lamIndx = (
G4int)(pIndxH);
398 pIndxH = pIndxH-lamIndx;
406 pIndxH = (qval-minQVal)*invDelQ;
407 qIndx = (
G4int)(pIndxH);
408 pIndxH = pIndxH-qIndx;
414 G4int indx = lamIndx*numQVal+qIndx;
425 if (lambdaval>10.0) {
426 transfpar = 0.5*(-2.77164+lLambda*( 2.94874-lLambda*(0.1535754-lLambda*0.00552888) ));
428 transfpar = 0.5*(1.347+lLambda*(0.209364-lLambda*(0.45525-lLambda*(0.50142-lLambda*0.081234))));
430 transfpar *= (lambdaval+4.0)*scra;
438 char* path = std::getenv(
"G4LEDATA");
440 G4Exception(
"G4GoudsmitSaundersonTable::LoadMSCData()",
"em0006",
442 "Environment variable G4LEDATA not defined");
450 std::ifstream infile(
fname,std::ios::in);
451 if (!infile.is_open()) {
453 G4Exception(
"G4GoudsmitSaundersonTable::LoadMSCData()",
"em0006",
464 infile >> ddummy; infile >> ddummy;
480 std::ifstream infile(
fname,std::ios::in);
481 if (!infile.is_open()) {
483 G4Exception(
"G4GoudsmitSaundersonTable::LoadMSCData()",
"em0006",
497 infile >> ddummy; infile >> ddummy;
519 G4double cost = 1.-2.0*scra*rand1/(1.0-rand1+scra);
522 static const G4int nlooplim = 1000;
528 G4double val = fMottCorrection->GetMottRejectionValue(lekin, beta2, q1, cost,
529 matindx, ekindx, deltindx);
533 cost = 1.-2.0*scra*rand1/(1.0-rand1+scra);
535 val = fMottCorrection->GetMottRejectionValue(lekin, beta2, q1, cost, matindx,
547 fMottCorrection->GetMottCorrectionFactors(logekin, beta2, matindx, mcToScr, mcToQ1, mcToG2PerG1);
556 const G4double finstrc2 = 5.325135453E-5;
560 size_t numMaterials = theMaterialTable->size();
562 if(gMoliereBc.size()<numMaterials) {
563 gMoliereBc.resize(numMaterials);
564 gMoliereXc2.resize(numMaterials);
573 for (
size_t imat=0; imat<numMaterials; ++imat) {
574 const G4Material* theMaterial = (*theMaterialTable)[imat];
586 for(
G4int ielem = 0; ielem < numelems; ielem++) {
587 G4double zet = (*theElemVect)[ielem]->GetZ();
591 G4double iwa = (*theElemVect)[ielem]->GetN();
592 G4double ipz = theNbAtomsPerVolVect[ielem]/theTotNbAtomsPerVol;
595 ze += dum*(-2.0/3.0)*
G4Log(zet);
596 zx += dum*
G4Log(1.0+3.34*finstrc2*zet*zet);
602 gMoliereXc2[theMaterial->
GetIndex()] = const2*density*zs/sa;
648 for (
size_t imc=0; imc<numMatCuts; ++imc) {
678 for (
G4int ie=0; ie<numEbins; ++ie) {
691 G4double gm =
G4Log(0.5*tau/tauCut) + (1.+dum0*dum0)*
G4Log(2.*(tau-tauCut+2.)/(tau+4.))
692 - 0.25*(tau+2.)*( tau+2.+2.*(2.*tau+1.)/(dum1*dum1))*
693 G4Log((tau+4.)*(tau-tauCut)/tau/(tau-tauCut+2.))
694 + 0.5*(tau-2*tauCut)*(tau+2.)*(1./(tau-tauCut)-1./(dum1*dum1));
701 scpCorr = 1.-gm*
z0/(
z0*(
z0+1.));
std::vector< const G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
std::vector< G4Material * > G4MaterialTable
G4double SampleGSSRCosTheta(const GSMSCAngularDtr *gsDrt, G4double transfpar)
static std::vector< GSMSCAngularDtr * > gGSMSCAngularDistributions2
static constexpr G4int gQNUM1
static constexpr G4int gQNUM2
G4double SampleCosTheta(G4double lambdaval, G4double qval, G4double scra, G4double lekin, G4double beta2, G4int matindx, GSMSCAngularDtr **gsDtr, G4int &mcekini, G4int &mcdelti, G4double &transfPar, G4bool isfirst)
G4double fHighEnergyLimit
static constexpr G4int gLAMBNUM
static constexpr G4double gQMAX1
static std::vector< GSMSCAngularDtr * > gGSMSCAngularDistributions1
G4double ComputeScatteringPowerCorrection(const G4MaterialCutsCouple *matcut, G4double ekin)
void GetMottCorrectionFactors(G4double logekin, G4double beta2, G4int matindx, G4double &mcToScr, G4double &mcToQ1, G4double &mcToG2PerG1)
G4double SingleScattering(G4double lambdaval, G4double scra, G4double lekin, G4double beta2, G4int matindx)
~G4GoudsmitSaundersonTable()
static constexpr G4double gQMIN1
G4bool Sampling(G4double lambdaval, G4double qval, G4double scra, G4double &cost, G4double &sint, G4double lekin, G4double beta2, G4int matindx, GSMSCAngularDtr **gsDtr, G4int &mcekini, G4int &mcdelti, G4double &transfPar, G4bool isfirst)
G4GoudsmitSaundersonTable(G4bool iselectron)
GSMSCAngularDtr * GetGSAngularDtr(G4double scra, G4double &lambdaval, G4double &qval, G4double &transfpar)
static constexpr G4double gLAMBMAX
G4double GetMoliereBc(G4int matindx)
std::vector< SCPCorrection * > fSCPCPerMatCuts
G4double fInvLogDeltaLambda
static G4bool gIsInitialised
void Initialise(G4double lownergylimit, G4double highenergylimit)
static constexpr G4double gQMIN2
void InitMoliereMSCParams()
static constexpr G4double gQMAX2
G4double GetMoliereXc2(G4int matindx)
static constexpr G4double gLAMBMIN
G4double GetZeffective() const
const G4Material * GetMaterial() const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
G4double GetTotNbOfAtomsPerVolume() const
G4IonisParamMat * GetIonisation() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4MaterialTable * GetMaterialTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
static constexpr double electron_mass_c2
static constexpr double cm3
static constexpr double keV
static constexpr double twopi
static constexpr double MeV
static constexpr double g
static constexpr double cm
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments