Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -41,20 +41,27 @@
// 06 Sep 2011 Override the local Penelope database and use the main
// G4AtomicDeexcitation database to retrieve the shell
// binding energies. L. Pandola
// 15 Mar 2012 Added method to retrieve number of atom of given Z per
// molecule. Restore the original Penelope database for levels
// below 100 eV. L. Pandola
//
// -------------------------------------------------------------------
#include "G4PenelopeOscillatorManager.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4AtomicTransitionManager.hh"
#include "G4AtomicShell.hh"
#include "G4Material.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PenelopeOscillatorManager::G4PenelopeOscillatorManager() :
oscillatorStoreIonisation(0),oscillatorStoreCompton(0),atomicNumber(0),
atomicMass(0),excitationEnergy(0),plasmaSquared(0),atomsPerMolecule(0)
atomicMass(0),excitationEnergy(0),plasmaSquared(0),atomsPerMolecule(0),
atomTablePerMolecule(0)
{
fReadElementData = false;
for (G4int i=0;i<5;i++)
@@ -131,7 +138,7 @@ void G4PenelopeOscillatorManager::Clear()
if (excitationEnergy) delete excitationEnergy;
if (plasmaSquared) delete plasmaSquared;
if (atomsPerMolecule) delete atomsPerMolecule;
if (atomTablePerMolecule) delete atomTablePerMolecule;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -249,7 +256,8 @@ void G4PenelopeOscillatorManager::CheckForTablesCreated()
plasmaSquared = new std::map<const G4Material*,G4double>;
if (!atomsPerMolecule)
atomsPerMolecule = new std::map<const G4Material*,G4double>;
if (!atomTablePerMolecule)
atomTablePerMolecule = new std::map< std::pair<const G4Material*,G4int>, G4double>;
}
@@ -443,7 +451,7 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
{
//G4int iZ = (G4int) (*elementVector)[i]->GetZ();
G4double fraction = fractionVector[i];
G4double atomicWeigth = (*elementVector)[i]->GetA()/(g/mole);
G4double atomicWeigth = (*elementVector)[i]->GetAtomicMassAmu();
StechiometricFactors->push_back(fraction/atomicWeigth);
}
//Find max
@@ -488,7 +496,7 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
{
G4int iZ = (G4int) (*elementVector)[i]->GetZ();
totalZ += iZ * (*StechiometricFactors)[i];
totalMolecularWeight += (*elementVector)[i]->GetA() * (*StechiometricFactors)[i];
totalMolecularWeight += (*elementVector)[i]->GetAtomicMassAmu() * (*StechiometricFactors)[i];
meanExcitationEnergy += iZ*std::log(meanAtomExcitationEnergy[iZ-1])*(*StechiometricFactors)[i];
/*
G4cout << iZ << " " << (*StechiometricFactors)[i] << " " << totalZ << " " <<
@@ -496,6 +504,9 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
meanAtomExcitationEnergy[iZ-1]/eV <<
G4endl;
*/
std::pair<const G4Material*,G4int> theKey = std::make_pair(material,iZ);
if (!atomTablePerMolecule->count(theKey))
atomTablePerMolecule->insert(std::make_pair(theKey,(*StechiometricFactors)[i]));
}
meanExcitationEnergy = std::exp(meanExcitationEnergy/totalZ);
@@ -504,6 +515,7 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
excitationEnergy->insert(std::make_pair(material,meanExcitationEnergy));
atomsPerMolecule->insert(std::make_pair(material,theatomsPerMolecule));
if (verbosityLevel > 1)
{
G4cout << "Calculated mean excitation energy for " << material->GetName() <<
@@ -545,20 +557,20 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
{
if (std::fabs(occup) > 0)
{
G4PenelopeOscillator newOsc;
newOsc.SetOscillatorStrength(std::fabs(occup)*(*StechiometricFactors)[k]);
newOsc.SetIonisationEnergy(elementData[3][i]);
newOsc.SetHartreeFactor(elementData[4][i]/fine_structure_const);
newOsc.SetParentZ(elementData[0][i]);
G4PenelopeOscillator newOscLocal;
newOscLocal.SetOscillatorStrength(std::fabs(occup)*(*StechiometricFactors)[k]);
newOscLocal.SetIonisationEnergy(elementData[3][i]);
newOscLocal.SetHartreeFactor(elementData[4][i]/fine_structure_const);
newOscLocal.SetParentZ(elementData[0][i]);
//keep track of the origianl shell level
newOsc.SetParentShellID((G4int)elementData[1][i]);
newOscLocal.SetParentShellID((G4int)elementData[1][i]);
//register only K, L and M shells. Outer shells all grouped with
//shellIndex = 30
if (elementData[0][i] > 6 && elementData[1][i] < 10)
newOsc.SetShellFlag(((G4int)elementData[1][i]));
newOscLocal.SetShellFlag(((G4int)elementData[1][i]));
else
newOsc.SetShellFlag(30);
helper->push_back(newOsc);
newOscLocal.SetShellFlag(30);
helper->push_back(newOscLocal);
if (occup < 0)
{
G4double ff = (*helper)[0].GetOscillatorStrength();
@@ -694,13 +706,13 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
do
{
adjustmentFactor = (AALow+AAHigh)*0.5;
G4double sum = 0;
G4double sumLocal = 0;
for (size_t i=0;i<helper->size();i++)
{
if (i == 0 && isAConductor)
{
G4double resEne = (*helper)[i].GetResonanceEnergy();
sum += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
}
else
{
@@ -709,11 +721,11 @@ void G4PenelopeOscillatorManager::BuildOscillatorTable(const G4Material* materia
G4double WI2 = (adjustmentFactor*adjustmentFactor*ionEne*ionEne) +
2./3.*(oscStre/totalZ)*Omega*Omega;
G4double resEne = std::sqrt(WI2);
(*helper)[i].SetResonanceEnergy(resEne);
sum += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
(*helper)[i].SetResonanceEnergy(resEne);
sumLocal += (*helper)[i].GetOscillatorStrength()*std::log(resEne/eV);
}
}
if (sum < TST)
if (sumLocal < TST)
AALow = adjustmentFactor;
else
AAHigh = adjustmentFactor;
@@ -1107,9 +1119,9 @@ void G4PenelopeOscillatorManager::ReadElementData()
bindingEnergy = shell->BindingEnergy();
}
//Valid level found in the G4AtomicTransition database: keep it, otherwise use
//the ionisation energy found in the Penelope database
elementData[3][i] = (bindingEnergy) ? bindingEnergy : ionisationEnergy*eV;
//elementData[3][i] = ionisationEnergy*eV;
//the ionisation energy found in the Penelope database
elementData[3][i] = (bindingEnergy>100*eV) ? bindingEnergy : ionisationEnergy*eV;
//elementData[3][i] = ionisationEnergy*eV;
elementData[4][i] = hartreeProfile;
shellCounter++;
}
@@ -1174,6 +1186,7 @@ G4double G4PenelopeOscillatorManager::GetPlasmaEnergySquared(const G4Material* m
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PenelopeOscillatorManager::GetAtomsPerMolecule(const G4Material* mat)
{
// (1) First time, create oscillatorStores and read data
@@ -1197,3 +1210,30 @@ G4double G4PenelopeOscillatorManager::GetAtomsPerMolecule(const G4Material* mat)
return 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4PenelopeOscillatorManager::GetNumberOfZAtomsPerMolecule(const G4Material* mat,G4int Z)
{
// (1) First time, create oscillatorStores and read data
CheckForTablesCreated();
// (2) Check if the material/Z couple has been already included
std::pair<const G4Material*,G4int> theKey = std::make_pair(mat,Z);
if (atomTablePerMolecule->count(theKey))
return atomTablePerMolecule->find(theKey)->second;
// (3) If we are here, it means that we have to create the table for the material
BuildOscillatorTable(mat);
// (4) now, the oscillator store should be ok
if (atomTablePerMolecule->count(theKey))
return atomTablePerMolecule->find(theKey)->second;
else
{
G4cout << "G4PenelopeOscillatorManager::GetAtomsPerMolecule() " << G4endl;
G4cout << "Impossible to retrieve the number of atoms per molecule for Z = "
<< Z << " in material " << mat->GetName() << G4endl;
return 0;
}
}