67 fOscillatorStoreIonisation(nullptr),fOscillatorStoreCompton(nullptr),
68 fAtomicNumber(nullptr),fAtomicMass(nullptr),fExcitationEnergy(nullptr),
69 fPlasmaSquared(nullptr),fAtomsPerMolecule(nullptr),
70 fAtomTablePerMolecule(nullptr)
72 fReadElementData =
false;
73 for (
G4int i=0;i<5;i++)
75 for (
G4int j=0;j<2000;j++)
76 fElementData[i][j] = 0.;
102 if (fVerbosityLevel > 1)
103 G4cout <<
" G4PenelopeOscillatorManager::Clear() - Clean Oscillator Tables" <<
G4endl;
106 for (
auto& item : (*fOscillatorStoreIonisation))
111 for (std::size_t k=0;k<table->size();++k)
114 delete ((*table)[k]);
119 delete fOscillatorStoreIonisation;
122 for (
auto& item : (*fOscillatorStoreCompton))
127 for (std::size_t k=0;k<table->size();++k)
130 delete ((*table)[k]);
135 delete fOscillatorStoreCompton;
137 if (fAtomicMass)
delete fAtomicMass;
138 if (fAtomicNumber)
delete fAtomicNumber;
139 if (fExcitationEnergy)
delete fExcitationEnergy;
140 if (fPlasmaSquared)
delete fPlasmaSquared;
141 if (fAtomsPerMolecule)
delete fAtomsPerMolecule;
142 if (fAtomTablePerMolecule)
delete fAtomTablePerMolecule;
152 G4cout <<
" G4PenelopeOscillatorManager::Dump " <<
G4endl;
153 G4cout <<
"Problem in retrieving the Ionisation Oscillator Table for "
157 G4cout <<
"*********************************************************************" <<
G4endl;
159 G4cout <<
"*********************************************************************" <<
G4endl;
160 G4cout <<
"The table contains " << theTable->size() <<
" oscillators " <<
G4endl;
161 G4cout <<
"*********************************************************************" <<
G4endl;
162 if (theTable->size() < 10)
163 for (std::size_t k=0;k<theTable->size();++k)
165 G4cout <<
"Oscillator # " << k <<
" Z = " << (*theTable)[k]->GetParentZ() <<
166 " Shell Flag = " << (*theTable)[k]->GetShellFlag() <<
167 " Parent shell ID = " << (*theTable)[k]->GetParentShellID() <<
G4endl;
168 G4cout <<
"Ionisation energy = " << (*theTable)[k]->GetIonisationEnergy()/eV <<
" eV" <<
G4endl;
169 G4cout <<
"Occupation number = " << (*theTable)[k]->GetOscillatorStrength() <<
G4endl;
170 G4cout <<
"Resonance energy = " << (*theTable)[k]->GetResonanceEnergy()/eV <<
" eV" <<
G4endl;
171 G4cout <<
"Cufoff resonance energy = " <<
172 (*theTable)[k]->GetCutoffRecoilResonantEnergy()/eV <<
" eV" <<
G4endl;
173 G4cout <<
"*********************************************************************" <<
G4endl;
175 for (std::size_t k=0;k<theTable->size();++k)
177 G4cout << k <<
" " << (*theTable)[k]->GetOscillatorStrength() <<
" " <<
178 (*theTable)[k]->GetIonisationEnergy()/eV <<
" "
179 << (*theTable)[k]->GetResonanceEnergy()/eV <<
" " <<
180 (*theTable)[k]->GetParentZ() <<
" " << (*theTable)[k]->GetShellFlag() <<
" " <<
181 (*theTable)[k]->GetParentShellID() <<
G4endl;
183 G4cout <<
"*********************************************************************" <<
G4endl;
189 G4cout <<
" G4PenelopeOscillatorManager::Dump " <<
G4endl;
190 G4cout <<
"Problem in retrieving the Compton Oscillator Table for " <<
194 G4cout <<
"*********************************************************************" <<
G4endl;
196 G4cout <<
"*********************************************************************" <<
G4endl;
197 G4cout <<
"The table contains " << theTable->size() <<
" oscillators " <<
G4endl;
198 G4cout <<
"*********************************************************************" <<
G4endl;
199 if (theTable->size() < 10)
200 for (std::size_t k=0;k<theTable->size();++k)
202 G4cout <<
"Oscillator # " << k <<
" Z = " << (*theTable)[k]->GetParentZ() <<
203 " Shell Flag = " << (*theTable)[k]->GetShellFlag() <<
204 " Parent shell ID = " << (*theTable)[k]->GetParentShellID() <<
G4endl;
205 G4cout <<
"Compton index = " << (*theTable)[k]->GetHartreeFactor() <<
G4endl;
206 G4cout <<
"Ionisation energy = " << (*theTable)[k]->GetIonisationEnergy()/eV <<
" eV" <<
G4endl;
207 G4cout <<
"Occupation number = " << (*theTable)[k]->GetOscillatorStrength() <<
G4endl;
208 G4cout <<
"*********************************************************************" <<
G4endl;
210 for (std::size_t k=0;k<theTable->size();++k)
212 G4cout << k <<
" " << (*theTable)[k]->GetOscillatorStrength() <<
" " <<
213 (*theTable)[k]->GetIonisationEnergy()/eV <<
" " << (*theTable)[k]->GetHartreeFactor() <<
" " <<
214 (*theTable)[k]->GetParentZ() <<
" " << (*theTable)[k]->GetShellFlag() <<
" " <<
215 (*theTable)[k]->GetParentShellID() <<
G4endl;
217 G4cout <<
"*********************************************************************" <<
G4endl;
224void G4PenelopeOscillatorManager::CheckForTablesCreated()
228 if (!fOscillatorStoreIonisation)
230 fOscillatorStoreIonisation =
new std::map<const G4Material*,G4PenelopeOscillatorTable*>;
231 if (!fReadElementData)
233 if (!fOscillatorStoreIonisation)
235 G4Exception(
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation()",
237 "Problem in allocating the Oscillator Store for Ionisation");
240 if (!fOscillatorStoreCompton)
242 fOscillatorStoreCompton =
new std::map<const G4Material*,G4PenelopeOscillatorTable*>;
243 if (!fReadElementData)
245 if (!fOscillatorStoreCompton)
247 G4Exception(
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation()",
249 "Problem in allocating the Oscillator Store for Compton");
253 fAtomicNumber =
new std::map<const G4Material*,G4double>;
255 fAtomicMass =
new std::map<const G4Material*,G4double>;
256 if (!fExcitationEnergy)
257 fExcitationEnergy =
new std::map<const G4Material*,G4double>;
259 fPlasmaSquared =
new std::map<const G4Material*,G4double>;
260 if (!fAtomsPerMolecule)
261 fAtomsPerMolecule =
new std::map<const G4Material*,G4double>;
262 if (!fAtomTablePerMolecule)
263 fAtomTablePerMolecule =
new std::map< std::pair<const G4Material*,G4int>,
G4double>;
272 CheckForTablesCreated();
275 if (fAtomicNumber->count(mat))
276 return fAtomicNumber->find(mat)->second;
279 BuildOscillatorTable(mat);
282 if (fAtomicNumber->count(mat))
283 return fAtomicNumber->find(mat)->second;
286 G4cout <<
"G4PenelopeOscillatorManager::GetTotalZ() " <<
G4endl;
297 CheckForTablesCreated();
300 if (fAtomicMass->count(mat))
301 return fAtomicMass->find(mat)->second;
304 BuildOscillatorTable(mat);
307 if (fAtomicMass->count(mat))
308 return fAtomicMass->find(mat)->second;
311 G4cout <<
"G4PenelopeOscillatorManager::GetTotalA() " <<
G4endl;
322 CheckForTablesCreated();
325 if (fOscillatorStoreIonisation->count(mat))
328 return fOscillatorStoreIonisation->find(mat)->second;
332 BuildOscillatorTable(mat);
335 if (fOscillatorStoreIonisation->count(mat))
336 return fOscillatorStoreIonisation->find(mat)->second;
339 G4cout <<
"G4PenelopeOscillatorManager::GetOscillatorTableIonisation() " <<
G4endl;
340 G4cout <<
"Impossible to create ionisation oscillator table for " << mat->
GetName() <<
G4endl;
351 if (((std::size_t)index) < theTable->size())
352 return (*theTable)[index];
355 G4cout <<
"WARNING: Ionisation table for material " << material->
GetName() <<
" has " <<
356 theTable->size() <<
" oscillators" <<
G4endl;
357 G4cout <<
"Oscillator #" << index <<
" cannot be retrieved" <<
G4endl;
369 CheckForTablesCreated();
372 if (fOscillatorStoreCompton->count(mat))
375 return fOscillatorStoreCompton->find(mat)->second;
379 BuildOscillatorTable(mat);
382 if (fOscillatorStoreCompton->count(mat))
383 return fOscillatorStoreCompton->find(mat)->second;
386 G4cout <<
"G4PenelopeOscillatorManager::GetOscillatorTableCompton() " <<
G4endl;
387 G4cout <<
"Impossible to create Compton oscillator table for " << mat->
GetName() <<
G4endl;
398 if (((std::size_t)index) < theTable->size())
399 return (*theTable)[index];
402 G4cout <<
"WARNING: Compton table for material " << material->
GetName() <<
" has " <<
403 theTable->size() <<
" oscillators" <<
G4endl;
404 G4cout <<
"Oscillator #" << index <<
" cannot be retrieved" <<
G4endl;
412void G4PenelopeOscillatorManager::BuildOscillatorTable(
const G4Material* material)
416 G4double meanAtomExcitationEnergy[99] = {19.2*eV, 41.8*eV, 40.0*eV, 63.7*eV, 76.0*eV, 81.0*eV,
417 82.0*eV, 95.0*eV,115.0*eV,137.0*eV,149.0*eV,156.0*eV,
419 173.0*eV,173.0*eV,180.0*eV,174.0*eV,188.0*eV,190.0*eV,191.0*eV,
420 216.0*eV,233.0*eV,245.0*eV,257.0*eV,272.0*eV,286.0*eV,297.0*eV,
421 311.0*eV,322.0*eV,330.0*eV,334.0*eV,350.0*eV,347.0*eV,348.0*eV,
422 343.0*eV,352.0*eV,363.0*eV,366.0*eV,379.0*eV,393.0*eV,417.0*eV,
423 424.0*eV,428.0*eV,441.0*eV,449.0*eV,470.0*eV,470.0*eV,469.0*eV,
424 488.0*eV,488.0*eV,487.0*eV,485.0*eV,491.0*eV,482.0*eV,488.0*eV,
425 491.0*eV,501.0*eV,523.0*eV,535.0*eV,546.0*eV,560.0*eV,574.0*eV,
426 580.0*eV,591.0*eV,614.0*eV,628.0*eV,650.0*eV,658.0*eV,674.0*eV,
427 684.0*eV,694.0*eV,705.0*eV,718.0*eV,727.0*eV,736.0*eV,746.0*eV,
428 757.0*eV,790.0*eV,790.0*eV,800.0*eV,810.0*eV,823.0*eV,823.0*eV,
429 830.0*eV,825.0*eV,794.0*eV,827.0*eV,826.0*eV,841.0*eV,847.0*eV,
430 878.0*eV,890.0*eV,902.0*eV,921.0*eV,934.0*eV,939.0*eV,952.0*eV,
433 if (fVerbosityLevel > 0)
449 std::vector<G4double> *StechiometricFactors =
new std::vector<G4double>;
451 for (
G4int i=0;i<nElements;i++)
454 G4double fraction = fractionVector[i];
455 G4double atomicWeigth = (*elementVector)[i]->GetAtomicMassAmu();
456 StechiometricFactors->push_back(fraction/atomicWeigth);
459 G4double MaxStechiometricFactor = 0.;
460 for (
G4int i=0;i<nElements;i++)
462 if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
463 MaxStechiometricFactor = (*StechiometricFactors)[i];
465 if (MaxStechiometricFactor<1e-16)
468 ed <<
"Problem with the mass composition of " << material->
GetName() <<
G4endl;
469 ed <<
"MaxStechiometricFactor = " << MaxStechiometricFactor <<
G4endl;
470 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
474 for (
G4int i=0;i<nElements;++i)
475 (*StechiometricFactors)[i] /= MaxStechiometricFactor;
479 for (
G4int i=0;i<nElements;i++)
480 theatomsPerMolecule += (*StechiometricFactors)[i];
484 if (fVerbosityLevel > 1)
486 for (std::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;
494 for (
G4int i=0;i<nElements;++i)
496 G4int iZ = (*elementVector)[i]->GetZasInt();
497 totalZ += iZ * (*StechiometricFactors)[i];
498 totalMolecularWeight += (*elementVector)[i]->GetAtomicMassAmu() * (*StechiometricFactors)[i];
499 meanExcitationEnergy += iZ*
G4Log(meanAtomExcitationEnergy[iZ-1])*(*StechiometricFactors)[i];
500 std::pair<const G4Material*,G4int> theKey = std::make_pair(material,iZ);
501 if (!fAtomTablePerMolecule->count(theKey))
502 fAtomTablePerMolecule->insert(std::make_pair(theKey,(*StechiometricFactors)[i]));
504 meanExcitationEnergy =
G4Exp(meanExcitationEnergy/totalZ);
506 fAtomicNumber->insert(std::make_pair(material,totalZ));
507 fAtomicMass->insert(std::make_pair(material,totalMolecularWeight));
508 fExcitationEnergy->insert(std::make_pair(material,meanExcitationEnergy));
509 fAtomsPerMolecule->insert(std::make_pair(material,theatomsPerMolecule));
511 if (fVerbosityLevel > 1)
513 G4cout <<
"Calculated mean excitation energy for " << material->
GetName() <<
514 " = " << meanExcitationEnergy/eV <<
" eV" <<
G4endl;
517 std::vector<G4PenelopeOscillator> *helper =
new std::vector<G4PenelopeOscillator>;
528 helper->push_back(newOsc);
531 for (
G4int k=0;k<nElements;k++)
533 G4double Z = (*elementVector)[k]->GetZ();
535 for (
G4int i=0;i<2000 && !finished;i++)
544 if (fElementData[0][i] == Z)
547 G4double occup = fElementData[2][i];
551 if (std::fabs(occup) > 0)
562 if (fElementData[0][i] > 6 && fElementData[1][i] < 10)
566 helper->push_back(newOscLocal);
569 G4double ff = (*helper)[0].GetOscillatorStrength();
570 ff += std::fabs(occup)*(*StechiometricFactors)[k];
571 (*helper)[0].SetOscillatorStrength(ff);
576 if (fElementData[0][i] > Z)
581 delete StechiometricFactors;
586 std::sort(helper->begin(),helper->end());
589 static const G4double RydbergEnergy = 13.60569*eV;
590 G4double Omega = std::sqrt(4*pi*moleculeDensity*totalZ*Bohr_radius)*Bohr_radius*2.0*RydbergEnergy;
591 G4double conductionStrength = (*helper)[0].GetOscillatorStrength();
592 G4double plasmaEnergy =
Omega*std::sqrt(conductionStrength/totalZ);
594 fPlasmaSquared->insert(std::make_pair(material,Omega*Omega));
596 G4bool isAConductor =
false;
599 if (fVerbosityLevel > 1)
601 G4cout <<
"Estimated oscillator strength and energy of plasmon: " <<
602 conductionStrength <<
" and " << plasmaEnergy/eV <<
" eV" <<
G4endl;
605 if (conductionStrength < 0.01 || plasmaEnergy<1.0*eV)
607 if (fVerbosityLevel >1 )
610 helper->erase(helper->begin());
614 if (fVerbosityLevel >1 )
618 G4double conductionStrengthCopy = conductionStrength;
620 for (std::size_t i = 1; i<helper->size() && !quit ;++i)
622 G4double oscStre = (*helper)[i].GetOscillatorStrength();
624 if (oscStre < conductionStrengthCopy)
626 conductionStrengthCopy = conductionStrengthCopy-oscStre;
627 (*helper)[i].SetOscillatorStrength(0.);
633 (*helper)[i].SetOscillatorStrength(oscStre-conductionStrengthCopy);
634 if (std::fabs((*helper)[i].GetOscillatorStrength()) < 1e-12)
636 conductionStrength += (*helper)[i].GetOscillatorStrength();
637 (*helper)[i].SetOscillatorStrength(0.);
643 (*helper)[0].SetOscillatorStrength(conductionStrength);
644 (*helper)[0].SetIonisationEnergy(0.);
645 (*helper)[0].SetResonanceEnergy(plasmaEnergy);
646 G4double hartree = 0.75/std::sqrt(3.0*pi*pi*moleculeDensity*
647 Bohr_radius*Bohr_radius*Bohr_radius*conductionStrength);
648 (*helper)[0].SetHartreeFactor(hartree/fine_structure_const);
653 for (std::size_t i=0;i<helper->size();++i)
655 sum += (*helper)[i].GetOscillatorStrength();
657 if (std::fabs(sum-totalZ) > (1e-6*totalZ))
660 ed <<
"Inconsistent oscillator data for " << material->
GetName() <<
G4endl;
661 ed << sum <<
" " << totalZ <<
G4endl;
662 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
665 if (std::fabs(sum-totalZ) > (1e-12*totalZ))
668 for (std::size_t i=0;i<helper->size();++i)
670 G4double ff = (*helper)[i].GetOscillatorStrength()*fact;
671 (*helper)[i].SetOscillatorStrength(ff);
676 for (
G4int k=0;k<nullOsc;k++)
679 for (std::size_t i=0;i<helper->size() && !exit;++i)
681 if (std::fabs((*helper)[i].GetOscillatorStrength()) < 1e-12)
683 helper->erase(helper->begin()+i);
691 if (helper->size() > 1)
698 adjustmentFactor = (AALow+AAHigh)*0.5;
700 for (std::size_t i=0;i<helper->size();++i)
702 if (i == 0 && isAConductor)
704 G4double resEne = (*helper)[i].GetResonanceEnergy();
705 sumLocal += (*helper)[i].GetOscillatorStrength()*
G4Log(resEne/eV);
709 G4double ionEne = (*helper)[i].GetIonisationEnergy();
710 G4double oscStre = (*helper)[i].GetOscillatorStrength();
711 G4double WI2 = (adjustmentFactor*adjustmentFactor*ionEne*ionEne) +
714 (*helper)[i].SetResonanceEnergy(resEne);
715 sumLocal += (*helper)[i].GetOscillatorStrength()*
G4Log(resEne/eV);
719 AALow = adjustmentFactor;
721 AAHigh = adjustmentFactor;
722 if (fVerbosityLevel > 3)
723 G4cout <<
"Sternheimer's adjustment factor loops: " << AALow <<
" " << AAHigh <<
" " <<
724 adjustmentFactor <<
" " << TST <<
" " <<
726 }
while((AAHigh-AALow)>(1e-14*adjustmentFactor));
730 G4double ionEne = (*helper)[0].GetIonisationEnergy();
731 (*helper)[0].SetIonisationEnergy(std::fabs(ionEne));
732 (*helper)[0].SetResonanceEnergy(meanExcitationEnergy);
734 if (fVerbosityLevel > 1)
736 G4cout <<
"Sternheimer's adjustment factor: " << adjustmentFactor <<
G4endl;
740 G4double xcheck = (*helper)[0].GetOscillatorStrength()*
G4Log((*helper)[0].GetResonanceEnergy());
741 G4double TST = (*helper)[0].GetOscillatorStrength();
742 for (std::size_t i=1;i<helper->size();++i)
744 xcheck += (*helper)[i].GetOscillatorStrength()*
G4Log((*helper)[i].GetResonanceEnergy());
745 TST += (*helper)[i].GetOscillatorStrength();
747 if (std::fabs(TST-totalZ)>1e-8*totalZ)
750 ed <<
"Inconsistent oscillator data " <<
G4endl;
751 ed << TST <<
" " << totalZ <<
G4endl;
752 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
755 xcheck =
G4Exp(xcheck/totalZ);
756 if (std::fabs(xcheck-meanExcitationEnergy) > 1e-8*meanExcitationEnergy)
759 ed <<
"Error in Sterheimer factor calculation " <<
G4endl;
760 ed << xcheck/eV <<
" " << meanExcitationEnergy/eV <<
G4endl;
761 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
770 for (
G4int k=0;k<nElements;k++)
772 G4double Z = (*elementVector)[k]->GetZ();
773 if (Z>Zmax) Zmax = Z;
778 for (std::size_t i=0;i<helper->size() && !found;++i)
780 G4double Z = (*helper)[i].GetParentZ();
781 G4int shID = (*helper)[i].GetParentShellID();
782 if (shID == 10 && Z == Zmax)
785 if ((*helper)[i].GetIonisationEnergy() > cutEnergy)
786 cutEnergy = (*helper)[i].GetIonisationEnergy();
791 G4double lowEnergyLimitForFluorescence = 250*eV;
792 cutEnergy = std::min(cutEnergy,lowEnergyLimitForFluorescence);
794 if (fVerbosityLevel > 1)
795 G4cout <<
"Cutoff energy: " << cutEnergy/eV <<
" eV" <<
G4endl;
802 std::sort(helper->begin(),helper->end(),
comparator);
805 for (std::size_t i=0;i<helper->size();++i)
809 theTable->push_back(theOsc);
815 std::size_t Nost = theTable->size();
817 std::size_t firstIndex = (isAConductor) ? 1 : 0;
820 G4int removedLevels = 0;
825 if (Nost>firstIndex+1)
828 for (std::size_t i=firstIndex;i<theTable->size()-1;++i)
831 G4int shellFlag = (*theTable)[i]->GetShellFlag();
832 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
833 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
834 G4double resEnePlus1 = (*theTable)[i+1]->GetResonanceEnergy();
835 G4double oscStre = (*theTable)[i]->GetOscillatorStrength();
836 G4double oscStrePlus1 = (*theTable)[i+1]->GetOscillatorStrength();
838 if (ionEne>cutEnergy)
840 if (resEne<1.0*eV || resEnePlus1<1.0*eV)
842 if (resEnePlus1 > Rgroup*resEne)
847 oscStrePlus1*
G4Log(resEnePlus1))
848 /(oscStre+oscStrePlus1));
849 (*theTable)[i]->SetResonanceEnergy(newRes);
851 oscStrePlus1*(*theTable)[i+1]->GetIonisationEnergy())/
852 (oscStre+oscStrePlus1);
853 (*theTable)[i]->SetIonisationEnergy(newIon);
854 G4double newStre = oscStre+oscStrePlus1;
855 (*theTable)[i]->SetOscillatorStrength(newStre);
856 G4double newHartree = (oscStre*(*theTable)[i]->GetHartreeFactor()+
857 oscStrePlus1*(*theTable)[i+1]->GetHartreeFactor())/
858 (oscStre+oscStrePlus1);
859 (*theTable)[i]->SetHartreeFactor(newHartree);
860 if ((*theTable)[i]->GetParentZ() != (*theTable)[i+1]->GetParentZ())
861 (*theTable)[i]->SetParentZ(0.);
862 if (shellFlag < 10 || (*theTable)[i+1]->GetShellFlag() < 10)
864 G4int newFlag = std::min(shellFlag,(*theTable)[i+1]->GetShellFlag());
865 (*theTable)[i]->SetShellFlag(newFlag);
868 (*theTable)[i]->SetShellFlag(30);
870 (*theTable)[i]->SetParentShellID((*theTable)[i]->GetShellFlag());
873 if (i<theTable->size()-2)
875 for (std::size_t ii=i+1;ii<theTable->size()-1;++ii)
876 (*theTable)[ii] = (*theTable)[ii+1];
879 theTable->erase(theTable->begin()+theTable->size()-1);
886 Nost -= removedLevels;
889 if (Rgroup < 1.414213 || Nost > 64)
891 Rgroup = Rgroup*Rgroup;
895 if (nLoops > 100 && !removedLevels)
899 if (fVerbosityLevel > 1)
901 G4cout <<
"Final grouping factor for Ionisation: " << Rgroup <<
G4endl;
905 for (std::size_t i=0;i<theTable->size();++i)
908 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
909 if (ionEne < 1e-3*eV)
911 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
912 (*theTable)[i]->SetIonisationEnergy(0.*eV);
913 (*theTable)[i]->SetCutoffRecoilResonantEnergy(resEne);
916 (*theTable)[i]->SetCutoffRecoilResonantEnergy(ionEne);
920 fOscillatorStoreIonisation->insert(std::make_pair(material,theTable));
931 std::sort(helper->begin(),helper->end());
933 for (std::size_t i=0;i<helper->size();++i)
937 theTableC->push_back(theOsc);
942 Nost = theTableC->size();
944 firstIndex = (isAConductor) ? 1 : 0;
951 if (Nost>firstIndex+1)
954 for (std::size_t i=firstIndex;i<theTableC->size()-1;++i)
957 G4double ionEne = (*theTableC)[i]->GetIonisationEnergy();
958 G4double ionEnePlus1 = (*theTableC)[i+1]->GetIonisationEnergy();
959 G4double oscStre = (*theTableC)[i]->GetOscillatorStrength();
960 G4double oscStrePlus1 = (*theTableC)[i+1]->GetOscillatorStrength();
962 if (ionEne>cutEnergy)
964 if (ionEne<1.0*eV || ionEnePlus1<1.0*eV)
966 if (ionEnePlus1 > Rgroup*ionEne)
972 oscStrePlus1*ionEnePlus1)/
973 (oscStre+oscStrePlus1);
974 (*theTableC)[i]->SetIonisationEnergy(newIon);
975 G4double newStre = oscStre+oscStrePlus1;
976 (*theTableC)[i]->SetOscillatorStrength(newStre);
977 G4double newHartree = (oscStre*(*theTableC)[i]->GetHartreeFactor()+
978 oscStrePlus1*(*theTableC)[i+1]->GetHartreeFactor())/
979 (oscStre+oscStrePlus1);
980 (*theTableC)[i]->SetHartreeFactor(newHartree);
981 if ((*theTableC)[i]->GetParentZ() != (*theTableC)[i+1]->GetParentZ())
982 (*theTableC)[i]->SetParentZ(0.);
983 (*theTableC)[i]->SetShellFlag(30);
984 (*theTableC)[i]->SetParentShellID((*theTableC)[i]->GetShellFlag());
986 if (i<theTableC->size()-2)
988 for (std::size_t ii=i+1;ii<theTableC->size()-1;++ii)
989 (*theTableC)[ii] = (*theTableC)[ii+1];
991 theTableC->erase(theTableC->begin()+theTableC->size()-1);
998 Nost -= removedLevels;
1001 if (Rgroup < 2.0 || Nost > 64)
1003 Rgroup = Rgroup*Rgroup;
1007 if (nLoops > 100 && !removedLevels)
1012 if (fVerbosityLevel > 1)
1014 G4cout <<
"Final grouping factor for Compton: " << Rgroup <<
G4endl;
1018 fOscillatorStoreCompton->insert(std::make_pair(material,theTableC));
1022 if (fVerbosityLevel > 1)
1030void G4PenelopeOscillatorManager::ReadElementData()
1032 if (fVerbosityLevel > 0)
1034 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData()" <<
G4endl;
1040 G4String excep =
"G4PenelopeOscillatorManager - G4LEDATA environment variable not set!";
1041 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1046 G4String pathFile = pathString +
"/penelope/pdatconf.p08";
1047 std::ifstream file(pathFile);
1049 if (!file.is_open())
1051 G4String excep =
"G4PenelopeOscillatorManager - data file " + pathFile +
" not found!";
1052 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1062 for (
G4int iline=0;iline<22;iline++)
1063 getline(file,theHeader);
1066 G4int shellCode = 0;
1068 G4int occupationNumber = 0;
1069 G4double ionisationEnergy = 0.0*eV;
1071 G4int shellCounter = 0;
1073 G4int numberOfShells = 0;
1075 for (
G4int i=0;!file.eof();i++)
1077 file >> Z >> shellCode >> shellId >> occupationNumber >> ionisationEnergy >> hartreeProfile;
1080 fElementData[0][i] = Z;
1081 fElementData[1][i] = shellCode;
1082 fElementData[2][i] = occupationNumber;
1091 if (shellCounter<numberOfShells)
1098 fElementData[3][i] = (
bindingEnergy>100*eV) ? bindingEnergy : ionisationEnergy*eV;
1099 fElementData[4][i] = hartreeProfile;
1105 if (fVerbosityLevel > 1)
1107 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData(): Data file read" <<
G4endl;
1109 fReadElementData =
true;
1117 CheckForTablesCreated();
1120 if (fExcitationEnergy->count(mat))
1121 return fExcitationEnergy->find(mat)->second;
1124 BuildOscillatorTable(mat);
1127 if (fExcitationEnergy->count(mat))
1128 return fExcitationEnergy->find(mat)->second;
1131 G4cout <<
"G4PenelopeOscillatorManager::GetMolecularExcitationEnergy() " <<
G4endl;
1132 G4cout <<
"Impossible to retrieve the excitation energy for " << mat->
GetName() <<
G4endl;
1141 CheckForTablesCreated();
1144 if (fPlasmaSquared->count(mat))
1145 return fPlasmaSquared->find(mat)->second;
1148 BuildOscillatorTable(mat);
1151 if (fPlasmaSquared->count(mat))
1152 return fPlasmaSquared->find(mat)->second;
1155 G4cout <<
"G4PenelopeOscillatorManager::GetPlasmaEnergySquared() " <<
G4endl;
1166 CheckForTablesCreated();
1169 if (fAtomsPerMolecule->count(mat))
1170 return fAtomsPerMolecule->find(mat)->second;
1173 BuildOscillatorTable(mat);
1176 if (fAtomsPerMolecule->count(mat))
1177 return fAtomsPerMolecule->find(mat)->second;
1180 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1181 G4cout <<
"Impossible to retrieve the number of atoms per molecule for "
1192 CheckForTablesCreated();
1195 std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
1196 if (fAtomTablePerMolecule->count(theKey))
1197 return fAtomTablePerMolecule->find(theKey)->second;
1200 BuildOscillatorTable(mat);
1203 if (fAtomTablePerMolecule->count(theKey))
1204 return fAtomTablePerMolecule->find(theKey)->second;
1207 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1208 G4cout <<
"Impossible to retrieve the number of atoms per molecule for Z = "
std::vector< const G4Element * > G4ElementVector
const char * G4FindDataDir(const char *)
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
void Initialise()
needs to be called once from other code before start of run
G4int NumberOfShells(G4int Z) const
static G4AtomicTransitionManager * Instance()
const G4ElementVector * GetElementVector() const
G4double GetTotNbOfAtomsPerVolume() const
const G4double * GetFractionVector() const
std::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)