Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4eDPWAElasticDCS Class Reference

#include <G4eDPWAElasticDCS.hh>

Public Member Functions

 G4eDPWAElasticDCS (G4bool iselectron=true, G4bool isrestricted=false)
 
 ~G4eDPWAElasticDCS ()
 
void InitialiseForZ (std::size_t iz)
 
void ComputeCSPerAtom (G4int iz, G4double ekin, G4double &elcs, G4double &tr1cs, G4double &tr2cs, G4double mumin=0.0, G4double mumax=1.0)
 
G4double SampleCosineTheta (std::size_t iz, G4double lekin, G4double r1, G4double r2, G4double r3)
 
G4double SampleCosineThetaRestricted (std::size_t iz, G4double lekin, G4double r1, G4double r2, G4double costMax, G4double costMin)
 
G4double ComputeScatteringPowerCorrection (const G4MaterialCutsCouple *matcut, G4double ekin)
 
void InitSCPCorrection (G4double lowEnergyLimit, G4double highEnergyLimit)
 

Detailed Description

Definition at line 107 of file G4eDPWAElasticDCS.hh.

Constructor & Destructor Documentation

◆ G4eDPWAElasticDCS()

G4eDPWAElasticDCS::G4eDPWAElasticDCS ( G4bool  iselectron = true,
G4bool  isrestricted = false 
)

Definition at line 80 of file G4eDPWAElasticDCS.cc.

81: fIsRestrictedSamplingRequired(isrestricted), fIsElectron(iselectron) {
82 fDCS.resize(gMaxZ+1, nullptr);
83 fDCSLow.resize(gMaxZ+1, nullptr);
84 fSamplingTables.resize(gMaxZ+1, nullptr);
85}

◆ ~G4eDPWAElasticDCS()

G4eDPWAElasticDCS::~G4eDPWAElasticDCS ( )

Definition at line 89 of file G4eDPWAElasticDCS.cc.

89 {
90 for (std::size_t i=0; i<fDCS.size(); ++i) {
91 if (fDCS[i]) delete fDCS[i];
92 }
93 for (std::size_t i=0; i<fDCSLow.size(); ++i) {
94 if (fDCSLow[i]) delete fDCSLow[i];
95 }
96 for (std::size_t i=0; i<fSamplingTables.size(); ++i) {
97 if (fSamplingTables[i]) delete fSamplingTables[i];
98 }
99 // clear scp correction data
100 for (std::size_t imc=0; imc<fSCPCPerMatCuts.size(); ++imc) {
101 if (fSCPCPerMatCuts[imc]) {
102 fSCPCPerMatCuts[imc]->fVSCPC.clear();
103 delete fSCPCPerMatCuts[imc];
104 }
105 }
106 fSCPCPerMatCuts.clear();
107}

Member Function Documentation

◆ ComputeCSPerAtom()

void G4eDPWAElasticDCS::ComputeCSPerAtom ( G4int  iz,
G4double  ekin,
G4double elcs,
G4double tr1cs,
G4double tr2cs,
G4double  mumin = 0.0,
G4double  mumax = 1.0 
)

Definition at line 268 of file G4eDPWAElasticDCS.cc.

