Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4AtomicShells.cc,v 1.7 2006/10/17 15:15:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
+93 -112
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Element.cc,v 1.24 2006/10/17 15:15:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Element.cc,v 1.26 2007/10/18 11:14:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,6 +50,8 @@
// 30-03-05: warning in GetElement(elementName)
// 15-11-05: GetElement(elementName, G4bool warning=true)
// 17-10-06: Add fNaturalAbandances (V.Ivanchenko)
// 27-07-07, improve destructor (V.Ivanchenko)
// 18-10-07, move definition of material index to ComputeDerivedQuantities (V.Ivanchenko)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -66,44 +68,29 @@ G4Element::G4Element(const G4String& name, const G4String& symbol,
G4double zeff, G4double aeff)
: fName(name), fSymbol(symbol)
{
if (zeff<1.) G4Exception (" ERROR from G4Element::G4Element !"
" It is not allowed to create an Element with Z < 1" );
if (zeff<1.) G4Exception (" ERROR from G4Element::G4Element !"
" It is not allowed to create an Element with Z < 1" );
if (aeff/(g/mole)<zeff) G4Exception (" ERROR from G4Element::G4Element !"
" Attempt to create an Element with N < Z !!!" );
if (aeff/(g/mole)<zeff) G4Exception (" ERROR from G4Element::G4Element !"
" Attempt to create an Element with N < Z !!!" );
if ((zeff-G4int(zeff)) > perMillion)
G4cerr << name << " : WARNING from G4Element::G4Element !"
" Trying to define an element as a mixture directly via effective Z."
<< G4endl;
if ((zeff-G4int(zeff)) > perMillion)
G4cerr << name << " : WARNING from G4Element::G4Element !"
" Trying to define an element as a mixture directly via effective Z."
<< G4endl;
InitializePointers();
InitializePointers();
fZeff = zeff;
fNeff = aeff/(g/mole);
fAeff = aeff;
fNumberOfIsotopes = 0;
fNaturalAbandances = false;
fZeff = zeff;
fNeff = aeff/(g/mole);
fAeff = aeff;
fNbOfAtomicShells = G4AtomicShells::GetNumberOfShells((G4int)fZeff);
fAtomicShells = new G4double[fNbOfAtomicShells];
for (G4int i=0;i<fNbOfAtomicShells;i++)
fAtomicShells[i] = G4AtomicShells::GetBindingEnergy((G4int)fZeff,i);
fNbOfAtomicShells = G4AtomicShells::GetNumberOfShells((G4int)fZeff);
fAtomicShells = new G4double[fNbOfAtomicShells];
for (G4int i=0;i<fNbOfAtomicShells;i++)
fAtomicShells[i] = G4AtomicShells::GetBindingEnergy((G4int)fZeff,i);
ComputeDerivedQuantities();
// Store in ElementTable
theElementTable.push_back(this);
fIndexInTable = theElementTable.size() - 1;
// check if elements with same Z already exist
fIndexZ = 0;
for (size_t J=0 ; J<fIndexInTable ; J++)
if (theElementTable[J]->GetZ() == fZeff) fIndexZ++;
//nb of materials which use this element
fCountUse = 0;
ComputeDerivedQuantities();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -115,17 +102,12 @@ G4Element::G4Element(const G4String& name,
const G4String& symbol, G4int nIsotopes)
: fName(name),fSymbol(symbol)
{
InitializePointers();
InitializePointers();
size_t n = size_t(nIsotopes);
size_t n = size_t(nIsotopes);
fNumberOfIsotopes = 0;
fNaturalAbandances = false;
theIsotopeVector = new G4IsotopeVector(n,0);
fRelativeAbundanceVector = new G4double[nIsotopes];
fCountUse = 0; //nb of materials which use this element
theIsotopeVector = new G4IsotopeVector(n,0);
fRelativeAbundanceVector = new G4double[nIsotopes];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -134,66 +116,60 @@ G4Element::G4Element(const G4String& name,
void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
{
if (theIsotopeVector == 0)
G4Exception ("ERROR from G4Element::AddIsotope!"
" Trying to add an Isotope before contructing the element.");
if (theIsotopeVector == 0)
G4Exception ("ERROR from G4Element::AddIsotope!"
" Trying to add an Isotope before contructing the element.");
// filling ...
if ( fNumberOfIsotopes < theIsotopeVector->size() ) {
// check same Z
if (fNumberOfIsotopes==0) fZeff = G4double(isotope->GetZ());
else if (G4double(isotope->GetZ()) != fZeff)
G4Exception ("ERROR from G4Element::AddIsotope!"
" Try to add isotopes with different Z");
//Z ok
fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
(*theIsotopeVector)[fNumberOfIsotopes] = isotope;
++fNumberOfIsotopes;
isotope->increaseCountUse();
}
else G4Exception ("ERROR from G4Element::AddIsotope!"
" Attempt to add more than the declared number of isotopes.");
// filling ...
if ( fNumberOfIsotopes < theIsotopeVector->size() ) {
// check same Z
if (fNumberOfIsotopes==0) fZeff = G4double(isotope->GetZ());
else if (G4double(isotope->GetZ()) != fZeff)
G4Exception ("ERROR from G4Element::AddIsotope!"
" Try to add isotopes with different Z");
//Z ok
fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
(*theIsotopeVector)[fNumberOfIsotopes] = isotope;
++fNumberOfIsotopes;
isotope->increaseCountUse();
}
else G4Exception ("ERROR from G4Element::AddIsotope!"
" Attempt to add more than the declared number of isotopes.");
// filled.
if ( fNumberOfIsotopes == theIsotopeVector->size() ) {
// Compute Neff, Aeff
G4double wtSum=0.0;
// filled.
if ( fNumberOfIsotopes == theIsotopeVector->size() ) {
// Compute Neff, Aeff
G4double wtSum=0.0;
fNeff = fAeff = 0.0;
for (size_t i=0;i<fNumberOfIsotopes;i++) {
fNeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
fAeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
wtSum += fRelativeAbundanceVector[i];
}
fNeff /= wtSum;
fAeff /= wtSum;
fNeff = fAeff = 0.0;
for (size_t i=0;i<fNumberOfIsotopes;i++) {
fNeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
fAeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
wtSum += fRelativeAbundanceVector[i];
}
fNeff /= wtSum;
fAeff /= wtSum;
fNbOfAtomicShells = G4AtomicShells::GetNumberOfShells((G4int)fZeff);
fAtomicShells = new G4double[fNbOfAtomicShells];
for (G4int j=0;j<fNbOfAtomicShells;j++)
fAtomicShells[j] = G4AtomicShells::GetBindingEnergy((G4int)fZeff,j);
fNbOfAtomicShells = G4AtomicShells::GetNumberOfShells((G4int)fZeff);
fAtomicShells = new G4double[fNbOfAtomicShells];
for (G4int j=0;j<fNbOfAtomicShells;j++)
fAtomicShells[j] = G4AtomicShells::GetBindingEnergy((G4int)fZeff,j);
ComputeDerivedQuantities();
ComputeDerivedQuantities();
// Store in table
theElementTable.push_back(this);
fIndexInTable = theElementTable.size() - 1;
// check if elements with same Z already exist
fIndexZ = 0;
for (size_t J=0 ; J<fIndexInTable ; J++)
if (theElementTable[J]->GetZ() == fZeff) fIndexZ++;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Element::InitializePointers()
{
theIsotopeVector = 0;
fRelativeAbundanceVector = 0;
fAtomicShells = 0;
fIonisation = 0;
theIsotopeVector = 0;
fRelativeAbundanceVector = 0;
fAtomicShells = 0;
fIonisation = 0;
fNumberOfIsotopes = 0;
fNaturalAbandances = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -213,16 +189,9 @@ G4Element::G4Element( __void__& )
G4Element::~G4Element()
{
if (fCountUse != 0)
G4cout << "--> warning from ~G4Element(): the element " << fName
<< " is still referenced by " << fCountUse << " G4Materials \n"
<< G4endl;
if (theIsotopeVector)
{ for (size_t i=0; i<fNumberOfIsotopes; i++)
(*theIsotopeVector)[i]->decreaseCountUse();
delete theIsotopeVector;
}
// G4cout << "### Destruction of element " << fName << " started" <<G4endl;
if (theIsotopeVector) delete theIsotopeVector;
if (fRelativeAbundanceVector) delete [] fRelativeAbundanceVector;
if (fAtomicShells) delete [] fAtomicShells;
if (fIonisation) delete fIonisation;
@@ -237,13 +206,25 @@ void G4Element::ComputeDerivedQuantities()
{
// some basic functions of the atomic number
// Store in table
theElementTable.push_back(this);
fIndexInTable = theElementTable.size() - 1;
// check if elements with same Z already exist
fIndexZ = 0;
for (size_t J=0 ; J<fIndexInTable ; J++)
if (theElementTable[J]->GetZ() == fZeff) fIndexZ++;
//nb of materials which use this element
fCountUse = 0;
// Radiation Length
ComputeCoulombFactor();
ComputeLradTsaiFactor();
ComputeCoulombFactor();
ComputeLradTsaiFactor();
// parameters for energy loss by ionisation
if (fIonisation) delete fIonisation;
fIonisation = new G4IonisParamElm(fZeff);
if (fIonisation) delete fIonisation;
fIonisation = new G4IonisParamElm(fZeff);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -312,8 +293,8 @@ G4Element* G4Element::GetElement(G4String elementName, G4bool warning)
// search the element by its name
for (size_t J=0 ; J<theElementTable.size() ; J++)
{
if (theElementTable[J]->GetName() == elementName)
return theElementTable[J];
if (theElementTable[J]->GetName() == elementName)
return theElementTable[J];
}
// the element does not exist in the table
@@ -329,12 +310,12 @@ G4Element* G4Element::GetElement(G4String elementName, G4bool warning)
G4Element::G4Element(G4Element& right)
{
InitializePointers();
*this = right;
InitializePointers();
*this = right;
// Store this new element in table and set the index
theElementTable.push_back(this);
fIndexInTable = theElementTable.size() - 1;
// Store this new element in table and set the index
theElementTable.push_back(this);
fIndexInTable = theElementTable.size() - 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4IonisParamElm.cc,v 1.14 2006/06/29 19:12:43 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
+87 -11
View File
@@ -24,19 +24,20 @@
// ********************************************************************
//
//
// $Id: G4IonisParamMat.cc,v 1.18 2006/06/29 19:12:45 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4IonisParamMat.cc,v 1.20 2007/09/27 14:05:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
// 10-05-05, add a missing coma in FindMeanExcitationEnergy() - Bug#746 (mma)
// 06-09-04, factor 2 to shell correction term (V.Ivanchenko)
// 28-10-02, add setMeanExcitationEnergy (V.Ivanchenko)
// 08-02-01, fShellCorrectionVector correctly handled (mma)
// 16-01-01, bug corrected in ComputeDensityEffect() E100eV (L.Urban)
// 18-07-98, bug corrected in ComputeDensityEffect() for gas
// 09-07-98, data moved from G4Material, M.Maire
// 18-07-98, bug corrected in ComputeDensityEffect() for gas
// 16-01-01, bug corrected in ComputeDensityEffect() E100eV (L.Urban)
// 08-02-01, fShellCorrectionVector correctly handled (mma)
// 28-10-02, add setMeanExcitationEnergy (V.Ivanchenko)
// 06-09-04, factor 2 to shell correction term (V.Ivanchenko)
// 10-05-05, add a missing coma in FindMeanExcitationEnergy() - Bug#746 (mma)
// 27-09-07, add computation of parameters for ions (V.Ivanchenko)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -52,6 +53,7 @@ G4IonisParamMat::G4IonisParamMat(G4Material* material)
ComputeMeanParameters();
ComputeDensityEffect();
ComputeFluctModel();
ComputeIonParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -216,18 +218,92 @@ void G4IonisParamMat::ComputeFluctModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
void G4IonisParamMat::ComputeIonParameters()
{
// compute parameters for ion transport
// The aproximation from:
// J.F.Ziegler, J.P. Biersack, U. Littmark
// The Stopping and Range of Ions in Matter,
// Vol.1, Pergamon Press, 1985
// Fast ions or hadrons
static G4double vFermi[92] = {
1.0309, 0.15976, 0.59782, 1.0781, 1.0486, 1.0, 1.058, 0.93942, 0.74562, 0.3424,
0.45259, 0.71074, 0.90519, 0.97411, 0.97184, 0.89852, 0.70827, 0.39816, 0.36552, 0.62712,
0.81707, 0.9943, 1.1423, 1.2381, 1.1222, 0.92705, 1.0047, 1.2, 1.0661, 0.97411,
0.84912, 0.95, 1.0903, 1.0429, 0.49715, 0.37755, 0.35211, 0.57801, 0.77773, 1.0207,
1.029, 1.2542, 1.122, 1.1241, 1.0882, 1.2709, 1.2542, 0.90094, 0.74093, 0.86054,
0.93155, 1.0047, 0.55379, 0.43289, 0.32636, 0.5131, 0.695, 0.72591, 0.71202, 0.67413,
0.71418, 0.71453, 0.5911, 0.70263, 0.68049, 0.68203, 0.68121, 0.68532, 0.68715, 0.61884,
0.71801, 0.83048, 1.1222, 1.2381, 1.045, 1.0733, 1.0953, 1.2381, 1.2879, 0.78654,
0.66401, 0.84912, 0.88433, 0.80746, 0.43357, 0.41923, 0.43638, 0.51464, 0.73087, 0.81065,
1.9578, 1.0257} ;
static G4double lFactor[92] = {
1.0, 1.0, 1.1, 1.06, 1.01, 1.03, 1.04, 0.99, 0.95, 0.9,
0.82, 0.81, 0.83, 0.88, 1.0, 0.95, 0.97, 0.99, 0.98, 0.97,
0.98, 0.97, 0.96, 0.93, 0.91, 0.9, 0.88, 0.9, 0.9, 0.9,
0.9, 0.85, 0.9, 0.9, 0.91, 0.92, 0.9, 0.9, 0.9, 0.9,
0.9, 0.88, 0.9, 0.88, 0.88, 0.9, 0.9, 0.88, 0.9, 0.9,
0.9, 0.9, 0.96, 1.2, 0.9, 0.88, 0.88, 0.85, 0.9, 0.9,
0.92, 0.95, 0.99, 1.03, 1.05, 1.07, 1.08, 1.1, 1.08, 1.08,
1.08, 1.08, 1.09, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15,
1.17, 1.2, 1.18, 1.17, 1.17, 1.16, 1.16, 1.16, 1.16, 1.16,
1.16, 1.16} ;
// get elements in the actual material,
const G4ElementVector* theElementVector = fMaterial->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
fMaterial->GetAtomicNumDensityVector() ;
const G4int NumberOfElements = fMaterial->GetNumberOfElements() ;
// loop for the elements in the material
// to find out average values Z, vF, lF
G4double z = 0.0, vF = 0.0, lF = 0.0, norm = 0.0 ;
if( 1 == NumberOfElements ) {
z = fMaterial->GetZ() ;
G4int iz = G4int(z) - 1 ;
if(iz < 0) iz = 0 ;
else if(iz > 91) iz = 91 ;
vF = vFermi[iz] ;
lF = lFactor[iz] ;
} else {
for (G4int iel=0; iel<NumberOfElements; iel++)
{
const G4Element* element = (*theElementVector)[iel] ;
G4double z2 = element->GetZ() ;
const G4double weight = theAtomicNumDensityVector[iel] ;
norm += weight ;
z += z2 * weight ;
G4int iz = G4int(z2) - 1 ;
if(iz < 0) iz = 0 ;
else if(iz > 91) iz =91 ;
vF += vFermi[iz] * weight ;
lF += lFactor[iz] * weight ;
}
z /= norm ;
vF /= norm ;
lF /= norm ;
}
fZeff = z;
fLfactor = lF;
fFermiEnergy = 25.*keV*vF*vF;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
void G4IonisParamMat::SetMeanExcitationEnergy(G4double value)
{
if(value == fMeanExcitationEnergy || value <= 0.0) return;
if (fMeanExcitationEnergy > 0.0 &&
G4NistManager::Instance()->GetVerbose() > 0) {
if (G4NistManager::Instance()->GetVerbose() > 0)
G4cout << "G4Material: Mean excitation energy is changed for "
<< fMaterial->GetName()
<< " Iold= " << fMeanExcitationEnergy/eV
<< "eV; Inew= " << value/eV << " eV;"
<< G4endl;
}
fMeanExcitationEnergy = value;
fLogMeanExcEnergy = std::log(value);
+4 -3
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Isotope.cc,v 1.20 2006/10/17 15:15:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Isotope.cc,v 1.21 2007/10/18 11:14:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -83,11 +83,12 @@ G4Isotope::G4Isotope(__void__&)
G4Isotope::~G4Isotope()
{
/*
if (fCountUse != 0)
G4cout << "--> warning from ~G4Isotope(): the isotope " << fName
<< " is still referenced by " << fCountUse << " G4Elements \n"
<< G4endl;
*/
//remove this isotope from theIsotopeTable
theIsotopeTable[fIndexInTable] = 0;
}
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4MPVEntry.cc,v 1.7 2006/06/29 19:12:49 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
////////////////////////////////////////////////////////////////////////
+40 -69
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Material.cc,v 1.35 2007/01/10 12:00:29 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Material.cc,v 1.38 2007/10/18 11:30:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
@@ -63,6 +63,9 @@
// 30-03-05, warning in GetMaterial(materialName)
// 09-03-06, minor change of printout (V.Ivanchenko)
// 10-01-07, compute fAtomVector in the case of mass fraction (V.Ivanchenko)
// 27-07-07, improve destructor (V.Ivanchenko)
// 18-10-07, move definition of material index to InitialisePointers (V.Ivanchenko)
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -118,10 +121,6 @@ G4Material::G4Material(const G4String& name, G4double z,
}
ComputeDerivedQuantities();
// Store in the table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -159,8 +158,8 @@ G4Material::G4Material(const G4String& name, G4double density,
if (fState == kStateUndefined)
{
if (fDensity > kGasThreshold) fState = kStateSolid;
else fState = kStateGas;
if (fDensity > kGasThreshold) fState = kStateSolid;
else fState = kStateGas;
}
}
@@ -215,10 +214,6 @@ void G4Material::AddElement(G4Element* element, G4int nAtoms)
}
ComputeDerivedQuantities();
// Store in the static Table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
}
@@ -228,14 +223,6 @@ void G4Material::AddElement(G4Element* element, G4int nAtoms)
void G4Material::AddElement(G4Element* element, G4double fraction)
{
// if fAtomsVector is non-NULL, complain. Apples and oranges. $$$
/*
if (fAtomsVector) {
G4cerr << "This material is already being defined via elements by"
<< "atoms." << G4endl;
G4Exception ("You are mixing apples and oranges ...");
}
*/
// initialization
if (fNumberOfComponents == 0) {
fMassFractionVector = new G4double[50];
@@ -283,10 +270,6 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
}
ComputeDerivedQuantities();
// Store in the static Table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
}
@@ -296,14 +279,6 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
void G4Material::AddMaterial(G4Material* material, G4double fraction)
{
/*
// if fAtomsVector is non-NULL, complain. Apples and oranges. $$$
if (fAtomsVector) {
G4cerr << "This material is already being defined via elements by"
"atoms." << G4endl;
G4Exception ("You are mixing apples and oranges ...");
}
*/
// initialization
if (fNumberOfComponents == 0) {
fMassFractionVector = new G4double[50];
@@ -356,10 +331,6 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
}
ComputeDerivedQuantities();
// Store in the static Table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
}
@@ -422,14 +393,18 @@ void G4Material::ComputeNuclearInterLength()
void G4Material::InitializePointers()
{
theElementVector = 0;
fMassFractionVector = 0;
fAtomsVector = 0;
fMaterialPropertiesTable = 0;
theElementVector = 0;
fMassFractionVector = 0;
fAtomsVector = 0;
fMaterialPropertiesTable = 0;
VecNbOfAtomsPerVolume = 0;
fIonisation = 0;
fSandiaTable = 0;
VecNbOfAtomsPerVolume = 0;
fIonisation = 0;
fSandiaTable = 0;
// Store in the static Table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -470,22 +445,15 @@ G4Material* G4Material::GetMaterial(G4String materialName, G4bool warning)
G4Material::G4Material(const G4Material& right)
{
InitializePointers();
*this = right;
// Store this new material in the table of Materials
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
InitializePointers();
*this = right;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material::~G4Material()
{
for (size_t i=0; i<fNumberOfElements; i++)
(*theElementVector)[i]->decreaseCountUse();
if (fImplicitElement) delete ((*theElementVector)[0]);
// G4cout << "### Destruction of material " << fName << " started" <<G4endl;
if (theElementVector) delete theElementVector;
if (fMassFractionVector) delete [] fMassFractionVector;
if (fAtomsVector) delete [] fAtomsVector;
@@ -546,7 +514,7 @@ const G4Material& G4Material::operator=(const G4Material& right)
fMaterialPropertiesTable = right.fMaterialPropertiesTable;
ComputeDerivedQuantities();
}
}
return *this;
}
@@ -577,23 +545,26 @@ std::ostream& operator<<(std::ostream& flux, G4Material* material)
<< " Material: " << std::setw(8) << material->fName
<< " " << material->fChemicalFormula << " "
<< " density: " << std::setw(6) << std::setprecision(3)
<< G4BestUnit(material->fDensity,"Volumic Mass")
<< " temperature: " << std::setw(6) << std::setprecision(2)
<< (material->fTemp)/kelvin << " K"
<< " pressure: " << std::setw(6) << std::setprecision(2)
<< (material->fPressure)/atmosphere << " atm"
<< " RadLength: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->fRadlen,"Length");
<< G4BestUnit(material->fDensity,"Volumic Mass")
<< " RadL: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->fRadlen,"Length")
<< " Imean: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->GetIonisation()->GetMeanExcitationEnergy(),"Energy");
if(material->fState == kStateGas)
flux
<< " temperature: " << std::setw(6) << std::setprecision(2)
<< (material->fTemp)/kelvin << " K"
<< " pressure: " << std::setw(6) << std::setprecision(2)
<< (material->fPressure)/atmosphere << " atm";
for (size_t i=0; i<material->fNumberOfElements; i++)
flux
<< "\n ---> " << (*(material->theElementVector))[i]
<< " ElmMassFraction: " << std::setw(6)<< std::setprecision(2)
<< (material->fMassFractionVector[i])/perCent << " %"
<< " ElmAbundance " << std::setw(6)<< std::setprecision(2)
<< 100*(material->VecNbOfAtomsPerVolume[i])/
(material->TotNbOfAtomsPerVolume)
<< " %";
flux
<< "\n ---> " << (*(material->theElementVector))[i]
<< " ElmMassFraction: " << std::setw(6)<< std::setprecision(2)
<< (material->fMassFractionVector[i])/perCent << " %"
<< " ElmAbundance " << std::setw(6)<< std::setprecision(2)
<< 100*(material->VecNbOfAtomsPerVolume[i])/(material->TotNbOfAtomsPerVolume)
<< " %";
flux.precision(prec);
flux.setf(mode,std::ios::floatfield);
@@ -25,7 +25,7 @@
//
//
// $Id: G4MaterialPropertiesTable.cc,v 1.19 2007/04/25 15:46:55 gum Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
////////////////////////////////////////////////////////////////////////
@@ -25,7 +25,7 @@
//
//
// $Id: G4MaterialPropertyVector.cc,v 1.15 2006/06/29 19:12:56 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
////////////////////////////////////////////////////////////////////////
+17 -19
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NistElementBuilder.cc,v 1.14 2007/06/14 14:24:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4NistElementBuilder.cc,v 1.16 2007/07/28 15:58:03 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -41,7 +41,9 @@
// 11.05.2006 Do not subtract mass of atomic electrons from NIST mass (VI)
// 17.10.2006 Add natiral abandances flag to element and
// use G4 units for isotope mass vector (VI)
// 10.01.2006 Add protection agains Z>101 (VI)
// 10.05.2007 Add protection agains Z>101 (VI)
// 26.07.2007 Create one and only one Nist element with given Z and
// allow users to create there own elements with the same Z (VI)
//
// -------------------------------------------------------------------
//
@@ -64,6 +66,7 @@ G4NistElementBuilder::G4NistElementBuilder(G4int vb):
Initialise();
// Atomic shells are defined only for 101 elements
limitNumElements = 101;
for(G4int i=0; i<maxNumElements; i++) {elmIndex[i] = -1;}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -95,24 +98,18 @@ G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb,
G4Element* G4NistElementBuilder::FindOrBuildElement(G4int Z,
G4bool buildIsotopes)
{
// already existing in G4ElementTable ?
//
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t nelm = theElementTable->size();
G4Element* anElement = 0;
if (nelm>0) {
for(size_t i=0; i<nelm; i++) {
G4int iz = G4int(((*theElementTable)[i])->GetZ());
if (iz == Z) {
anElement = (*theElementTable)[i];
break;
}
}
}
// if not, build it
//
if (!anElement) anElement = BuildElement(Z, buildIsotopes);
// Nist element does exist
if(elmIndex[Z] >= 0) {
const G4ElementTable* theElementTable = G4Element::GetElementTable();
anElement = (*theElementTable)[elmIndex[Z]];
// build new element
} else {
anElement = BuildElement(Z, buildIsotopes);
if(anElement) elmIndex[Z] = anElement->GetIndex();
}
return anElement;
}
@@ -178,6 +175,7 @@ void G4NistElementBuilder::PrintElement(G4int Z)
imin = 1;
imax = maxNumElements;
}
if(imax > maxNumElements) imax = maxNumElements;
for(G4int i=imin; i<imax; i++) {
G4int nc = nIsotopes[i];
+68 -129
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NistManager.cc,v 1.9 2007/05/02 10:48:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4NistManager.cc,v 1.15 2007/12/11 13:32:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -41,6 +41,11 @@
// 27.02.06 V.Ivanchneko add ConstructNewGasMaterial
// 18.04.06 V.Ivanchneko add combined creation of materials (NIST + user)
// 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
// 26.07.07 V.Ivanchneko modify destructor to provide complete destruction
// of all elements and materials
// 27-07-07, improve destructor (V.Ivanchenko)
// 28.07.07 V.Ivanchneko make simple methods inline
// 28.07.07 V.Ivanchneko simplify Print methods
//
// -------------------------------------------------------------------
//
@@ -53,11 +58,12 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4NistManager.hh"
#include "G4NistMaterialBuilder.hh"
#include "G4NistMessenger.hh"
#include "G4Isotope.hh"
G4NistManager* G4NistManager::instance = 0;
G4double G4NistManager::POWERZ13[256] = {0};
G4double G4NistManager::LOGA[256] = {0};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -79,48 +85,46 @@ G4NistManager::G4NistManager()
verbose = 0;
elmBuilder = new G4NistElementBuilder(verbose);
matBuilder = new G4NistMaterialBuilder(this,elmBuilder,verbose);
matBuilder = new G4NistMaterialBuilder(elmBuilder,verbose);
messenger = new G4NistMessenger(this);
for(G4int i=1; i<256; i++) {
G4double x = G4double(i);
POWERZ13[i] = std::pow(x,1.0/3.0);
LOGA[i] = std::log(x);
}
POWERZ13[0] = 1.0;
LOGA[0] = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NistManager::~G4NistManager()
{
for (size_t i=0; i<nMaterials; i++) {
if( materials[i] ) delete materials[i];
// G4cout << "NistManager: start material destruction" << G4endl;
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t nmat = theMaterialTable->size();
size_t i;
for(i=0; i<nmat; i++) {
if((*theMaterialTable)[i]) delete (*theMaterialTable)[i];
}
for (size_t j=0; j<nElements; j++) {
if( elements[j] ) delete elements[j];
// G4cout << "NistManager: start element destruction" << G4endl;
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t nelm = theElementTable->size();
for(i=0; i<nelm; i++) {
if((*theElementTable)[i]) delete (*theElementTable)[i];
}
// G4cout << "NistManager: start isotope destruction" << G4endl;
const G4IsotopeTable* theIsotopeTable = G4Isotope::GetIsotopeTable();
size_t niso = theIsotopeTable->size();
for(i=0; i<niso; i++) {
if((*theIsotopeTable)[i]) delete (*theIsotopeTable)[i];
}
// G4cout << "NistManager: end isotope destruction" << G4endl;
delete messenger;
delete matBuilder;
delete elmBuilder;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::RegisterElement(G4Element* elm)
{
if(elm) {
elements.push_back(elm);
nElements++;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::DeRegisterElement(G4Element* elm)
{
for(size_t i=0; i<nElements; i++) {
if(elm == elements[i]) {
elements[i] = 0;
return;
}
}
delete elmBuilder;
// G4cout << "NistManager: end destruction" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -133,112 +137,32 @@ void G4NistManager::PrintElement(const G4String& symbol)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::PrintElement(G4int Z)
{
elmBuilder->PrintElement(Z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::PrintG4Element(const G4String& name)
{
for (size_t i=0; i<nElements; i++) {
if ((name==(elements[i])->GetName()) || (name==(elements[i])->GetSymbol())) {
G4cout << *(elements[i]) << G4endl;
return;
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t nelm = theElementTable->size();
for(size_t i=0; i<nelm; i++) {
G4Element* elm = (*theElementTable)[i];
if ( name == elm->GetName() || "all" == name) {
G4cout << *elm << G4endl;
return;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::RegisterMaterial(G4Material* mat)
{
if(mat) {
materials.push_back(mat);
nMaterials++;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::DeRegisterMaterial(G4Material* mat)
{
for (size_t i=0; i<nMaterials; i++) {
if (mat == materials[i]) { materials[i] = 0; return; }
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* G4NistManager::FindOrBuildMaterial(const G4String& name,
G4bool isotopes,
G4bool warning)
{
if (verbose>1) G4cout << "G4NistManager::FindMaterial " << name
<< G4endl;
// search the material in the list of user
G4Material* mat = G4Material::GetMaterial(name, warning);
if (!mat) mat = matBuilder->FindOrBuildMaterial(name, isotopes, warning);
return mat;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* G4NistManager::ConstructNewMaterial(
const G4String& name,
const std::vector<G4String>& elm,
const std::vector<G4int>& nbAtoms,
G4double dens, G4bool isotopes)
{
return matBuilder->ConstructNewMaterial(name,elm,nbAtoms,dens,isotopes);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* G4NistManager::ConstructNewMaterial(
const G4String& name,
const std::vector<G4String>& elm,
const std::vector<G4double>& w,
G4double dens, G4bool isotopes)
{
return matBuilder->ConstructNewMaterial(name,elm,w,dens,isotopes);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* G4NistManager::ConstructNewGasMaterial(
const G4String& name,
const G4String& nameNist,
G4double temp, G4double pres,
G4bool isotopes)
{
return matBuilder->ConstructNewGasMaterial(name,nameNist,
temp,pres,isotopes);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::ListMaterials(const G4String& list)
{
matBuilder->ListMaterials(list);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistManager::PrintG4Material(const G4String& name)
{
for (size_t i=0; i<nMaterials; i++) {
if (name == (materials[i])->GetName()) {
G4cout << *(materials[i]) << G4endl;
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t nmat = theMaterialTable->size();
for(size_t i=0; i<nmat; i++) {
G4Material* mat = (*theMaterialTable)[i];
if ( name == mat->GetName() || "all" == name) {
G4cout << *mat << G4endl;
return;
}
}
// search the material in the list of user
G4Material* mat = G4Material::GetMaterial(name, true);
if(mat) G4cout << *mat << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -252,9 +176,24 @@ void G4NistManager::SetVerbose(G4int val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::vector<G4String>& G4NistManager::GetNistMaterialNames() const
G4double G4NistManager::GetZ13(G4double Z)
{
return matBuilder->GetMaterialNames();
G4int iz = G4int(Z);
G4double x = (Z - G4double(iz))/(3.0*Z);
if(iz > 255) iz = 255;
else if(iz < 0) iz = 0;
return POWERZ13[iz]*(1.0 + x);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4NistManager::GetLOGA(G4double A)
{
G4int ia = G4int(A);
G4double x = (A - G4double(ia))/A;
if(ia > 255) ia = 255;
else if(ia < 0) ia = 0;
return LOGA[ia] + x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+97 -71
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NistMaterialBuilder.cc,v 1.15 2007/01/10 12:25:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4NistMaterialBuilder.cc,v 1.17 2007/10/28 18:10:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// -------------------------------------------------------------------
@@ -42,6 +42,7 @@
// 27.02.06 V.Ivanchneko add ConstructNewGasMaterial
// 11.05.06 V.Ivanchneko add warning flag to FindMaterial method
// 27.06.06 V.Ivanchneko fix graphite description
// 27.07.07 V.Ivanchneko remove dependence on NistManager
//
// -------------------------------------------------------------------
//
@@ -53,16 +54,13 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4NistManager.hh"
#include "G4NistMaterialBuilder.hh"
#include "G4NistElementBuilder.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NistMaterialBuilder::G4NistMaterialBuilder(G4NistManager* mm,
G4NistElementBuilder* eb, G4int vb)
: matManager(mm),
elmBuilder(eb),
G4NistMaterialBuilder::G4NistMaterialBuilder(G4NistElementBuilder* eb, G4int vb)
: elmBuilder(eb),
verbose(vb),
nMaterials(0),
nComponents(0),
@@ -93,35 +91,41 @@ G4Material* G4NistMaterialBuilder::FindOrBuildMaterial(const G4String& name,
if (verbose > 1)
G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial " << name << G4endl;
//already existing in NistMaterialManager ?
//
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int nmat = theMaterialTable->size();
// Check if name inside NIST DB?
G4Material* mat = 0;
size_t nm = 0;
if (matManager) nm = matManager->GetNumberOfMaterials();
if (nm > 0) {
for (size_t i=0; i<nm; i++) {
if(name == matManager->GetMaterial(i)->GetName()) {
mat = matManager->GetMaterial(i);
break;
for (G4int i=0; i<nMaterials; i++) {
// Is inside NIST DB?
if (name == names[i]) {
// Build new Nist material
if(matIndex[i] == -1) mat = BuildMaterial(i, isotopes);
// Nist material was already built
else mat = (*theMaterialTable)[matIndex[i]];
return mat;
}
}
// Check the list of all materials
if (nmat > 0) {
for (G4int i=0; i<nmat; i++) {
if(name == ((*theMaterialTable)[i])->GetName()) {
mat = (*theMaterialTable)[i];
return mat;
}
}
}
//if not, build it
//
if(!mat) mat = BuildMaterial(name, isotopes);
if (mat) {
if( verbose > 1)
G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial material "
<< name << " is available"
<< G4endl;
} else {
if( (verbose == 1 && warning) || verbose > 1)
G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial WARNING:"
<< " material <" << name
<< "> is not found out" << G4endl;
}
if( (verbose == 1 && warning) || verbose > 1)
G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial WARNING:"
<< " material <" << name
<< "> is not found out" << G4endl;
return mat;
}
@@ -140,34 +144,51 @@ G4Material* G4NistMaterialBuilder::BuildMaterial(const G4String& name,
for (G4int i=0; i<nMaterials; i++) {
if (name == names[i]) {
G4int nc = components[i];
mat = new G4Material(names[i],densities[i],nc,
states[i],temperatures[i], presures[i]);
if (verbose>1) G4cout << "New material nComponents= " << nc << G4endl;
if (nc > 0) {
G4int idx = indexes[i];
for (G4int j=0; j<nc; j++) {
G4int Z = elements[idx+j];
G4Element* elm = elmBuilder->FindOrBuildElement(Z, isotopes);
mat->AddElement(elm,fractions[idx+j]);
}
}
if (chFormulas[i] != "") {
mat->SetChemicalFormula(chFormulas[i]);
G4double exc = mat->GetIonisation()
->FindMeanExcitationEnergy(chFormulas[i]);
mat->GetIonisation()->SetMeanExcitationEnergy(exc);
}
if (ionPotentials[i] != 0.0)
mat->GetIonisation()->SetMeanExcitationEnergy(ionPotentials[i]);
if (matManager) matManager->RegisterMaterial(mat);
mat = BuildMaterial(i, isotopes);
break;
}
}
}
return mat;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* G4NistMaterialBuilder::BuildMaterial(G4int i,
G4bool isotopes)
{
if (verbose > 1) G4cout << "G4NistMaterialBuilder: BuildMaterial #" << i
<< G4endl;
G4Material* mat = 0;
if (nMaterials == 0) return mat;
G4int nc = components[i];
mat = new G4Material(names[i],densities[i],nc,
states[i],temperatures[i], presures[i]);
if (verbose>1) G4cout << "New material nComponents= " << nc << G4endl;
if (nc > 0) {
G4int idx = indexes[i];
for (G4int j=0; j<nc; j++) {
G4int Z = elements[idx+j];
G4Element* elm = elmBuilder->FindOrBuildElement(Z, isotopes);
mat->AddElement(elm,fractions[idx+j]);
}
}
if (chFormulas[i] != "") {
mat->SetChemicalFormula(chFormulas[i]);
G4double exc =
mat->GetIonisation()->FindMeanExcitationEnergy(chFormulas[i]);
mat->GetIonisation()->SetMeanExcitationEnergy(exc);
}
if (ionPotentials[i] != 0.0)
mat->GetIonisation()->SetMeanExcitationEnergy(ionPotentials[i]);
matIndex[i] = mat->GetIndex();
return mat;
}
@@ -177,7 +198,11 @@ G4Material* G4NistMaterialBuilder::ConstructNewMaterial(
const G4String& name,
const std::vector<G4String>& elm,
const std::vector<G4int>& nbAtoms,
G4double dens, G4bool isotopes)
G4double dens,
G4bool isotopes,
G4State state,
G4double temp,
G4double pressure)
{
G4int Z;
G4int nm = elm.size();
@@ -186,7 +211,7 @@ G4Material* G4NistMaterialBuilder::ConstructNewMaterial(
AddMaterial(name,dens,Z);
}
else if (nm > 1) {
AddMaterial(name,dens,0,0.0,nm);
AddMaterial(name,dens,0,0.0,nm,state,temp,pressure);
for (G4int i=0; i<nm; i++) {
Z = G4int((elmBuilder->FindOrBuildElement(elm[i]))->GetZ());
AddElementByAtomCount(Z, nbAtoms[i]);
@@ -202,7 +227,11 @@ G4Material* G4NistMaterialBuilder::ConstructNewMaterial(
const G4String& name,
const std::vector<G4String>& elm,
const std::vector<G4double>& w,
G4double dens, G4bool isotopes)
G4double dens,
G4bool isotopes,
G4State state,
G4double temp,
G4double pressure)
{
G4int Z;
G4int nm = elm.size();
@@ -217,7 +246,7 @@ G4Material* G4NistMaterialBuilder::ConstructNewMaterial(
AddMaterial(name,dens,Z);
} else {
AddMaterial(name,dens,0,0.0,nm);
AddMaterial(name,dens,0,0.0,nm,state,temp,pressure);
for (G4int i=0; i<nm; i++) {
Z = G4int((elmBuilder->FindOrBuildElement(elm[i]))->GetZ());
AddElementByWeightFraction(Z, w[i]);
@@ -232,7 +261,8 @@ G4Material* G4NistMaterialBuilder::ConstructNewMaterial(
G4Material* G4NistMaterialBuilder::ConstructNewGasMaterial(
const G4String& name,
const G4String& nameNist,
G4double temp, G4double pres,
G4double temp,
G4double pres,
G4bool isotopes)
{
G4int idx = -1;
@@ -287,15 +317,16 @@ G4Material* G4NistMaterialBuilder::ConstructNewGasMaterial(
if (chFormulas[idx] != "") {
mat->SetChemicalFormula(chFormulas[idx]);
G4double exc = mat->GetIonisation()
->FindMeanExcitationEnergy(chFormulas[idx]);
G4double exc =
mat->GetIonisation()->FindMeanExcitationEnergy(chFormulas[idx]);
mat->GetIonisation()->SetMeanExcitationEnergy(exc);
}
if (ionPotentials[idx] != 0.0)
mat->GetIonisation()->SetMeanExcitationEnergy(ionPotentials[idx]);
if (matManager) matManager->RegisterMaterial(mat);
matIndex[idx] = mat->GetIndex();
return mat;
}
@@ -412,6 +443,7 @@ void G4NistMaterialBuilder::AddMaterial(const G4String& nameMat, G4double dens,
indexes.push_back(nComponents);
temperatures.push_back(temp);
presures.push_back(pres);
matIndex.push_back(-1);
if (ncomp == 1) {
elements.push_back(Z);
@@ -545,12 +577,6 @@ void G4NistMaterialBuilder::Initialise()
if (verbose > 0)
G4cout << "### G4NistMaterialBuilder::Initialise()" << G4endl;
if (!matManager) {
G4cout << "G4NistMaterialBuilder::Initialise(): Warning : "
<< "G4NistManager do not exist" << G4endl;
///exit(1);
}
NistSimpleMaterials();
NistCompoundMaterials();
HepAndNuclearMaterials();
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4NistMessenger.cc,v 1.4 2007/05/02 10:48:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// File name: G4NistMessenger
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpticalSurface.cc,v 1.10 2006/06/29 19:13:08 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
////////////////////////////////////////////////////////////////////////
+319 -193
View File
@@ -24,20 +24,20 @@
// ********************************************************************
//
//
// $Id: G4SandiaTable.cc,v 1.27 2007/06/20 09:21:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4SandiaTable.cc,v 1.34 2007/10/02 10:13:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//
// 05.03.04 New methods for old sorting algorithm for PAI model. V.Grichine
// 03.02.04 Update distructor V.Ivanchenko
// 10.07.01 Migration to STL. M. Verderi.
// 03.04.01 fnulcof returned if energy < emin
// 22.02.01 GetsandiaCofForMaterial(energy) return 0 below lowest interval mma
// 16.02.01 adapted for STL. mma
// 31.01.01 redesign of ComputeMatSandiaMatrix(). mma
// 18.11.98 simplified public interface; new methods for materials. mma
// 10.06.97 created. V. Grichine
// 18.11.98 simplified public interface; new methods for materials. mma
// 31.01.01 redesign of ComputeMatSandiaMatrix(). mma
// 16.02.01 adapted for STL. mma
// 22.02.01 GetsandiaCofForMaterial(energy) return 0 below lowest interval mma
// 03.04.01 fnulcof returned if energy < emin
// 10.07.01 Migration to STL. M. Verderi.
// 03.02.04 Update distructor V.Ivanchenko
// 05.03.04 New methods for old sorting algorithm for PAI model. V.Grichine
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -49,40 +49,25 @@
G4int G4SandiaTable::fCumulInterval[101];
G4double G4SandiaTable::fSandiaCofPerAtom[4];
G4double const G4SandiaTable::funitc[4] = {cm2*keV/g,
cm2*keV*keV/g,
cm2*keV*keV*keV/g,
cm2*keV*keV*keV*keV/g};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4SandiaTable::G4SandiaTable(G4int matIndex)
{
fMatSandiaMatrix = 0 ;
fPhotoAbsorptionCof = 0 ;
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t numberOfMat = G4Material::GetNumberOfMaterials();
if ( matIndex >= 0 && matIndex < G4int(numberOfMat) )
{
fMaterial = (*theMaterialTable)[matIndex];
}
else
{
G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex): wrong matIndex ");
}
ComputeMatTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4SandiaTable::G4SandiaTable(G4Material* material)
: fMaterial(material)
{
fMatSandiaMatrix = 0 ;
fPhotoAbsorptionCof = 0 ;
fMatSandiaMatrix = 0;
fMatSandiaMatrixPAI = 0;
fPhotoAbsorptionCof = 0;
//build the CumulInterval array
fCumulInterval[0] = 1;
for (G4int Z=1; Z<101; Z++)
fCumulInterval[Z] = fCumulInterval[Z-1] + fNbOfIntervals[Z];
for (G4int Z=1; Z<101; Z++) {
fCumulInterval[Z] = fCumulInterval[Z-1] + fNbOfIntervals[Z];
}
//compute macroscopic Sandia coefs for a material
ComputeMatSandiaMatrix();
@@ -105,16 +90,59 @@ G4SandiaTable::G4SandiaTable(__void__&)
G4SandiaTable::~G4SandiaTable()
{
if(fMatSandiaMatrix) {
// fMatSandiaMatrix->clearAndDestroy();
fMatSandiaMatrix->clearAndDestroy();
delete fMatSandiaMatrix;
}
if(fMatSandiaMatrixPAI) {
fMatSandiaMatrixPAI->clearAndDestroy();
delete fMatSandiaMatrixPAI;
}
if(fPhotoAbsorptionCof)
{
// for(G4int i = 0 ; i < fMaxInterval ; i++) delete[] fPhotoAbsorptionCof[i];
delete [] fPhotoAbsorptionCof ;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4double G4SandiaTable::GetZtoA(G4int Z)
{
return fZtoAratio[Z];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4double*
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4double energy)
{
assert (Z > 0 && Z < 101);
G4double Emin = fSandiaTable[fCumulInterval[Z-1]][0]*keV;
G4double Iopot = fIonizationPotentials[Z]*eV;
if (Iopot > Emin) Emin = Iopot;
G4int interval = fNbOfIntervals[Z] - 1;
G4int row = fCumulInterval[Z-1] + interval;
while ((interval>0) && (energy<fSandiaTable[row][0]*keV)) {
--interval;
row = fCumulInterval[Z-1] + interval;
}
if (energy >= Emin)
{
G4double AoverAvo = Z*amu/fZtoAratio[Z];
fSandiaCofPerAtom[0]=AoverAvo*funitc[0]*fSandiaTable[row][1];
fSandiaCofPerAtom[1]=AoverAvo*funitc[1]*fSandiaTable[row][2];
fSandiaCofPerAtom[2]=AoverAvo*funitc[2]*fSandiaTable[row][3];
fSandiaCofPerAtom[3]=AoverAvo*funitc[3]*fSandiaTable[row][4];
}
else
{
fSandiaCofPerAtom[0] = fSandiaCofPerAtom[1] = fSandiaCofPerAtom[2] =
fSandiaCofPerAtom[3] = 0.;
}
return fSandiaCofPerAtom;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -131,10 +159,10 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
//
G4int MaxIntervals = 0;
G4int elm;
for (elm=0; elm<NbElm; elm++)
{ Z[elm] = (G4int)(*ElementVector)[elm]->GetZ();
MaxIntervals += fNbOfIntervals[Z[elm]];
}
for (elm=0; elm<NbElm; elm++) {
Z[elm] = (G4int)(*ElementVector)[elm]->GetZ();
MaxIntervals += fNbOfIntervals[Z[elm]];
}
//
//copy the Energy bins in a tmp1 array
@@ -143,13 +171,13 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
G4double* tmp1 = new G4double[MaxIntervals];
G4double IonizationPot;
G4int interval1=0;
for (elm=0; elm<NbElm; elm++)
{
IonizationPot = GetIonizationPot(Z[elm]);
for (G4int row=fCumulInterval[Z[elm]-1];row<fCumulInterval[Z[elm]];row++)
tmp1[interval1++] = std::max(fSandiaTable[row][0]*keV,IonizationPot);
}
for (elm=0; elm<NbElm; elm++) {
IonizationPot = GetIonizationPot(Z[elm]);
for (G4int row=fCumulInterval[Z[elm]-1];row<fCumulInterval[Z[elm]];row++) {
tmp1[interval1++] = std::max(fSandiaTable[row][0]*keV,IonizationPot);
}
}
//
//sort the energies in strickly increasing values in a tmp2 array
//(eliminate redondances)
@@ -159,22 +187,24 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
G4int interval2 = 0;
do {
Emin = DBL_MAX;
for (G4int i1=0; i1<MaxIntervals; i1++)
if (tmp1[i1] < Emin) Emin = tmp1[i1]; //find the minimum
if (Emin < DBL_MAX) tmp2[interval2++] = Emin; //copy Emin in tmp2
for (G4int j1=0; j1<MaxIntervals; j1++)
if (tmp1[j1] <= Emin) tmp1[j1] = DBL_MAX; //eliminate from tmp1
} while (Emin < DBL_MAX);
Emin = DBL_MAX;
for (G4int i1=0; i1<MaxIntervals; i1++) {
if (tmp1[i1] < Emin) Emin = tmp1[i1]; //find the minimum
}
if (Emin < DBL_MAX) tmp2[interval2++] = Emin; //copy Emin in tmp2
for (G4int j1=0; j1<MaxIntervals; j1++) {
if (tmp1[j1] <= Emin) tmp1[j1] = DBL_MAX; //eliminate from tmp1
}
} while (Emin < DBL_MAX);
//
//create the sandia matrix for this material
//
fMatSandiaMatrix = new G4OrderedTable();
G4int interval;
for (interval=0; interval<interval2; interval++)
fMatSandiaMatrix->push_back(new G4DataVector(5,0.));
for (interval=0; interval<interval2; interval++) {
fMatSandiaMatrix->push_back(new G4DataVector(5,0.));
}
//
//ready to compute the Sandia coefs for the material
//
@@ -184,26 +214,28 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
G4double coef, oldsum(0.), newsum(0.);
fMatNbOfIntervals = 0;
for (interval=0; interval<interval2; interval++)
{
Emin = (*(*fMatSandiaMatrix)[fMatNbOfIntervals])[0] = tmp2[interval];
for (G4int k=1; k<5; k++)(*(*fMatSandiaMatrix)[fMatNbOfIntervals])[k]=0.;
newsum = 0.;
for (interval=0; interval<interval2; interval++) {
Emin = (*(*fMatSandiaMatrix)[fMatNbOfIntervals])[0] = tmp2[interval];
for (G4int k=1; k<5; k++) {
(*(*fMatSandiaMatrix)[fMatNbOfIntervals])[k]=0.;
}
newsum = 0.;
for (elm=0; elm<NbElm; elm++)
{
GetSandiaCofPerAtom(Z[elm], Emin+prec);
for (G4int j=1; j<5; j++)
{
coef = NbOfAtomsPerVolume[elm]*fSandiaCofPerAtom[j-1];
(*(*fMatSandiaMatrix)[fMatNbOfIntervals])[j] += coef;
newsum += std::abs(coef);
}
}
for (elm=0; elm<NbElm; elm++) {
GetSandiaCofPerAtom(Z[elm], Emin+prec);
for (G4int j=1; j<5; j++) {
coef = NbOfAtomsPerVolume[elm]*fSandiaCofPerAtom[j-1];
(*(*fMatSandiaMatrix)[fMatNbOfIntervals])[j] += coef;
newsum += std::abs(coef);
}
}
//check for null or redondant intervals
if (newsum != oldsum) { oldsum = newsum; fMatNbOfIntervals++;}
}
//check for null or redondant intervals
if (newsum != oldsum) { oldsum = newsum; fMatNbOfIntervals++;}
}
delete [] Z;
delete [] tmp1;
delete [] tmp2;
@@ -211,21 +243,197 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4double G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j)
{
assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
return ((*(*fMatSandiaMatrix)[interval])[j]);
}
void G4SandiaTable::ComputeMatSandiaMatrixPAI()
{
G4int MaxIntervals = 0;
G4int elm, c, i, j, jj, k, k1, k2, c1, n1;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
const G4int noElm = fMaterial->GetNumberOfElements();
const G4ElementVector* ElementVector = fMaterial->GetElementVector();
G4int* Z = new G4int[noElm]; //Atomic number
G4double* G4SandiaTable::GetSandiaCofForMaterial(G4double energy)
{
if (energy < (*(*fMatSandiaMatrix)[0])[0]) return fnulcof;
for (elm = 0; elm<noElm; elm++)
{
Z[elm] = (G4int)(*ElementVector)[elm]->GetZ();
MaxIntervals += fNbOfIntervals[Z[elm]];
}
fMaxInterval = MaxIntervals + 2;
// G4cout<<"fMaxInterval = "<<fMaxInterval<<G4endl ;
G4double* fPhotoAbsorptionCof0 = new G4double[fMaxInterval];
G4double* fPhotoAbsorptionCof1 = new G4double[fMaxInterval];
G4double* fPhotoAbsorptionCof2 = new G4double[fMaxInterval];
G4double* fPhotoAbsorptionCof3 = new G4double[fMaxInterval];
G4double* fPhotoAbsorptionCof4 = new G4double[fMaxInterval];
for(c = 0 ; c<fMaxInterval ; c++) // just in case
{
fPhotoAbsorptionCof0[c] = 0. ;
fPhotoAbsorptionCof1[c] = 0. ;
fPhotoAbsorptionCof2[c] = 0. ;
fPhotoAbsorptionCof3[c] = 0. ;
fPhotoAbsorptionCof4[c] = 0. ;
}
c = 1 ;
for(i = 0 ; i < noElm ; i++)
{
G4double I1 = fIonizationPotentials[Z[i]]*keV ; // First ionization
n1 = 1 ; // potential in keV
for(j = 1 ; j < Z[i] ; j++)
{
n1 += fNbOfIntervals[j] ;
}
G4int n2 = n1 + fNbOfIntervals[Z[i]] ;
for(k1 = n1 ; k1 < n2 ; k1++)
{
if(I1 > fSandiaTable[k1][0])
{
continue ; // no ionization for energies smaller than I1 (first
} // ionisation potential)
break ;
}
G4int flag = 0 ;
for(c1 = 1 ; c1 < c ; c1++)
{
if(fPhotoAbsorptionCof0[c1] == I1) // this value already has existed
{
flag = 1 ;
break ;
}
}
if(flag == 0)
{
fPhotoAbsorptionCof0[c] = I1 ;
c++ ;
}
for(k2 = k1 ; k2 < n2 ; k2++)
{
flag = 0 ;
for(c1 = 1 ; c1 < c ; c1++)
{
if(fPhotoAbsorptionCof0[c1] == fSandiaTable[k2][0])
{
flag = 1 ;
break ;
}
}
if(flag == 0)
{
fPhotoAbsorptionCof0[c] = fSandiaTable[k2][0] ;
c++ ;
}
}
} // end for(i)
// sort out
for(i = 1; i < c ; i++ )
{
for(j = i + 1 ; j < c; j++ )
{
if(fPhotoAbsorptionCof0[i] > fPhotoAbsorptionCof0[j])
{
G4double tmp = fPhotoAbsorptionCof0[i];
fPhotoAbsorptionCof0[i] = fPhotoAbsorptionCof0[j];
fPhotoAbsorptionCof0[j] = tmp ;
}
}
}
fMaxInterval = c ;
const G4double* fractionW = fMaterial->GetFractionVector();
G4int interval = fMatNbOfIntervals - 1;
while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0])) interval--;
return &((*(*fMatSandiaMatrix)[interval])[1]);
for(i = 0 ; i < noElm; i++)
{
n1 = 1 ;
G4double I1 = fIonizationPotentials[Z[i]]*keV ;
for(j = 1 ; j < Z[i] ; j++)
{
n1 += fNbOfIntervals[j] ;
}
G4int n2 = n1 + fNbOfIntervals[Z[i]] - 1 ;
for(k = n1 ; k < n2 ; k++)
{
G4double B1 = fSandiaTable[k][0];
G4double B2 = fSandiaTable[k+1][0];
for(G4int c = 1 ; c < fMaxInterval-1 ; c++)
{
G4double E1 = fPhotoAbsorptionCof0[c];
G4double E2 = fPhotoAbsorptionCof0[c+1];
if(B1 > E1 || B2 < E2 || E1 < I1)
{
continue ;
}
fPhotoAbsorptionCof1[c] += fSandiaTable[k][1]*fractionW[i] ;
fPhotoAbsorptionCof2[c] += fSandiaTable[k][2]*fractionW[i] ;
fPhotoAbsorptionCof3[c] += fSandiaTable[k][3]*fractionW[i] ;
fPhotoAbsorptionCof4[c] += fSandiaTable[k][4]*fractionW[i] ;
}
}
// Last interval
fPhotoAbsorptionCof1[fMaxInterval-1] += fSandiaTable[k][1]*fractionW[i] ;
fPhotoAbsorptionCof2[fMaxInterval-1] += fSandiaTable[k][2]*fractionW[i] ;
fPhotoAbsorptionCof3[fMaxInterval-1] += fSandiaTable[k][3]*fractionW[i] ;
fPhotoAbsorptionCof4[fMaxInterval-1] += fSandiaTable[k][4]*fractionW[i] ;
} // for(i)
c = 0 ; // Deleting of first intervals where all coefficients = 0
do
{
c++ ;
if( fPhotoAbsorptionCof1[c] != 0.0 ||
fPhotoAbsorptionCof2[c] != 0.0 ||
fPhotoAbsorptionCof3[c] != 0.0 ||
fPhotoAbsorptionCof4[c] != 0.0 ) continue ;
for(jj = 2 ; jj < fMaxInterval ; jj++)
{
fPhotoAbsorptionCof0[jj-1] = fPhotoAbsorptionCof0[jj];
fPhotoAbsorptionCof1[jj-1] = fPhotoAbsorptionCof1[jj];
fPhotoAbsorptionCof2[jj-1] = fPhotoAbsorptionCof2[jj];
fPhotoAbsorptionCof3[jj-1] = fPhotoAbsorptionCof3[jj];
fPhotoAbsorptionCof4[jj-1] = fPhotoAbsorptionCof4[jj];
}
fMaxInterval-- ;
c-- ;
}
while(c < fMaxInterval - 1) ;
// create the sandia matrix for this material
fMatSandiaMatrixPAI = new G4OrderedTable();
G4double density = fMaterial->GetDensity();
for (i = 0; i < fMaxInterval; i++)
{
fMatSandiaMatrixPAI->push_back(new G4DataVector(5,0.));
}
for (i = 0; i < fMaxInterval; i++)
{
(*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1];
(*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1]*density;
(*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1]*density;
(*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1]*density;
(*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1]*density;
}
delete [] Z;
delete [] fPhotoAbsorptionCof0;
delete [] fPhotoAbsorptionCof1;
delete [] fPhotoAbsorptionCof2;
delete [] fPhotoAbsorptionCof3;
delete [] fPhotoAbsorptionCof4;
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -235,6 +443,27 @@ G4double* G4SandiaTable::GetSandiaCofForMaterial(G4double energy)
//
// Methods for PAI model
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4SandiaTable::G4SandiaTable(G4int matIndex)
{
fMatSandiaMatrix = 0 ;
fMatSandiaMatrixPAI = 0;
fPhotoAbsorptionCof = 0 ;
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t numberOfMat = G4Material::GetNumberOfMaterials();
if ( matIndex >= 0 && matIndex < G4int(numberOfMat) )
{
fMaterial = (*theMaterialTable)[matIndex];
}
else
{
G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex): wrong matIndex ");
}
ComputeMatTable();
}
///////////////////////////////////////////////////////////////////////
//
@@ -428,8 +657,6 @@ G4SandiaTable::SandiaMixing( G4int Z[],
return mi ;
}
////////////////////////////////////////////////////////////////////////////
//
// Sandia interval and mixing calculations for materialCutsCouple constructor
@@ -464,7 +691,6 @@ void G4SandiaTable::ComputeMatTable()
fPhotoAbsorptionCof[i] = new G4double[5] ;
}
// for(c = 0 ; c < fIntervalLimit ; c++) // just in case
for(c = 0 ; c < fMaxInterval ; c++) // just in case
@@ -530,16 +756,7 @@ void G4SandiaTable::ComputeMatTable()
SandiaSort(fPhotoAbsorptionCof,c) ;
fMaxInterval = c ;
// G4int
// G4SandiaTable::SandiaMixing( G4int Z[],
const G4double* fractionW = fMaterial->GetFractionVector();
// G4int el,
// G4int mi )
for(i = 0 ; i < fMaxInterval ; i++)
{
@@ -622,97 +839,6 @@ void G4SandiaTable::ComputeMatTable()
return ;
}
///////////////////////////////////////////////////////////////////////
//
// GetNbOfIntervals
//
G4int
G4SandiaTable::GetNbOfIntervals(G4int Z)
{
return fNbOfIntervals[Z];
}
///////////////////////////////////////////////////////////////////////
//
// GetSandiaCofPerAtom(Z, interval, index)
//
G4double
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j)
{
assert (Z>0 && Z<101 && interval>=0 && interval<fNbOfIntervals[Z]
&& j>=0 && j<5);
G4int row = fCumulInterval[Z-1] + interval;
if (j==0) return fSandiaTable[row][0]*keV;
G4double AoverAvo = Z*amu/fZtoAratio[Z];
return AoverAvo*(fSandiaTable[row][j]*cm2*std::pow(keV,G4double(j))/g);
}
///////////////////////////////////////////////////////////////////////
//
// GetSandiaCofPerAtom(Z, energy)
//
G4double*
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4double energy)
{
assert (Z > 0);
G4double Emin = fSandiaTable[fCumulInterval[Z-1]][0]*keV;
G4double Iopot = fIonizationPotentials[Z]*eV;
if (Iopot > Emin) Emin = Iopot;
G4int interval = fNbOfIntervals[Z] - 1;
G4int row = fCumulInterval[Z-1] + interval;
while ((interval>0) && (energy<fSandiaTable[row][0]*keV))
row = fCumulInterval[Z-1] + --interval;
if (energy >= Emin)
{
G4double AoverAvo = Z*amu/fZtoAratio[Z];
fSandiaCofPerAtom[0]=AoverAvo*(fSandiaTable[row][1]*cm2*keV/g);
fSandiaCofPerAtom[1]=AoverAvo*(fSandiaTable[row][2]*cm2*keV*keV/g);
fSandiaCofPerAtom[2]=AoverAvo*(fSandiaTable[row][3]*cm2*keV*keV*keV/g);
fSandiaCofPerAtom[3]=AoverAvo*(fSandiaTable[row][4]*cm2*keV*keV*keV*keV/g);
}
else
fSandiaCofPerAtom[0] = fSandiaCofPerAtom[1] = fSandiaCofPerAtom[2] =
fSandiaCofPerAtom[3] = 0.;
return fSandiaCofPerAtom;
}
///////////////////////////////////////////////////////////////////////
//
// GetIonizationPot
//
G4double
G4SandiaTable::GetIonizationPot(G4int Z)
{
return fIonizationPotentials[Z]*eV;
}
///////////////////////////////////////////////////////////////////////
//
// GetZtoA
//
G4double
G4SandiaTable::GetZtoA(G4int Z)
{
return fZtoAratio[Z];
}
// G4SandiaTable class -- end of implementation file
//
////////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4SurfaceProperty.cc,v 1.1 2007/04/25 16:19:26 gum Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
////////////////////////////////////////////////////////////////////////