91 #include "G4String.hh"
107 std::vector<double> G4GoudsmitSaundersonTable::gMoliereBc;
108 std::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.0
e-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));
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");
451 if (!infile.is_open()) {
453 G4Exception(
"G4GoudsmitSaundersonTable::LoadMSCData()",
"em0006",
464 infile >> ddummy; infile >> ddummy;
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);
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.));