270 {
271 // init all cross section values to zero;
272 elcs = 0.0;
273 tr1cs = 0.0;
274 tr2cs = 0.0;
275 // make sure that mu(theta) = 0.5[1-cos(theta)] limits have appropriate vals
276 mumin = std::max(0.0, std::min(1.0, mumin));
277 mumax = std::max(0.0, std::min(1.0, mumax));
278 if (mumin>=mumax) return;
279 // make sure that kin. energy is within the available range (10 eV-100MeV)
280 const G4double lekin = std::max(gTheEnergies[0], std::min(gTheEnergies[gNumEnergies-1], G4Log(ekin)));
281 // if the lower, denser in theta, DCS set should be used
282 const G4bool isLowerGrid = (fIsElectron && lekin<gTheEnergies[gIndxEnergyLim]);
283 const std::vector<G4double>& theMuVector = (isLowerGrid) ? gTheMus1 : gTheMus2;
284 const G4Physics2DVector* the2DDCS = (isLowerGrid) ? fDCSLow[iz] : fDCS[iz];
285 // find lower/upper mu bin of integration:
286 // 0.0 <= mumin < 1.0 for sure here
287 const std::size_t iMuStart = (mumin == 0.0) ? 0 : std::distance( theMuVector.begin(), std::upper_bound(theMuVector.begin(), theMuVector.end(), mumin) )-1 ;
288 // 0.0 < mumax <= 1.0 for sure here
289 const std::size_t iMuEnd = (mumax == 1.0) ? theMuVector.size()-2 : std::distance( theMuVector.begin(), std::upper_bound(theMuVector.begin(), theMuVector.end(), mumax) )-1 ;
290 // perform numerical integration of the DCS over the given [mumin, mumax]
291 // interval (where mu(theta) = 0.5[1-cos(theta)]) to get the elastic, first
292 std::size_t ix = 0;
293 std::size_t iy = 0;
294 for (std::size_t imu=iMuStart; imu<=iMuEnd; ++imu) {
295 G4double elcsPar = 0.0;
296 G4double tr1csPar = 0.0;
297 G4double tr2csPar = 0.0;
298 const G4double low = (imu==iMuStart) ? mumin : theMuVector[imu];
299 const G4double del = (imu==iMuEnd) ? mumax-low : theMuVector[imu+1]-low;
300 ix = imu;
301 for (std::size_t igl=0; igl<8; ++igl) {
302 const double mu = low + del*gXGL[igl];
303 const double dcs = G4Exp(the2DDCS->Value(mu, lekin, ix, iy));
304 elcsPar += gWGL[igl]*dcs; // elastic
305 tr1csPar += gWGL[igl]*dcs*mu; // first transport
306 tr2csPar += gWGL[igl]*dcs*mu*(1.0-mu); // second transport
307 }
308 elcs += del*elcsPar;
309 tr1cs += del*tr1csPar;
310 tr2cs += del*tr2csPar;
311 }
312 elcs *= 2.0*CLHEP::twopi;
313 tr1cs *= 4.0*CLHEP::twopi;
314 tr2cs *= 12.0*CLHEP::twopi;
315}
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
G4double G4Log(G4double x)
Definition: G4Log.hh:226
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
G4double Value(G4double x, G4double y, std::size_t &lastidx, std::size_t &lastidy) const

Referenced by G4eDPWACoulombScatteringModel::ComputeCrossSectionPerAtom().

◆ ComputeScatteringPowerCorrection()

G4double G4eDPWAElasticDCS::ComputeScatteringPowerCorrection ( const G4MaterialCutsCouple matcut,
G4double  ekin 
)

Definition at line 571 of file G4eDPWAElasticDCS.cc.

572 {
573 const G4int imc = matcut->GetIndex();
574 G4double corFactor = 1.0;
575 if (!(fSCPCPerMatCuts[imc]->fIsUse) || ekin<=fSCPCPerMatCuts[imc]->fPrCut) {
576 return corFactor;
577 }
578 // get the scattering power correction factor
579 const G4double lekin = G4Log(ekin);
580 G4double remaining = (lekin-fSCPCPerMatCuts[imc]->fLEmin)*fSCPCPerMatCuts[imc]->fILDel;
581 G4int lindx = (G4int)remaining;
582 remaining -= lindx;
583 G4int imax = fSCPCPerMatCuts[imc]->fVSCPC.size()-1;
584 if (lindx>=imax) {
585 corFactor = fSCPCPerMatCuts[imc]->fVSCPC[imax];
586 } else {
587 corFactor = fSCPCPerMatCuts[imc]->fVSCPC[lindx] + remaining*(fSCPCPerMatCuts[imc]->fVSCPC[lindx+1]-fSCPCPerMatCuts[imc]->fVSCPC[lindx]);
588 }
589 return corFactor;
590}
int G4int
Definition: G4Types.hh:85

