63 oscillatorStoreIonisation(0),oscillatorStoreCompton(0),atomicNumber(0),
64 atomicMass(0),excitationEnergy(0),plasmaSquared(0),atomsPerMolecule(0),
65 atomTablePerMolecule(0)
67 fReadElementData =
false;
68 for (
G4int i=0;i<5;i++)
70 for (
G4int j=0;j<2000;j++)
71 elementData[i][j] = 0.;
101 if (verbosityLevel > 1)
102 G4cout <<
" G4PenelopeOscillatorManager::Clear() - Clean Oscillator Tables" <<
G4endl;
105 for (
auto& item : (*oscillatorStoreIonisation))
110 for (
size_t k=0;k<table->size();k++)
113 delete ((*table)[k]);
118 delete oscillatorStoreIonisation;
121 for (
auto& item : (*oscillatorStoreCompton))
126 for (
size_t k=0;k<table->size();k++)
129 delete ((*table)[k]);
134 delete oscillatorStoreCompton;
136 if (atomicMass)
delete atomicMass;
137 if (atomicNumber)
delete atomicNumber;
138 if (excitationEnergy)
delete excitationEnergy;
139 if (plasmaSquared)
delete plasmaSquared;
140 if (atomsPerMolecule)
delete atomsPerMolecule;
141 if (atomTablePerMolecule)
delete atomTablePerMolecule;
151 G4cout <<
" G4PenelopeOscillatorManager::Dump " <<
G4endl;
152 G4cout <<
"Problem in retrieving the Ionisation Oscillator Table for " << material->
GetName() <<
G4endl;
155 G4cout <<
"*********************************************************************" <<
G4endl;
157 G4cout <<
"*********************************************************************" <<
G4endl;
158 G4cout <<
"The table contains " << theTable->size() <<
" oscillators " <<
G4endl;
159 G4cout <<
"*********************************************************************" <<
G4endl;
160 if (theTable->size() < 10)
161 for (
size_t k=0;k<theTable->size();k++)
163 G4cout <<
"Oscillator # " << k <<
" Z = " << (*theTable)[k]->GetParentZ() <<
164 " Shell Flag = " << (*theTable)[k]->GetShellFlag() <<
165 " Parent shell ID = " << (*theTable)[k]->GetParentShellID() <<
G4endl;
166 G4cout <<
"Ionisation energy = " << (*theTable)[k]->GetIonisationEnergy()/
eV <<
" eV" <<
G4endl;
167 G4cout <<
"Occupation number = " << (*theTable)[k]->GetOscillatorStrength() <<
G4endl;
168 G4cout <<
"Resonance energy = " << (*theTable)[k]->GetResonanceEnergy()/
eV <<
" eV" <<
G4endl;
169 G4cout <<
"Cufoff resonance energy = " <<
170 (*theTable)[k]->GetCutoffRecoilResonantEnergy()/
eV <<
" eV" <<
G4endl;
171 G4cout <<
"*********************************************************************" <<
G4endl;
173 for (
size_t k=0;k<theTable->size();k++)
175 G4cout << k <<
" " << (*theTable)[k]->GetOscillatorStrength() <<
" " <<
176 (*theTable)[k]->GetIonisationEnergy()/
eV <<
" " << (*theTable)[k]->GetResonanceEnergy()/
eV <<
" " <<
177 (*theTable)[k]->GetParentZ() <<
" " << (*theTable)[k]->GetShellFlag() <<
" " <<
178 (*theTable)[k]->GetParentShellID() <<
G4endl;
180 G4cout <<
"*********************************************************************" <<
G4endl;
187 G4cout <<
" G4PenelopeOscillatorManager::Dump " <<
G4endl;
188 G4cout <<
"Problem in retrieving the Compton Oscillator Table for " << material->
GetName() <<
G4endl;
191 G4cout <<
"*********************************************************************" <<
G4endl;
193 G4cout <<
"*********************************************************************" <<
G4endl;
194 G4cout <<
"The table contains " << theTable->size() <<
" oscillators " <<
G4endl;
195 G4cout <<
"*********************************************************************" <<
G4endl;
196 if (theTable->size() < 10)
197 for (
size_t k=0;k<theTable->size();k++)
199 G4cout <<
"Oscillator # " << k <<
" Z = " << (*theTable)[k]->GetParentZ() <<
200 " Shell Flag = " << (*theTable)[k]->GetShellFlag() <<
201 " Parent shell ID = " << (*theTable)[k]->GetParentShellID() <<
G4endl;
202 G4cout <<
"Compton index = " << (*theTable)[k]->GetHartreeFactor() <<
G4endl;
203 G4cout <<
"Ionisation energy = " << (*theTable)[k]->GetIonisationEnergy()/
eV <<
" eV" <<
G4endl;
204 G4cout <<
"Occupation number = " << (*theTable)[k]->GetOscillatorStrength() <<
G4endl;
205 G4cout <<
"*********************************************************************" <<
G4endl;
207 for (
size_t k=0;k<theTable->size();k++)
209 G4cout << k <<
" " << (*theTable)[k]->GetOscillatorStrength() <<
" " <<
210 (*theTable)[k]->GetIonisationEnergy()/
eV <<
" " << (*theTable)[k]->GetHartreeFactor() <<
" " <<
211 (*theTable)[k]->GetParentZ() <<
" " << (*theTable)[k]->GetShellFlag() <<
" " <<
212 (*theTable)[k]->GetParentShellID() <<
G4endl;
214 G4cout <<
"*********************************************************************" <<
G4endl;
221 void G4PenelopeOscillatorManager::CheckForTablesCreated()
225 if (!oscillatorStoreIonisation)
227 oscillatorStoreIonisation =
new std::map<const G4Material*,G4PenelopeOscillatorTable*>;
228 if (!fReadElementData)
230 if (!oscillatorStoreIonisation)
232 G4Exception(
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation()",
234 "Problem in allocating the Oscillator Store for Ionisation");
237 if (!oscillatorStoreCompton)
239 oscillatorStoreCompton =
new std::map<const G4Material*,G4PenelopeOscillatorTable*>;
240 if (!fReadElementData)
242 if (!oscillatorStoreCompton)
244 G4Exception(
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation()",
246 "Problem in allocating the Oscillator Store for Compton");
250 atomicNumber =
new std::map<const G4Material*,G4double>;
252 atomicMass =
new std::map<const G4Material*,G4double>;
253 if (!excitationEnergy)
254 excitationEnergy =
new std::map<const G4Material*,G4double>;
256 plasmaSquared =
new std::map<const G4Material*,G4double>;
257 if (!atomsPerMolecule)
258 atomsPerMolecule =
new std::map<const G4Material*,G4double>;
259 if (!atomTablePerMolecule)
260 atomTablePerMolecule =
new std::map< std::pair<const G4Material*,G4int>,
G4double>;
269 CheckForTablesCreated();
272 if (atomicNumber->count(mat))
273 return atomicNumber->find(mat)->second;
276 BuildOscillatorTable(mat);
279 if (atomicNumber->count(mat))
280 return atomicNumber->find(mat)->second;
283 G4cout <<
"G4PenelopeOscillatorManager::GetTotalZ() " <<
G4endl;
294 CheckForTablesCreated();
297 if (atomicMass->count(mat))
298 return atomicMass->find(mat)->second;
301 BuildOscillatorTable(mat);
304 if (atomicMass->count(mat))
305 return atomicMass->find(mat)->second;
308 G4cout <<
"G4PenelopeOscillatorManager::GetTotalA() " <<
G4endl;
319 CheckForTablesCreated();
322 if (oscillatorStoreIonisation->count(mat))
325 return oscillatorStoreIonisation->find(mat)->second;
329 BuildOscillatorTable(mat);
332 if (oscillatorStoreIonisation->count(mat))
333 return oscillatorStoreIonisation->find(mat)->second;
336 G4cout <<
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation() " <<
G4endl;
337 G4cout <<
"Impossible to create ionisation oscillator table for " << mat->
GetName() <<
G4endl;
348 if (((
size_t)index) < theTable->size())
349 return (*theTable)[index];
352 G4cout <<
"WARNING: Ionisation table for material " << material->
GetName() <<
" has " <<
353 theTable->size() <<
" oscillators" <<
G4endl;
354 G4cout <<
"Oscillator #" << index <<
" cannot be retrieved" <<
G4endl;
366 CheckForTablesCreated();
369 if (oscillatorStoreCompton->count(mat))
372 return oscillatorStoreCompton->find(mat)->second;
376 BuildOscillatorTable(mat);
379 if (oscillatorStoreCompton->count(mat))
380 return oscillatorStoreCompton->find(mat)->second;
383 G4cout <<
"G4PenelopeOscillatorManager::GetOscillatorTableCompton() " <<
G4endl;
384 G4cout <<
"Impossible to create Compton oscillator table for " << mat->
GetName() <<
G4endl;
395 if (((
size_t)index) < theTable->size())
396 return (*theTable)[index];
399 G4cout <<
"WARNING: Compton table for material " << material->
GetName() <<
" has " <<
400 theTable->size() <<
" oscillators" <<
G4endl;
401 G4cout <<
"Oscillator #" << index <<
" cannot be retrieved" <<
G4endl;
409 void G4PenelopeOscillatorManager::BuildOscillatorTable(
const G4Material* material)
430 if (verbosityLevel > 0)
448 std::vector<G4double> *StechiometricFactors =
new std::vector<G4double>;
450 for (
G4int i=0;i<nElements;i++)
453 G4double fraction = fractionVector[i];
454 G4double atomicWeigth = (*elementVector)[i]->GetAtomicMassAmu();
455 StechiometricFactors->push_back(fraction/atomicWeigth);
458 G4double MaxStechiometricFactor = 0.;
459 for (
G4int i=0;i<nElements;i++)
461 if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
462 MaxStechiometricFactor = (*StechiometricFactors)[i];
464 if (MaxStechiometricFactor<1e-16)
467 ed <<
"Problem with the mass composition of " << material->
GetName() <<
G4endl;
468 ed <<
"MaxStechiometricFactor = " << MaxStechiometricFactor <<
G4endl;
469 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
473 for (
G4int i=0;i<nElements;i++)
474 (*StechiometricFactors)[i] /= MaxStechiometricFactor;
478 for (
G4int i=0;i<nElements;i++)
479 theatomsPerMolecule += (*StechiometricFactors)[i];
484 if (verbosityLevel > 1)
486 for (
size_t i=0;i<StechiometricFactors->size();i++)
488 G4cout <<
"Element " << (*elementVector)[i]->GetSymbol() <<
" (Z = " <<
489 (*elementVector)[i]->GetZ() <<
") --> " <<
490 (*StechiometricFactors)[i] <<
" atoms/molecule " <<
G4endl;
495 for (
G4int i=0;i<nElements;i++)
497 G4int iZ = (
G4int) (*elementVector)[i]->GetZ();
498 totalZ += iZ * (*StechiometricFactors)[i];
499 totalMolecularWeight += (*elementVector)[i]->GetAtomicMassAmu() * (*StechiometricFactors)[i];
500 meanExcitationEnergy += iZ*std::log(meanAtomExcitationEnergy[iZ-1])*(*StechiometricFactors)[i];
507 std::pair<const G4Material*,G4int> theKey = std::make_pair(material,iZ);
508 if (!atomTablePerMolecule->count(theKey))
509 atomTablePerMolecule->insert(std::make_pair(theKey,(*StechiometricFactors)[i]));
511 meanExcitationEnergy =
G4Exp(meanExcitationEnergy/totalZ);
513 atomicNumber->insert(std::make_pair(material,totalZ));
514 atomicMass->insert(std::make_pair(material,totalMolecularWeight));
515 excitationEnergy->insert(std::make_pair(material,meanExcitationEnergy));
516 atomsPerMolecule->insert(std::make_pair(material,theatomsPerMolecule));
519 if (verbosityLevel > 1)
521 G4cout <<
"Calculated mean excitation energy for " << material->
GetName() <<
522 " = " << meanExcitationEnergy/
eV <<
" eV" <<
G4endl;
525 std::vector<G4PenelopeOscillator> *helper =
new std::vector<G4PenelopeOscillator>;
536 helper->push_back(newOsc);
539 for (
G4int k=0;k<nElements;k++)
541 G4double Z = (*elementVector)[k]->GetZ();
543 for (
G4int i=0;i<2000 && !finished;i++)
552 if (elementData[0][i] == Z)
559 if (std::fabs(occup) > 0)
570 if (elementData[0][i] > 6 && elementData[1][i] < 10)
574 helper->push_back(newOscLocal);
577 G4double ff = (*helper)[0].GetOscillatorStrength();
578 ff += std::fabs(occup)*(*StechiometricFactors)[k];
579 (*helper)[0].SetOscillatorStrength(ff);
584 if (elementData[0][i] > Z)
589 delete StechiometricFactors;
594 std::sort(helper->begin(),helper->end());
597 static const G4double RydbergEnergy = 13.60569*
eV;
599 G4double conductionStrength = (*helper)[0].GetOscillatorStrength();
600 G4double plasmaEnergy = Omega*std::sqrt(conductionStrength/totalZ);
602 plasmaSquared->insert(std::make_pair(material,Omega*Omega));
604 G4bool isAConductor =
false;
607 if (verbosityLevel > 1)
609 G4cout <<
"Estimated oscillator strenght and energy of plasmon: " <<
610 conductionStrength <<
" and " << plasmaEnergy/
eV <<
" eV" <<
G4endl;
613 if (conductionStrength < 0.01 || plasmaEnergy<1.0*
eV)
615 if (verbosityLevel >1 )
618 helper->erase(helper->begin());
622 if (verbosityLevel >1 )
626 G4double conductionStrengthCopy = conductionStrength;
628 for (
size_t i = 1; i<helper->size() && !quit ;i++)
630 G4double oscStre = (*helper)[i].GetOscillatorStrength();
632 if (oscStre < conductionStrengthCopy)
634 conductionStrengthCopy = conductionStrengthCopy-oscStre;
635 (*helper)[i].SetOscillatorStrength(0.);
641 (*helper)[i].SetOscillatorStrength(oscStre-conductionStrengthCopy);
642 if (std::fabs((*helper)[i].GetOscillatorStrength()) < 1e-12)
644 conductionStrength += (*helper)[i].GetOscillatorStrength();
645 (*helper)[i].SetOscillatorStrength(0.);
652 (*helper)[0].SetOscillatorStrength(conductionStrength);
653 (*helper)[0].SetIonisationEnergy(0.);
654 (*helper)[0].SetResonanceEnergy(plasmaEnergy);
655 G4double hartree = 0.75/std::sqrt(3.0*
pi*
pi*moleculeDensity*
662 for (
size_t i=0;i<helper->size();i++)
664 sum += (*helper)[i].GetOscillatorStrength();
666 if (std::fabs(sum-totalZ) > (1e-6*totalZ))
669 ed <<
"Inconsistent oscillator data for " << material->
GetName() <<
G4endl;
670 ed << sum <<
" " << totalZ <<
G4endl;
671 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
674 if (std::fabs(sum-totalZ) > (1e-12*totalZ))
677 for (
size_t i=0;i<helper->size();i++)
679 G4double ff = (*helper)[i].GetOscillatorStrength()*fact;
680 (*helper)[i].SetOscillatorStrength(ff);
685 for (
G4int k=0;k<nullOsc;k++)
688 for (
size_t i=0;i<helper->size() && !exit;i++)
690 if (std::fabs((*helper)[i].GetOscillatorStrength()) < 1e-12)
692 helper->erase(helper->begin()+i);
700 if (helper->size() > 1)
702 G4double TST = totalZ*std::log(meanExcitationEnergy/
eV);
707 adjustmentFactor = (AALow+AAHigh)*0.5;
709 for (
size_t i=0;i<helper->size();i++)
711 if (i == 0 && isAConductor)
713 G4double resEne = (*helper)[i].GetResonanceEnergy();
714 sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/
eV);
718 G4double ionEne = (*helper)[i].GetIonisationEnergy();
719 G4double oscStre = (*helper)[i].GetOscillatorStrength();
720 G4double WI2 = (adjustmentFactor*adjustmentFactor*ionEne*ionEne) +
721 2./3.*(oscStre/totalZ)*Omega*
Omega;
723 (*helper)[i].SetResonanceEnergy(resEne);
724 sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/
eV);
728 AALow = adjustmentFactor;
730 AAHigh = adjustmentFactor;
731 if (verbosityLevel > 3)
732 G4cout <<
"Sternheimer's adjustment factor loops: " << AALow <<
" " << AAHigh <<
" " <<
733 adjustmentFactor <<
" " << TST <<
" " <<
735 }
while((AAHigh-AALow)>(1e-14*adjustmentFactor));
739 G4double ionEne = (*helper)[0].GetIonisationEnergy();
740 (*helper)[0].SetIonisationEnergy(std::fabs(ionEne));
741 (*helper)[0].SetResonanceEnergy(meanExcitationEnergy);
743 if (verbosityLevel > 1)
745 G4cout <<
"Sternheimer's adjustment factor: " << adjustmentFactor <<
G4endl;
749 G4double xcheck = (*helper)[0].GetOscillatorStrength()*std::log((*helper)[0].GetResonanceEnergy());
750 G4double TST = (*helper)[0].GetOscillatorStrength();
751 for (
size_t i=1;i<helper->size();i++)
753 xcheck += (*helper)[i].GetOscillatorStrength()*std::log((*helper)[i].GetResonanceEnergy());
754 TST += (*helper)[i].GetOscillatorStrength();
756 if (std::fabs(TST-totalZ)>1e-8*totalZ)
759 ed <<
"Inconsistent oscillator data " <<
G4endl;
760 ed << TST <<
" " << totalZ <<
G4endl;
761 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
764 xcheck =
G4Exp(xcheck/totalZ);
765 if (std::fabs(xcheck-meanExcitationEnergy) > 1e-8*meanExcitationEnergy)
768 ed <<
"Error in Sterheimer factor calculation " <<
G4endl;
769 ed << xcheck/
eV <<
" " << meanExcitationEnergy/
eV <<
G4endl;
770 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
779 for (
G4int k=0;k<nElements;k++)
781 G4double Z = (*elementVector)[k]->GetZ();
782 if (Z>Zmax) Zmax =
Z;
787 for (
size_t i=0;i<helper->size() && !found;i++)
789 G4double Z = (*helper)[i].GetParentZ();
790 G4int shID = (*helper)[i].GetParentShellID();
791 if (shID == 10 && Z == Zmax)
794 if ((*helper)[i].GetIonisationEnergy() > cutEnergy)
795 cutEnergy = (*helper)[i].GetIonisationEnergy();
800 G4double lowEnergyLimitForFluorescence = 250*
eV;
801 cutEnergy =
std::min(cutEnergy,lowEnergyLimitForFluorescence);
803 if (verbosityLevel > 1)
812 std::sort(helper->begin(),helper->end(),comparator);
815 for (
size_t i=0;i<helper->size();i++)
819 theTable->push_back(theOsc);
825 size_t Nost = theTable->size();
827 size_t firstIndex = (isAConductor) ? 1 : 0;
829 G4int removedLevels = 0;
833 if (Nost>firstIndex+1)
836 for (
size_t i=firstIndex;i<theTable->size()-1;i++)
839 G4int shellFlag = (*theTable)[i]->GetShellFlag();
840 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
841 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
842 G4double resEnePlus1 = (*theTable)[i+1]->GetResonanceEnergy();
843 G4double oscStre = (*theTable)[i]->GetOscillatorStrength();
844 G4double oscStrePlus1 = (*theTable)[i+1]->GetOscillatorStrength();
846 if (ionEne>cutEnergy)
848 if (resEne<1.0*
eV || resEnePlus1<1.0*
eV)
850 if (resEnePlus1 > Rgroup*resEne)
855 oscStrePlus1*std::log(resEnePlus1))
856 /(oscStre+oscStrePlus1));
857 (*theTable)[i]->SetResonanceEnergy(newRes);
859 oscStrePlus1*(*theTable)[i+1]->GetIonisationEnergy())/
860 (oscStre+oscStrePlus1);
861 (*theTable)[i]->SetIonisationEnergy(newIon);
862 G4double newStre = oscStre+oscStrePlus1;
863 (*theTable)[i]->SetOscillatorStrength(newStre);
864 G4double newHartree = (oscStre*(*theTable)[i]->GetHartreeFactor()+
865 oscStrePlus1*(*theTable)[i+1]->GetHartreeFactor())/
866 (oscStre+oscStrePlus1);
867 (*theTable)[i]->SetHartreeFactor(newHartree);
868 if ((*theTable)[i]->GetParentZ() != (*theTable)[i+1]->GetParentZ())
869 (*theTable)[i]->SetParentZ(0.);
870 if (shellFlag < 10 || (*theTable)[i+1]->GetShellFlag() < 10)
872 G4int newFlag =
std::min(shellFlag,(*theTable)[i+1]->GetShellFlag());
873 (*theTable)[i]->SetShellFlag(newFlag);
876 (*theTable)[i]->SetShellFlag(30);
878 (*theTable)[i]->SetParentShellID((*theTable)[i]->GetShellFlag());
881 if (i<theTable->size()-2)
883 for (
size_t ii=i+1;ii<theTable->size()-1;ii++)
884 (*theTable)[ii] = (*theTable)[ii+1];
887 theTable->erase(theTable->begin()+theTable->size()-1);
894 Nost -= removedLevels;
897 if (Rgroup < 1.414213 || Nost > 64)
899 Rgroup = Rgroup*Rgroup;
904 if (verbosityLevel > 1)
906 G4cout <<
"Final grouping factor for Ionisation: " << Rgroup <<
G4endl;
910 for (
size_t i=0;i<theTable->size();i++)
913 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
914 if (ionEne < 1e-3*
eV)
916 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
917 (*theTable)[i]->SetIonisationEnergy(0.*
eV);
918 (*theTable)[i]->SetCutoffRecoilResonantEnergy(resEne);
921 (*theTable)[i]->SetCutoffRecoilResonantEnergy(ionEne);
925 oscillatorStoreIonisation->insert(std::make_pair(material,theTable));
937 std::sort(helper->begin(),helper->end());
939 for (
size_t i=0;i<helper->size();i++)
943 theTableC->push_back(theOsc);
948 Nost = theTableC->size();
950 firstIndex = (isAConductor) ? 1 : 0;
956 if (Nost>firstIndex+1)
959 for (
size_t i=firstIndex;i<theTableC->size()-1;i++)
963 G4double ionEne = (*theTableC)[i]->GetIonisationEnergy();
964 G4double ionEnePlus1 = (*theTableC)[i+1]->GetIonisationEnergy();
965 G4double oscStre = (*theTableC)[i]->GetOscillatorStrength();
966 G4double oscStrePlus1 = (*theTableC)[i+1]->GetOscillatorStrength();
968 if (ionEne>cutEnergy)
970 if (ionEne<1.0*
eV || ionEnePlus1<1.0*
eV)
972 if (ionEnePlus1 > Rgroup*ionEne)
978 oscStrePlus1*ionEnePlus1)/
979 (oscStre+oscStrePlus1);
980 (*theTableC)[i]->SetIonisationEnergy(newIon);
981 G4double newStre = oscStre+oscStrePlus1;
982 (*theTableC)[i]->SetOscillatorStrength(newStre);
983 G4double newHartree = (oscStre*(*theTableC)[i]->GetHartreeFactor()+
984 oscStrePlus1*(*theTableC)[i+1]->GetHartreeFactor())/
985 (oscStre+oscStrePlus1);
986 (*theTableC)[i]->SetHartreeFactor(newHartree);
987 if ((*theTableC)[i]->GetParentZ() != (*theTableC)[i+1]->GetParentZ())
988 (*theTableC)[i]->SetParentZ(0.);
989 (*theTableC)[i]->SetShellFlag(30);
990 (*theTableC)[i]->SetParentShellID((*theTableC)[i]->GetShellFlag());
992 if (i<theTableC->size()-2)
994 for (
size_t ii=i+1;ii<theTableC->size()-1;ii++)
995 (*theTableC)[ii] = (*theTableC)[ii+1];
997 theTableC->erase(theTableC->begin()+theTableC->size()-1);
1004 Nost -= removedLevels;
1007 if (Rgroup < 2.0 || Nost > 64)
1009 Rgroup = Rgroup*Rgroup;
1015 if (verbosityLevel > 1)
1017 G4cout <<
"Final grouping factor for Compton: " << Rgroup <<
G4endl;
1021 oscillatorStoreCompton->insert(std::make_pair(material,theTableC));
1051 if (verbosityLevel > 1)
1059 void G4PenelopeOscillatorManager::ReadElementData()
1061 if (verbosityLevel > 0)
1063 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData()" <<
G4endl;
1066 char* path = getenv(
"G4LEDATA");
1069 G4String excep =
"G4PenelopeOscillatorManager - G4LEDATA environment variable not set!";
1070 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1075 G4String pathFile = pathString +
"/penelope/pdatconf.p08";
1076 std::ifstream file(pathFile);
1078 if (!file.is_open())
1080 G4String excep =
"G4PenelopeOscillatorManager - data file " + pathFile +
" not found!";
1081 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1092 for (
G4int iline=0;iline<22;iline++)
1093 getline(file,theHeader);
1096 G4int shellCode = 0;
1098 G4int occupationNumber = 0;
1101 G4int shellCounter = 0;
1103 G4int numberOfShells = 0;
1105 for (
G4int i=0;!file.eof();i++)
1107 file >> Z >> shellCode >> shellId >> occupationNumber >> ionisationEnergy >> hartreeProfile;
1110 elementData[0][i] =
Z;
1111 elementData[1][i] = shellCode;
1112 elementData[2][i] = occupationNumber;
1121 if (shellCounter<numberOfShells)
1128 elementData[3][i] = (bindingEnergy>100*
eV) ? bindingEnergy : ionisationEnergy*
eV;
1130 elementData[4][i] = hartreeProfile;
1136 if (verbosityLevel > 1)
1138 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData(): Data file read" <<
G4endl;
1140 fReadElementData =
true;
1149 CheckForTablesCreated();
1152 if (excitationEnergy->count(mat))
1153 return excitationEnergy->find(mat)->second;
1156 BuildOscillatorTable(mat);
1159 if (excitationEnergy->count(mat))
1160 return excitationEnergy->find(mat)->second;
1163 G4cout <<
"G4PenelopeOscillatorManager::GetMolecularExcitationEnergy() " <<
G4endl;
1164 G4cout <<
"Impossible to retrieve the excitation energy for " << mat->
GetName() <<
G4endl;
1173 CheckForTablesCreated();
1176 if (plasmaSquared->count(mat))
1177 return plasmaSquared->find(mat)->second;
1180 BuildOscillatorTable(mat);
1183 if (plasmaSquared->count(mat))
1184 return plasmaSquared->find(mat)->second;
1187 G4cout <<
"G4PenelopeOscillatorManager::GetPlasmaEnergySquared() " <<
G4endl;
1198 CheckForTablesCreated();
1201 if (atomsPerMolecule->count(mat))
1202 return atomsPerMolecule->find(mat)->second;
1205 BuildOscillatorTable(mat);
1208 if (atomsPerMolecule->count(mat))
1209 return atomsPerMolecule->find(mat)->second;
1212 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1213 G4cout <<
"Impossible to retrieve the number of atoms per molecule for "
1224 CheckForTablesCreated();
1227 std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
1228 if (atomTablePerMolecule->count(theKey))
1229 return atomTablePerMolecule->find(theKey)->second;
1232 BuildOscillatorTable(mat);
1235 if (atomTablePerMolecule->count(theKey))
1236 return atomTablePerMolecule->find(theKey)->second;
1239 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1240 G4cout <<
"Impossible to retrieve the number of atoms per molecule for Z = "
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4int NumberOfShells(G4int Z) const
std::vector< G4Element * > G4ElementVector
std::ostringstream G4ExceptionDescription
G4double GetPlasmaEnergySquared(const G4Material *)
Returns the squared plasma energy.
static constexpr double Bohr_radius
const G4String & GetName() const
G4double BindingEnergy() const
G4PenelopeOscillator * GetOscillatorIonisation(const G4Material *, G4int)
G4PenelopeOscillatorManager()
const G4ElementVector * GetElementVector() const
G4PenelopeOscillatorTable * GetOscillatorTableCompton(const G4Material *)
void SetParentZ(G4double parZ)
void SetOscillatorStrength(G4double ostr)
G4GLOB_DLL std::ostream G4cout
void SetHartreeFactor(G4double hf)
void SetIonisationEnergy(G4double ie)
static constexpr double eV
static G4PenelopeOscillatorManager * GetOscillatorManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetParentShellID(G4int psID)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double GetTotNbOfAtomsPerVolume() const
G4double GetTotalA(const G4Material *)
Returns the total A for the molecule.
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
static constexpr double pi
size_t GetNumberOfElements() const
void Dump(const G4Material *)
~G4PenelopeOscillatorManager()
G4PenelopeOscillator * GetOscillatorCompton(const G4Material *, G4int)
static constexpr double fine_structure_const
G4double GetNumberOfZAtomsPerMolecule(const G4Material *, G4int Z)
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4double GetMeanExcitationEnergy(const G4Material *)
Returns the mean excitation energy.
const G4double * GetFractionVector() const
G4double bindingEnergy(G4int A, G4int Z)
static G4AtomicTransitionManager * Instance()
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
G4double GetTotalZ(const G4Material *)
void SetShellFlag(G4int theflag)