62 oscillatorStoreIonisation(0),oscillatorStoreCompton(0),atomicNumber(0),
63 atomicMass(0),excitationEnergy(0),plasmaSquared(0),atomsPerMolecule(0),
64 atomTablePerMolecule(0)
66 fReadElementData =
false;
67 for (
G4int i=0;i<5;i++)
69 for (
G4int j=0;j<2000;j++)
70 elementData[i][j] = 0.;
100 if (verbosityLevel > 1)
101 G4cout <<
" G4PenelopeOscillatorManager::Clear() - Clean Oscillator Tables" <<
G4endl;
104 std::map<const G4Material*,G4PenelopeOscillatorTable*>::iterator i;
105 for (i=oscillatorStoreIonisation->begin();i != oscillatorStoreIonisation->end();i++)
110 for (
size_t k=0;k<table->size();k++)
113 delete ((*table)[k]);
118 delete oscillatorStoreIonisation;
121 for (i=oscillatorStoreCompton->begin();i != oscillatorStoreCompton->end();i++)
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]->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 = std::exp(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)
558 if (std::fabs(occup) > 0)
569 if (elementData[0][i] > 6 && elementData[1][i] < 10)
573 helper->push_back(newOscLocal);
576 G4double ff = (*helper)[0].GetOscillatorStrength();
577 ff += std::fabs(occup)*(*StechiometricFactors)[k];
578 (*helper)[0].SetOscillatorStrength(ff);
584 if ( elementData[0][i] > Z)
589 delete StechiometricFactors;
594 std::sort(helper->begin(),helper->end());
597 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 strenght and energy of plasmon: " <<
610 conductionStrength <<
" and " << plasmaEnergy/eV <<
" eV" <<
G4endl;
613 if (conductionStrength < 0.5 || 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);
701 if (helper->size() > 1)
703 G4double TST = totalZ*std::log(meanExcitationEnergy/eV);
708 adjustmentFactor = (AALow+AAHigh)*0.5;
710 for (
size_t i=0;i<helper->size();i++)
712 if (i == 0 && isAConductor)
714 G4double resEne = (*helper)[i].GetResonanceEnergy();
715 sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
719 G4double ionEne = (*helper)[i].GetIonisationEnergy();
720 G4double oscStre = (*helper)[i].GetOscillatorStrength();
721 G4double WI2 = (adjustmentFactor*adjustmentFactor*ionEne*ionEne) +
722 2./3.*(oscStre/totalZ)*Omega*Omega;
724 (*helper)[i].SetResonanceEnergy(resEne);
725 sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
729 AALow = adjustmentFactor;
731 AAHigh = adjustmentFactor;
732 }
while((AAHigh-AALow)>(1e-14*adjustmentFactor));
736 G4double ionEne = (*helper)[0].GetIonisationEnergy();
737 (*helper)[0].SetIonisationEnergy(std::fabs(ionEne));
738 (*helper)[0].SetResonanceEnergy(meanExcitationEnergy);
740 if (verbosityLevel > 1)
742 G4cout <<
"Sternheimer's adjustment factor: " << adjustmentFactor <<
G4endl;
746 G4double xcheck = (*helper)[0].GetOscillatorStrength()*std::log((*helper)[0].GetResonanceEnergy());
747 G4double TST = (*helper)[0].GetOscillatorStrength();
748 for (
size_t i=1;i<helper->size();i++)
750 xcheck += (*helper)[i].GetOscillatorStrength()*std::log((*helper)[i].GetResonanceEnergy());
751 TST += (*helper)[i].GetOscillatorStrength();
753 if (std::fabs(TST-totalZ)>1e-8*totalZ)
756 ed <<
"Inconsistent oscillator data " <<
G4endl;
757 ed << TST <<
" " << totalZ <<
G4endl;
758 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
761 xcheck = std::exp(xcheck/totalZ);
762 if (std::fabs(xcheck-meanExcitationEnergy) > 1e-8*meanExcitationEnergy)
765 ed <<
"Error in Sterheimer factor calculation " <<
G4endl;
766 ed << xcheck/eV <<
" " << meanExcitationEnergy/eV <<
G4endl;
767 G4Exception(
"G4PenelopeOscillatorManager::BuildOscillatorTable()",
776 for (
G4int k=0;k<nElements;k++)
778 G4double Z = (*elementVector)[k]->GetZ();
779 if (Z>Zmax) Zmax = Z;
784 for (
size_t i=0;i<helper->size() && !found;i++)
786 G4double Z = (*helper)[i].GetParentZ();
787 G4int shID = (*helper)[i].GetParentShellID();
788 if (shID == 10 && Z == Zmax)
791 if ((*helper)[i].GetIonisationEnergy() > cutEnergy)
792 cutEnergy = (*helper)[i].GetIonisationEnergy();
797 G4double lowEnergyLimitForFluorescence = 250*eV;
798 cutEnergy = std::min(cutEnergy,lowEnergyLimitForFluorescence);
800 if (verbosityLevel > 1)
801 G4cout <<
"Cutoff energy: " << cutEnergy/eV <<
" eV" <<
G4endl;
809 std::sort(helper->begin(),helper->end(),
comparator);
812 for (
size_t i=0;i<helper->size();i++)
816 theTable->push_back(theOsc);
822 size_t Nost = theTable->size();
824 size_t firstIndex = (isAConductor) ? 1 : 0;
826 G4int removedLevels = 0;
830 if (Nost>firstIndex+1)
833 for (
size_t i=firstIndex;i<theTable->size()-1;i++)
836 G4int shellFlag = (*theTable)[i]->GetShellFlag();
837 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
838 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
839 G4double resEnePlus1 = (*theTable)[i+1]->GetResonanceEnergy();
840 G4double oscStre = (*theTable)[i]->GetOscillatorStrength();
841 G4double oscStrePlus1 = (*theTable)[i+1]->GetOscillatorStrength();
843 if (ionEne>cutEnergy)
845 if (resEne<1.0*eV || resEnePlus1<1.0*eV)
847 if (resEnePlus1 > Rgroup*resEne)
851 G4double newRes = std::exp((oscStre*std::log(resEne)+
852 oscStrePlus1*std::log(resEnePlus1))
853 /(oscStre+oscStrePlus1));
854 (*theTable)[i]->SetResonanceEnergy(newRes);
856 oscStrePlus1*(*theTable)[i+1]->GetIonisationEnergy())/
857 (oscStre+oscStrePlus1);
858 (*theTable)[i]->SetIonisationEnergy(newIon);
859 G4double newStre = oscStre+oscStrePlus1;
860 (*theTable)[i]->SetOscillatorStrength(newStre);
861 G4double newHartree = (oscStre*(*theTable)[i]->GetHartreeFactor()+
862 oscStrePlus1*(*theTable)[i+1]->GetHartreeFactor())/
863 (oscStre+oscStrePlus1);
864 (*theTable)[i]->SetHartreeFactor(newHartree);
865 if ((*theTable)[i]->GetParentZ() != (*theTable)[i+1]->GetParentZ())
866 (*theTable)[i]->SetParentZ(0.);
867 if (shellFlag < 10 || (*theTable)[i+1]->GetShellFlag() < 10)
869 G4int newFlag = std::min(shellFlag,(*theTable)[i+1]->GetShellFlag());
870 (*theTable)[i]->SetShellFlag(newFlag);
873 (*theTable)[i]->SetShellFlag(30);
875 (*theTable)[i]->SetParentShellID((*theTable)[i]->GetShellFlag());
878 if (i<theTable->size()-2)
880 for (
size_t ii=i+1;ii<theTable->size()-1;ii++)
881 (*theTable)[ii] = (*theTable)[ii+1];
884 theTable->erase(theTable->begin()+theTable->size()-1);
891 Nost -= removedLevels;
894 if (Rgroup < 1.414213 || Nost > 64)
896 Rgroup = Rgroup*Rgroup;
901 if (verbosityLevel > 1)
903 G4cout <<
"Final grouping factor for Ionisation: " << Rgroup <<
G4endl;
907 for (
size_t i=0;i<theTable->size();i++)
910 G4double ionEne = (*theTable)[i]->GetIonisationEnergy();
911 if (ionEne < 1e-3*eV)
913 G4double resEne = (*theTable)[i]->GetResonanceEnergy();
914 (*theTable)[i]->SetIonisationEnergy(0.*eV);
915 (*theTable)[i]->SetCutoffRecoilResonantEnergy(resEne);
918 (*theTable)[i]->SetCutoffRecoilResonantEnergy(ionEne);
922 oscillatorStoreIonisation->insert(std::make_pair(material,theTable));
934 std::sort(helper->begin(),helper->end());
936 for (
size_t i=0;i<helper->size();i++)
940 theTableC->push_back(theOsc);
945 Nost = theTableC->size();
947 firstIndex = (isAConductor) ? 1 : 0;
953 if (Nost>firstIndex+1)
956 for (
size_t i=firstIndex;i<theTableC->size()-1;i++)
960 G4double ionEne = (*theTableC)[i]->GetIonisationEnergy();
961 G4double ionEnePlus1 = (*theTableC)[i+1]->GetIonisationEnergy();
962 G4double oscStre = (*theTableC)[i]->GetOscillatorStrength();
963 G4double oscStrePlus1 = (*theTableC)[i+1]->GetOscillatorStrength();
965 if (ionEne>cutEnergy)
967 if (ionEne<1.0*eV || ionEnePlus1<1.0*eV)
969 if (ionEnePlus1 > Rgroup*ionEne)
975 oscStrePlus1*ionEnePlus1)/
976 (oscStre+oscStrePlus1);
977 (*theTableC)[i]->SetIonisationEnergy(newIon);
978 G4double newStre = oscStre+oscStrePlus1;
979 (*theTableC)[i]->SetOscillatorStrength(newStre);
980 G4double newHartree = (oscStre*(*theTableC)[i]->GetHartreeFactor()+
981 oscStrePlus1*(*theTableC)[i+1]->GetHartreeFactor())/
982 (oscStre+oscStrePlus1);
983 (*theTableC)[i]->SetHartreeFactor(newHartree);
984 if ((*theTableC)[i]->GetParentZ() != (*theTableC)[i+1]->GetParentZ())
985 (*theTableC)[i]->SetParentZ(0.);
986 (*theTableC)[i]->SetShellFlag(30);
987 (*theTableC)[i]->SetParentShellID((*theTableC)[i]->GetShellFlag());
989 if (i<theTableC->size()-2)
991 for (
size_t ii=i+1;ii<theTableC->size()-1;ii++)
992 (*theTableC)[ii] = (*theTableC)[ii+1];
994 theTableC->erase(theTableC->begin()+theTableC->size()-1);
1001 Nost -= removedLevels;
1004 if (Rgroup < 2.0 || Nost > 64)
1006 Rgroup = Rgroup*Rgroup;
1012 if (verbosityLevel > 1)
1014 G4cout <<
"Final grouping factor for Compton: " << Rgroup <<
G4endl;
1018 oscillatorStoreCompton->insert(std::make_pair(material,theTableC));
1048 if (verbosityLevel > 1)
1056void G4PenelopeOscillatorManager::ReadElementData()
1058 if (verbosityLevel > 0)
1060 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData()" <<
G4endl;
1063 char* path = getenv(
"G4LEDATA");
1066 G4String excep =
"G4PenelopeOscillatorManager - G4LEDATA environment variable not set!";
1067 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1072 G4String pathFile = pathString +
"/penelope/pdatconf.p08";
1073 std::ifstream file(pathFile);
1075 if (!file.is_open())
1077 G4String excep =
"G4PenelopeOscillatorManager - data file " + pathFile +
" not found!";
1078 G4Exception(
"G4PenelopeOscillatorManager::ReadElementData()",
1087 for (
G4int iline=0;iline<22;iline++)
1088 getline(file,theHeader);
1091 G4int shellCode = 0;
1093 G4int occupationNumber = 0;
1094 G4double ionisationEnergy = 0.0*eV;
1096 G4int shellCounter = 0;
1098 G4int numberOfShells = 0;
1100 for (
G4int i=0;!file.eof();i++)
1102 file >> Z >> shellCode >> shellId >> occupationNumber >> ionisationEnergy >> hartreeProfile;
1105 elementData[0][i] = Z;
1106 elementData[1][i] = shellCode;
1107 elementData[2][i] = occupationNumber;
1116 if (shellCounter<numberOfShells)
1123 elementData[3][i] = (
bindingEnergy>100*eV) ? bindingEnergy : ionisationEnergy*eV;
1125 elementData[4][i] = hartreeProfile;
1131 if (verbosityLevel > 1)
1133 G4cout <<
"G4PenelopeOscillatorManager::ReadElementData(): Data file read" <<
G4endl;
1135 fReadElementData =
true;
1144 CheckForTablesCreated();
1147 if (excitationEnergy->count(mat))
1148 return excitationEnergy->find(mat)->second;
1151 BuildOscillatorTable(mat);
1154 if (excitationEnergy->count(mat))
1155 return excitationEnergy->find(mat)->second;
1158 G4cout <<
"G4PenelopeOscillatorManager::GetMolecularExcitationEnergy() " <<
G4endl;
1159 G4cout <<
"Impossible to retrieve the excitation energy for " << mat->
GetName() <<
G4endl;
1168 CheckForTablesCreated();
1171 if (plasmaSquared->count(mat))
1172 return plasmaSquared->find(mat)->second;
1175 BuildOscillatorTable(mat);
1178 if (plasmaSquared->count(mat))
1179 return plasmaSquared->find(mat)->second;
1182 G4cout <<
"G4PenelopeOscillatorManager::GetPlasmaEnergySquared() " <<
G4endl;
1193 CheckForTablesCreated();
1196 if (atomsPerMolecule->count(mat))
1197 return atomsPerMolecule->find(mat)->second;
1200 BuildOscillatorTable(mat);
1203 if (atomsPerMolecule->count(mat))
1204 return atomsPerMolecule->find(mat)->second;
1207 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1208 G4cout <<
"Impossible to retrieve the number of atoms per molecule for "
1219 CheckForTablesCreated();
1222 std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
1223 if (atomTablePerMolecule->count(theKey))
1224 return atomTablePerMolecule->find(theKey)->second;
1227 BuildOscillatorTable(mat);
1230 if (atomTablePerMolecule->count(theKey))
1231 return atomTablePerMolecule->find(theKey)->second;
1234 G4cout <<
"G4PenelopeOscillatorManager::GetAtomsPerMolecule() " <<
G4endl;
1235 G4cout <<
"Impossible to retrieve the number of atoms per molecule for Z = "
std::vector< G4Element * > G4ElementVector
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
G4DLLIMPORT 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)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription
G4double bindingEnergy(G4int A, G4int Z)