Referenced by G4eDPWACoulombScatteringModel::ComputeCrossSectionPerAtom().

◆ InitialiseForZ()

void G4eDPWAElasticDCS::InitialiseForZ ( std::size_t  iz)

Definition at line 112 of file G4eDPWAElasticDCS.cc.

112 {
113 if (!gIsGridLoaded) {
114 LoadGrid();
115 }
116 LoadDCSForZ(iz);
117 BuildSmplingTableForZ(iz);
118}

Referenced by G4eDPWACoulombScatteringModel::Initialise().

◆ InitSCPCorrection()

void G4eDPWAElasticDCS::InitSCPCorrection ( G4double  lowEnergyLimit,
G4double  highEnergyLimit 
)

Definition at line 593 of file G4eDPWAElasticDCS.cc.

594 {
595 // get the material-cuts table
597 std::size_t numMatCuts = thePCTable->GetTableSize();
598 // clear container if any
599 for (std::size_t imc=0; imc<fSCPCPerMatCuts.size(); ++imc) {
600 if (fSCPCPerMatCuts[imc]) {
601 fSCPCPerMatCuts[imc]->fVSCPC.clear();
602 delete fSCPCPerMatCuts[imc];
603 fSCPCPerMatCuts[imc] = nullptr;
604 }
605 }
606 //
607 // set size of the container and create the corresponding data structures
608 fSCPCPerMatCuts.resize(numMatCuts,nullptr);
609 // loop over the material-cuts and create scattering power correction data structure for each
610 for (std::size_t imc=0; imc<numMatCuts; ++imc) {
611 const G4MaterialCutsCouple *matCut = thePCTable->GetMaterialCutsCouple(imc);
612 const G4Material* mat = matCut->GetMaterial();
613 // get e- production cut in the current material-cuts in energy
614 const G4double ecut = (*(thePCTable->GetEnergyCutsVector(idxG4ElectronCut)))[matCut->GetIndex()];
615 const G4double limit = fIsElectron ? 2.0*ecut : ecut;
616 const G4double min = std::max(limit,lowEnergyLimit);
617 const G4double max = highEnergyLimit;
618 if (min>=max) {
619 fSCPCPerMatCuts[imc] = new SCPCorrection();
620 fSCPCPerMatCuts[imc]->fIsUse = false;
621 fSCPCPerMatCuts[imc]->fPrCut = min;
622 continue;
623 }
624 G4int numEbins = fNumSPCEbinPerDec*G4lrint(std::log10(max/min));
625 numEbins = std::max(numEbins,3);
626 const G4double lmin = G4Log(min);
627 const G4double ldel = G4Log(max/min)/(numEbins-1.0);
628 fSCPCPerMatCuts[imc] = new SCPCorrection();
629 fSCPCPerMatCuts[imc]->fVSCPC.resize(numEbins,1.0);
630 fSCPCPerMatCuts[imc]->fIsUse = true;
631 fSCPCPerMatCuts[imc]->fPrCut = min;
632 fSCPCPerMatCuts[imc]->fLEmin = lmin;
633 fSCPCPerMatCuts[imc]->fILDel = 1./ldel;
634 // compute Moliere material dependet parameetrs
635 G4double moliereBc = 0.0;
636 G4double moliereXc2 = 0.0;
637 ComputeMParams(mat, moliereBc, moliereXc2);
638 // compute scattering power correction over the enrgy grid
639 for (G4int ie=0; ie<numEbins; ++ie) {
640 const G4double ekin = G4Exp(lmin+ie*ldel);
641 G4double scpCorr = 1.0;
642 // compute correction factor: I.Kawrakow, Med.Phys.24,505-517(1997)(Eqs(32-37)
643 if (ie>0) {
644 const G4double tau = ekin/CLHEP::electron_mass_c2;
645 const G4double tauCut = ecut/CLHEP::electron_mass_c2;
646 // Moliere's screening parameter
647 const G4double A = moliereXc2/(4.0*tau*(tau+2.)*moliereBc);
648 const G4double gr = (1.+2.*A)*G4Log(1.+1./A)-2.;
649 const G4double dum0 = (tau+2.)/(tau+1.);
650 const G4double dum1 = tau+1.;
651 G4double gm = G4Log(0.5*tau/tauCut) + (1.+dum0*dum0)*G4Log(2.*(tau-tauCut+2.)/(tau+4.))
652 - 0.25*(tau+2.)*( tau+2.+2.*(2.*tau+1.)/(dum1*dum1))*
653 G4Log((tau+4.)*(tau-tauCut)/tau/(tau-tauCut+2.))
654 + 0.5*(tau-2*tauCut)*(tau+2.)*(1./(tau-tauCut)-1./(dum1*dum1));
655 if (gm<gr) {
656 gm = gm/gr;
657 } else {
658 gm = 1.;
659 }
660 const G4double z0 = matCut->GetMaterial()->GetIonisation()->GetZeffective();
661 scpCorr = 1.-gm*z0/(z0*(z0+1.));
662 }
663 fSCPCPerMatCuts[imc]->fVSCPC[ie] = scpCorr;
664 }
665 }
666}
double A(double temperature)
@ idxG4ElectronCut
G4double GetZeffective() const
const G4Material * GetMaterial() const
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
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
int G4lrint(double ad)
Definition: templates.hh:134

