Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AtomicShells.cc,v 1.2.4.1 2001/06/28 19:10:30 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4AtomicShells.cc,v 1.3 2001/07/11 10:01:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Element.cc,v 1.7.2.1 2001/06/28 19:10:30 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4Element.cc,v 1.14 2001/11/29 15:19:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// 26-06-96: Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
|
||||
// 09-07-96: new data members added by L.Urban
|
||||
@@ -40,16 +40,18 @@
|
||||
// 16-11-98: name Subshell -> Shell; GetBindingEnergy() (mma)
|
||||
// 09-03-01: assignement operator revised (mma)
|
||||
// 02-05-01: check identical Z in AddIsotope (marc)
|
||||
// 03-05-01, flux.precision(prec) at begin/end of operator<<
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
// 03-05-01; flux.precision(prec) at begin/end of operator<<
|
||||
// 13-09-01: suppression of the data member fIndexInTable
|
||||
// 14-09-01: fCountUse: nb of materials which use this element
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Element.hh"
|
||||
#include "g4std/iomanip"
|
||||
|
||||
G4ElementTable G4Element::theElementTable;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to Generate an element from scratch
|
||||
|
||||
@@ -83,13 +85,13 @@ G4Element::G4Element(const G4String& name, const G4String& symbol,
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in table and set the index
|
||||
theElementTable.insert(this);
|
||||
fIndexInTable = theElementTable.index(this);
|
||||
|
||||
// Store in ElementTable
|
||||
theElementTable.push_back(this);
|
||||
|
||||
fCountUse = 0; //nb of materials which use this element
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to Generate element from a List of 'nIsotopes' isotopes, added
|
||||
// via AddIsotope
|
||||
@@ -103,22 +105,24 @@ G4Element::G4Element(const G4String& name, const G4String& symbol, G4int nIsotop
|
||||
|
||||
fNumberOfIsotopes = 0;
|
||||
|
||||
theIsotopeVector = new G4IsotopeVector(n);
|
||||
theIsotopeVector = new G4IsotopeVector(n,0);
|
||||
fRelativeAbundanceVector = new G4double[nIsotopes];
|
||||
|
||||
fCountUse = 0; //nb of materials which use this element
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Add an isotope to the element
|
||||
|
||||
void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
|
||||
{
|
||||
if (theIsotopeVector == NULL)
|
||||
if (theIsotopeVector == 0)
|
||||
G4Exception ("ERROR from G4Element::AddIsotope!"
|
||||
" Trying to add an Isotope before contructing the element.");
|
||||
|
||||
// filling ...
|
||||
if ( fNumberOfIsotopes < theIsotopeVector->length() ) {
|
||||
if ( fNumberOfIsotopes < theIsotopeVector->size() ) {
|
||||
// check same Z
|
||||
if (fNumberOfIsotopes==0) fZeff = G4double(isotope->GetZ());
|
||||
else if (G4double(isotope->GetZ()) != fZeff)
|
||||
@@ -126,21 +130,22 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
|
||||
" Try to add isotopes with different Z");
|
||||
//Z ok
|
||||
fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
|
||||
(*theIsotopeVector)(fNumberOfIsotopes) = isotope;
|
||||
(*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->length() ) {
|
||||
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();
|
||||
fNeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
|
||||
fAeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
|
||||
wtSum += fRelativeAbundanceVector[i];
|
||||
}
|
||||
fNeff /= wtSum;
|
||||
@@ -153,33 +158,46 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in table and set the index
|
||||
theElementTable.insert(this);
|
||||
fIndexInTable = theElementTable.index(this);
|
||||
}
|
||||
// Store in table
|
||||
theElementTable.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Element::InitializePointers()
|
||||
{
|
||||
theIsotopeVector = NULL;
|
||||
fRelativeAbundanceVector = NULL;
|
||||
fAtomicShells = NULL;
|
||||
fIonisation = NULL;
|
||||
theIsotopeVector = 0;
|
||||
fRelativeAbundanceVector = 0;
|
||||
fAtomicShells = 0;
|
||||
fIonisation = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Element::~G4Element()
|
||||
{
|
||||
if (theIsotopeVector) delete theIsotopeVector;
|
||||
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;
|
||||
}
|
||||
if (fRelativeAbundanceVector) delete [] fRelativeAbundanceVector;
|
||||
if (fAtomicShells) delete [] fAtomicShells;
|
||||
if (fIonisation) delete fIonisation;
|
||||
|
||||
//remove this element from theElementTable
|
||||
G4ElementTable::iterator iter = theElementTable.begin();
|
||||
while ((iter != theElementTable.end())&&(*iter != this)) iter++;
|
||||
if (iter != theElementTable.end()) theElementTable.erase(iter);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Element::ComputeDerivedQuantities()
|
||||
{
|
||||
@@ -194,7 +212,7 @@ void G4Element::ComputeDerivedQuantities()
|
||||
fIonisation = new G4IonisParamElm(fZeff);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Element::ComputeCoulombFactor()
|
||||
{
|
||||
@@ -209,7 +227,7 @@ void G4Element::ComputeCoulombFactor()
|
||||
fCoulomb = (k1*az4 + k2 + 1./(1.+az2))*az2 - (k3*az4 + k4)*az4;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Element::ComputeLradTsaiFactor()
|
||||
{
|
||||
@@ -230,7 +248,7 @@ void G4Element::ComputeLradTsaiFactor()
|
||||
fRadTsai = 4*alpha_rcl2*fZeff*(fZeff*(Lrad-fCoulomb) + Lprad);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4Element::GetAtomicShell(G4int i) const
|
||||
{
|
||||
@@ -239,7 +257,36 @@ G4double G4Element::GetAtomicShell(G4int i) const
|
||||
return fAtomicShells[i];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4ElementTable* G4Element::GetElementTable()
|
||||
{
|
||||
return &theElementTable;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
size_t G4Element::GetNumberOfElements()
|
||||
{
|
||||
return theElementTable.size();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Element* G4Element::GetElement(G4String elementName)
|
||||
{
|
||||
// search the element by its name
|
||||
for (size_t J=0 ; J<theElementTable.size() ; J++)
|
||||
{
|
||||
if (theElementTable[J]->GetName() == elementName)
|
||||
return theElementTable[J];
|
||||
}
|
||||
|
||||
// the element does not exist in the table
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Element::G4Element(G4Element& right)
|
||||
{
|
||||
@@ -247,11 +294,10 @@ G4Element::G4Element(G4Element& right)
|
||||
*this = right;
|
||||
|
||||
// Store this new element in table and set the index
|
||||
theElementTable.insert(this);
|
||||
fIndexInTable = theElementTable.index(this);
|
||||
theElementTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4Element& G4Element::operator=(const G4Element& right)
|
||||
{
|
||||
@@ -275,7 +321,7 @@ const G4Element& G4Element::operator=(const G4Element& right)
|
||||
fNumberOfIsotopes = right.fNumberOfIsotopes;
|
||||
if (fNumberOfIsotopes > 0)
|
||||
{
|
||||
theIsotopeVector = new G4IsotopeVector(fNumberOfIsotopes);
|
||||
theIsotopeVector = new G4IsotopeVector(fNumberOfIsotopes,0);
|
||||
fRelativeAbundanceVector = new G4double[fNumberOfIsotopes];
|
||||
for (size_t i=0;i<fNumberOfIsotopes;i++)
|
||||
{
|
||||
@@ -284,38 +330,43 @@ const G4Element& G4Element::operator=(const G4Element& right)
|
||||
}
|
||||
}
|
||||
ComputeDerivedQuantities();
|
||||
fIndexInTable = right.fIndexInTable;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Element::operator==(const G4Element& right) const
|
||||
{
|
||||
return (this == (G4Element*) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Element::operator!=(const G4Element& right) const
|
||||
{
|
||||
return (this != (G4Element*) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Element* element)
|
||||
{
|
||||
{
|
||||
#ifdef G4USE_STD_NAMESPACE
|
||||
G4std::ios::fmtflags mode = flux.flags();
|
||||
flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#else
|
||||
long mode = flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#endif
|
||||
long prec = flux.precision(3);
|
||||
|
||||
flux
|
||||
<< " Element: " << G4std::setw(8) << element->fName << G4std::setw(3) << element->fSymbol
|
||||
<< " Element: " << G4std::setw(8) << element->fName << G4std::setw(3)
|
||||
<< element->fSymbol
|
||||
<< " Z = " << G4std::setw(4) << G4std::setprecision(1) << element->fZeff
|
||||
<< " N = " << G4std::setw(5) << G4std::setprecision(1) << element->fNeff
|
||||
<< " A = " << G4std::setw(6) << G4std::setprecision(2) << (element->fAeff)/(g/mole)
|
||||
<< " g/mole";
|
||||
<< " A = " << G4std::setw(6) << G4std::setprecision(2)
|
||||
<< (element->fAeff)/(g/mole) << " g/mole";
|
||||
|
||||
for (size_t i=0; i<element->fNumberOfIsotopes; i++)
|
||||
flux
|
||||
@@ -328,7 +379,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Element* element)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Element& element)
|
||||
{
|
||||
@@ -336,18 +387,18 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Element* element)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4ElementTable ElementTable)
|
||||
{
|
||||
//Dump info for all known elements
|
||||
flux << "\n***** Table : Nb of elements = " << ElementTable.length()
|
||||
flux << "\n***** Table : Nb of elements = " << ElementTable.size()
|
||||
<< " *****\n" << G4endl;
|
||||
|
||||
for (size_t i=0; i<ElementTable.length(); i++) flux << ElementTable[i]
|
||||
<< G4endl << G4endl;
|
||||
for (size_t i=0; i<ElementTable.size(); i++) flux << ElementTable[i]
|
||||
<< G4endl << G4endl;
|
||||
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IonisParamElm.cc,v 1.6.2.1 2001/06/28 19:10:30 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4IonisParamElm.cc,v 1.7 2001/07/11 10:01:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IonisParamMat.cc,v 1.7.2.1 2001/06/28 19:10:30 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4IonisParamMat.cc,v 1.9 2001/09/13 08:57:46 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
@@ -106,8 +106,8 @@ void G4IonisParamMat::ComputeDensityEffect()
|
||||
const G4double X0valS[] = {1.0 , 1.5 };
|
||||
const G4double X1valS[] = {2.0 , 3.0 };
|
||||
|
||||
if(fMeanExcitationEnergy < E100eV) icase = 0 ;
|
||||
else icase = 1 ;
|
||||
if(fMeanExcitationEnergy < E100eV) icase = 0;
|
||||
else icase = 1;
|
||||
|
||||
if(fCdensity < ClimiS[icase]) fX0density = 0.2;
|
||||
else fX0density = 0.326*fCdensity-X0valS[icase];
|
||||
@@ -153,14 +153,14 @@ void G4IonisParamMat::ComputeDensityEffect()
|
||||
|
||||
G4double DensitySTP = Density*STP_Pressure*Temp/(Pressure*STP_Temperature);
|
||||
|
||||
G4double ParCorr = log(Density/DensitySTP) ;
|
||||
G4double ParCorr = log(Density/DensitySTP);
|
||||
|
||||
fCdensity -= ParCorr;
|
||||
fX0density -= ParCorr/twoln10 ;
|
||||
fX1density -= ParCorr/twoln10 ;
|
||||
fX0density -= ParCorr/twoln10;
|
||||
fX1density -= ParCorr/twoln10;
|
||||
}
|
||||
|
||||
G4double Xa = fCdensity/twoln10 ;
|
||||
G4double Xa = fCdensity/twoln10;
|
||||
fAdensity = twoln10*(Xa-fX0density)
|
||||
/pow((fX1density-fX0density),fMdensity);
|
||||
}
|
||||
|
||||
@@ -21,54 +21,69 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Isotope.cc,v 1.5.2.1 2001/06/28 19:10:30 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4Isotope.cc,v 1.11 2001/11/29 15:19:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// 03-05-01, flux.precision(prec) at begin/end of operator<<
|
||||
// 29-01-97: Forbidden to create Isotope with Z<1 or N<Z, M.Maire
|
||||
// 26-06-96: Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
|
||||
// 14.09.01: fCountUse: nb of elements which use this isotope
|
||||
// 13.09.01: suppression of the data member fIndexInTable
|
||||
// 17.07.01: migration to STL. M. Verderi.
|
||||
// 03.05.01: flux.precision(prec) at begin/end of operator<<
|
||||
// 29.01.97: Forbidden to create Isotope with Z<1 or N<Z, M.Maire
|
||||
// 26.06.96: Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Isotope.hh"
|
||||
#include "g4std/iomanip"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4IsotopeTable G4Isotope::theIsotopeTable;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Create an isotope
|
||||
//
|
||||
G4Isotope::G4Isotope(const G4String& Name, G4int Z, G4int N, G4double A)
|
||||
: fName(Name), fZ(Z), fN(N), fA(A)
|
||||
: fName(Name), fZ(Z), fN(N), fA(A), fCountUse(0)
|
||||
{
|
||||
if (Z<1) G4Exception
|
||||
(" ERROR! It is not allowed to create an Isotope with Z < 1" );
|
||||
if (Z<1) G4Exception
|
||||
(" ERROR! It is not allowed to create an Isotope with Z < 1" );
|
||||
|
||||
if (N<Z) G4Exception
|
||||
(" ERROR! Attempt to create an Isotope with N < Z !!!" );
|
||||
if (N<Z) G4Exception
|
||||
(" ERROR! Attempt to create an Isotope with N < Z !!!" );
|
||||
|
||||
theIsotopeTable.insert(this);
|
||||
fIndexInTable = theIsotopeTable.index(this);
|
||||
theIsotopeTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Isotope::~G4Isotope() {}
|
||||
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
|
||||
G4IsotopeTable::iterator iter = theIsotopeTable.begin();
|
||||
while ((iter != theIsotopeTable.end())&&(*iter != this)) iter++;
|
||||
if (iter != theIsotopeTable.end()) theIsotopeTable.erase(iter);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Isotope::G4Isotope(G4Isotope& right)
|
||||
{
|
||||
*this = right;
|
||||
|
||||
//insert this new isotope in table
|
||||
theIsotopeTable.insert(this);
|
||||
fIndexInTable = theIsotopeTable.index(this);
|
||||
theIsotopeTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Isotope & G4Isotope::operator=(const G4Isotope& right)
|
||||
{
|
||||
@@ -78,36 +93,40 @@ G4Isotope & G4Isotope::operator=(const G4Isotope& right)
|
||||
fZ = right.fZ;
|
||||
fN = right.fZ;
|
||||
fA = right.fA;
|
||||
fIndexInTable = theIsotopeTable.index(this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Isotope::operator==(const G4Isotope &right) const
|
||||
{
|
||||
return (this == (G4Isotope *) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Isotope::operator!=(const G4Isotope &right) const
|
||||
{
|
||||
return (this != (G4Isotope *) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
|
||||
{
|
||||
#ifdef G4USE_STD_NAMESPACE
|
||||
G4std::ios::fmtflags mode = flux.flags();
|
||||
flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#else
|
||||
long mode = flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#endif
|
||||
long prec = flux.precision(3);
|
||||
|
||||
flux
|
||||
<< " Isotope: " << G4std::setw(5) << isotope->fName
|
||||
<< " Z = " << G4std::setw(2) << isotope->fZ
|
||||
<< " N = " << G4std::setw(3) << isotope->fN
|
||||
<< " Z = " << G4std::setw(2) << isotope->fZ
|
||||
<< " N = " << G4std::setw(3) << isotope->fN
|
||||
<< " A = " << G4std::setw(6) << G4std::setprecision(2)
|
||||
<< (isotope->fA)/(g/mole) << " g/mole";
|
||||
|
||||
@@ -116,7 +135,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope& isotope)
|
||||
{
|
||||
@@ -124,19 +143,46 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4IsotopeTable IsotopeTable)
|
||||
{
|
||||
//Dump info for all known isotopes
|
||||
flux
|
||||
<< "\n***** Table : Nb of isotopes = " << IsotopeTable.length()
|
||||
<< "\n***** Table : Nb of isotopes = " << IsotopeTable.size()
|
||||
<< " *****\n" << G4endl;
|
||||
|
||||
for (size_t i=0; i<IsotopeTable.length(); i++)
|
||||
for (size_t i=0; i<IsotopeTable.size(); i++)
|
||||
flux << IsotopeTable[i] << G4endl;
|
||||
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4IsotopeTable* G4Isotope::GetIsotopeTable()
|
||||
{
|
||||
return &theIsotopeTable;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
size_t G4Isotope::GetNumberOfIsotopes()
|
||||
{
|
||||
return theIsotopeTable.size();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Isotope* G4Isotope::GetIsotope(G4String isotopeName)
|
||||
{
|
||||
// search the isotope by its name
|
||||
for (size_t J=0 ; J<theIsotopeTable.size() ; J++)
|
||||
{
|
||||
if (theIsotopeTable[J]->GetName() == isotopeName)
|
||||
return theIsotopeTable[J];
|
||||
}
|
||||
|
||||
// the isotope does not exist in the table
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MPVEntry.cc,v 1.5.4.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4MPVEntry.cc,v 1.6 2001/07/11 10:01:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+348
-284
@@ -21,10 +21,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Material.cc,v 1.10.2.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4Material.cc,v 1.18 2001/11/29 15:19:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// 26-06-96, Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
|
||||
// 10-07-96, new data members added by L.Urban
|
||||
@@ -50,8 +50,11 @@
|
||||
// 12-03-01, G4bool fImplicitElement;
|
||||
// copy constructor and assignement operator revised (mma)
|
||||
// 03-05-01, flux.precision(prec) at begin/end of operator<<
|
||||
// 17-07-01, migration to STL. M. Verderi.
|
||||
// 14-09-01, Suppression of the data member fIndexInTable
|
||||
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
@@ -60,7 +63,7 @@
|
||||
|
||||
G4MaterialTable G4Material::theMaterialTable;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to create a material from scratch
|
||||
|
||||
@@ -69,85 +72,86 @@ G4Material::G4Material(const G4String& name, G4double z,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name)
|
||||
{
|
||||
InitializePointers();
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
if (density < universe_mean_density)
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << G4endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
maxNbComponents = fNumberOfComponents = fNumberOfElements = 1;
|
||||
fImplicitElement = true;
|
||||
theElementVector = new G4ElementVector(1);
|
||||
theElementVector[0] = new G4Element(name, " ", z, a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1. ;
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
maxNbComponents = fNumberOfComponents = fNumberOfElements = 1;
|
||||
fImplicitElement = true;
|
||||
theElementVector = new G4ElementVector(1,(G4Element*)0);
|
||||
(*theElementVector)[0] = new G4Element(name, " ", z, a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1. ;
|
||||
|
||||
(*theElementVector)[0] -> increaseCountUse();
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the table of Materials
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to create a material from a List of constituents
|
||||
// (elements and/or materials) added with AddElement or AddMaterial
|
||||
|
||||
G4Material::G4Material(const G4String& name, G4double density, G4int nComponents,
|
||||
G4Material::G4Material(const G4String& name, G4double density,
|
||||
G4int nComponents,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name)
|
||||
{
|
||||
|
||||
InitializePointers();
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
if (density < universe_mean_density)
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << G4endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
|
||||
maxNbComponents = nComponents;
|
||||
fNumberOfComponents = fNumberOfElements = 0;
|
||||
fImplicitElement = false;
|
||||
theElementVector = new G4ElementVector(maxNbComponents);
|
||||
maxNbComponents = nComponents;
|
||||
fNumberOfComponents = fNumberOfElements = 0;
|
||||
fImplicitElement = false;
|
||||
theElementVector = new G4ElementVector(maxNbComponents,(G4Element*)0);
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to create a material with chemical formula from scratch
|
||||
|
||||
@@ -156,45 +160,51 @@ G4Material::G4Material(const G4String& name, const G4String& chFormula,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name),fChemicalFormula(chFormula)
|
||||
{
|
||||
InitializePointers();
|
||||
G4cout
|
||||
<< "---> warning from G4Material constructor with chemical formula."
|
||||
" This constructor is going to be depreciated.\n"
|
||||
" Use material->SetChemicalFormula(const G4String&)" << G4endl;
|
||||
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
if (density < universe_mean_density)
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << G4endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
maxNbComponents = fNumberOfComponents = fNumberOfElements = 1;
|
||||
fImplicitElement = true;
|
||||
theElementVector = new G4ElementVector(1);
|
||||
theElementVector[0] = new G4Element(name, " ", z, a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1. ;
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
maxNbComponents = fNumberOfComponents = fNumberOfElements = 1;
|
||||
fImplicitElement = true;
|
||||
theElementVector = new G4ElementVector(1,(G4Element*)0);
|
||||
(*theElementVector)[0] = new G4Element(name, " ", z, a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1. ;
|
||||
|
||||
(*theElementVector)[0] -> increaseCountUse();
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
// Store in the table of Materials
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Constructor to create a material with chemical formula from a List
|
||||
// of constituents (elements and/or materials) added with AddElement
|
||||
@@ -205,198 +215,208 @@ G4Material::G4Material(const G4String& name, const G4String& chFormula,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name),fChemicalFormula(chFormula)
|
||||
{
|
||||
|
||||
InitializePointers();
|
||||
G4cout
|
||||
<< "---> warning from G4Material constructor with chemical formula."
|
||||
" This constructor is going to be depreciated.\n"
|
||||
" Use material->SetChemicalFormula(const G4String&)" << G4endl;
|
||||
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
if (density < universe_mean_density)
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << G4endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
|
||||
maxNbComponents = nComponents;
|
||||
fNumberOfComponents = fNumberOfElements = 0;
|
||||
fImplicitElement = false;
|
||||
theElementVector = new G4ElementVector(maxNbComponents);
|
||||
maxNbComponents = nComponents;
|
||||
fNumberOfComponents = fNumberOfElements = 0;
|
||||
fImplicitElement = false;
|
||||
theElementVector = new G4ElementVector(maxNbComponents,(G4Element*)0);
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// AddElement -- composition by atom count
|
||||
|
||||
void G4Material::AddElement(G4Element* element, G4int nAtoms)
|
||||
{
|
||||
// initialization
|
||||
if ( fNumberOfElements == 0 ) {
|
||||
fAtomsVector = new G4int [maxNbComponents];
|
||||
fMassFractionVector = new G4double[maxNbComponents];
|
||||
}
|
||||
// initialization
|
||||
if ( fNumberOfElements == 0 ) {
|
||||
fAtomsVector = new G4int [maxNbComponents];
|
||||
fMassFractionVector = new G4double[maxNbComponents];
|
||||
}
|
||||
|
||||
// filling ...
|
||||
if ( G4int(fNumberOfElements) < maxNbComponents ) {
|
||||
(*theElementVector)[fNumberOfElements] = element;
|
||||
fAtomsVector [fNumberOfElements] = nAtoms;
|
||||
fNumberOfComponents = ++fNumberOfElements;
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of elements.");
|
||||
// filling ...
|
||||
if ( G4int(fNumberOfElements) < maxNbComponents ) {
|
||||
(*theElementVector)[fNumberOfElements] = element;
|
||||
fAtomsVector [fNumberOfElements] = nAtoms;
|
||||
fNumberOfComponents = ++fNumberOfElements;
|
||||
element->increaseCountUse();
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of elements.");
|
||||
|
||||
// filled.
|
||||
if ( G4int(fNumberOfElements) == maxNbComponents ) {
|
||||
// compute proportion by mass
|
||||
size_t i=0;
|
||||
G4double Zmol(0.), Amol(0.);
|
||||
for (i=0;i<fNumberOfElements;i++) {
|
||||
Zmol += fAtomsVector[i]*(*theElementVector)[i]->GetZ();
|
||||
Amol += fAtomsVector[i]*(*theElementVector)[i]->GetA();
|
||||
}
|
||||
for (i=0;i<fNumberOfElements;i++) {
|
||||
fMassFractionVector[i] = fAtomsVector[i]*(*theElementVector)[i]->GetA()/Amol;
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
// filled.
|
||||
if ( G4int(fNumberOfElements) == maxNbComponents ) {
|
||||
// compute proportion by mass
|
||||
size_t i=0;
|
||||
G4double Zmol(0.), Amol(0.);
|
||||
for (i=0;i<fNumberOfElements;i++) {
|
||||
Zmol += fAtomsVector[i]*(*theElementVector)[i]->GetZ();
|
||||
Amol += fAtomsVector[i]*(*theElementVector)[i]->GetA();
|
||||
}
|
||||
for (i=0;i<fNumberOfElements;i++) {
|
||||
fMassFractionVector[i] = fAtomsVector[i]
|
||||
*(*theElementVector)[i]->GetA()/Amol;
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// AddElement -- composition by fraction of mass
|
||||
|
||||
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"
|
||||
// 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 ...");
|
||||
}
|
||||
G4Exception ("You are mixing apples and oranges ...");
|
||||
}
|
||||
|
||||
// initialization
|
||||
if (fNumberOfComponents == 0) {
|
||||
fMassFractionVector = new G4double[100];
|
||||
}
|
||||
// initialization
|
||||
if (fNumberOfComponents == 0) {
|
||||
fMassFractionVector = new G4double[100];
|
||||
}
|
||||
|
||||
// filling ...
|
||||
if (G4int(fNumberOfComponents) < maxNbComponents) {
|
||||
size_t el = 0;
|
||||
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
|
||||
if (el<fNumberOfElements) fMassFractionVector[el] += fraction;
|
||||
else {
|
||||
if(el>=theElementVector->length()) theElementVector->resize(el+1);
|
||||
(*theElementVector)[el] = element;
|
||||
fMassFractionVector[el] = fraction;
|
||||
fNumberOfElements ++;
|
||||
}
|
||||
fNumberOfComponents++;
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of components.");
|
||||
|
||||
// filled.
|
||||
if (G4int(fNumberOfComponents) == maxNbComponents) {
|
||||
// check sum of weights -- OK?
|
||||
G4double wtSum(0.0);
|
||||
for (size_t i=0;i<fNumberOfElements;i++) { wtSum += fMassFractionVector[i]; }
|
||||
if (abs(1.-wtSum) > perThousand) {
|
||||
G4cerr << "WARNING !! - Fractional masses do not sum to 1 :the Delta is > 0.001"
|
||||
<< "( the weights are NOT renormalized; the results may be wrong)"
|
||||
// filling ...
|
||||
if (G4int(fNumberOfComponents) < maxNbComponents) {
|
||||
size_t el = 0;
|
||||
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
|
||||
if (el<fNumberOfElements) fMassFractionVector[el] += fraction;
|
||||
else {
|
||||
if(el>=theElementVector->size()) theElementVector->resize(el+1);
|
||||
(*theElementVector)[el] = element;
|
||||
fMassFractionVector[el] = fraction;
|
||||
fNumberOfElements ++;
|
||||
element->increaseCountUse();
|
||||
}
|
||||
fNumberOfComponents++;
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of components.");
|
||||
|
||||
// filled.
|
||||
if (G4int(fNumberOfComponents) == maxNbComponents) {
|
||||
// check sum of weights -- OK?
|
||||
G4double wtSum(0.0);
|
||||
for (size_t i=0;i<fNumberOfElements;i++) {wtSum += fMassFractionVector[i];}
|
||||
if (abs(1.-wtSum) > perThousand) {
|
||||
G4cerr << "WARNING !! - Fractional masses do not sum to 1 : "
|
||||
"the Delta is > 0.001"
|
||||
"(the weights are NOT renormalized; the results may be wrong)"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
}
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// AddMaterial -- composition by fraction of mass
|
||||
|
||||
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[100];
|
||||
}
|
||||
// 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[100];
|
||||
}
|
||||
|
||||
// filling ...
|
||||
if (G4int(fNumberOfComponents) < maxNbComponents) {
|
||||
for (size_t elm=0; elm < material->GetNumberOfElements(); elm++)
|
||||
{ G4Element* element = (*(material->GetElementVector()))[elm];
|
||||
size_t el = 0;
|
||||
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
|
||||
if (el<fNumberOfElements) fMassFractionVector[el] += fraction
|
||||
*(material->GetFractionVector())[elm];
|
||||
else {
|
||||
if(el>=theElementVector->length()) theElementVector->resize(el+1);
|
||||
(*theElementVector)[el] = element;
|
||||
fMassFractionVector[el] = fraction*(material->GetFractionVector())[elm];
|
||||
fNumberOfElements ++;
|
||||
}
|
||||
}
|
||||
fNumberOfComponents++;
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of components.");
|
||||
|
||||
// filled.
|
||||
if (G4int(fNumberOfComponents) == maxNbComponents) {
|
||||
// check sum of weights -- OK?
|
||||
G4double wtSum(0.0);
|
||||
for (size_t i=0;i<fNumberOfElements;i++)
|
||||
{ wtSum += fMassFractionVector[i]; }
|
||||
if (abs(1.-wtSum) > perThousand) {
|
||||
G4cerr << "WARNING !! - Fractional masses do not sum to 1 :the Delta is > 0.001"
|
||||
<< "( the weights are NOT renormalized; the results may be wrong)"
|
||||
// filling ...
|
||||
if (G4int(fNumberOfComponents) < maxNbComponents) {
|
||||
for (size_t elm=0; elm < material->GetNumberOfElements(); elm++)
|
||||
{
|
||||
G4Element* element = (*(material->GetElementVector()))[elm];
|
||||
size_t el = 0;
|
||||
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
|
||||
if (el < fNumberOfElements) fMassFractionVector[el] += fraction
|
||||
*(material->GetFractionVector())[elm];
|
||||
else {
|
||||
if (el >= theElementVector->size()) theElementVector->resize(el+1);
|
||||
(*theElementVector)[el] = element;
|
||||
fMassFractionVector[el] = fraction
|
||||
*(material->GetFractionVector())[elm];
|
||||
fNumberOfElements ++;
|
||||
element->increaseCountUse();
|
||||
}
|
||||
}
|
||||
fNumberOfComponents++;
|
||||
}
|
||||
else
|
||||
G4Exception
|
||||
("ERROR!!! - Attempt to add more than the declared number of components.");
|
||||
|
||||
// filled.
|
||||
if (G4int(fNumberOfComponents) == maxNbComponents) {
|
||||
// check sum of weights -- OK?
|
||||
G4double wtSum(0.0);
|
||||
for (size_t i=0;i<fNumberOfElements;i++)
|
||||
{ wtSum += fMassFractionVector[i]; }
|
||||
if (abs(1.-wtSum) > perThousand) {
|
||||
G4cerr << "WARNING !! - Fractional masses do not sum to 1 : "
|
||||
"the Delta is > 0.001"
|
||||
"(the weights are NOT renormalized; the results may be wrong)"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
}
|
||||
// Store in the static Table of Materials
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Material::ComputeDerivedQuantities()
|
||||
{
|
||||
// Header routine to compute various properties of material.
|
||||
//
|
||||
|
||||
// Atoms density vector, Electrons density
|
||||
// Number of atoms per volume (per element), total nb of electrons per volume
|
||||
G4double Zi, Ai;
|
||||
TotNbOfAtomsPerVolume = 0.;
|
||||
if (VecNbOfAtomsPerVolume) delete [] VecNbOfAtomsPerVolume;
|
||||
@@ -408,44 +428,46 @@ void G4Material::ComputeDerivedQuantities()
|
||||
VecNbOfAtomsPerVolume[i] = Avogadro*fDensity*fMassFractionVector[i]/Ai;
|
||||
TotNbOfAtomsPerVolume += VecNbOfAtomsPerVolume[i];
|
||||
TotNbOfElectPerVolume += VecNbOfAtomsPerVolume[i]*Zi;
|
||||
}
|
||||
}
|
||||
|
||||
//for gas, check coherence of the state conditions
|
||||
if (fState == kStateGas) {
|
||||
G4double ratio = TotNbOfAtomsPerVolume*k_Boltzmann*fTemp/fPressure;
|
||||
if ((ratio<0.1)||(ratio>10.)) {
|
||||
G4cerr << "---warning from G4Material-- The state conditions of the gas: "
|
||||
//for gas, check coherence of the state conditions
|
||||
if (fState == kStateGas) {
|
||||
G4double ratio = TotNbOfAtomsPerVolume*k_Boltzmann*fTemp/fPressure;
|
||||
if ((ratio<0.1)||(ratio>10.)) {
|
||||
G4cerr << "--warning from G4Material-- The state conditions of the gas: "
|
||||
<< fName << " are not consistent."
|
||||
<< "\n density = " << fDensity/(mg/cm3) << " mg/cm3"
|
||||
<< "\t pressure = " << fPressure/atmosphere << " atmosphere"
|
||||
<< "\t temperature = " << fTemp/kelvin << " kelvin"
|
||||
<< "\n rho*(T/P) would be of the order of: "
|
||||
<< (fDensity/(TotNbOfAtomsPerVolume*k_Boltzmann))/((mg/cm3)*(kelvin/atmosphere))
|
||||
<< " (mg/cm3)*(kelvin/atmosphere). The energy loss calculation maybe be affected \n";
|
||||
}
|
||||
}
|
||||
|
||||
ComputeRadiationLength();
|
||||
ComputeNuclearInterLength();
|
||||
<< (fDensity/(TotNbOfAtomsPerVolume*k_Boltzmann))
|
||||
/((mg/cm3)*(kelvin/atmosphere))
|
||||
<< " (mg/cm3)*(kelvin/atmosphere)."
|
||||
" The energy loss calculation maybe be affected \n";
|
||||
}
|
||||
}
|
||||
|
||||
ComputeRadiationLength();
|
||||
ComputeNuclearInterLength();
|
||||
|
||||
if (fIonisation) delete fIonisation;
|
||||
fIonisation = new G4IonisParamMat(this);
|
||||
if (fSandiaTable) delete fSandiaTable;
|
||||
fSandiaTable = new G4SandiaTable(this);
|
||||
if (fIonisation) delete fIonisation;
|
||||
fIonisation = new G4IonisParamMat(this);
|
||||
if (fSandiaTable) delete fSandiaTable;
|
||||
fSandiaTable = new G4SandiaTable(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Material::ComputeRadiationLength()
|
||||
{
|
||||
G4double radinv = 0.0 ;
|
||||
for (size_t i=0;i<fNumberOfElements;i++) {
|
||||
radinv += VecNbOfAtomsPerVolume[i]*((*theElementVector)[i]->GetfRadTsai());
|
||||
radinv += VecNbOfAtomsPerVolume[i]*((*theElementVector)[i]->GetfRadTsai());
|
||||
}
|
||||
fRadlen = (radinv <= 0.0 ? DBL_MAX : 1./radinv);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Material::ComputeNuclearInterLength()
|
||||
{
|
||||
@@ -453,40 +475,56 @@ void G4Material::ComputeNuclearInterLength()
|
||||
G4double NILinv = 0.0;
|
||||
for (size_t i=0;i<fNumberOfElements;i++) {
|
||||
NILinv +=
|
||||
VecNbOfAtomsPerVolume[i]*pow(((*theElementVector)[i]->GetN()),2./3.);
|
||||
VecNbOfAtomsPerVolume[i]*pow(((*theElementVector)[i]->GetN()),0.6666667);
|
||||
}
|
||||
NILinv *= amu/lambda0;
|
||||
fNuclInterLen = (NILinv <= 0.0 ? DBL_MAX : 1./NILinv);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4Material::InitializePointers()
|
||||
{
|
||||
theElementVector = NULL;
|
||||
fMassFractionVector = NULL;
|
||||
fAtomsVector = NULL;
|
||||
fMaterialPropertiesTable = NULL;
|
||||
theElementVector = 0;
|
||||
fMassFractionVector = 0;
|
||||
fAtomsVector = 0;
|
||||
fMaterialPropertiesTable = 0;
|
||||
|
||||
VecNbOfAtomsPerVolume = NULL;
|
||||
fIonisation = NULL;
|
||||
fSandiaTable = NULL;
|
||||
VecNbOfAtomsPerVolume = 0;
|
||||
fIonisation = 0;
|
||||
fSandiaTable = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Material::~G4Material()
|
||||
const G4MaterialTable* G4Material::GetMaterialTable()
|
||||
{
|
||||
if (fImplicitElement) delete ((*theElementVector)[0]);
|
||||
if (theElementVector) delete theElementVector;
|
||||
if (fMassFractionVector) delete [] fMassFractionVector;
|
||||
if (fAtomsVector) delete [] fAtomsVector;
|
||||
if (VecNbOfAtomsPerVolume) delete [] VecNbOfAtomsPerVolume;
|
||||
if (fIonisation) delete fIonisation;
|
||||
if (fSandiaTable) delete fSandiaTable;
|
||||
return &theMaterialTable;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
size_t G4Material::GetNumberOfMaterials()
|
||||
{
|
||||
return theMaterialTable.size();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Material* G4Material::GetMaterial(G4String materialName)
|
||||
{
|
||||
// search the material by its name
|
||||
for (size_t J=0 ; J<theMaterialTable.size() ; J++)
|
||||
{
|
||||
if (theMaterialTable[J]->GetName() == materialName)
|
||||
return theMaterialTable[J];
|
||||
}
|
||||
|
||||
// the material does not exist in the table
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Material::G4Material(const G4Material& right)
|
||||
{
|
||||
@@ -494,11 +532,31 @@ G4Material::G4Material(const G4Material& right)
|
||||
*this = right;
|
||||
|
||||
// Store this new material in the table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
theMaterialTable.push_back(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Material::~G4Material()
|
||||
{
|
||||
for (size_t i=0; i<fNumberOfElements; i++)
|
||||
(*theElementVector)[i]->decreaseCountUse();
|
||||
|
||||
if (fImplicitElement) delete ((*theElementVector)[0]);
|
||||
if (theElementVector) delete theElementVector;
|
||||
if (fMassFractionVector) delete [] fMassFractionVector;
|
||||
if (fAtomsVector) delete [] fAtomsVector;
|
||||
if (VecNbOfAtomsPerVolume) delete [] VecNbOfAtomsPerVolume;
|
||||
if (fIonisation) delete fIonisation;
|
||||
if (fSandiaTable) delete fSandiaTable;
|
||||
|
||||
//remove this material from theMaterialTable
|
||||
G4MaterialTable::iterator iter = theMaterialTable.begin();
|
||||
while ((iter != theMaterialTable.end())&&(*iter != this)) iter++;
|
||||
if (iter != theMaterialTable.end()) theMaterialTable.erase(iter);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4Material& G4Material::operator=(const G4Material& right)
|
||||
{
|
||||
@@ -524,12 +582,12 @@ const G4Material& G4Material::operator=(const G4Material& right)
|
||||
if (fImplicitElement) {
|
||||
G4double z = (*right.theElementVector)[0]->GetZ();
|
||||
G4double a = (*right.theElementVector)[0]->GetA();
|
||||
theElementVector = new G4ElementVector(1);
|
||||
theElementVector[0] = new G4Element(fName," ",z,a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1.;
|
||||
theElementVector = new G4ElementVector(1,(G4Element*)0);
|
||||
(*theElementVector)[0] = new G4Element(fName," ",z,a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1.;
|
||||
} else {
|
||||
theElementVector = new G4ElementVector(fNumberOfElements);
|
||||
theElementVector = new G4ElementVector(fNumberOfElements,0);
|
||||
fMassFractionVector = new G4double[fNumberOfElements];
|
||||
for (size_t i=0; i<fNumberOfElements; i++) {
|
||||
(*theElementVector)[i]= (*right.theElementVector)[i];
|
||||
@@ -546,31 +604,35 @@ const G4Material& G4Material::operator=(const G4Material& right)
|
||||
fMaterialPropertiesTable = right.fMaterialPropertiesTable;
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
fIndexInTable = right.fIndexInTable;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Material::operator==(const G4Material& right) const
|
||||
{
|
||||
return (this == (G4Material *) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4Material::operator!=(const G4Material& right) const
|
||||
{
|
||||
return (this != (G4Material *) &right);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
|
||||
{
|
||||
#ifdef G4USE_STD_NAMESPACE
|
||||
G4std::ios::fmtflags mode = flux.flags();
|
||||
flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#else
|
||||
long mode = flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
|
||||
#endif
|
||||
long prec = flux.precision(3);
|
||||
|
||||
flux
|
||||
@@ -601,7 +663,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4Material& material)
|
||||
{
|
||||
@@ -609,16 +671,18 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream& flux, G4MaterialTable MaterialTable)
|
||||
{
|
||||
//Dump info for all known materials
|
||||
flux << "\n***** Table : Nb of materials = " << MaterialTable.length()
|
||||
flux << "\n***** Table : Nb of materials = " << MaterialTable.size()
|
||||
<< " *****\n" << G4endl;
|
||||
|
||||
for (size_t i=0; i<MaterialTable.length(); i++) flux << MaterialTable[i]
|
||||
for (size_t i=0; i<MaterialTable.size(); i++) flux << MaterialTable[i]
|
||||
<< G4endl << G4endl;
|
||||
|
||||
return flux;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MaterialPropertiesTable.cc,v 1.9.4.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4MaterialPropertiesTable.cc,v 1.12 2001/10/17 07:59:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -162,7 +162,7 @@ void G4MaterialPropertiesTable::AddEntry(const char *key,
|
||||
G4double aPropertyValue)
|
||||
{
|
||||
G4MaterialPropertyVector *targetVector=MPT [G4String(key)];
|
||||
if (targetVector != NULL) {
|
||||
if (targetVector != 0) {
|
||||
targetVector->AddElement(aPhotonMomentum, aPropertyValue);
|
||||
}
|
||||
else {
|
||||
@@ -179,7 +179,7 @@ void G4MaterialPropertiesTable::RemoveEntry(const char *key,
|
||||
targetVector->RemoveElement(aPhotonMomentum);
|
||||
}
|
||||
else {
|
||||
G4Exception("G4MaterialPropertiesTable::AddEntry ==> "
|
||||
G4Exception("G4MaterialPropertiesTable::RemoveEntry ==> "
|
||||
"Material Property Vector not found.");
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,12 @@ void G4MaterialPropertiesTable::DumpTable()
|
||||
{
|
||||
MPTiterator i;
|
||||
for (i = MPT.begin(); i != MPT.end(); ++i) {
|
||||
G4cout << *(*i).first << G4endl;
|
||||
(*i).second->DumpVector();
|
||||
G4cout << (*i).first << G4endl;
|
||||
if ( (*i).second != 0 ) {
|
||||
(*i).second->DumpVector();
|
||||
}
|
||||
else {
|
||||
G4cout << "NULL Material Property Vector Pointer." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MaterialPropertyVector.cc,v 1.5.4.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4MaterialPropertyVector.cc,v 1.11 2001/11/28 15:42:12 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -73,7 +73,7 @@ G4MaterialPropertyVector::operator =(const G4MaterialPropertyVector& right)
|
||||
|
||||
// clear the vector of current contents
|
||||
|
||||
MPV.clearAndDestroy();
|
||||
MPV.clear();
|
||||
|
||||
// create an actual copy (instead of the shallow copy that the
|
||||
// assignment operator defaults to for G4RWTPtrSortedVector)
|
||||
@@ -83,7 +83,7 @@ G4MaterialPropertyVector::operator =(const G4MaterialPropertyVector& right)
|
||||
|
||||
for (G4int i = 0 ; i < right.NumEntries; i++) {
|
||||
G4MPVEntry *newElement = new G4MPVEntry(right.GetEntry(i));
|
||||
MPV.insert(newElement);
|
||||
MPV.push_back(newElement);
|
||||
NumEntries++;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ G4MaterialPropertyVector::G4MaterialPropertyVector
|
||||
|
||||
for (G4int i = 0 ; i < right.NumEntries; i++) {
|
||||
G4MPVEntry *newElement = new G4MPVEntry(right.GetEntry(i));
|
||||
MPV.insert(newElement);
|
||||
MPV.push_back(newElement);
|
||||
NumEntries++;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ G4MaterialPropertyVector::G4MaterialPropertyVector
|
||||
|
||||
G4MaterialPropertyVector::~G4MaterialPropertyVector()
|
||||
{
|
||||
MPV.clearAndDestroy();
|
||||
MPV.clear();
|
||||
}
|
||||
|
||||
////////////
|
||||
@@ -143,24 +143,32 @@ void G4MaterialPropertyVector::AddElement(G4double aPhotonMomentum,
|
||||
G4MPVEntry *newElement;
|
||||
|
||||
newElement = new G4MPVEntry(aPhotonMomentum, aPropertyValue);
|
||||
MPV.insert(newElement);
|
||||
MPV.push_back(newElement);
|
||||
NumEntries++;
|
||||
}
|
||||
|
||||
void G4MaterialPropertyVector::RemoveElement(G4double aPhotonMomentum)
|
||||
{
|
||||
G4MPVEntry *newElement;
|
||||
G4MPVEntry *success;
|
||||
G4MPVEntry *success=0;
|
||||
|
||||
newElement = new G4MPVEntry(aPhotonMomentum, DBL_MAX);
|
||||
success = MPV.remove(newElement);
|
||||
|
||||
if(success == NULL)
|
||||
G4std::vector<G4MPVEntry*>::iterator i;
|
||||
for (i = MPV.begin(); i != MPV.end(); i++)
|
||||
if (**i == *newElement) {success = *i; break;}
|
||||
// success = MPV.remove(newElement);
|
||||
|
||||
if(success == 0)
|
||||
{
|
||||
G4Exception("G4MaterialPropertyVector::RemoveElement==>"
|
||||
"element not found");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MPV.erase(i); // remove done here.
|
||||
}
|
||||
|
||||
NumEntries--;
|
||||
}
|
||||
@@ -176,10 +184,10 @@ G4MaterialPropertyVector::GetProperty(G4double aPhotonMomentum) const
|
||||
// Establish table range
|
||||
/////////////////////////
|
||||
|
||||
G4double PMmin = MPV.first()->GetPhotonMomentum();
|
||||
G4double minProp = MPV.first()->GetProperty();
|
||||
G4double PMmax = MPV.last()->GetPhotonMomentum();
|
||||
G4double maxProp = MPV.last()->GetProperty();
|
||||
G4double PMmin = MPV.front()->GetPhotonMomentum();
|
||||
G4double minProp = MPV.front()->GetProperty();
|
||||
G4double PMmax = MPV.back() ->GetPhotonMomentum();
|
||||
G4double maxProp = MPV.back() ->GetProperty();
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Does value fall outside range of table?
|
||||
@@ -203,8 +211,12 @@ G4MaterialPropertyVector::GetProperty(G4double aPhotonMomentum) const
|
||||
|
||||
target = new G4MPVEntry(aPhotonMomentum, 0.0);
|
||||
|
||||
temp = MPV.find(target);
|
||||
if (temp != NULL) {
|
||||
temp = 0;
|
||||
//temp = MPV.find(target);
|
||||
G4std::vector<G4MPVEntry*>::const_iterator i;
|
||||
for (i = MPV.begin(); i != MPV.end(); i++)
|
||||
if (**i == *target) {temp = *i; break;}
|
||||
if (temp != 0) {
|
||||
|
||||
////////////////////////
|
||||
// Return actual value
|
||||
@@ -281,10 +293,10 @@ G4MaterialPropertyVector::GetPhotonMomentum(G4double aProperty) const
|
||||
// Establish Table range
|
||||
//////////////////////////
|
||||
|
||||
G4double PropMin = MPV.first()->GetProperty();
|
||||
G4double PMmin= MPV.first()->GetPhotonMomentum();
|
||||
G4double PropMax = MPV.last()->GetProperty();
|
||||
G4double PMmax= MPV.last()->GetPhotonMomentum();
|
||||
G4double PropMin = MPV.front()->GetProperty();
|
||||
G4double PMmin = MPV.front()->GetPhotonMomentum();
|
||||
G4double PropMax = MPV.back() ->GetProperty();
|
||||
G4double PMmax = MPV.back() ->GetPhotonMomentum();
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Does value fall outside range of table?
|
||||
@@ -310,7 +322,7 @@ G4MaterialPropertyVector::GetPhotonMomentum(G4double aProperty) const
|
||||
//////////////////////////////
|
||||
|
||||
left = 0;
|
||||
right = MPV.entries();
|
||||
right = MPV.size(); // was .entries()
|
||||
|
||||
// find values in bins on either side of aProperty
|
||||
|
||||
@@ -355,7 +367,7 @@ void G4MaterialPropertyVector::ResetIterator()
|
||||
|
||||
void G4MaterialPropertyVector::DumpVector()
|
||||
{
|
||||
if (MPV.isEmpty()) {
|
||||
if (MPV.empty()) {
|
||||
G4cerr << "nothing to dump" << G4endl;
|
||||
G4Exception("G4MaterialPropertyVector::DumpVector ==>"
|
||||
"Nothing to dump! Vector is empty");
|
||||
@@ -364,9 +376,8 @@ void G4MaterialPropertyVector::DumpVector()
|
||||
for (G4int i = 0; i < NumEntries; i++) {
|
||||
G4cout << "MPV["<< i << "]: ";
|
||||
MPV[i]->DumpEntry();
|
||||
G4cout << i << NumEntries << G4endl;
|
||||
}
|
||||
G4cout << " Done DumpVector " << G4endl;
|
||||
G4cout << " Done DumpVector of " << NumEntries << " entries " << G4endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -383,7 +394,7 @@ G4MaterialPropertyVector::GetAdjacentBins(G4double aPhotonMomentum,
|
||||
G4int mid;
|
||||
|
||||
*left = 0;
|
||||
*right = (MPV.entries() - 1);
|
||||
*right = (MPV.size() - 1); // was .entries()
|
||||
|
||||
// find values in bins on either side of aPhotonMomentum
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpticalSurface.cc,v 1.5.2.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4OpticalSurface.cc,v 1.7 2001/10/17 07:59:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -79,7 +79,7 @@ G4OpticalSurface::G4OpticalSurface(const G4String& name,
|
||||
theModel(model),
|
||||
theFinish(finish),
|
||||
theType(type),
|
||||
theMaterialPropertiesTable(NULL)
|
||||
theMaterialPropertiesTable(0)
|
||||
{
|
||||
if (model == glisur ){
|
||||
polish = value;
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SandiaTable.cc,v 1.11.2.1 2001/06/28 19:10:31 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4SandiaTable.cc,v 1.14 2001/10/17 07:59:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
//
|
||||
// 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
|
||||
@@ -98,7 +99,7 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
|
||||
G4int MaxIntervals = 0;
|
||||
G4int elm;
|
||||
for (elm=0; elm<NbElm; elm++)
|
||||
{ Z[elm] = (int)(*ElementVector)(elm)->GetZ();
|
||||
{ Z[elm] = (int)(*ElementVector)[elm]->GetZ();
|
||||
MaxIntervals += fNbOfIntervals[Z[elm]];
|
||||
}
|
||||
|
||||
@@ -110,10 +111,11 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
|
||||
G4double IonizationPot;
|
||||
G4int interval1=0;
|
||||
for (elm=0; elm<NbElm; elm++)
|
||||
{ IonizationPot = GetIonizationPot(Z[elm]);
|
||||
{
|
||||
IonizationPot = GetIonizationPot(Z[elm]);
|
||||
for (G4int row=fCumulInterval[Z[elm]-1];row<fCumulInterval[Z[elm]];row++)
|
||||
tmp1[interval1++] = G4std::max(fSandiaTable[row][0]*keV,IonizationPot);
|
||||
}
|
||||
tmp1[interval1++] = G4std::max(fSandiaTable[row][0]*keV,IonizationPot);
|
||||
}
|
||||
|
||||
//
|
||||
//sort the energies in strickly increasing values in a tmp2 array
|
||||
@@ -169,7 +171,9 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
|
||||
//check for null or redondant intervals
|
||||
if (newsum != oldsum) { oldsum = newsum; fMatNbOfIntervals++;}
|
||||
}
|
||||
delete Z; delete tmp1; delete tmp2;
|
||||
delete [] Z;
|
||||
delete [] tmp1;
|
||||
delete [] tmp2;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
@@ -391,6 +395,92 @@ G4SandiaTable::SandiaMixing( G4int Z[],
|
||||
return mi ;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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*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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user