Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4CompositeDataSet.cc,v 1.2 2010/11/19 17:16:20 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4CompositeDataSet.cc,v 1.2 2010-11-19 17:16:20 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -56,7 +56,10 @@ G4CompositeDataSet::G4CompositeDataSet(G4IInterpolator* algo,
maxZ(zMax)
{
if (algorithm == 0)
G4Exception("G4CompositeDataSet::G4CompositeDataSet - interpolation == 0");
G4Exception("G4CompositeDataSet::G4CompositeDataSet",
"pii00000001",
FatalException,
"Interpolation == 0");
}
@@ -77,7 +80,10 @@ G4double G4CompositeDataSet::FindValue(G4double energy, G4int componentId) const
std::ostringstream message;
message << "G4CompositeDataSet::FindValue - component " << componentId << " not found";
G4Exception(message.str().c_str());
G4Exception("G4CompositeDataSet::FindValue",
"pii00000010",
FatalException,
message.str().c_str());
return 0.;
}
@@ -112,7 +118,11 @@ void G4CompositeDataSet::SetEnergiesData(G4DataVector* energies, G4DataVector* d
std::ostringstream message;
message << "G4CompositeDataSet::SetEnergiesData - component " << componentId << " not found";
G4Exception(message.str().c_str());
G4Exception("G4CompositeDataSet::SetEnergiesData",
"pii00000020",
FatalException,
message.str().c_str());
}
G4bool G4CompositeDataSet::LoadData(const G4String& argFileName)
@@ -144,7 +154,10 @@ G4bool G4CompositeDataSet::SaveData(const G4String& argFileName) const
{
std::ostringstream message;
message << "G4CompositeDataSet::SaveData - component " << (z-minZ) << " not found";
G4Exception(message.str().c_str());
G4Exception("G4CompositeDataSet::SaveData",
"pii00000030",
FatalException,
message.str().c_str());
}
if (!component->SaveData(argFileName))
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DataSet.cc,v 1.4 2010/11/25 19:49:43 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4DataSet.cc,v 1.4 2010-11-25 19:49:43 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -59,7 +59,10 @@ G4DataSet::G4DataSet(G4int Z,
pdf(0),
randomSet(random)
{
if (algorithm == 0) G4Exception("G4DataSet::G4DataSet - interpolation == 0");
if (algorithm == 0) G4Exception("G4DataSet::G4DataSet",
"pii00000101",
FatalException,
"Interpolation == 0");
if (randomSet) BuildPdf();
}
@@ -79,15 +82,24 @@ G4DataSet::G4DataSet(G4int argZ,
pdf(0),
randomSet(random)
{
if (algorithm == 0) G4Exception("G4DataSet::G4DataSet - interpolation == 0");
if (algorithm == 0) G4Exception("G4DataSet::G4DataSet",
"pii00000110",
FatalException,
"Interpolation == 0");
if ((energies == 0) ^ (data == 0))
G4Exception("G4DataSet::G4DataSet - different size for energies and data (zero case)");
G4Exception("G4DataSet::G4DataSet",
"pii00000111-",
FatalException,
"different size for energies and data (zero case)");
if (energies == 0) return;
if (energies->size() != data->size())
G4Exception("G4DataSet::G4DataSet - different size for energies and data");
G4Exception("G4DataSet::G4DataSet",
"pii00000112",
FatalException,
"different size for energies and data");
if (randomSet) BuildPdf();
}
@@ -102,7 +114,10 @@ G4DataSet::~G4DataSet()
G4double G4DataSet::FindValue(G4double energy, G4int /* componentId */) const
{
if (!energies) G4Exception("G4DataSet::FindValue - energies == 0");
if (!energies) G4Exception("G4DataSet::FindValue",
"pii00000120",
FatalException,
"energies == 0");
if (energies->empty()) return 0;
if (energy <= (*energies)[0]) return (*data)[0];
@@ -145,12 +160,18 @@ void G4DataSet::SetEnergiesData(G4DataVector* dataX,
data = dataY;
if ((energies == 0) ^ (data==0))
G4Exception("G4DataSet::SetEnergiesData - different size for energies and data (zero case)");
G4Exception("G4DataSet::SetEnergiesData",
"pii00000130",
FatalException,
"different size for energies and data (zero case)");
if (energies == 0) return;
if (energies->size() != data->size())
G4Exception("G4DataSet::SetEnergiesData - different size for energies and data");
G4Exception("G4DataSet::SetEnergiesData",
"pii00000131",
FatalException,
"different size for energies and data");
}
G4bool G4DataSet::LoadData(const G4String& fileName)
@@ -166,10 +187,14 @@ G4bool G4DataSet::LoadData(const G4String& fileName)
if (!in.is_open())
{
G4String message("G4DataSet::LoadData - data file \"");
message += fullFileName;
message += "\" not found";
G4Exception(message);
std::ostringstream message;
message << "G4DataSet::LoadData - data file " << fullFileName << " not found";
G4Exception("G4CompositeDataSet::LoadData",
"pii00000140",
FatalException,
message.str().c_str());
}
G4DataVector* argEnergies=new G4DataVector;
@@ -215,10 +240,15 @@ G4bool G4DataSet::SaveData(const G4String& name) const
if (!out.is_open())
{
G4String message("G4DataSet::SaveData - cannot open \"");
message+=fullFileName;
message+="\"";
G4Exception(message);
std::ostringstream message;
message << "G4DataSet:: SaveData - cannot open " << fullFileName;
G4Exception("G4CompositeDataSet::SaveData",
"pii00000150",
FatalException,
message.str().c_str());
}
out.precision(10);
@@ -309,7 +339,10 @@ G4String G4DataSet::FullFileName(const G4String& name) const
{
char* path = getenv("G4PIIDATA");
if (!path)
G4Exception("G4DataSet::FullFileName - G4PIIDATA environment variable not set");
G4Exception("G4DataSet::FullFileName",
"pii00000160",
FatalException,
"G4PIIDATA environment variable not set");
std::ostringstream fullFileName;
fullFileName << path << '/' << name << z << ".dat";
@@ -353,7 +386,10 @@ G4double G4DataSet::RandomSelect(G4int /* componentId */) const
// Random select a X value according to the cumulative probability distribution
// derived from the data
if (!pdf) G4Exception("G4DataSet::RandomSelect - PDF has not been created for this data set");
if (!pdf) G4Exception("G4DataSet::RandomSelect",
"pii00000170",
FatalException,
"PDF has not been created for this data set");
G4double value = 0.;
G4double x = G4UniformRand();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LinInterpolator.cc,v 1.2 2010/11/19 17:16:21 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4LinInterpolator.cc,v 1.2 2010-11-19 17:16:21 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LogLogInterpolator.cc,v 1.2 2010/11/19 17:16:21 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4LogLogInterpolator.cc,v 1.2 2010-11-19 17:16:21 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -57,19 +57,28 @@ G4double G4LogLogInterpolator::Calculate(G4double x, G4int bin,
const G4DataVector& data) const
{
G4int nBins = data.size() - 1;
// ---- MGP ---- To be verified; value = 0. is redundant here
G4double value = 0.;
if (x < points[0])
if (x < points[0] || x == 0.)
{
value = 0.;
value = 0;
}
else if (bin < nBins)
{
G4double e1 = points[bin];
G4double e2 = points[bin+1];
G4double d1 = data[bin];
G4double d1 = data[bin];
G4double d2 = data[bin+1];
value = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1);
value = std::pow(10.,value);
if (d1 != 0. && d2 != 0.)
{
value = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1);
value = std::pow(10.,value);
}
else
{
value = 0.;
}
}
else
{
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PixeCrossSectionHandler.cc,v 1.2 2010/11/19 17:16:21 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4PixeCrossSectionHandler.cc,v 1.2 2010-11-19 17:16:21 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -353,8 +353,11 @@ G4double G4PixeCrossSectionHandler::ValueForMaterial(const G4Material* material,
crossSections = BuildCrossSectionsForMaterials(energyVector);
if (crossSections == 0)
G4Exception("G4PixeCrossSectionHandler::BuildMeanFreePathForMaterials, crossSections = 0");
G4Exception("G4PixeCrossSectionHandler::BuildMeanFreePathForMaterials",
"pii00000201",
FatalException,
"crossSections = 0");
G4IInterpolator* algo = CreateInterpolation();
G4IDataSet* materialSet = new G4CompositeDataSet(algo);
@@ -433,7 +436,10 @@ void G4PixeCrossSectionHandler::BuildForMaterials()
crossSections = BuildCrossSectionsForMaterials(energyVector);
if (crossSections == 0)
G4Exception("G4PixeCrossSectionHandler::BuildForMaterials, crossSections = 0");
G4Exception("G4PixeCrossSectionHandler::BuildForMaterials",
"pii00000210",
FatalException,
", crossSections = 0");
return;
}
@@ -571,7 +577,10 @@ void G4PixeCrossSectionHandler::ActiveElements()
{
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
if (materialTable == 0)
G4Exception("G4PixeCrossSectionHandler::ActiveElements - no MaterialTable found)");
G4Exception("G4PixeCrossSectionHandler::ActiveElements",
"pii00000220",
FatalException,
"no MaterialTable found");
G4int nMaterials = G4Material::GetNumberOfMaterials();
@@ -636,7 +645,10 @@ G4PixeCrossSectionHandler::BuildCrossSectionsForMaterials(const G4DataVector& en
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
if (materialTable == 0)
G4Exception("G4PixeCrossSectionHandler - no MaterialTable found)");
G4Exception("G4PixeCrossSectionHandler::BuildCrossSectionsForMaterials",
"pii00000230",
FatalException,
"no MaterialTable found");
G4int nMaterials = G4Material::GetNumberOfMaterials();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PixeShellDataSet.cc,v 1.3 2010/11/22 11:29:38 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4PixeShellDataSet.cc,v 1.3 2010-11-22 11:29:38 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
//
@@ -58,7 +58,10 @@ G4PixeShellDataSet::G4PixeShellDataSet(G4int zeta,
unitEnergies(eUnit),
unitData(dataUnit)
{
if (algorithm == 0) G4Exception("G4PixeShellDataSet::G4PixeShellDataSet - interpolation == 0");
if (algorithm == 0) G4Exception("G4PixeShellDataSet::G4PixeShellDataSet",
"pii00000301",
FatalException,
"interpolation == 0");
crossModel.push_back(modelK);
crossModel.push_back(modelL);
@@ -148,7 +151,10 @@ void G4PixeShellDataSet::SetEnergiesData(G4DataVector* energies,
std::ostringstream message;
message << "G4PixeShellDataSet::SetEnergiesData - component " << componentId << " not found";
G4Exception(message.str().c_str());
G4Exception("G4PixeShellDataSet::SetEnergiesData",
"pii000000310",
FatalException,
message.str().c_str());
}
@@ -199,7 +205,10 @@ G4String G4PixeShellDataSet::FullFileName(const G4String& file,
{
char* path = getenv("G4PIIDATA");
if (!path)
G4Exception("G4PixeShellDataSet::FullFileName - G4PIIDATA environment variable not set");
G4Exception("G4PixeShellDataSet::FullFileName",
"pii00000320",
FatalException,
"G4PIIDATA environment variable not set");
// Identify the shell this subshell belongs to
G4int shellIndex = TranslateShell(subShell);
@@ -28,8 +28,8 @@
// ------------------------------------------------------------
// G4RDHadronIonisation
//
// $Id: G4hImpactIonisation.cc,v 1.4 2010/11/25 19:49:43 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4hImpactIonisation.cc,v 1.4 2010-11-25 19:49:43 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Author: Maria Grazia Pia (MariaGrazia.Pia@ge.infn.it)
//
@@ -346,21 +346,21 @@ void G4hImpactIonisation::BuildPhysicsTable(const G4ParticleDefinition& particle
// --------------------------------------------------------------------
void G4hImpactIonisation::BuildLossTable(const G4ParticleDefinition& particleDef)
{
// Initialisation
G4double lowEdgeEnergy , ionloss, ionlossBB, paramB ;
G4double lowEnergy, highEnergy;
//G4double lowEnergy, highEnergy;
G4double highEnergy;
G4Proton* proton = G4Proton::Proton();
if (particleDef == *proton)
{
lowEnergy = protonLowEnergy ;
//lowEnergy = protonLowEnergy ;
highEnergy = protonHighEnergy ;
charge = 1. ;
}
else
{
lowEnergy = antiprotonLowEnergy ;
//lowEnergy = antiprotonLowEnergy ;
highEnergy = antiprotonHighEnergy ;
charge = -1. ;
}
@@ -1368,14 +1368,14 @@ G4double G4hImpactIonisation::BarkasTerm(const G4Material* material,
if(0.0 >= beta2) return 0.0;
G4double BarkasTerm = 0.0;
G4double AMaterial = 0.0;
//G4double AMaterial = 0.0;
G4double ZMaterial = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
AMaterial = (*theElementVector)[i]->GetA()*mole/g;
//AMaterial = (*theElementVector)[i]->GetA()*mole/g;
ZMaterial = (*theElementVector)[i]->GetZ();
G4double X = 137.0 * 137.0 * beta2 / ZMaterial;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4hRDEnergyLoss.cc,v 1.3 2010/11/25 19:49:43 pia Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4hRDEnergyLoss.cc,v 1.3 2010-11-25 19:49:43 pia Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -----------------------------------------------------------
// GEANT 4 class implementation file
@@ -59,6 +59,9 @@
// 25 Nov 2010 MGP Added some protections for FPE (mostly division by 0)
// The whole energy loss domain would profit from a design iteration
// 20 Jun 2011 MGP Corrected some compilation warnings. The whole class will be heavily refactored anyway.
// --------------------------------------------------------------
#include "G4hRDEnergyLoss.hh"
@@ -66,7 +69,6 @@
#include "G4Poisson.hh"
#include "G4ProductionCutsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Initialisation of static members ******************************************
// contributing processes : ion.loss ->NumberOfProcesses is initialized
@@ -511,7 +513,8 @@ void G4hRDEnergyLoss::BuildLabTimeVector(G4int materialIndex,
G4int nbin=100;
G4bool isOut;
G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
G4double losslim,clim,taulim,timelim,ltaulim,ltaumax,
//G4double losslim,clim,taulim,timelim,ltaulim,ltaumax,
G4double losslim,clim,taulim,timelim,
LowEdgeEnergy,tau,Value ;
G4PhysicsVector* physicsVector= (*theDEDXTable)[materialIndex];
@@ -520,8 +523,8 @@ void G4hRDEnergyLoss::BuildLabTimeVector(G4int materialIndex,
losslim = physicsVector->GetValue(tlim,isOut);
taulim=tlim/ParticleMass ;
clim=std::sqrt(ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
ltaulim = std::log(taulim);
ltaumax = std::log(HighestKineticEnergy/ParticleMass) ;
//ltaulim = std::log(taulim);
//ltaumax = std::log(HighestKineticEnergy/ParticleMass) ;
G4int i=-1;
G4double oldValue = 0. ;
@@ -570,7 +573,8 @@ void G4hRDEnergyLoss::BuildProperTimeVector(G4int materialIndex,
G4int nbin=100;
G4bool isOut;
G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
G4double losslim,clim,taulim,timelim,ltaulim,ltaumax,
//G4double losslim,clim,taulim,timelim,ltaulim,ltaumax,
G4double losslim,clim,taulim,timelim,
LowEdgeEnergy,tau,Value ;
G4PhysicsVector* physicsVector= (*theDEDXTable)[materialIndex];
@@ -579,8 +583,8 @@ void G4hRDEnergyLoss::BuildProperTimeVector(G4int materialIndex,
losslim = physicsVector->GetValue(tlim,isOut);
taulim=tlim/ParticleMass ;
clim=std::sqrt(ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
ltaulim = std::log(taulim);
ltaumax = std::log(HighestKineticEnergy/ParticleMass) ;
//ltaulim = std::log(taulim);
//ltaumax = std::log(HighestKineticEnergy/ParticleMass) ;
G4int i=-1;
G4double oldValue = 0. ;