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;
221void 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;
409void G4PenelopeOscillatorManager::BuildOscillatorTable(
const G4Material* material)
413 G4double meanAtomExcitationEnergy[99] = {19.2*eV, 41.8*eV, 40.0*eV, 63.7*eV, 76.0*eV, 81.0*eV,
414 82.0*eV, 95.0*eV,115.0*eV,137.0*eV,149.0*eV,156.0*eV,
416 173.0*eV,173.0*eV,180.0*eV,174.0*eV,188.0*eV,190.0*eV,191.0*eV,
417 216.0*eV,233.0*eV,245.0*eV,257.0*eV,272.0*eV,286.0*eV,297.0*eV,
418 311.0*eV,322.0*eV,330.0*eV,334.0*eV,350.0*eV,347.0*eV,348.0*eV,
419 343.0*eV,352.0*eV,363.0*eV,366.0*eV,379.0*eV,393.0*eV,417.0*eV,
420 424.0*eV,428.0*eV,441.0*eV,449.0*eV,470.0*eV,470.0*eV,469.0*eV,
421 488.0*eV,488.0*eV,487.0*eV,485.0*eV,491.0*eV,482.0*eV,488.0*eV,
422 491.0*eV,501.0*eV,523.0*eV,535.0*eV,546.0*eV,560.0*eV,574.0*eV,
423 580.0*eV,591.0*eV,614.0*eV,628.0*eV,650.0*eV,658.0*eV,674.0*eV,
424 684.0*eV,694.0*eV,705.0*eV,718.0*eV,727.0*eV,736.0*eV,746.0*eV,
425 757.0*eV,790.0*eV,790.0*eV,800.0*eV,810.0*eV,823.0*eV,823.0*eV,
426 830.0*eV,825.0*eV,794.0*eV,827.0*eV,826.0*eV,841.0*eV,847.0*eV,
427 878.0*eV,890.0*eV,902.0*eV,921.0*eV,934.0*eV,939.0*eV,952.0*eV,
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]->GetZasInt() <<
") --> " <<
490 (*StechiometricFactors)[i] <<
" atoms/molecule " <<
G4endl;
495 for (
G4int i=0;i<nElements;i++)
497 G4int iZ = (*elementVector)[i]->GetZasInt();
498 totalZ += iZ * (*StechiometricFactors)[i];
499 totalMolecularWeight += (*elementVector)[i]->GetAtomicMassAmu() * (*StechiometricFactors)[i];
500 meanExcitationEnergy += iZ*
G4Log(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;
598 G4double Omega = std::sqrt(4*pi*moleculeDensity*totalZ*Bohr_radius)*Bohr_radius*2.0*RydbergEnergy;
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 strength 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*
656 Bohr_radius*Bohr_radius*Bohr_radius*conductionStrength);
657 (*helper)[0].SetHartreeFactor(hartree/fine_structure_const);
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)
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()*
G4Log(resEne/eV);
718 G4double ionEne = (*helper)[i].GetIonisationEnergy();
719 G4double oscStre = (*helper)[i].GetOscillatorStrength();
720 G4double WI2 = (adjustmentFactor*adjustmentFactor*ionEne*ionEne) +
723 (*helper)[i].SetResonanceEnergy(resEne);
724 sumLocal += (*helper)[i].GetOscillatorStrength()*
G4Log(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()*
G4Log((*helper)[0].GetResonanceEnergy());
750 G4double TST = (*helper)[0].GetOscillatorStrength();
751 for (
size_t i=1;i<helper->size();i++)
753 xcheck += (*helper)[i].GetOscillatorStrength()*
G4Log((*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)
804 G4cout <<
"Cutoff energy: " << cutEnergy/eV <<
" eV" <<
G4endl;
811 std::sort(helper->begin(),helper->end(),
comparator);
814 for (
size_t i=0;i<helper->size();i++)
818 theTable->push_back(theOsc);
824 size_t Nost = theTable->size();
826 size_t firstIndex = (isAConductor) ? 1 : 0;
829 G4int removedLevels = 0;
834 if (Nost>firstIndex+1)
837 for (
size_t i=firstIndex;i<theTable->size()-1;i++)
840 G4int shellFlag = (*theTable)[i]->GetShellFlag();
841 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
842 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
843 G4double resEnePlus1 = (*theTable)[i+1]->GetResonanceEnergy();
844 G4double oscStre = (*theTable)[i]->GetOscillatorStrength();
845 G4double oscStrePlus1 = (*theTable)[i+1]->GetOscillatorStrength();
847 if (ionEne>cutEnergy)
849 if (resEne<1.0*eV || resEnePlus1<1.0*eV)
851 if (resEnePlus1 > Rgroup*resEne)
856 oscStrePlus1*
G4Log(resEnePlus1))
857 /(oscStre+oscStrePlus1));
858 (*theTable)[i]->SetResonanceEnergy(newRes);
860 oscStrePlus1*(*theTable)[i+1]->GetIonisationEnergy())/
861 (oscStre+oscStrePlus1);
862 (*theTable)[i]->SetIonisationEnergy(newIon);
863 G4double newStre = oscStre+oscStrePlus1;
864 (*theTable)[i]->SetOscillatorStrength(newStre);
865 G4double newHartree = (oscStre*(*theTable)[i]->GetHartreeFactor()+
866 oscStrePlus1*(*theTable)[i+1]->GetHartreeFactor())/
867 (oscStre+oscStrePlus1);
868 (*theTable)[i]->SetHartreeFactor(newHartree);
869 if ((*theTable)[i]->GetParentZ() != (*theTable)[i+1]->GetParentZ())
870 (*theTable)[i]->SetParentZ(0.);
871 if (shellFlag < 10 || (*theTable)[i+1]->GetShellFlag() < 10)
873 G4int newFlag = std::min(shellFlag,(*theTable)[i+1]->GetShellFlag());
874 (*theTable)[i]->SetShellFlag(newFlag);
877 (*theTable)[i]->SetShellFlag(30);
879 (*theTable)[i]->SetParentShellID((*theTable)[i]->GetShellFlag());
882 if (i<theTable->size()-2)
884 for (
size_t ii=i+1;ii<theTable->size()-1;ii++)
885 (*theTable)[ii] = (*theTable)[ii+1];
888 theTable->erase(theTable->begin()+theTable->size()-1);
895 Nost -= removedLevels;
898 if (Rgroup < 1.414213 || Nost > 64)
900 Rgroup = Rgroup*Rgroup;
904 if (nLoops > 100 && !removedLevels)
908 if (verbosityLevel > 1)
910 G4cout <<
"Final grouping factor for Ionisation: " << Rgroup <<
G4endl;
914 for (
size_t i=0;i<theTable->size();i++)
917 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
918 if (ionEne < 1e-3*eV)
920 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
921 (*theTable)[i]->SetIonisationEnergy(0.*eV);
922 (*theTable)[i]->SetCutoffRecoilResonantEnergy(resEne);
925 (*theTable)[i]->SetCutoffRecoilResonantEnergy(ionEne);
929 oscillatorStoreIonisation->insert(std::make_pair(material,theTable));
941 std::sort(helper->begin(),helper->end());
943 for (
size_t i=0;i<helper->size();i++)
947 theTableC->push_back(theOsc);
952 Nost = theTableC->size();
954 firstIndex = (isAConductor) ? 1 : 0;
961 if (Nost>firstIndex+1)
964 for (
size_t i=firstIndex;i<theTableC->size()-1;i++)
968 G4double ionEne = (*theTableC)[i]->GetIonisationEnergy();
969 G4double ionEnePlus1 = (*theTableC)[i+1]->GetIonisationEnergy();
970 G4double oscStre = (*theTableC)[i]->GetOscillatorStrength();
971 G4double oscStrePlus1 = (*theTableC)[i+1]->GetOscillatorStrength();
973 if (ionEne>cutEnergy)
975 if (ionEne<1.0*eV || ionEnePlus1<1.0*eV)
977 if (ionEnePlus1 > Rgroup*ionEne)
983 oscStrePlus1*ionEnePlus1)/
984 (oscStre+oscStrePlus1);
985 (*theTableC)[i]->SetIonisationEnergy(newIon);
986 G4double newStre = oscStre+oscStrePlus1;
987 (*theTableC)[i]->SetOscillatorStrength(newStre);
988 G4double newHartree = (oscStre*(*theTableC)[i]->GetHartreeFactor()+
989 oscStrePlus1*(*theTableC)[i+1]->GetHartreeFactor())/
990 (oscStre+oscStrePlus1);
991 (*theTableC)[i]->SetHartreeFactor(newHartree);
992 if ((*theTableC)[i]->GetParentZ() != (*theTableC)[i+1]->GetParentZ())
993 (*theTableC)[i]->SetParentZ(0.);
994 (*theTableC)[i]->SetShellFlag(30);
995 (*theTableC)[i]->SetParentShellID((*theTableC)[i]->GetShellFlag());
997 if (i<theTableC->size()-2)
999 for (
size_t ii=i+1;ii<theTableC->size()-1;ii++)
1000 (*theTableC)[ii] = (*theTableC)[ii+1];
1002 theTableC->erase(theTableC->begin()+theTableC->size()-1);
1009 Nost -= removedLevels;
1012 if (Rgroup < 2.0 || Nost > 64)
1014 Rgroup = Rgroup*Rgroup;
1018 if (nLoops > 100 && !removedLevels)
1023 if (verbosityLevel > 1)
1025 G4cout <<
"Final grouping factor for Compton: " << Rgroup <<
G4endl;
1029 oscillatorStoreCompton->insert(std::make_pair(material,theTableC));
1059 if (verbosityLevel > 1)
1067void G4PenelopeOscillatorManager::ReadElementData()
1069 if (verbosityLevel > 0)
1071 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData()" <<
G4endl;
1074 char* path = std::getenv(
"G4LEDATA");
1077 G4String excep =
"G4PenelopeOscillatorManager - G4LEDATA environment variable not set!";
1078 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1083 G4String pathFile = pathString +
"/penelope/pdatconf.p08";
1084 std::ifstream file(pathFile);
1086 if (!file.is_open())
1088 G4String excep =
"G4PenelopeOscillatorManager - data file " + pathFile +
" not found!";
1089 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1100 for (
G4int iline=0;iline<22;iline++)
1101 getline(file,theHeader);
1104 G4int shellCode = 0;
1106 G4int occupationNumber = 0;
1107 G4double ionisationEnergy = 0.0*eV;
1109 G4int shellCounter = 0;
1111 G4int numberOfShells = 0;
1113 for (
G4int i=0;!file.eof();i++)
1115 file >> Z >> shellCode >> shellId >> occupationNumber >> ionisationEnergy >> hartreeProfile;
1118 elementData[0][i] = Z;
1119 elementData[1][i] = shellCode;
1120 elementData[2][i] = occupationNumber;
1129 if (shellCounter<numberOfShells)
1136 elementData[3][i] = (
bindingEnergy>100*eV) ? bindingEnergy : ionisationEnergy*eV;
1138 elementData[4][i] = hartreeProfile;
1144 if (verbosityLevel > 1)
1146 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData(): Data file read" <<
G4endl;
1148 fReadElementData =
true;
1157 CheckForTablesCreated();
1160 if (excitationEnergy->count(mat))
1161 return excitationEnergy->find(mat)->second;
1164 BuildOscillatorTable(mat);
1167 if (excitationEnergy->count(mat))
1168 return excitationEnergy->find(mat)->second;
1171 G4cout <<
"G4PenelopeOscillatorManager::GetMolecularExcitationEnergy() " <<
G4endl;
1172 G4cout <<
"Impossible to retrieve the excitation energy for " << mat->
GetName() <<
G4endl;
1181 CheckForTablesCreated();
1184 if (plasmaSquared->count(mat))
1185 return plasmaSquared->find(mat)->second;
1188 BuildOscillatorTable(mat);
1191 if (plasmaSquared->count(mat))
1192 return plasmaSquared->find(mat)->second;
1195 G4cout <<
"G4PenelopeOscillatorManager::GetPlasmaEnergySquared() " <<
G4endl;
1206 CheckForTablesCreated();
1209 if (atomsPerMolecule->count(mat))
1210 return atomsPerMolecule->find(mat)->second;
1213 BuildOscillatorTable(mat);
1216 if (atomsPerMolecule->count(mat))
1217 return atomsPerMolecule->find(mat)->second;
1220 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1221 G4cout <<
"Impossible to retrieve the number of atoms per molecule for "
1232 CheckForTablesCreated();
1235 std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
1236 if (atomTablePerMolecule->count(theKey))
1237 return atomTablePerMolecule->find(theKey)->second;
1240 BuildOscillatorTable(mat);
1243 if (atomTablePerMolecule->count(theKey))
1244 return atomTablePerMolecule->find(theKey)->second;
1247 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1248 G4cout <<
"Impossible to retrieve the number of atoms per molecule for Z = "
std::vector< G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
G4GLOB_DLL std::ostream G4cout
G4double BindingEnergy() const
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
G4int NumberOfShells(G4int Z) const
static G4AtomicTransitionManager * Instance()
const G4ElementVector * GetElementVector() const
G4double GetTotNbOfAtomsPerVolume() const
const G4double * GetFractionVector() const
size_t GetNumberOfElements() const
const G4String & GetName() const
G4double GetNumberOfZAtomsPerMolecule(const G4Material *, G4int Z)
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4PenelopeOscillatorTable * GetOscillatorTableCompton(const G4Material *)
static G4PenelopeOscillatorManager * GetOscillatorManager()
~G4PenelopeOscillatorManager()
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4double GetPlasmaEnergySquared(const G4Material *)
Returns the squared plasma energy.
G4double GetTotalZ(const G4Material *)
G4double GetMeanExcitationEnergy(const G4Material *)
Returns the mean excitation energy.
void Dump(const G4Material *)
G4PenelopeOscillator * GetOscillatorIonisation(const G4Material *, G4int)
G4PenelopeOscillator * GetOscillatorCompton(const G4Material *, G4int)
G4PenelopeOscillatorManager()
G4double GetTotalA(const G4Material *)
Returns the total A for the molecule.
void SetIonisationEnergy(G4double ie)
void SetShellFlag(G4int theflag)
void SetParentShellID(G4int psID)
void SetParentZ(G4double parZ)
void SetOscillatorStrength(G4double ostr)
void SetHartreeFactor(G4double hf)
G4double bindingEnergy(G4int A, G4int Z)