Referenced by G4eDPWACoulombScatteringModel::Initialise().

◆ SampleCosineTheta()

G4double G4eDPWAElasticDCS::SampleCosineTheta ( std::size_t  iz,
G4double  lekin,
G4double  r1,
G4double  r2,
G4double  r3 
)

Definition at line 403 of file G4eDPWAElasticDCS.cc.

404 {
405 lekin = std::max(gTheEnergies[0], std::min(gTheEnergies[gNumEnergies-1], lekin));
406 // determine the discrete ekin sampling table to be used:
407 // - statistical interpolation (i.e. linear) on log energy scale
408 const G4double rem = (lekin-gLogMinEkin)*gInvDelLogEkin;
409 const std::size_t k = (std::size_t)rem;
410 const std::size_t iekin = (r1 < rem-k) ? k+1 : k;
411 // sample the mu(t)=0.5(1-cos(t))
412 const double mu = SampleMu(iz, iekin, r2, r3);
413 return std::max(-1.0, std::min(1.0, 1.0-2.0*mu));
414}

Referenced by G4eDPWACoulombScatteringModel::SampleSecondaries().

◆ SampleCosineThetaRestricted()

G4double G4eDPWAElasticDCS::SampleCosineThetaRestricted ( std::size_t  iz,
G4double  lekin,
G4double  r1,
G4double  r2,
G4double  costMax,
G4double  costMin 
)

Definition at line 426 of file G4eDPWAElasticDCS.cc.

428 {
429 // costMin corresponds to mu-max while costMax to mu-min: mu(t)=0.5[1-cos(t)]
430 lekin = std::max(gTheEnergies[0], std::min(gTheEnergies[gNumEnergies-1], lekin));
431 // determine the discrete ekin sampling table to be used:
432 // - statistical interpolation (i.e. linear) on log energy scale
433 const G4double rem = (lekin-gLogMinEkin)*gInvDelLogEkin;
434 const std::size_t k = (size_t)rem;
435 const std::size_t iekin = (r1 < rem-k) ? k : k+1;
436 // sample the mu(t)=0.5(1-cos(t))
437 const G4double mu = SampleMu(iz, iekin, r2, 0.5*(1.0-costMax), 0.5*(1.0-costMin));
438 return std::max(-1.0, std::min(1.0, 1.0-2.0*mu));
439}

Referenced by G4eDPWACoulombScatteringModel::SampleSecondaries().


The documentation for this class was generated from the following files: