Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -285,7 +285,7 @@ std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
}
G4String name(ost.str());
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4AugerData::LoadData";
@@ -112,7 +112,7 @@ void G4BoldyshevTripletModel::Initialise(const G4ParticleDefinition*,
if(IsMaster())
{
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -164,7 +164,7 @@ void G4BoldyshevTripletModel::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4BoldyshevTripletModel::ReadData()",
@@ -143,7 +143,7 @@ void G4BremsstrahlungParameters::LoadData(const G4String& name)
// Read parameters
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (path == 0)
{
G4Exception("G4BremsstrahlungParameters::LoadData",
@@ -462,7 +462,7 @@ G4bool G4CrossSectionDataSet::SaveData(const G4String & argFileName) const
G4String G4CrossSectionDataSet::FullFileName(const G4String& argFileName) const
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4CrossSectionDataSet::FullFileName",
@@ -121,7 +121,7 @@ void G4DopplerProfile::LoadBiggsP(const G4String& fileName)
ost << fileName << ".dat";
G4String name(ost.str());
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4DopplerProfile::LoadBiggsP",
@@ -163,7 +163,7 @@ void G4DopplerProfile::LoadProfile(const G4String& fileName,G4int Z)
ost << fileName << "-" << Z << ".dat";
G4String name(ost.str());
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep("G4LEDATA environment variable not set");
@@ -465,7 +465,7 @@ size_t G4EMDataSet::FindLowerBound(G4double x, G4DataVector* values) const
G4String G4EMDataSet::FullFileName(const G4String& name) const
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path) {
G4Exception("G4EMDataSet::FullFileName",
"em0006",FatalException,"G4LEDATA environment variable not set");
@@ -204,7 +204,7 @@ void G4FluoData::LoadData(G4int Z)
}
G4String name(ost.str());
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep("G4FluoData::LoadData()");
@@ -90,6 +90,7 @@
#include "G4ProductionCutsTable.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4LossTableManager.hh"
#include "G4EmParameters.hh"
#include "G4GenericIon.hh"
#include "G4Electron.hh"
#include "G4DeltaAngle.hh"
@@ -112,24 +113,17 @@ G4IonParametrisedLossModel::G4IonParametrisedLossModel(
particleChangeLoss(0),
corrFactor(1.0),
energyLossLimit(0.01),
cutEnergies(0)
cutEnergies(0),
isInitialised(false)
{
genericIon = G4GenericIon::Definition();
genericIonPDGMass = genericIon -> GetPDGMass();
corrections = G4LossTableManager::Instance() -> EmCorrections();
// The upper limit of the current model is set to 100 TeV
SetHighEnergyLimit(100.0 * TeV);
genericIonPDGMass = genericIon->GetPDGMass();
corrections = G4LossTableManager::Instance()->EmCorrections();
// The Bragg ion and Bethe Bloch models are instantiated
braggIonModel = new G4BraggIonModel();
betheBlochModel = new G4BetheBlochModel();
// By default ICRU 73 stopping power tables are loaded:
AddDEDXTable("ICRU73",
new G4IonStoppingData("ion_stopping_data/icru73"),
new G4IonDEDXScalingICRU73());
// The boundaries for the range tables are set
lowerEnergyEdgeIntegr = 0.025 * MeV;
upperEnergyEdgeIntegr = betheBlochModel -> HighEnergyLimit();
@@ -190,8 +184,7 @@ G4double G4IonParametrisedLossModel::MinEnergyCut(
const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple) {
return couple -> GetMaterial() -> GetIonisation() ->
GetMeanExcitationEnergy();
return couple->GetMaterial()->GetIonisation()->GetMeanExcitationEnergy();
}
// #########################################################################
@@ -277,19 +270,28 @@ void G4IonParametrisedLossModel::Initialise(
dedxCacheTransitionFactor = 0.0;
dedxCacheGenIonMassRatio = 0.0;
// By default ICRU 73 stopping power tables are loaded:
if(!isInitialised) {
G4bool icru90 = G4EmParameters::Instance()->UseICRU90Data();
isInitialised = true;
AddDEDXTable("ICRU73",
new G4IonStoppingData("ion_stopping_data/icru",icru90),
new G4IonDEDXScalingICRU73());
}
// The cache of loss tables is cleared
LossTableList::iterator iterTables = lossTableList.begin();
LossTableList::iterator iterTables_end = lossTableList.end();
for(;iterTables != iterTables_end; iterTables++)
(*iterTables) -> ClearCache();
for(;iterTables != iterTables_end; ++iterTables) {
(*iterTables) -> ClearCache();
}
// Range vs energy and energy vs range vectors from previous runs are
// cleared
RangeEnergyTable::iterator iterRange = r.begin();
RangeEnergyTable::iterator iterRange_end = r.end();
for(;iterRange != iterRange_end; iterRange++) {
for(;iterRange != iterRange_end; ++iterRange) {
delete iterRange->second;
}
r.clear();
@@ -302,15 +304,13 @@ void G4IonParametrisedLossModel::Initialise(
}
E.clear();
// The cut energies are (re)loaded
size_t size = cuts.size();
cutEnergies.clear();
for(size_t i = 0; i < size; i++) cutEnergies.push_back(cuts[i]);
// The cut energies
cutEnergies = cuts;
// All dE/dx vectors are built
const G4ProductionCutsTable* coupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t nmbCouples = coupleTable -> GetTableSize();
size_t nmbCouples = coupleTable->GetTableSize();
#ifdef PRINT_TABLE_BUILT
G4cout << "G4IonParametrisedLossModel::Initialise():"
@@ -318,30 +318,25 @@ void G4IonParametrisedLossModel::Initialise(
<< G4endl;
#endif
for (size_t i = 0; i < nmbCouples; i++) {
for (size_t i = 0; i < nmbCouples; ++i) {
const G4MaterialCutsCouple* couple =
coupleTable -> GetMaterialCutsCouple(i);
const G4MaterialCutsCouple* couple = coupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
const G4Material* material = couple -> GetMaterial();
// G4ProductionCuts* productionCuts = couple -> GetProductionCuts();
for(G4int atomicNumberIon = 3; atomicNumberIon < 102; atomicNumberIon++) {
for(G4int atomicNumberIon = 3; atomicNumberIon < 102; ++atomicNumberIon) {
LossTableList::iterator iter = lossTableList.begin();
LossTableList::iterator iter_end = lossTableList.end();
for(;iter != iter_end; iter++) {
for(;iter != iter_end; ++iter) {
if(*iter == 0) {
G4cout << "G4IonParametrisedLossModel::Initialise():"
<< " Skipping illegal table."
<< G4endl;
}
G4bool isApplicable =
(*iter) -> BuildDEDXTable(atomicNumberIon, material);
if(isApplicable) {
if((*iter)->BuildDEDXTable(atomicNumberIon, material)) {
#ifdef PRINT_TABLE_BUILT
G4cout << " Atomic Number Ion = " << atomicNumberIon
@@ -358,8 +353,8 @@ void G4IonParametrisedLossModel::Initialise(
// The particle change object
if(! particleChangeLoss) {
particleChangeLoss = GetParticleChangeForLoss();
braggIonModel -> SetParticleChange(particleChangeLoss, 0);
betheBlochModel -> SetParticleChange(particleChangeLoss, 0);
braggIonModel->SetParticleChange(particleChangeLoss, 0);
betheBlochModel->SetParticleChange(particleChangeLoss, 0);
}
// The G4BraggIonModel and G4BetheBlochModel instances are initialised with
@@ -1245,7 +1240,7 @@ G4bool G4IonParametrisedLossModel::AddDEDXTable(
G4VIonDEDXScalingAlgorithm* algorithm) {
if(table == 0) {
G4cerr << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
G4cout << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
<< " add table: Invalid pointer."
<< G4endl;
@@ -1256,11 +1251,11 @@ G4bool G4IonParametrisedLossModel::AddDEDXTable(
LossTableList::iterator iter = lossTableList.begin();
LossTableList::iterator iter_end = lossTableList.end();
for(;iter != iter_end; iter++) {
G4String tableName = (*iter) -> GetName();
for(;iter != iter_end; ++iter) {
const G4String& tableName = (*iter)->GetName();
if(tableName == nam) {
G4cerr << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
G4cout << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
<< " add table: Name already exists."
<< G4endl;
@@ -1320,11 +1315,11 @@ G4bool G4IonParametrisedLossModel::RemoveDEDXTable(
}
// #########################################################################
/*
void G4IonParametrisedLossModel::DeactivateICRU73Scaling() {
RemoveDEDXTable("ICRU73");
AddDEDXTable("ICRU73", new G4IonStoppingData("ion_stopping_data/icru73"));
}
*/
// #########################################################################
@@ -106,7 +106,7 @@ void G4JAEAElasticScatteringModel::Initialise(const G4ParticleDefinition* partic
InitialiseElementSelectors(particle, cuts);
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
@@ -160,7 +160,7 @@ void G4JAEAElasticScatteringModel::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4JAEAElasticScatteringModel::ReadData()","em0006",
@@ -114,13 +114,13 @@ void G4LivermoreBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
// check environment variable
// Build the complete string identifying the file with the data set
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
const G4ElementTable* theElmTable = G4Element::GetElementTable();
size_t numOfElm = G4Element::GetNumberOfElements();
if(numOfElm > 0) {
for(size_t i=0; i<numOfElm; ++i) {
G4int Z = G4int(((*theElmTable)[i])->GetZ());
G4int Z = (*theElmTable)[i]->GetZasInt();
if(Z < 1) { Z = 1; }
else if(Z > 100) { Z = 100; }
//G4cout << "Z= " << Z << G4endl;
@@ -151,7 +151,7 @@ void G4LivermoreBremsstrahlungModel::ReadData(G4int Z, const char* path)
const char* datadir = path;
if(!datadir) {
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir) {
G4Exception("G4LivermoreBremsstrahlungModel::ReadData()","em0006",
FatalException,"Environment variable G4LEDATA not defined");
@@ -120,7 +120,7 @@ void G4LivermoreComptonModel::Initialise(const G4ParticleDefinition* particle,
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -193,7 +193,7 @@ void G4LivermoreComptonModel::ReadData(size_t Z, const char* path)
const char* datadir = path;
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreComptonModel::ReadData()",
@@ -115,8 +115,7 @@ void G4LivermoreGammaConversionModel::Initialise(
InitialiseElementSelectors(particle, cuts);
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -174,7 +173,7 @@ void G4LivermoreGammaConversionModel::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreGammaConversionModel::ReadData()",
@@ -106,7 +106,7 @@ void G4LivermoreGammaConversionModelRC::Initialise(
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -168,7 +168,7 @@ void G4LivermoreGammaConversionModelRC::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreGammaConversionModelRC::ReadData()",
@@ -103,7 +103,7 @@ void G4LivermoreNuclearGammaConversionModel::Initialise(
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -166,7 +166,7 @@ void G4LivermoreNuclearGammaConversionModel::ReadData(size_t Z, const char* path
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreNuclearGammaConversionModel::ReadData()",
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
//
// Author: Sebastien Incerti
// 30 October 2008
// on base of G4LowEnergyPhotoElectric developed by A.Forti and M.G.Pia
@@ -57,6 +56,11 @@ G4int G4LivermorePhotoElectricModel::fNShellsUsed[] = {0};
G4ElementData* G4LivermorePhotoElectricModel::fShellCrossSection = nullptr;
G4Material* G4LivermorePhotoElectricModel::fWater = nullptr;
G4double G4LivermorePhotoElectricModel::fWaterEnergyLimit = 0.0;
G4String G4LivermorePhotoElectricModel::fDataDirectory = "";
#ifdef G4MULTITHREADED
G4Mutex G4LivermorePhotoElectricModel::livPhotoeffMutex = G4MUTEX_INITIALIZER;
#endif
using namespace std;
@@ -131,8 +135,6 @@ G4LivermorePhotoElectricModel::Initialise(const G4ParticleDefinition*,
if(!fShellCrossSection) { fShellCrossSection = new G4ElementData(); }
char* path = getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
@@ -146,8 +148,7 @@ G4LivermorePhotoElectricModel::Initialise(const G4ParticleDefinition*,
for (G4int j=0; j<nelm; ++j) {
G4int Z = std::min(maxZ, (*theElementVector)[j]->GetZasInt());
if((!fCrossSectionLE[Z] && 1>fNShells[Z]) ||
(!fCrossSection[Z] && (1<=fNShells[Z])) ) { ReadData(Z, path); }
if(!fCrossSection[Z]) { ReadData(Z); }
}
}
}
@@ -216,20 +217,16 @@ G4double G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom(
}
G4double cs = 0.0;
G4int Z = G4lrint(ZZ);
if(Z < 1 || Z >= maxZ) { return cs; }
if(Z >= maxZ) { return cs; }
// if element was not initialised
// do initialisation safely for MT mode
if((!fCrossSectionLE[Z] && 1>fNShells[Z]) || (!fCrossSection[Z] && (1<=fNShells[Z])) ) {
InitialiseForElement(0, Z);
if(!fCrossSectionLE[Z] && !fCrossSection[Z]) { return cs; }
}
if(!fCrossSection[Z]) { InitialiseForElement(theGamma, Z); }
//7: rows in the parameterization file; 5: number of parameters
G4int idx = fNShells[Z]*7 - 5;
if (energy < (*(fParamHigh[Z]))[idx-1]) {
energy = (*(fParamHigh[Z]))[idx-1];
}
energy = std::max(energy, (*(fParamHigh[Z]))[idx-1]);
G4double x1 = 1.0/energy;
G4double x2 = x1*x1;
@@ -286,8 +283,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
G4cout << "G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
<< gammaEnergy/keV << G4endl;
}
// kill incident photon
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
@@ -317,7 +313,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
if(Z >= maxZ) { Z = maxZ-1; }
// element was not initialised gamma should be absorbed
if(!fCrossSectionLE[Z] && !fCrossSection[Z]) {
if(!fCrossSection[Z]) {
fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy);
return;
}
@@ -328,8 +324,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
if(nn > 1)
{
if(gammaEnergy >= (*(fParamHigh[Z]))[0])
{
{
G4double x1 = 1.0/gammaEnergy;
G4double x2 = x1*x1;
G4double x3 = x2*x1;
@@ -363,8 +358,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
if(cs >= cs0) { break; }
}
}
if(shellIdx >= nn) { shellIdx = nn-1; }
if(shellIdx >= nn) { shellIdx = nn-1; }
}
else if(gammaEnergy >= (*(fParamLow[Z]))[0])
{
@@ -422,8 +416,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
}
}
// END: SAMPLING OF THE SHELL
G4double bindingEnergy = (*(fParamHigh[Z]))[shellIdx*7 + 1];
//G4cout << "Z= " << Z << " shellIdx= " << shellIdx
// << " nShells= " << fNShells[Z]
@@ -441,8 +434,7 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
// If binding energy of the selected shell is larger than photon energy
// do not generate secondaries
if(gammaEnergy < bindingEnergy) {
fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy);
fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy);
return;
}
@@ -502,8 +494,28 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
const G4String& G4LivermorePhotoElectricModel::FindDirectoryPath()
{
// check environment variable
// build the complete string identifying the file with the data set
if(fDataDirectory.empty()) {
const char* path = std::getenv("G4LEDATA");
if (path) {
std::ostringstream ost;
ost << path << "/livermore/phot_epics2014/";
fDataDirectory = ost.str();
} else {
G4Exception("G4SeltzerBergerModel::FindDirectoryPath()","em0006",
FatalException,
"Environment variable G4LEDATA not defined");
}
}
return fDataDirectory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LivermorePhotoElectricModel::ReadData(G4int Z)
{
if (verboseLevel > 1)
{
@@ -511,28 +523,14 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
<< G4endl;
}
if(fCrossSection[Z] || fCrossSectionLE[Z]) { return; }
if(fCrossSection[Z]) { return; }
const char* datadir = path;
if(!datadir)
{
datadir = getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermorePhotoElectricModel::ReadData()",
"em0006",FatalException,
"Environment variable G4LEDATA not defined");
return;
}
}
// spline for photoeffect total x-section above K-shell
// but below the parameterized ones
fCrossSection[Z] = new G4LPhysicsFreeVector();
fCrossSection[Z]->SetSpline(true);
std::ostringstream ost;
ost << datadir << "/livermore/phot_epics2014/pe-cs-" << Z <<".dat";
ost << FindDirectoryPath() << "pe-cs-" << Z <<".dat";
std::ifstream fin(ost.str().c_str());
if( !fin.is_open()) {
G4ExceptionDescription ed;
@@ -542,14 +540,14 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
return;
} else {
if(verboseLevel > 3) { G4cout << "File " << ost.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;}
fCrossSection[Z]->Retrieve(fin, true);
fCrossSection[Z]->ScaleVector(MeV, barn);
fin.close();
}
if(verboseLevel > 3) {
G4cout << "File " << ost.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fCrossSection[Z]->Retrieve(fin, true);
fCrossSection[Z]->ScaleVector(MeV, barn);
fin.close();
// read high-energy fit parameters
fParamHigh[Z] = new std::vector<G4double>;
@@ -557,7 +555,7 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
G4int n2 = 0;
G4double x;
std::ostringstream ost1;
ost1 << datadir << "/livermore/phot_epics2014/pe-high-" << Z <<".dat";
ost1 << fDataDirectory << "pe-high-" << Z <<".dat";
std::ifstream fin1(ost1.str().c_str());
if( !fin1.is_open()) {
G4ExceptionDescription ed;
@@ -567,35 +565,34 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
return;
} else {
if(verboseLevel > 3) {
G4cout << "File " << ost1.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fin1 >> n1;
if(fin1.fail()) { return; }
if(0 > n1 || n1 >= INT_MAX) { n1 = 0; }
fin1 >> n2;
if(fin1.fail()) { return; }
if(0 > n2 || n2 >= INT_MAX) { n2 = 0; }
fin1 >> x;
if(fin1.fail()) { return; }
fNShells[Z] = n1;
fParamHigh[Z]->reserve(7*n1+1);
fParamHigh[Z]->push_back(x*MeV);
for(G4int i=0; i<n1; ++i) {
for(G4int j=0; j<7; ++j) {
fin1 >> x;
if(0 == j) { x *= MeV; }
else { x *= barn; }
fParamHigh[Z]->push_back(x);
}
}
fin1.close();
}
if(verboseLevel > 3) {
G4cout << "File " << ost1.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fin1 >> n1;
if(fin1.fail()) { return; }
if(0 > n1 || n1 >= INT_MAX) { n1 = 0; }
fin1 >> n2;
if(fin1.fail()) { return; }
if(0 > n2 || n2 >= INT_MAX) { n2 = 0; }
fin1 >> x;
if(fin1.fail()) { return; }
fNShells[Z] = n1;
fParamHigh[Z]->reserve(7*n1+1);
fParamHigh[Z]->push_back(x*MeV);
for(G4int i=0; i<n1; ++i) {
for(G4int j=0; j<7; ++j) {
fin1 >> x;
if(0 == j) { x *= MeV; }
else { x *= barn; }
fParamHigh[Z]->push_back(x);
}
}
fin1.close();
// read low-energy fit parameters
fParamLow[Z] = new std::vector<G4double>;
@@ -603,7 +600,7 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
G4int n2_low = 0;
G4double x_low;
std::ostringstream ost1_low;
ost1_low << datadir << "/livermore/phot_epics2014/pe-low-" << Z <<".dat";
ost1_low << fDataDirectory << "pe-low-" << Z <<".dat";
std::ifstream fin1_low(ost1_low.str().c_str());
if( !fin1_low.is_open()) {
G4ExceptionDescription ed;
@@ -613,47 +610,43 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
return;
} else {
if(verboseLevel > 3) {
G4cout << "File " << ost1_low.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fin1_low >> n1_low;
if(fin1_low.fail()) { return; }
if(0 > n1_low || n1_low >= INT_MAX) { n1_low = 0; }
fin1_low >> n2_low;
if(fin1_low.fail()) { return; }
if(0 > n2_low || n2_low >= INT_MAX) { n2_low = 0; }
fin1_low >> x_low;
if(fin1_low.fail()) { return; }
fNShells[Z] = n1_low;
fParamLow[Z]->reserve(7*n1_low+1);
fParamLow[Z]->push_back(x_low*MeV);
for(G4int i=0; i<n1_low; ++i) {
for(G4int j=0; j<7; ++j) {
fin1_low >> x_low;
if(0 == j) { x_low *= MeV; }
else { x_low *= barn; }
fParamLow[Z]->push_back(x_low);
}
}
fin1_low.close();
}
if(verboseLevel > 3) {
G4cout << "File " << ost1_low.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fin1_low >> n1_low;
if(fin1_low.fail()) { return; }
if(0 > n1_low || n1_low >= INT_MAX) { n1_low = 0; }
fin1_low >> n2_low;
if(fin1_low.fail()) { return; }
if(0 > n2_low || n2_low >= INT_MAX) { n2_low = 0; }
fin1_low >> x_low;
if(fin1_low.fail()) { return; }
fNShells[Z] = n1_low;
fParamLow[Z]->reserve(7*n1_low+1);
fParamLow[Z]->push_back(x_low*MeV);
for(G4int i=0; i<n1_low; ++i) {
for(G4int j=0; j<7; ++j) {
fin1_low >> x_low;
if(0 == j) { x_low *= MeV; }
else { x_low *= barn; }
fParamLow[Z]->push_back(x_low);
}
}
fin1_low.close();
// there is a possibility to use only main shells
if(nShellLimit < n2) { n2 = nShellLimit; }
fShellCrossSection->InitialiseForComponent(Z, n2);//number of shells
fNShellsUsed[Z] = n2;
if(1 < n2) {
std::ostringstream ost2;
ost2 << datadir << "/livermore/phot_epics2014/pe-ss-cs-" << Z <<".dat";
ost2 << fDataDirectory << "pe-ss-cs-" << Z <<".dat";
std::ifstream fin2(ost2.str().c_str());
if( !fin2.is_open()) {
G4ExceptionDescription ed;
@@ -663,32 +656,31 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
return;
} else {
if(verboseLevel > 3) {
G4cout << "File " << ost2.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
G4int n3, n4;
G4double y;
for(G4int i=0; i<n2; ++i) {
fin2 >> x >> y >> n3 >> n4;
G4LPhysicsFreeVector* v = new G4LPhysicsFreeVector(n3, x, y);
for(G4int j=0; j<n3; ++j) {
fin2 >> x >> y;
v->PutValues(j, x*MeV, y*barn);
}
fShellCrossSection->AddComponent(Z, n4, v);
}
fin2.close();
}
if(verboseLevel > 3) {
G4cout << "File " << ost2.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
G4int n3, n4;
G4double y;
for(G4int i=0; i<n2; ++i) {
fin2 >> x >> y >> n3 >> n4;
G4LPhysicsFreeVector* v = new G4LPhysicsFreeVector(n3, x, y);
for(G4int j=0; j<n3; ++j) {
fin2 >> x >> y;
v->PutValues(j, x*MeV, y*barn);
}
fShellCrossSection->AddComponent(Z, n4, v);
}
fin2.close();
}
// no spline for photoeffect total x-section below K-shell
if(1 < fNShells[Z]) {
fCrossSectionLE[Z] = new G4LPhysicsFreeVector();
std::ostringstream ost3;
ost3 << datadir << "/livermore/phot_epics2014/pe-le-cs-" << Z <<".dat";
ost3 << fDataDirectory << "pe-le-cs-" << Z <<".dat";
std::ifstream fin3(ost3.str().c_str());
if( !fin3.is_open()) {
G4ExceptionDescription ed;
@@ -698,52 +690,48 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
return;
} else {
if(verboseLevel > 3) {
G4cout << "File " << ost3.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fCrossSectionLE[Z]->Retrieve(fin3, true);
fCrossSectionLE[Z]->ScaleVector(MeV, barn);
fin3.close();
}
if(verboseLevel > 3) {
G4cout << "File " << ost3.str().c_str()
<< " is opened by G4LivermorePhotoElectricModel" << G4endl;
}
fCrossSectionLE[Z]->Retrieve(fin3, true);
fCrossSectionLE[Z]->ScaleVector(MeV, barn);
fin3.close();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LivermorePhotoElectricModel::GetBindingEnergy(G4double ZZ, G4int shell)
G4double G4LivermorePhotoElectricModel::GetBindingEnergy(G4int Z, G4int shell)
{
G4int Z = G4lrint(ZZ);
//Control on Z
if(Z < 1 || Z >= maxZ) { return -1;} //If Z is out of the supported return 0
//If necessary load data for Z
InitialiseForElement(0, Z);
if(!fCrossSectionLE[Z] && !fCrossSection[Z]) { return -1; } //If there are not data for that Z return -1
if(shell < 0 || shell >= fNShellsUsed[Z]) { return -1;}
InitialiseForElement(theGamma, Z);
if(!fCrossSection[Z] || shell < 0 || shell >= fNShellsUsed[Z]) { return -1; }
if(Z>2)
return fShellCrossSection->GetComponentDataByIndex(Z, shell)->Energy(0);
else
return fCrossSection[Z]->Energy(0);
return fCrossSection[Z]->Energy(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4AutoLock.hh"
namespace { G4Mutex LivermorePhotoElectricModelMutex = G4MUTEX_INITIALIZER; }
void G4LivermorePhotoElectricModel::InitialiseForElement(
const G4ParticleDefinition*, G4int Z)
{
G4AutoLock l(&LivermorePhotoElectricModelMutex);
// G4cout << "G4LivermorePhotoElectricModel::InitialiseForElement Z= "
// << Z << G4endl;
if((!fCrossSectionLE[Z] && 1>fNShells[Z]) ||
(!fCrossSection[Z] && (1<=fNShells[Z])) ) {ReadData(Z); }
l.unlock();
if (!fCrossSection[Z]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&livPhotoeffMutex);
if (!fCrossSection[Z]) {
#endif
ReadData(Z);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&livPhotoeffMutex);
#endif
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -121,7 +121,7 @@ void G4LivermorePolarizedComptonModel::Initialise(const G4ParticleDefinition* pa
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -205,7 +205,7 @@ void G4LivermorePolarizedComptonModel::ReadData(size_t Z, const char* path)
const char* datadir = path;
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermorePolarizedComptonModel::ReadData()",
@@ -109,7 +109,7 @@ void G4LivermorePolarizedGammaConversionModel::Initialise(const G4ParticleDefini
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -171,7 +171,7 @@ void G4LivermorePolarizedGammaConversionModel::ReadData(size_t Z, const char* pa
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermorePolarizedGammaConversionModel::ReadData()",
@@ -121,7 +121,7 @@ G4LivermorePolarizedPhotoElectricGDModel::Initialise(
if(!fShellCrossSection) { fShellCrossSection = new G4ElementData(); }
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -442,7 +442,7 @@ void G4LivermorePolarizedPhotoElectricGDModel::ReadData(G4int Z, const char* pat
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermorePhotoElectricModel::ReadData()",
@@ -129,7 +129,7 @@ G4LivermorePolarizedPhotoElectricModel::Initialise(const G4ParticleDefinition*,
if(!fShellCrossSection) { fShellCrossSection = new G4ElementData(); }
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -445,7 +445,7 @@ G4LivermorePolarizedPhotoElectricModel::ReadData(G4int Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermorePolarizedPhotoElectricModel::ReadData()",
@@ -127,7 +127,7 @@ void G4LivermorePolarizedRayleighModel::Initialise(const G4ParticleDefinition* p
InitialiseElementSelectors(particle, cuts);
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
@@ -181,7 +181,7 @@ void G4LivermorePolarizedRayleighModel::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreRayleighModelModel::ReadData()","em0006",
@@ -95,7 +95,7 @@ void G4LivermoreRayleighModel::Initialise(const G4ParticleDefinition* particle,
InitialiseElementSelectors(particle, cuts);
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
@@ -110,7 +110,7 @@ void G4LivermoreRayleighModel::Initialise(const G4ParticleDefinition* particle,
for (G4int j=0; j<nelm; ++j)
{
G4int Z = G4lrint((*theElementVector)[j]->GetZ());
G4int Z = (*theElementVector)[j]->GetZasInt();
if(Z < 1) { Z = 1; }
else if(Z > maxZ) { Z = maxZ; }
if( (!dataCS[Z]) ) { ReadData(Z, path); }
@@ -148,7 +148,7 @@ void G4LivermoreRayleighModel::ReadData(size_t Z, const char* path)
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LivermoreRayleighModelModel::ReadData()","em0006",
@@ -143,7 +143,7 @@ void G4LowEPComptonModel::Initialise(const G4ParticleDefinition* particle,
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -216,7 +216,7 @@ void G4LowEPComptonModel::ReadData(size_t Z, const char* path)
const char* datadir = path;
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LowEPComptonModel::ReadData()",
@@ -130,7 +130,7 @@ void G4LowEPPolarizedComptonModel::Initialise(const G4ParticleDefinition* partic
// Access to elements
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
@@ -203,7 +203,7 @@ void G4LowEPPolarizedComptonModel::ReadData(size_t Z, const char* path)
const char* datadir = path;
if(!datadir)
{
datadir = getenv("G4LEDATA");
datadir = std::getenv("G4LEDATA");
if(!datadir)
{
G4Exception("G4LowEPPolarizedComptonModel::ReadData()",
@@ -438,7 +438,7 @@ G4bool G4MicroElecCrossSectionDataSet::SaveData(const G4String & argFileName) co
G4String G4MicroElecCrossSectionDataSet::FullFileName(const G4String& argFileName) const
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4MicroElecCrossSectionDataSet::FullFileName","em0006",
@@ -143,7 +143,7 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
// For final state
char *path = getenv("G4LEDATA");
char *path = std::getenv("G4LEDATA");
if (!path)
{
@@ -132,7 +132,7 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
G4double scaleFactor = 1e-18 * cm *cm;
char *path = getenv("G4LEDATA");
char *path = std::getenv("G4LEDATA");
// *** ELECTRON
electron = electronDef->GetParticleName();
@@ -434,7 +434,7 @@ G4bool G4MuElecCrossSectionDataSet::SaveData(const G4String & argFileName) const
G4String G4MuElecCrossSectionDataSet::FullFileName(const G4String& argFileName) const
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4MuElecCrossSectionDataSet::FullFileName","em0006",
@@ -153,7 +153,7 @@ void G4MuElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*/,
// For final state
char *path = getenv("G4LEDATA");
char *path = std::getenv("G4LEDATA");
if (!path)
{
@@ -133,7 +133,7 @@ void G4MuElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
G4double scaleFactor = 1e-18 * cm *cm;
char *path = getenv("G4LEDATA");
char *path = std::getenv("G4LEDATA");
// *** ELECTRON
electron = electronDef->GetParticleName();
@@ -119,7 +119,7 @@ void G4PenelopeBremsstrahlungAngular::ClearTables()
void G4PenelopeBremsstrahlungAngular::ReadDataFile()
{
//Read information from DataBase file
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep =
@@ -371,7 +371,7 @@ void G4PenelopeBremsstrahlungFS::BuildScaledXSTable(const G4Material* material,
void G4PenelopeBremsstrahlungFS::ReadDataFile(G4int Z)
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4PenelopeBremsstrahlungFS - G4LEDATA environment variable not set!";
@@ -513,13 +513,13 @@ void G4PenelopeGammaConversionModel::ReadDataFile(const G4int Z)
G4Exception("G4PenelopeGammaConversionModel::ReadDataFile()",
"em0100",FatalException,"Worker thread in this method");
if (verboseLevel > 2)
if (verboseLevel > 2)
{
G4cout << "G4PenelopeGammaConversionModel::ReadDataFile()" << G4endl;
G4cout << "Going to read Gamma Conversion data files for Z=" << Z << G4endl;
}
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep =
@@ -1071,7 +1071,7 @@ void G4PenelopeOscillatorManager::ReadElementData()
G4cout << "G4PenelopeOscillatorManager::ReadElementData()" << G4endl;
G4cout << "Going to read Element Data" << G4endl;
}
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4PenelopeOscillatorManager - G4LEDATA environment variable not set!";
@@ -540,7 +540,7 @@ void G4PenelopePhotoElectricModel::ReadDataFile(G4int Z)
G4cout << "Going to read PhotoElectric data files for Z=" << Z << G4endl;
}
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4PenelopePhotoElectricModel - G4LEDATA environment variable not set!";
@@ -592,7 +592,7 @@ void G4PenelopeRayleighModel::ReadDataFile(const G4int Z)
G4cout << "Going to read Rayleigh data files for Z=" << Z << G4endl;
}
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4LEDATA environment variable not set!";
@@ -90,7 +90,7 @@ G4PhotoElectricAngularGeneratorPolarized::G4PhotoElectricAngularGeneratorPolariz
if(level == 0) filename = nameChar0;
if(level == 1) filename = nameChar1;
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep = "G4EMDataSet - G4LEDATA environment variable not set";
@@ -240,7 +240,7 @@ void G4ShellData::LoadData(const G4String& fileName)
G4String name(ost.str());
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4String excep("G4ShellData::LoadData()");
@@ -397,7 +397,7 @@ void G4ShellEMDataSet::CleanUpComponents(void)
G4String G4ShellEMDataSet::FullFileName(const G4String& fileName) const
{
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
@@ -192,7 +192,7 @@ void G4VCrossSectionHandler::LoadData(const G4String& fileName)
// Build the complete string identifying the file with the data set
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4VCrossSectionHandler::LoadData",
@@ -269,7 +269,7 @@ void G4VCrossSectionHandler::LoadNonLogData(const G4String& fileName)
// Build the complete string identifying the file with the data set
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4VCrossSectionHandler::LoadNonLogData",
@@ -173,7 +173,7 @@ void G4eIonisationParameters::LoadData()
}
}
char* path = getenv("G4LEDATA");
char* path = std::getenv("G4LEDATA");
if (!path)
{
G4Exception("G4BremsstrahlungParameters::LoadData",
@@ -61,7 +61,7 @@ G4ecpssrBaseKxsModel::G4ecpssrBaseKxsModel()
// Storing FK data needed for medium velocities region
char *path = 0;
path = getenv("G4LEDATA");
path = std::getenv("G4LEDATA");
if (!path) {
G4Exception("G4ecpssrBaseKxsModel::G4ecpssrBaseKxsModel()", "em0006", FatalException,"G4LEDATA environment variable not set" );
@@ -46,7 +46,7 @@ G4ecpssrBaseLixsModel::G4ecpssrBaseLixsModel()
// Storing FLi data needed for 0.2 to 3.0 velocities region
char *path = getenv("G4LEDATA");
char *path = std::getenv("G4LEDATA");
if (!path) {
G4Exception("G4ecpssrLCrossSection::G4ecpssrBaseLixsModel()","em0006", FatalException ,"G4LEDATA environment variable not set");