57const std::string G4GSPWACorrections::gElemSymbols[] = {
"H",
"He",
"Li",
"Be",
"B" ,
58 "C" ,
"N" ,
"O" ,
"F" ,
"Ne",
"Na",
"Mg",
"Al",
"Si",
"P" ,
"S",
"Cl",
"Ar",
"K" ,
"Ca",
"Sc",
59 "Ti",
"V" ,
"Cr",
"Mn",
"Fe",
"Co",
"Ni",
"Cu",
"Zn",
"Ga",
"Ge",
"As",
"Se",
"Br",
"Kr",
"Rb",
60 "Sr",
"Y" ,
"Zr",
"Nb",
"Mo",
"Tc",
"Ru",
"Rh",
"Pd",
"Ag",
"Cd",
"In",
"Sn",
"Sb",
"Te",
"I" ,
61 "Xe",
"Cs",
"Ba",
"La",
"Ce",
"Pr",
"Nd",
"Pm",
"Sm",
"Eu",
"Gd",
"Tb",
"Dy",
"Ho",
"Er",
"Tm",
62 "Yb",
"Lu",
"Hf",
"Ta",
"W" ,
"Re",
"Os",
"Ir",
"Pt",
"Au",
"Hg",
"Tl",
"Pb",
"Bi",
"Po",
"At",
63 "Rn",
"Fr",
"Ra",
"Ac",
"Th",
"Pa",
"U" ,
"Np",
"Pu",
"Am",
"Cm",
"Bk",
"Cf"};
67 fMaxEkin = CLHEP::electron_mass_c2*(1./std::sqrt(1.-gMaxBeta2)-1.);
68 fLogMinEkin =
G4Log(gMinEkin);
69 fInvLogDelEkin = (gNumEkin-gNumBeta2)/
G4Log(gMidEkin/gMinEkin);
70 G4double pt2 = gMidEkin*(gMidEkin+2.0*CLHEP::electron_mass_c2);
71 fMinBeta2 = pt2/(pt2+CLHEP::electron_mass_c2*CLHEP::electron_mass_c2);
72 fInvDelBeta2 = (gNumBeta2-1.)/(gMaxBeta2-fMinBeta2);
77 ClearDataPerElement();
78 ClearDataPerMaterial();
84 G4int ekinIndxLow = 0;
86 if (beta2>=gMaxBeta2) {
87 ekinIndxLow = gNumEkin - 1;
89 }
else if (beta2>=fMinBeta2) {
90 remRfaction = (beta2 - fMinBeta2) * fInvDelBeta2;
91 ekinIndxLow = (
G4int)remRfaction;
92 remRfaction -= ekinIndxLow;
93 ekinIndxLow += (gNumEkin - gNumBeta2);
94 }
else if (logekin>=fLogMinEkin) {
95 remRfaction = (logekin - fLogMinEkin) * fInvLogDelEkin;
96 ekinIndxLow = (
G4int)remRfaction;
97 remRfaction -= ekinIndxLow;
100 DataPerMaterial *data = fDataPerMaterial[matindx];
101 corToScr = data->fCorScreening[ekinIndxLow];
102 corToQ1 = data->fCorFirstMoment[ekinIndxLow];
103 corToG2PerG1 = data->fCorSecondMoment[ekinIndxLow];
104 if (remRfaction>0.) {
105 corToScr += remRfaction*(data->fCorScreening[ekinIndxLow+1] - data->fCorScreening[ekinIndxLow]);
106 corToQ1 += remRfaction*(data->fCorFirstMoment[ekinIndxLow+1] - data->fCorFirstMoment[ekinIndxLow]);
107 corToG2PerG1 += remRfaction*(data->fCorSecondMoment[ekinIndxLow+1] - data->fCorSecondMoment[ekinIndxLow]);
114 InitDataPerElement();
116 ClearDataPerMaterial();
118 InitDataPerMaterials();
122void G4GSPWACorrections::InitDataPerElement() {
124 if (fDataPerElement.size()<gMaxZet+1) {
125 fDataPerElement.resize(gMaxZet+1,
nullptr);
131 for (
G4int imc=0; imc<numMatCuts; ++imc) {
139 std::size_t numElems = elemVect->size();
140 for (std::size_t ielem=0; ielem<numElems; ++ielem) {
146 if (!fDataPerElement[izet]) {
147 LoadDataElement(
elem);
154void G4GSPWACorrections::InitDataPerMaterials() {
157 if (fDataPerMaterial.size()!=numMaterials) {
158 fDataPerMaterial.resize(numMaterials);
163 for (
G4int imc=0; imc<numMatCuts; ++imc) {
169 if (!fDataPerMaterial[mat->
GetIndex()]) {
170 InitDataMaterial(mat);
177void G4GSPWACorrections::LoadDataElement(
const G4Element *
elem) {
186 path +=
"/msc_GS/PWACor/el/";
188 path +=
"/msc_GS/PWACor/pos/";
190 std::string fname = path+
"cf_"+gElemSymbols[izet-1];
191 std::ifstream infile(fname,std::ios::in);
192 if (!infile.is_open()) {
193 std::string msg =
" Problem while trying to read " + fname +
" data file.\n";
198 auto perElem =
new DataPerMaterial();
199 perElem->fCorScreening.resize(gNumEkin,0.0);
200 perElem->fCorFirstMoment.resize(gNumEkin,0.0);
201 perElem->fCorSecondMoment.resize(gNumEkin,0.0);
202 fDataPerElement[izet] = perElem;
204 for (
G4int iek=0; iek<gNumEkin; ++iek) {
206 infile >> perElem->fCorScreening[iek];
207 infile >> perElem->fCorFirstMoment[iek];
208 infile >> perElem->fCorSecondMoment[iek];
214void G4GSPWACorrections::InitDataMaterial(
const G4Material *mat) {
217 constexpr G4double finstrc2 = 5.325135453E-5;
219 G4double constFactor = CLHEP::electron_mass_c2*CLHEP::fine_structure_const/0.88534;
220 constFactor *= constFactor;
222 auto perMat =
new DataPerMaterial();
223 perMat->fCorScreening.resize(gNumEkin,0.0);
224 perMat->fCorFirstMoment.resize(gNumEkin,0.0);
225 perMat->fCorSecondMoment.resize(gNumEkin,0.0);
226 fDataPerMaterial[mat->
GetIndex()] = perMat;
242 for (
G4int ielem=0; ielem<numElems; ++ielem) {
243 G4double zet = (*elemVect)[ielem]->GetZ();
247 G4double iwa = (*elemVect)[ielem]->GetN();
248 G4double ipz = nbAtomsPerVolVect[ielem]/totNbAtomsPerVol;
251 ze += dum*(-2.0/3.0)*
G4Log(zet);
252 zx += dum*
G4Log(1.0+3.34*finstrc2*zet*zet);
257 moliereBc = const1*density*zs/sa*
G4Exp(ze/zs)/
G4Exp(zx/zs);
258 moliereXc2 = const2*density*zs/sa;
260 moliereBc *= 1.0/CLHEP::cm;
261 moliereXc2 *= CLHEP::MeV*CLHEP::MeV/CLHEP::cm;
264 for (
G4int iek=0; iek<gNumEkin; ++iek) {
267 G4double pt2 = ekin*(ekin+2.0*CLHEP::electron_mass_c2);
269 G4double b2 = fMinBeta2+(iek-(gNumEkin-gNumBeta2))/fInvDelBeta2;
270 ekin = CLHEP::electron_mass_c2*(1./std::sqrt(1.-b2)-1.);
271 pt2 = ekin*(ekin+2.0*CLHEP::electron_mass_c2);
274 for (
G4int ielem=0; ielem<numElems; ++ielem) {
282 DataPerMaterial *perElem = fDataPerElement[izet];
285 G4double nZZPlus1 = nbAtomsPerVolVect[ielem]*zet*(zet+1.0)/totNbAtomsPerVol;
289 G4double mcScrCF = perElem->fCorScreening[iek];
294 perMat->fCorScreening[iek] += nZZPlus1*
G4Log(Z23*mcScrCF);
297 mcScrCF *= constFactor*Z23/(4.*pt2);
307 perMat->fCorFirstMoment[iek] += nZZPlus1*(
G4Log(1.+1./mcScrCF)-1./(1.+mcScrCF))*perElem->fCorFirstMoment[iek];
312 perMat->fCorSecondMoment[iek] += nZZPlus1*perElem->fCorSecondMoment[iek];
315 if (ielem==numElems-1) {
320 perMat->fCorScreening[iek] = constFactor*dumScr*moliereBc/moliereXc2;
324 G4double scrCorTed = constFactor*dumScr/(4.*pt2);
326 perMat->fCorFirstMoment[iek] = perMat->fCorFirstMoment[iek]/(zs*(dum0-1./(1.+scrCorTed)));
330 G4double G2PerG1 = 3.*(1.+scrCorTed)*((1.+2.*scrCorTed)*dum0-2.)/((1.+scrCorTed)*dum0-1.);
331 perMat->fCorSecondMoment[iek] = perMat->fCorSecondMoment[iek]/(zs*G2PerG1);
339void G4GSPWACorrections::ClearDataPerElement() {
340 for (std::size_t i=0; i<fDataPerElement.size(); ++i) {
341 if (fDataPerElement[i]) {
342 fDataPerElement[i]->fCorScreening.clear();
343 fDataPerElement[i]->fCorFirstMoment.clear();
344 fDataPerElement[i]->fCorSecondMoment.clear();
345 delete fDataPerElement[i];
348 fDataPerElement.clear();
352void G4GSPWACorrections::ClearDataPerMaterial() {
353 for (std::size_t i=0; i<fDataPerMaterial.size(); ++i) {
354 if (fDataPerMaterial[i]) {
355 fDataPerMaterial[i]->fCorScreening.clear();
356 fDataPerMaterial[i]->fCorFirstMoment.clear();
357 fDataPerMaterial[i]->fCorSecondMoment.clear();
358 delete fDataPerMaterial[i];
361 fDataPerMaterial.clear();
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)
static G4EmParameters * Instance()
const G4String & GetDirLEDATA() const
G4GSPWACorrections(G4bool iselectron=true)
void GetPWACorrectionFactors(G4double logekin, G4double beta2, G4int matindx, G4double &corToScr, G4double &corToQ1, G4double &corToG2PerG1)
const G4Material * GetMaterial() const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
G4double GetTotNbOfAtomsPerVolume() const
static std::size_t GetNumberOfMaterials()
const G4double * GetVecNbOfAtomsPerVolume() const
std::size_t GetIndex() const
std::size_t GetNumberOfElements() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()