Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4AtomicShells.cc 66811 2013-01-12 16:04:23Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4DensityEffectData.cc 66811 2013-01-12 16:04:23Z gcosmo $
//---------------------------------------------------------------------------
//
+35 -39
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4Element.cc 69704 2013-05-13 09:06:12Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -48,7 +48,7 @@
// 26-02-02: fIndexInTable renewed
// 30-03-05: warning in GetElement(elementName)
// 15-11-05: GetElement(elementName, G4bool warning=true)
// 17-10-06: Add fNaturalAbandances (V.Ivanchenko)
// 17-10-06: Add fNaturalAbundances (V.Ivanchenko)
// 27-07-07: improve destructor (V.Ivanchenko)
// 18-10-07: move definition of material index to ComputeDerivedQuantities (VI)
// 25.10.11: new scheme for G4Exception (mma)
@@ -75,17 +75,17 @@ G4Element::G4Element(const G4String& name, const G4String& symbol,
G4double zeff, G4double aeff)
: fName(name), fSymbol(symbol)
{
G4int iz = (G4int)zeff;
if (zeff<1.) {
G4int iz = G4lrint(zeff);
if (iz < 1) {
G4ExceptionDescription ed;
ed << "Fail to create G4Element " << name
<< " Z= " << zeff << " < 1 !" << G4endl;
<< " Z= " << zeff << " < 1 !";
G4Exception ("G4Element::G4Element()", "mat011", FatalException, ed);
}
if (std::abs(zeff - iz) > perMillion) {
G4ExceptionDescription ed;
ed << "G4Element Warning: " << name << " Z= " << zeff
<< " A= " << aeff/(g/mole) << G4endl;
<< " A= " << aeff/(g/mole);
G4Exception("G4Element::G4Element()", "mat017", JustWarning, ed);
}
@@ -102,7 +102,7 @@ G4Element::G4Element(const G4String& name, const G4String& symbol,
ed << "Fail to create G4Element " << name
<< " with Z= " << zeff << " N= " << fNeff
<< " N < Z is not allowed" << G4endl;
G4Exception ("G4Element::G4Element()", "mat012", FatalException, ed);
G4Exception("G4Element::G4Element()", "mat012", FatalException, ed);
}
fNbOfAtomicShells = G4AtomicShells::GetNumberOfShells(iz);
@@ -132,8 +132,12 @@ G4Element::G4Element(const G4String& name,
size_t n = size_t(nIsotopes);
if(0 == nIsotopes) {
AddNaturalIsotopes();
if(0 >= nIsotopes) {
G4ExceptionDescription ed;
ed << "Fail to create G4Element " << name
<< " <" << symbol << "> with " << nIsotopes
<< " isotopes";
G4Exception ("G4Element::G4Element()", "mat012", FatalException, ed);
} else {
theIsotopeVector = new G4IsotopeVector(n,0);
fRelativeAbundanceVector = new G4double[nIsotopes];
@@ -149,7 +153,7 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
if (theIsotopeVector == 0) {
G4ExceptionDescription ed;
ed << "Fail to add Isotope to G4Element " << fName
<< " with Z= " << fZeff << " N= " << fNeff << G4endl;
<< " with Z= " << fZeff << " N= " << fNeff;
G4Exception ("G4Element::AddIsotope()", "mat013", FatalException, ed);
return;
}
@@ -162,8 +166,7 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
else if (G4double(iz) != fZeff) {
G4ExceptionDescription ed;
ed << "Fail to add Isotope Z= " << iz << " to G4Element " << fName
<< " with different Z= " << fZeff << fNeff
<< G4endl;
<< " with different Z= " << fZeff << fNeff;
G4Exception ("G4Element::AddIsotope()", "mat014", FatalException, ed);
return;
}
@@ -171,11 +174,11 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
(*theIsotopeVector)[fNumberOfIsotopes] = isotope;
++fNumberOfIsotopes;
isotope->increaseCountUse();
} else {
G4ExceptionDescription ed;
ed << "Fail to add Isotope Z= " << iz << " to G4Element " << fName
<< " - more isotopes than declaired " << G4endl;
<< " - more isotopes than declaired ";
G4Exception ("G4Element::AddIsotope()", "mat015", FatalException, ed);
return;
}
@@ -185,14 +188,19 @@ void G4Element::AddIsotope(G4Isotope* isotope, G4double abundance)
// Compute Neff, Aeff
G4double wtSum=0.0;
fNeff = fAeff = 0.0;
G4double aeff = 0.0;
G4double neff = 0.0;
for (size_t i=0;i<fNumberOfIsotopes;i++) {
fAeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
fNeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
aeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
neff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
wtSum += fRelativeAbundanceVector[i];
}
fAeff /= wtSum;
fNeff /= wtSum;
aeff /= wtSum;
neff /= wtSum;
if(0.0 == fAeff) {
fAeff = aeff;
fNeff = neff;
}
if(wtSum != 1.0) {
for(size_t i=0; i<fNumberOfIsotopes; ++i) {
@@ -224,17 +232,14 @@ void G4Element::InitializePointers()
fNbOfShellElectrons = 0;
fIonisation = 0;
fNumberOfIsotopes = 0;
fNaturalAbandances = false;
fNaturalAbundance = false;
// add initialisation of all remaining members
fZeff = 0;
fNeff = 0;
fAeff = 0;
fNbOfAtomicShells = 0;
fCountUse = 0;
fIndexZ = 0;
fIndexInTable = 0;
fNaturalAbandances = false;
fCoulomb = 0.0;
fRadTsai = 0.0;
}
@@ -275,14 +280,6 @@ void G4Element::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; }
}
//nb of materials which use this element
fCountUse = 0;
// Radiation Length
ComputeCoulombFactor();
@@ -300,7 +297,7 @@ void G4Element::ComputeCoulombFactor()
//
// Compute Coulomb correction factor (Phys Rev. D50 3-1 (1994) page 1254)
const G4double k1 = 0.0083 , k2 = 0.20206 ,k3 = 0.0020 , k4 = 0.0369 ;
static const G4double k1 = 0.0083 , k2 = 0.20206 ,k3 = 0.0020 , k4 = 0.0369 ;
G4double az2 = (fine_structure_const*fZeff)*(fine_structure_const*fZeff);
G4double az4 = az2 * az2;
@@ -316,8 +313,8 @@ void G4Element::ComputeLradTsaiFactor()
// Compute Tsai's Expression for the Radiation Length
// (Phys Rev. D50 3-1 (1994) page 1254)
const G4double Lrad_light[] = {5.31 , 4.79 , 4.74 , 4.71} ;
const G4double Lprad_light[] = {6.144 , 5.621 , 5.805 , 5.924} ;
static const G4double Lrad_light[] = {5.31 , 4.79 , 4.74 , 4.71} ;
static const G4double Lprad_light[] = {6.144 , 5.621 , 5.805 , 5.924} ;
const G4double logZ3 = std::log(fZeff)/3.;
@@ -360,6 +357,7 @@ void G4Element::AddNaturalIsotopes()
if(xsum != 0.0 && xsum != 1.0) {
for(G4int i=0; i<idx; ++i) { fRelativeAbundanceVector[i] /= xsum; }
}
fNaturalAbundance = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -370,8 +368,7 @@ G4double G4Element::GetAtomicShell(G4int i) const
G4ExceptionDescription ed;
ed << "Invalid argument " << i << " in for G4Element " << fName
<< " with Z= " << fZeff
<< " and Nshells= " << fNbOfAtomicShells
<< G4endl;
<< " and Nshells= " << fNbOfAtomicShells;
G4Exception("G4Element::GetAtomicShell()", "mat016", FatalException, ed);
return 0.0;
}
@@ -386,8 +383,7 @@ G4int G4Element::GetNbOfShellElectrons(G4int i) const
G4ExceptionDescription ed;
ed << "Invalid argument " << i << " for G4Element " << fName
<< " with Z= " << fZeff
<< " and Nshells= " << fNbOfAtomicShells
<< G4endl;
<< " and Nshells= " << fNbOfAtomicShells;
G4Exception("G4Element::GetNbOfShellElectrons()", "mat016", FatalException, ed);
return 0;
}
@@ -396,7 +392,7 @@ G4int G4Element::GetNbOfShellElectrons(G4int i) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4ElementTable* G4Element::GetElementTable()
G4ElementTable* G4Element::GetElementTable()
{
return &theElementTable;
}
+19 -2
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ElementData.cc 76289 2013-11-08 13:07:00Z gcosmo $
//
//---------------------------------------------------------------------------
//
@@ -50,6 +50,7 @@ G4ElementData::G4ElementData()
name = "";
for(G4int i=0; i<maxNumElements; ++i) {
elmData[i] = 0;
elm2Data[i] = 0;
compLength[i] = 0;
}
}
@@ -59,12 +60,15 @@ G4ElementData::G4ElementData()
G4ElementData::~G4ElementData()
{
for(G4int i=0; i<maxNumElements; ++i) {
delete elmData[i];
//delete elmData[i];
delete elm2Data[i];
/*
if(compLength[i] > 0) {
for(size_t j=0; j<compLength[i]; ++j) {
delete (compData[i])[j];
}
}
*/
}
}
@@ -81,6 +85,19 @@ void G4ElementData::InitialiseForElement(G4int Z, G4PhysicsVector* v)
elmData[Z] = v;
}
void G4ElementData::InitialiseForElement(G4int Z, G4Physics2DVector* v)
{
if(Z < 1 || Z >= maxNumElements) {
G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
<< " Z = " << Z << " is out of range!" << G4endl;
G4Exception("G4ElementData::InitialiseForElement()", "mat601",
FatalException, "Wrong data handling");
return;
}
if(elm2Data[Z]) { delete elm2Data[Z]; }
elm2Data[Z] = v;
}
void G4ElementData::InitialiseForComponent(G4int Z, G4int nComponents)
{
if(Z < 1 || Z >= maxNumElements) {
+6 -16
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ExtDEDXTable.cc 72057 2013-07-04 13:07:29Z gcosmo $
//
// ===========================================================================
// GEANT4 class source file
@@ -420,27 +420,17 @@ G4bool G4ExtDEDXTable::RetrievePhysicsTable(const G4String& fileName)
}
//std::string::size_type nmbVectors;
G4int nmbVectors;
G4int nmbVectors = 0;
ifilestream >> nmbVectors;
if( ifilestream.fail() ) {
if( ifilestream.fail() || nmbVectors <= 0) {
G4cout << "G4ExtDEDXTable::RetrievePhysicsTable() "
<< " File content of " << fileName << " ill-formated."
<< G4endl;
<< " File content of " << fileName << " ill-formated."
<< " Nvectors= " << nmbVectors
<< G4endl;
ifilestream.close();
return false;
}
// if(nmbVectors == std::string::npos) {
/*
if(nmbVectors <= 0) {
#ifdef G4VERBOSE
G4cout << "G4ExtDEDXTable::RetrievePhysicsTable() "
<< " The file is corrupted " << G4endl;
#endif
return false;
}
*/
//size_t nm = size_t(nmbVectors);
for(G4int i = 0; i<nmbVectors; ++i) {
G4String line = "";
+2 -2
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4IonStoppingData.cc 76289 2013-11-08 13:07:00Z gcosmo $
//
// ===========================================================================
// GEANT4 class source file
@@ -70,7 +70,7 @@ G4IonStoppingData::G4IonStoppingData(const G4String& leDirectory) :
G4IonStoppingData::~G4IonStoppingData() {
ClearTable();
// ClearTable();
}
// #########################################################################
+3 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4IonisParamElm.cc 68721 2013-04-05 09:20:30Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -77,7 +77,7 @@ G4IonisParamElm::G4IonisParamElm(G4double AtomNumber)
G4int iz = Z - 1;
if(91 < iz) { iz = 91; }
static G4double vFermi[92] = {
static const 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,
@@ -89,7 +89,7 @@ G4IonisParamElm::G4IonisParamElm(G4double AtomNumber)
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] = {
static const 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,
+66 -41
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4IonisParamMat.cc 76883 2013-11-18 12:50:08Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -48,6 +48,8 @@
#include "G4Pow.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
G4DensityEffectData* G4IonisParamMat::fDensityData = 0;
@@ -133,23 +135,23 @@ void G4IonisParamMat::ComputeMeanParameters()
const G4ElementVector* elmVector = fMaterial->GetElementVector();
const G4double* nAtomsPerVolume = fMaterial->GetVecNbOfAtomsPerVolume();
const G4String ch = fMaterial->GetChemicalFormula();
G4String ch = fMaterial->GetChemicalFormula();
if(ch != "") { fMeanExcitationEnergy = FindMeanExcitationEnergy(ch); }
// Chemical formula defines mean excitation energy
if(fMeanExcitationEnergy > 0.0) {
fLogMeanExcEnergy = std::log(fMeanExcitationEnergy);
fLogMeanExcEnergy = G4Log(fMeanExcitationEnergy);
// Compute average
} else {
for (size_t i=0; i < nElements; i++) {
const G4Element* elm = (*elmVector)[i];
fLogMeanExcEnergy += nAtomsPerVolume[i]*elm->GetZ()
*std::log(elm->GetIonisation()->GetMeanExcitationEnergy());
*G4Log(elm->GetIonisation()->GetMeanExcitationEnergy());
}
fLogMeanExcEnergy /= fMaterial->GetTotNbOfElectPerVolume();
fMeanExcitationEnergy = std::exp(fLogMeanExcEnergy);
fMeanExcitationEnergy = G4Exp(fLogMeanExcEnergy);
}
fShellCorrectionVector = new G4double[3];
@@ -183,7 +185,7 @@ void G4IonisParamMat::ComputeDensityEffect()
// R.M. Sternheimer, Atomic Data and Nuclear Data Tables, 30: 261 (1984)
G4int idx = fDensityData->GetIndex(fMaterial->GetName());
G4int nelm= fMaterial->GetNumberOfElements();
G4int Z0 = G4int((*(fMaterial->GetElementVector()))[0]->GetZ()+0.5);
G4int Z0 = G4lrint((*(fMaterial->GetElementVector()))[0]->GetZ());
if(idx < 0 && 1 == nelm) {
idx = fDensityData->GetElementIndex(Z0, fMaterial->GetState());
}
@@ -209,7 +211,7 @@ void G4IonisParamMat::ComputeDensityEffect()
// Correction for base material
const G4Material* bmat = fMaterial->GetBaseMaterial();
if(bmat) {
G4double corr = std::log(bmat->GetDensity()/fMaterial->GetDensity());
G4double corr = G4Log(bmat->GetDensity()/fMaterial->GetDensity());
fCdensity += corr;
fX0density += corr/twoln10;
fX1density += corr/twoln10;
@@ -217,23 +219,23 @@ void G4IonisParamMat::ComputeDensityEffect()
} else {
const G4double Cd2 = 4*pi*hbarc_squared*classic_electr_radius;
static const G4double Cd2 = 4*pi*hbarc_squared*classic_electr_radius;
fPlasmaEnergy = std::sqrt(Cd2*fMaterial->GetTotNbOfElectPerVolume());
// Compute parameters for the density effect correction in DE/Dx formula.
// The parametrization is from R.M. Sternheimer, Phys. Rev.B,3:3681 (1971)
G4int icase;
fCdensity = 1. + 2*std::log(fMeanExcitationEnergy/fPlasmaEnergy);
fCdensity = 1. + 2*G4Log(fMeanExcitationEnergy/fPlasmaEnergy);
//
// condensed materials
//
if ((State == kStateSolid)||(State == kStateLiquid)) {
const G4double E100eV = 100.*eV;
const G4double ClimiS[] = {3.681 , 5.215 };
const G4double X0valS[] = {1.0 , 1.5 };
const G4double X1valS[] = {2.0 , 3.0 };
static const G4double E100eV = 100.*eV;
static const G4double ClimiS[] = {3.681 , 5.215 };
static const G4double X0valS[] = {1.0 , 1.5 };
static const G4double X1valS[] = {2.0 , 3.0 };
if(fMeanExcitationEnergy < E100eV) { icase = 0; }
else { icase = 1; }
@@ -253,14 +255,24 @@ void G4IonisParamMat::ComputeDensityEffect()
//
if (State == kStateGas) {
const G4double ClimiG[] = { 10. , 10.5 , 11. , 11.5 , 12.25 , 13.804};
const G4double X0valG[] = { 1.6 , 1.7 , 1.8 , 1.9 , 2.0 , 2.0 };
const G4double X1valG[] = { 4.0 , 4.0 , 4.0 , 4.0 , 4.0 , 5.0 };
fMdensity = 3.;
fX1density = 4.0;
//static const G4double ClimiG[] = { 10. , 10.5 , 11. , 11.5 , 12.25 , 13.804};
//static const G4double X0valG[] = { 1.6 , 1.7 , 1.8 , 1.9 , 2.0 , 2.0 };
//static const G4double X1valG[] = { 4.0 , 4.0 , 4.0 , 4.0 , 4.0 , 5.0 };
icase = 5;
fX0density = 0.326*fCdensity-2.5 ; fX1density = 5.0 ; fMdensity = 3. ;
while((icase > 0)&&(fCdensity < ClimiG[icase])) { icase-- ; }
fX0density = X0valG[icase]; fX1density = X1valG[icase];
if(fCdensity < 10.) {
fX0density = 1.6;
} else if(fCdensity < 11.5) {
fX0density = 1.6 + 0.2*(fCdensity - 10.);
} else if(fCdensity < 12.25) {
fX0density = 1.9 + (fCdensity - 11.5)/7.5;
} else if(fCdensity < 13.804) {
fX0density = 2.0;
fX1density = 4.0 + (fCdensity - 12.25)/1.554;
} else {
fX0density = 0.326*fCdensity-2.5; fX1density = 5.0;
}
//special: Hydrogen
if (1 == nelm && 1 == Z0) {
@@ -286,7 +298,7 @@ void G4IonisParamMat::ComputeDensityEffect()
G4double DensitySTP = Density*STP_Pressure*Temp/(Pressure*STP_Temperature);
G4double ParCorr = std::log(Density/DensitySTP);
G4double ParCorr = G4Log(Density/DensitySTP);
fCdensity -= ParCorr;
fX0density -= ParCorr/twoln10;
@@ -329,10 +341,10 @@ void G4IonisParamMat::ComputeFluctModel()
fF1fluct = 1. - fF2fluct;
fEnergy2fluct = 10.*Zeff*Zeff*eV;
fLogEnergy2fluct = std::log(fEnergy2fluct);
fLogEnergy2fluct = G4Log(fEnergy2fluct);
fLogEnergy1fluct = (fLogMeanExcEnergy - fF2fluct*fLogEnergy2fluct)
/fF1fluct;
fEnergy1fluct = std::exp(fLogEnergy1fluct);
fEnergy1fluct = G4Exp(fLogEnergy1fluct);
fEnergy0fluct = 10.*eV;
fRateionexcfluct = 0.4;
}
@@ -396,7 +408,7 @@ void G4IonisParamMat::SetMeanExcitationEnergy(G4double value)
fMeanExcitationEnergy = value;
// add corrections to density effect
G4double newlog = std::log(value);
G4double newlog = G4Log(value);
G4double corr = 2*(newlog - fLogMeanExcEnergy);
fCdensity += corr;
fX0density += corr/twoln10;
@@ -415,29 +427,42 @@ G4double G4IonisParamMat::FindMeanExcitationEnergy(const G4String& chFormula)
// from "Stopping Powers for Electrons and Positrons"
// ICRU Report N#37, 1984 (energy in eV)
const size_t numberOfMolecula = 54;
static G4String name[numberOfMolecula] = {
size_t numberOfMolecula = 54;
static const G4String name[54] = {
// gas 0 - 12
"NH_3", "C_4H_10", "CO_2", "C_2H_6", "C_7H_16",
"C_6H_14", "CH_4", "NO", "N_2O", "C_8H_18",
"C_5H_12", "C_3H_8", "H_2O-Gas",
"NH_3", "C_4H_10", "CO_2", "C_2H_6", "C_7H_16-Gas",
// "G4_AMMONIA", "G4_BUTANE","G4_CARBON_DIOXIDE","G4_ETHANE", "G4_N-HEPTANE"
"C_6H_14-Gas", "CH_4", "NO", "N_2O", "C_8H_18-Gas",
// "G4_N-HEXANE" , "G4_METHANE", "x", "G4_NITROUS_OXIDE", "G4_OCTANE"
"C_5H_12-Gas", "C_3H_8", "H_2O-Gas",
// "G4_N-PENTANE", "G4_PROPANE", "G4_WATER_VAPOR"
// liquid 13 - 39
"C_3H_6O", "C_6H_5NH_2", "C_6H_6", "C_4H_9OH", "CCl_4",
"C_6H_5Cl", "CHCl_3", "C_6H_12", "C_6H_4Cl_2", "C_4Cl_2H_8O",
"C_2Cl_2H_4", "(C_2H_5)_2O", "C_2H_5OH", "C_3H_5(OH)_3","C_7H_16",
"C_6H_14", "CH_3OH", "C_6H_5NO_2","C_5H_12", "C_3H_7OH",
"C_5H_5N", "C_8H_8", "C_2Cl_4", "C_7H_8", "C_2Cl_3H",
"H_2O", "C_8H_10",
"C_3H_6O", "C_6H_5NH_2", "C_6H_6", "C_4H_9OH", "CCl_4",
//"G4_ACETONE","G4_ANILINE","G4_BENZENE","G4_N-BUTYL_ALCOHOL","G4_CARBON_TETRACHLORIDE"
"C_6H_5Cl", "CHCl_3", "C_6H_12", "C_6H_4Cl_2", "C_4Cl_2H_8O",
//"G4_CHLOROBENZENE","G4_CHLOROFORM","G4_CYCLOHEXANE","G4_1,2-DICHLOROBENZENE","G4_DICHLORODIETHYL_ETHER"
"C_2Cl_2H_4", "(C_2H_5)_2O", "C_2H_5OH", "C_3H_5(OH)_3","C_7H_16",
//"G4_1,2-DICHLOROETHANE","G4_DIETHYL_ETHER","G4_ETHYL_ALCOHOL","G4_GLYCEROL","G4_N-HEPTANE"
"C_6H_14", "CH_3OH", "C_6H_5NO_2","C_5H_12", "C_3H_7OH",
//"G4_N-HEXANE","G4_METHANOL","G4_NITROBENZENE","G4_N-PENTANE","G4_N-PROPYL_ALCOHOL",
"C_5H_5N", "C_8H_8", "C_2Cl_4", "C_7H_8", "C_2Cl_3H",
//"G4_PYRIDINE","G4_POLYSTYRENE","G4_TETRACHLOROETHYLENE","G4_TOLUENE","G4_TRICHLOROETHYLENE"
"H_2O", "C_8H_10",
// "G4_WATER", "G4_XYLENE"
// solid 40 - 53
"C_5H_5N_5", "C_5H_5N_5O", "(C_6H_11NO)-nylon", "C_25H_52",
"(C_2H_4)-Polyethylene", "(C_5H_8O-2)-Polymethil_Methacrylate",
"(C_8H_8)-Polystyrene", "A-150-tissue", "Al_2O_3", "CaF_2",
"LiF", "Photo_Emulsion", "(C_2F_4)-Teflon", "SiO_2"
};
"C_5H_5N_5", "C_5H_5N_5O", "(C_6H_11NO)-nylon", "C_25H_52",
// "G4_ADENINE", "G4_GUANINE", "G4_NYLON-6-6", "G4_PARAFFIN"
"(C_2H_4)-Polyethylene", "(C_5H_8O_2)-Polymethil_Methacrylate",
// "G4_ETHYLENE", "G4_PLEXIGLASS"
"(C_8H_8)-Polystyrene", "A-150-tissue", "Al_2O_3", "CaF_2",
// "G4_POLYSTYRENE", "G4_A-150_TISSUE", "G4_ALUMINUM_OXIDE", "G4_CALCIUM_FLUORIDE"
"LiF", "Photo_Emulsion", "(C_2F_4)-Teflon", "SiO_2"
// "G4_LITHIUM_FLUORIDE", "G4_PHOTO_EMULSION", "G4_TEFLON", "G4_SILICON_DIOXIDE"
} ;
static G4double meanExcitation[numberOfMolecula] = {
static const G4double meanExcitation[54] = {
53.7, 48.3, 85.0, 45.4, 49.2,
49.1, 41.7, 87.8, 84.9, 49.5,
+4 -4
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4Isotope.cc 68070 2013-03-13 15:03:06Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -57,7 +57,7 @@ G4IsotopeTable G4Isotope::theIsotopeTable;
// Create an isotope
//
G4Isotope::G4Isotope(const G4String& Name,G4int Z,G4int N,G4double A,G4int il)
: fName(Name), fZ(Z), fN(N), fA(A), fm(il), fCountUse(0)
: fName(Name), fZ(Z), fN(N), fA(A), fm(il)//, fCountUse(0)
{
if (Z<1) {
G4ExceptionDescription ed;
@@ -82,7 +82,7 @@ G4Isotope::G4Isotope(const G4String& Name,G4int Z,G4int N,G4double A,G4int il)
// for usage restricted to object persistency
G4Isotope::G4Isotope(__void__&)
: fZ(0), fN(0), fA(0), fm(0), fCountUse(0), fIndexInTable(0)
: fZ(0), fN(0), fA(0), fm(0), /*fCountUse(0),*/ fIndexInTable(0)
{
}
@@ -115,7 +115,7 @@ G4Isotope & G4Isotope::operator=(const G4Isotope& right)
fN = right.fN;
fA = right.fA;
fm = right.fm;
fCountUse = right.fCountUse;
// fCountUse = right.fCountUse;
}
return *this;
}
+243
View File
@@ -0,0 +1,243 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file materials/src/G4LatticeLogical.cc
/// \brief Implementation of the G4LatticeLogical class
//
// $Id: G4LatticeLogical.cc 76764 2013-11-15 09:37:24Z gcosmo $
//
#include "G4LatticeLogical.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include <cmath>
#include <fstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LatticeLogical::G4LatticeLogical()
: verboseLevel(0), fVresTheta(0), fVresPhi(0), fDresTheta(0), fDresPhi(0),
fA(0), fB(0), fLDOS(0), fSTDOS(0), fFTDOS(0),
fBeta(0), fGamma(0), fLambda(0), fMu(0) {
for (G4int i=0; i<3; i++) {
for (G4int j=0; j<MAXRES; j++) {
for (G4int k=0; k<MAXRES; k++) {
fMap[i][j][k] = 0.;
fN_map[i][j][k].set(0.,0.,0.);
}
}
}
}
G4LatticeLogical::~G4LatticeLogical() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
///////////////////////////////////////////
//Load map of group velocity scalars (m/s)
////////////////////////////////////////////
G4bool G4LatticeLogical::LoadMap(G4int tRes, G4int pRes,
G4int polarizationState, G4String map) {
if (tRes>MAXRES || pRes>MAXRES) {
G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of "
<< MAXRES << " by " << MAXRES << ". terminating." << G4endl;
return false; //terminate if resolution out of bounds.
}
std::ifstream fMapFile(map.data());
if (!fMapFile.is_open()) return false;
G4double vgrp = 0.;
for (G4int theta = 0; theta<tRes; theta++) {
for (G4int phi = 0; phi<pRes; phi++) {
fMapFile >> vgrp;
fMap[polarizationState][theta][phi] = vgrp * (m/s);
}
}
if (verboseLevel) {
G4cout << "\nG4LatticeLogical::LoadMap(" << map << ") successful"
<< " (Vg scalars " << tRes << " x " << pRes << " for polarization "
<< polarizationState << ")." << G4endl;
}
fVresTheta=tRes; //store map dimensions
fVresPhi=pRes;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
////////////////////////////////////
//Load map of group velocity unit vectors
///////////////////////////////////
G4bool G4LatticeLogical::Load_NMap(G4int tRes, G4int pRes,
G4int polarizationState, G4String map) {
if (tRes>MAXRES || pRes>MAXRES) {
G4cerr << "G4LatticeLogical::LoadMap exceeds maximum resolution of "
<< MAXRES << " by " << MAXRES << ". terminating." << G4endl;
return false; //terminate if resolution out of bounds.
}
std::ifstream fMapFile(map.data());
if(!fMapFile.is_open()) return false;
G4double x,y,z; // Buffers to read coordinates from file
G4ThreeVector dir;
for (G4int theta = 0; theta<tRes; theta++) {
for (G4int phi = 0; phi<pRes; phi++) {
fMapFile >> x >> y >> z;
dir.set(x,y,z);
fN_map[polarizationState][theta][phi] = dir.unit(); // Enforce unity
}
}
if (verboseLevel) {
G4cout << "\nG4LatticeLogical::Load_NMap(" << map << ") successful"
<< " (Vdir " << tRes << " x " << pRes << " for polarization "
<< polarizationState << ")." << G4endl;
}
fDresTheta=tRes; //store map dimensions
fDresPhi=pRes;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//Given the phonon wave vector k, phonon physical volume Vol
//and polarizationState(0=LON, 1=FT, 2=ST),
//returns phonon velocity in m/s
G4double G4LatticeLogical::MapKtoV(G4int polarizationState,
const G4ThreeVector& k) const {
G4double theta, phi, tRes, pRes;
tRes=pi/fVresTheta;
pRes=twopi/fVresPhi;
theta=k.getTheta();
phi=k.getPhi();
if(phi<0) phi = phi + twopi;
if(theta>pi) theta=theta-pi;
G4double Vg = fMap[polarizationState][int(theta/tRes)][int(phi/pRes)];
if(Vg == 0){
G4cout<<"\nFound v=0 for polarization "<<polarizationState
<<" theta "<<theta<<" phi "<<phi<< " translating to map coords "
<<"theta "<< int(theta/tRes) << " phi " << int(phi/pRes)<<G4endl;
}
if (verboseLevel>1) {
G4cout << "G4LatticeLogical::MapKtoV theta,phi=" << theta << " " << phi
<< " : ith,iph " << int(theta/tRes) << " " << int(phi/pRes)
<< " : V " << Vg << G4endl;
}
return Vg;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//Given the phonon wave vector k, phonon physical volume Vol
//and polarizationState(0=LON, 1=FT, 2=ST),
//returns phonon propagation direction as dimensionless unit vector
G4ThreeVector G4LatticeLogical::MapKtoVDir(G4int polarizationState,
const G4ThreeVector& k) const {
G4double theta, phi, tRes, pRes;
tRes=pi/(fDresTheta-1);//The summant "-1" is required:index=[0:array length-1]
pRes=2*pi/(fDresPhi-1);
theta=k.getTheta();
phi=k.getPhi();
if(theta>pi) theta=theta-pi;
//phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
if(phi<0) phi = phi + 2*pi;
G4int iTheta = int(theta/tRes+0.5);
G4int iPhi = int(phi/pRes+0.5);
if (verboseLevel>1) {
G4cout << "G4LatticeLogical::MapKtoVDir theta,phi=" << theta << " " << phi
<< " : ith,iph " << iTheta << " " << iPhi
<< " : dir " << fN_map[polarizationState][iTheta][iPhi] << G4endl;
}
return fN_map[polarizationState][iTheta][iPhi];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Dump structure in format compatible with reading back
void G4LatticeLogical::Dump(std::ostream& os) const {
os << "dyn " << fBeta << " " << fGamma << " " << fLambda << " " << fMu
<< "\nscat " << fB << " decay " << fA
<< "\nLDOS " << fLDOS << " STDOS " << fSTDOS << " FTDOS " << fFTDOS
<< std::endl;
Dump_NMap(os, 0, "LVec.ssv");
Dump_NMap(os, 1, "FTVec.ssv");
Dump_NMap(os, 2, "STVec.ssv");
DumpMap(os, 0, "L.ssv");
DumpMap(os, 1, "FT.ssv");
DumpMap(os, 2, "ST.ssv");
}
void G4LatticeLogical::DumpMap(std::ostream& os, G4int pol,
const G4String& name) const {
os << "VG " << name << " " << (pol==0?"L":pol==1?"FT":pol==2?"ST":"??")
<< " " << fVresTheta << " " << fVresPhi << std::endl;
for (G4int iTheta=0; iTheta<fVresTheta; iTheta++) {
for (G4int iPhi=0; iPhi<fVresPhi; iPhi++) {
os << fMap[pol][iTheta][iPhi] << std::endl;
}
}
}
void G4LatticeLogical::Dump_NMap(std::ostream& os, G4int pol,
const G4String& name) const {
os << "VDir " << name << " " << (pol==0?"L":pol==1?"FT":pol==2?"ST":"??")
<< " " << fDresTheta << " " << fDresPhi << std::endl;
for (G4int iTheta=0; iTheta<fDresTheta; iTheta++) {
for (G4int iPhi=0; iPhi<fDresPhi; iPhi++) {
os << fN_map[pol][iTheta][iPhi].x()
<< " " << fN_map[pol][iTheta][iPhi].y()
<< " " << fN_map[pol][iTheta][iPhi].z()
<< std::endl;
}
}
}
+157
View File
@@ -0,0 +1,157 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file materials/src/G4LatticePhysical.cc
/// \brief Implementation of the G4LatticePhysical class
//
// $Id: G4LatticePhysical.cc 76883 2013-11-18 12:50:08Z gcosmo $
//
// 20131115 Save rotation results in local variable, report verbosely
// 20131116 Replace G4Transform3D with G4RotationMatrix
#include "G4LatticePhysical.hh"
#include "G4LatticeLogical.hh"
#include "G4PhysicalConstants.hh"
#include "G4RotationMatrix.hh"
#include "G4SystemOfUnits.hh"
// Unit vectors defined for convenience (avoid memory churn)
namespace {
G4ThreeVector xhat(1,0,0), yhat(0,1,0), zhat(0,0,1), nullVec(0,0,0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LatticePhysical::G4LatticePhysical(const G4LatticeLogical* Lat,
const G4RotationMatrix* Rot)
: verboseLevel(0), fTheta(0), fPhi(0), fLattice(Lat) {
SetPhysicalOrientation(Rot);
}
G4LatticePhysical::~G4LatticePhysical() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LatticePhysical::SetPhysicalOrientation(const G4RotationMatrix* Rot) {
if (!Rot) { // No orientation specified
fLocalToGlobal = fGlobalToLocal = G4RotationMatrix::IDENTITY;
} else {
fLocalToGlobal = fGlobalToLocal = *Rot; // Frame rotation
fGlobalToLocal.invert();
}
if (verboseLevel) {
G4cout << "G4LatticePhysical::SetPhysicalOrientation " << *Rot
<< "\nfLocalToGlobal: " << fLocalToGlobal
<< "\nfGlobalToLocal: " << fGlobalToLocal
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LatticePhysical::SetLatticeOrientation(G4double t_rot, G4double p_rot) {
fTheta = t_rot;
fPhi = p_rot;
if (verboseLevel)
G4cout << "G4LatticePhysical::SetLatticeOrientation " << fTheta << " "
<< fPhi << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LatticePhysical::SetMillerOrientation(G4int l, G4int k, G4int n) {
fTheta = halfpi - std::atan2(n+0.000001,l+0.000001);
fPhi = halfpi - std::atan2(l+0.000001,k+0.000001);
if (verboseLevel)
G4cout << "G4LatticePhysical::SetMillerOrientation(" << l << k << n
<< ") : " << fTheta << " " << fPhi << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
///////////////////////////////
//Loads the group velocity in m/s
/////////////////////////////
G4double G4LatticePhysical::MapKtoV(G4int polarizationState,
G4ThreeVector k) const {
if (verboseLevel>1) G4cout << "G4LatticePhysical::MapKtoV " << k << G4endl;
k.rotate(yhat,fTheta).rotate(zhat, fPhi);
return fLattice->MapKtoV(polarizationState, k);
}
///////////////////////////////
//Loads the normalized direction vector along VG
///////////////////////////////
G4ThreeVector G4LatticePhysical::MapKtoVDir(G4int polarizationState,
G4ThreeVector k) const {
if (verboseLevel>1) G4cout << "G4LatticePhysical::MapKtoVDir " << k << G4endl;
k.rotate(yhat,fTheta).rotate(zhat,fPhi);
G4ThreeVector VG = fLattice->MapKtoVDir(polarizationState, k);
return VG.rotate(zhat,-fPhi).rotate(yhat,-fTheta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Apply orientation transforms to specified vector
G4ThreeVector
G4LatticePhysical::RotateToGlobal(const G4ThreeVector& dir) const {
if (verboseLevel>1) {
G4cout << "G4LatticePhysical::RotateToGlobal " << dir
<< "\nusing fLocalToGlobal " << fLocalToGlobal
<< G4endl;
}
G4ThreeVector result = fLocalToGlobal*dir;
if (verboseLevel>1) G4cout << " result " << result << G4endl;
return result;
}
G4ThreeVector
G4LatticePhysical::RotateToLocal(const G4ThreeVector& dir) const {
if (verboseLevel>1) {
G4cout << "G4LatticePhysical::RotateToLocal " << dir
<< "\nusing fGlobalToLocal " << fGlobalToLocal
<< G4endl;
}
G4ThreeVector result = fGlobalToLocal*dir;
if (verboseLevel>1) G4cout << " result " << result << G4endl;
return result;
}
+33 -31
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4Material.cc 70847 2013-06-06 11:56:34Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
@@ -75,7 +75,6 @@
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4Pow.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
@@ -94,7 +93,7 @@ G4Material::G4Material(const G4String& name, G4double z,
if (density < universe_mean_density)
{
G4cout << "--- Warning from G4Material::G4Material()"
G4cout << " G4Material WARNING:"
<< " 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)
@@ -118,8 +117,6 @@ G4Material::G4Material(const G4String& name, G4double z,
fMassFractionVector[0] = 1. ;
fMassOfMolecule = a/Avogadro;
(*theElementVector)[0] -> increaseCountUse();
if (fState == kStateUndefined)
{
if (fDensity > kGasThreshold) { fState = kStateSolid; }
@@ -217,7 +214,7 @@ G4Material::G4Material(__void__&)
: fNumberOfComponents(0), fNumberOfElements(0), theElementVector(0),
fImplicitElement(false), fMassFractionVector(0), fAtomsVector(0),
fMaterialPropertiesTable(0), fIndexInTable(0),
VecNbOfAtomsPerVolume(0), fIonisation(0), fSandiaTable(0)
VecNbOfAtomsPerVolume(0)
{
InitializePointers();
}
@@ -231,9 +228,9 @@ G4Material::~G4Material()
if (theElementVector) { delete theElementVector; }
if (fMassFractionVector) { delete [] fMassFractionVector; }
if (fAtomsVector) { delete [] fAtomsVector; }
if (fSandiaTable) { delete fSandiaTable; }
if (fSandiaTable) { delete fSandiaTable; }
}
if (fIonisation) { delete fIonisation; }
if (fIonisation) { delete fIonisation; }
if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
// Remove this material from theMaterialTable.
@@ -251,9 +248,6 @@ void G4Material::InitializePointers()
fMaterialPropertiesTable = 0;
VecNbOfAtomsPerVolume = 0;
fIonisation = 0;
fSandiaTable = 0;
fBaseMaterial = 0;
fImplicitElement = false;
@@ -272,9 +266,19 @@ void G4Material::InitializePointers()
fNuclInterLen = 0.0;
fMassOfMolecule = 0.0;
fIonisation = 0;
fSandiaTable = 0;
// Store in the static Table of Materials
fIndexInTable = theMaterialTable.size();
for(size_t i=0; i<fIndexInTable; ++i) {
if(theMaterialTable[i]->GetName() == fName) {
G4cout << "G4Material WARNING: doublicate name of the new material "
<< fName << G4endl;
break;
}
}
theMaterialTable.push_back(this);
fIndexInTable = theMaterialTable.size() - 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -328,7 +332,7 @@ void G4Material::CopyPointersOfBaseMaterial()
fRadlen = fBaseMaterial->GetRadlen()/factor;
fNuclInterLen = fBaseMaterial->GetNuclearInterLength()/factor;
if (fIonisation) { delete fIonisation; }
fIonisation = new G4IonisParamMat(this);
fIonisation = new G4IonisParamMat(this);
fSandiaTable = fBaseMaterial->GetSandiaTable();
fIonisation->SetMeanExcitationEnergy(fBaseMaterial->GetIonisation()->GetMeanExcitationEnergy());
@@ -351,7 +355,6 @@ void G4Material::AddElement(G4Element* element, G4int nAtoms)
theElementVector->push_back(element);
fAtomsVector[fNumberOfElements] = nAtoms;
fNumberOfComponents = ++fNumberOfElements;
element->increaseCountUse();
} else {
G4cout << "G4Material::AddElement ERROR for " << fName << " nElement= "
<< fNumberOfElements << G4endl;
@@ -404,7 +407,7 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
theElementVector->push_back(element);
fMassFractionVector[el] = fraction;
++fNumberOfElements;
element->increaseCountUse();
// element->increaseCountUse();
}
++fNumberOfComponents;
} else {
@@ -433,7 +436,7 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
}
for (i=0; i<fNumberOfElements; ++i) {
fAtomsVector[i] =
G4int(fMassFractionVector[i]*Amol/(*theElementVector)[i]->GetA()+0.5);
G4lrint(fMassFractionVector[i]*Amol/(*theElementVector)[i]->GetA());
}
ComputeDerivedQuantities();
@@ -449,7 +452,7 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
if(fraction < 0.0 || fraction > 1.0) {
G4cout << "G4Material::AddMaterial ERROR for " << fName << " and "
<< material->GetName() << " mass fraction= " << fraction
<< " is wrong " << G4endl;
<< " is wrong ";
G4Exception ("G4Material::AddMaterial()", "mat034", FatalException,
"Attempt to add material with wrong mass fraction");
}
@@ -491,7 +494,7 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
fMassFractionVector[el] = fraction
*(material->GetFractionVector())[elm];
++fNumberOfElements;
element->increaseCountUse();
//element->increaseCountUse();
}
}
++fNumberOfComponents;
@@ -524,7 +527,7 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
}
for (i=0;i<fNumberOfElements;i++) {
fAtomsVector[i] =
G4int(fMassFractionVector[i]*Amol/(*theElementVector)[i]->GetA()+0.5);
G4lrint(fMassFractionVector[i]*Amol/(*theElementVector)[i]->GetA());
}
ComputeDerivedQuantities();
@@ -546,12 +549,11 @@ void G4Material::ComputeRadiationLength()
void G4Material::ComputeNuclearInterLength()
{
const G4double lambda0 = 35*g/cm2;
static const G4double lambda0 = 35*g/cm2;
G4double NILinv = 0.0;
G4Pow* g4pow = G4Pow::GetInstance();
for (size_t i=0; i<fNumberOfElements; ++i) {
NILinv +=
VecNbOfAtomsPerVolume[i]*g4pow->Z23(G4int((*theElementVector)[i]->GetN()+0.5));
VecNbOfAtomsPerVolume[i]*std::pow((*theElementVector)[i]->GetN(),0.6666666667);
}
NILinv *= amu/lambda0;
fNuclInterLen = (NILinv <= 0.0 ? DBL_MAX : 1./NILinv);
@@ -559,7 +561,7 @@ void G4Material::ComputeNuclearInterLength()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4MaterialTable* G4Material::GetMaterialTable()
G4MaterialTable* G4Material::GetMaterialTable()
{
return &theMaterialTable;
}
@@ -604,8 +606,8 @@ G4Material::G4Material(const G4Material& right)
G4double G4Material::GetZ() const
{
if (fNumberOfElements > 1) {
G4cout << "G4Material ERROR in GetZ. The material: " << fName << " is a mixture."
<< G4endl;
G4cout << "G4Material ERROR in GetZ. The material: " << fName
<< " is a mixture.";
G4Exception ("G4Material::GetZ()", "mat036", FatalException,
"the Atomic number is not well defined." );
}
@@ -617,8 +619,8 @@ G4double G4Material::GetZ() const
G4double G4Material::GetA() const
{
if (fNumberOfElements > 1) {
G4cout << "G4Material ERROR in GetA. The material: " << fName << " is a mixture."
<< G4endl;
G4cout << "G4Material ERROR in GetA. The material: " << fName
<< " is a mixture.";
G4Exception ("G4Material::GetA()", "mat037", FatalException,
"the Atomic mass is not well defined." );
}
@@ -671,8 +673,7 @@ const G4Material& G4Material::operator=(const G4Material& right)
fAtomsVector[i] = right.fAtomsVector[i];
}
ComputeDerivedQuantities();
}
}
}
return *this;
}
@@ -693,7 +694,6 @@ G4int G4Material::operator!=(const G4Material& right) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::ostream& operator<<(std::ostream& flux, G4Material* material)
{
std::ios::fmtflags mode = flux.flags();
@@ -708,7 +708,7 @@ std::ostream& operator<<(std::ostream& flux, G4Material* material)
<< " RadL: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->fRadlen,"Length")
<< " Nucl.Int.Length: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->fNuclInterLen,"Length")
<< G4BestUnit(material->fNuclInterLen,"Length") <<"\n" << std::setw(30)
<< " Imean: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->GetIonisation()->GetMeanExcitationEnergy(),"Energy");
@@ -719,6 +719,8 @@ std::ostream& operator<<(std::ostream& flux, G4Material* material)
<< " pressure: " << std::setw(6) << std::setprecision(2)
<< (material->fPressure)/atmosphere << " atm";
}
flux << "\n";
for (size_t i=0; i<material->fNumberOfElements; i++) {
flux
<< "\n ---> " << (*(material->theElementVector))[i]
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4MaterialPropertiesTable.cc 66811 2013-01-12 16:04:23Z gcosmo $
//
//
////////////////////////////////////////////////////////////////////////
+37 -50
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4NistElementBuilder.cc 72057 2013-07-04 13:07:29Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -80,7 +80,7 @@ G4NistElementBuilder::~G4NistElementBuilder()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4NistElementBuilder::GetZ(const G4String& name)
G4int G4NistElementBuilder::GetZ(const G4String& name) const
{
G4int Z = maxNumElements;
do {--Z;} while( Z>0 && elmSymbol[Z] != name);
@@ -89,7 +89,7 @@ G4int G4NistElementBuilder::GetZ(const G4String& name)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4NistElementBuilder::GetAtomicMassAmu(const G4String& name)
G4double G4NistElementBuilder::GetAtomicMassAmu(const G4String& name) const
{
G4int Z = maxNumElements;
do {--Z;} while( Z>0 && elmSymbol[Z] != name);
@@ -98,8 +98,7 @@ G4double G4NistElementBuilder::GetAtomicMassAmu(const G4String& name)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb,
G4bool buildIsotopes)
G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb, G4bool)
{
if(first) {
if(verbose > 0) {
@@ -110,7 +109,7 @@ G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb,
G4Element* elm = 0;
for(G4int Z = 1; Z<maxNumElements; ++Z) {
if(symb == elmSymbol[Z]) {
elm = FindOrBuildElement(Z, buildIsotopes);
elm = FindOrBuildElement(Z);
break;
}
}
@@ -119,8 +118,7 @@ G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Element* G4NistElementBuilder::FindOrBuildElement(G4int Z,
G4bool buildIsotopes)
G4Element* G4NistElementBuilder::FindOrBuildElement(G4int Z, G4bool)
{
G4Element* anElement = 0;
if(Z <= 0 || Z >= maxNumElements) { return anElement; }
@@ -132,7 +130,7 @@ G4Element* G4NistElementBuilder::FindOrBuildElement(G4int Z,
// build new element
} else {
anElement = BuildElement(Z, buildIsotopes);
anElement = BuildElement(Z);
if(anElement) { elmIndex[Z] = anElement->GetIndex(); }
}
return anElement;
@@ -140,65 +138,54 @@ G4Element* G4NistElementBuilder::FindOrBuildElement(G4int Z,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Element* G4NistElementBuilder::BuildElement(G4int Z, G4bool buildIsotopes)
G4Element* G4NistElementBuilder::BuildElement(G4int Z)
{
G4Element* theElement = 0;
if(Z<1 || Z>=maxNumElements) { return theElement; }
G4double Zeff = (G4double)Z;
G4double Aeff = atomicMass[Z];
if (verbose > 1) {
G4cout << "G4NistElementBuilder: Build Element <" << elmSymbol[Z]
<< "> Z= " << Zeff
<< " A= " << Aeff;
if(buildIsotopes) { G4cout << " with natural isotope composition" << G4endl; }
else { G4cout << " isotopes are not built" << G4endl; }
<< "> Z= " << Z
<< " Aeff= " << Aeff;
G4cout << " with natural isotope composition" << G4endl;
}
//build Element with its Isotopes
//
if (buildIsotopes) {
G4int nc = nIsotopes[Z];
G4int n0 = nFirstIsotope[Z];
G4int idx = idxIsotopes[Z];
std::vector<G4Isotope*> iso;
G4Isotope* ist;
for (G4int i=0; i<nc; ++i) {
if (relAbundance[idx + i] > 0.0) {
std::ostringstream os;
os << elmSymbol[Z] << n0 + i;
ist = new G4Isotope(os.str(), Z, n0 + i,
GetAtomicMass(Z, n0 + i)*g/(mole*amu_c2));
/*
G4cout << " Z= " << Z << " N= " << n0 + i
<< " miso(amu)= " << GetIsotopeMass(Z, n0 + i)/amu_c2
<< " matom(amu)= " << GetAtomicMass(Z, n0 + i)/amu_c2 << G4endl;
*/
iso.push_back(ist);
}
}
G4int ni = iso.size();
G4double w;
theElement = new G4Element(elmSymbol[Z],elmSymbol[Z],ni);
for(G4int j=0; j<ni; ++j) {
w = relAbundance[idx + (iso[j])->GetN() - n0];
ist = iso[j];
theElement->AddIsotope(ist, w);
G4int nc = nIsotopes[Z];
G4int n0 = nFirstIsotope[Z];
G4int idx = idxIsotopes[Z];
std::vector<G4Isotope*> iso;
G4Isotope* ist;
for (G4int i=0; i<nc; ++i) {
if (relAbundance[idx + i] > 0.0) {
std::ostringstream os;
os << elmSymbol[Z] << n0 + i;
ist = new G4Isotope(os.str(), Z, n0 + i,
GetAtomicMass(Z, n0 + i)*g/(mole*amu_c2));
/*
G4cout << " Z= " << Z << " N= " << n0 + i
<< " miso(amu)= " << GetIsotopeMass(Z, n0 + i)/amu_c2
<< " matom(amu)= " << GetAtomicMass(Z, n0 + i)/amu_c2 << G4endl;
*/
iso.push_back(ist);
}
}
//build Element without Isotopes
//
else {
theElement = new G4Element(elmSymbol[Z],elmSymbol[Z],Zeff,Aeff*gram/mole);
G4int ni = iso.size();
G4double w;
theElement = new G4Element(elmSymbol[Z],elmSymbol[Z],ni);
for(G4int j=0; j<ni; ++j) {
w = relAbundance[idx + (iso[j])->GetN() - n0];
ist = iso[j];
theElement->AddIsotope(ist, w);
}
theElement->SetNaturalAbandancesFlag(buildIsotopes);
theElement->SetNaturalAbundanceFlag(true);
return theElement;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4NistElementBuilder::PrintElement(G4int Z)
void G4NistElementBuilder::PrintElement(G4int Z) const
{
G4int imin = Z;
G4int imax = Z+1;
+32 -25
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4NistManager.cc 74262 2013-10-02 14:37:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -76,30 +76,6 @@ G4NistManager* G4NistManager::Instance()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NistManager::G4NistManager()
{
nElements = 0;
nMaterials = 0;
verbose = 0;
elmBuilder = new G4NistElementBuilder(verbose);
matBuilder = new G4NistMaterialBuilder(elmBuilder,verbose);
messenger = new G4NistMessenger(this);
g4pow = G4Pow::GetInstance();
// compute frequently used values for mean atomic numbers
for(G4int j=1; j<101; ++j) {
G4double A = elmBuilder->GetAtomicMassAmu(j);
POWERA27[j] = std::pow(A,0.27);
LOGAZ[j] = std::log(A);
}
POWERA27[0] = 1.0;
LOGAZ[0] = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NistManager::~G4NistManager()
{
// G4cout << "NistManager: start material destruction" << G4endl;
@@ -216,3 +192,34 @@ void G4NistManager::SetVerbose(G4int val)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Threading.hh"
G4NistManager::G4NistManager()
{
if(G4Threading::IsWorkerThread() == true) {
G4Exception ("G4NistMaterial::G4NistManager()", "mat090", FatalException,
"Attempt to instantiate G4NistManager in worker thread");
}
nElements = 0;
nMaterials = 0;
verbose = 0;
elmBuilder = new G4NistElementBuilder(verbose);
matBuilder = new G4NistMaterialBuilder(elmBuilder,verbose);
messenger = new G4NistMessenger(this);
g4pow = G4Pow::GetInstance();
// compute frequently used values for mean atomic numbers
for(G4int j=1; j<101; ++j) {
G4double A = elmBuilder->GetAtomicMassAmu(j);
POWERA27[j] = std::pow(A,0.27);
LOGAZ[j] = std::log(A);
}
POWERA27[0] = 1.0;
LOGAZ[0] = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4NistMessenger.cc 72057 2013-07-04 13:07:29Z gcosmo $
//
//
// File name: G4NistMessenger
@@ -54,7 +54,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4NistMessenger::G4NistMessenger(G4NistManager* man)
:manager(man)
: manager(man)
{
matDir = new G4UIdirectory("/material/");
matDir->SetGuidance("Commands for materials");
@@ -80,14 +80,14 @@ G4NistMessenger::G4NistMessenger(G4NistManager* man)
przElmCmd->SetRange("0<=Z && Z<108");
lisMatCmd = new G4UIcmdWithAString("/material/nist/listMaterials",this);
lisMatCmd->SetGuidance("list materials in Geant4 dataBase.");
lisMatCmd->SetGuidance("Materials in Geant4 dataBase.");
lisMatCmd->SetGuidance("simple - simple NIST materials.");
lisMatCmd->SetGuidance("compound - compound NIST materials.");
lisMatCmd->SetGuidance("hep - HEP materials.");
lisMatCmd->SetGuidance("biomedical - biomedical materials.");
lisMatCmd->SetGuidance("bio - biomedical materials.");
lisMatCmd->SetGuidance("all - list of all Geant4 materials.");
lisMatCmd->SetParameterName("list", true);
lisMatCmd->SetCandidates("simple compound hep all");
lisMatCmd->SetParameterName("matlist", true);
// lisMatCmd->SetCandidates("simple compound hep bio all");
lisMatCmd->SetDefaultValue("all");
g4Dir = new G4UIdirectory("/material/g4/");
@@ -102,13 +102,13 @@ G4NistMessenger::G4NistMessenger(G4NistManager* man)
g4MatCmd = new G4UIcmdWithAString("/material/g4/printMaterial",this);
g4MatCmd->SetGuidance("print Material from G4MaterialTable.");
g4MatCmd->SetGuidance("all - all materials");
g4MatCmd->SetParameterName("mat", true);
g4MatCmd->SetParameterName("pmat", true);
g4MatCmd->SetDefaultValue("all");
g4DensCmd = new G4UIcmdWithAString("/material/g4/printDensityEffParam",this);
g4DensCmd->SetGuidance("print Material from G4DensityEffectData.");
g4DensCmd->SetGuidance("all - all materials");
g4DensCmd->SetParameterName("mat", true);
g4DensCmd->SetParameterName("dmat", true);
g4DensCmd->SetDefaultValue("all");
}
@@ -133,25 +133,25 @@ G4NistMessenger::~G4NistMessenger()
void G4NistMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
//G4cout << "G4NistMessenger::SetNewValue <" << newValue << ">" << G4endl;
if (command == verCmd)
{ manager->SetVerbose(verCmd->GetNewIntValue(newValue));}
else if (command == prtElmCmd)
{ manager->PrintElement(newValue);}
{ manager->PrintElement(newValue); }
else if (command == przElmCmd) {
G4int Z = przElmCmd->GetNewIntValue(newValue);
if(Z >= 0 && Z < 108) { manager->PrintElement(Z); }
}
}
else if (command == lisMatCmd)
{ manager->ListMaterials(newValue);}
{ manager->ListMaterials(newValue); }
else if (command == g4ElmCmd)
{ manager->PrintG4Element(newValue);}
{ manager->PrintG4Element(newValue); }
else if (command == g4MatCmd)
{ manager->PrintG4Material(newValue);}
{ manager->PrintG4Material(newValue); }
else if (command == g4DensCmd)
{ G4IonisParamMat::GetDensityEffectData()->PrintData(newValue); }
+150 -41
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4OpticalSurface.cc 71488 2013-06-17 08:20:50Z gcosmo $
//
//
////////////////////////////////////////////////////////////////////////
@@ -63,7 +63,10 @@ G4OpticalSurface& G4OpticalSurface::operator=(const G4OpticalSurface& right)
polish = right.polish;
theMaterialPropertiesTable = right.theMaterialPropertiesTable;
AngularDistribution = right.AngularDistribution;
readFileHandle = right.readFileHandle;
readLUTFileHandle = right.readLUTFileHandle;
DichroicVector = right.DichroicVector;
theSurfacePropertyTable = right.theSurfacePropertyTable;
}
return *this;
}
@@ -94,6 +97,10 @@ G4OpticalSurface::G4OpticalSurface(const G4String& name,
sigma_alpha = value;
polish = 0.0;
}
else if ( model == dichroic ) {
sigma_alpha = value;
polish = 0.0;
}
else {
G4Exception("G4OpticalSurface::G4OpticalSurface()", "mat309",
FatalException,
@@ -101,26 +108,44 @@ G4OpticalSurface::G4OpticalSurface(const G4String& name,
}
AngularDistribution = NULL;
DichroicVector = NULL;
readLUTFileHandle = NULL;
if (type == dielectric_LUT) {
AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadFile();
ReadLUTFile();
}
if (type == dielectric_dichroic) {
DichroicVector = new G4Physics2DVector();
ReadDichroicFile();
}
}
G4OpticalSurface::~G4OpticalSurface()
{
if (AngularDistribution) delete AngularDistribution;
if (DichroicVector) delete DichroicVector;
if (readLUTFileHandle) delete readLUTFileHandle;
}
G4OpticalSurface::G4OpticalSurface(const G4OpticalSurface &right)
: G4SurfaceProperty(right.theName,right.theType)
{
*this = right;
this->theName = right.theName;
this->theType = right.theType;
this->theModel = right.theModel;
this->theFinish = right.theFinish;
this->sigma_alpha = right.sigma_alpha;
this->polish = right.polish;
this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
this->AngularDistribution = right.AngularDistribution;
this->readFileHandle = right.readFileHandle;
this->readLUTFileHandle = right.readLUTFileHandle;
this->DichroicVector = right.DichroicVector;
}
G4int G4OpticalSurface::operator==(const G4OpticalSurface &right) const
@@ -168,7 +193,11 @@ void G4OpticalSurface::SetType(const G4SurfaceType& type)
if (type == dielectric_LUT) {
if (!AngularDistribution) AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadFile();
ReadLUTFile();
}
if (type == dielectric_dichroic) {
if (!DichroicVector) DichroicVector = new G4Physics2DVector();
ReadDichroicFile();
}
}
@@ -178,116 +207,196 @@ void G4OpticalSurface::SetFinish(const G4OpticalSurfaceFinish finish)
if (theType == dielectric_LUT) {
if (!AngularDistribution) AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadFile();
ReadLUTFile();
}
if (theType == dielectric_dichroic) {
if (!DichroicVector) DichroicVector = new G4Physics2DVector();
ReadDichroicFile();
}
}
void G4OpticalSurface::ReadFile()
void G4OpticalSurface::ReadLUTFile()
{
G4String readFileName = " ";
G4String readLUTFileName = " ";
if (theFinish == polishedlumirrorglue) {
readFileName = "PolishedLumirrorGlue.dat";
readLUTFileName = "PolishedLumirrorGlue.dat";
}
else if (theFinish == polishedlumirrorair) {
readFileName = "PolishedLumirror.dat";
readLUTFileName = "PolishedLumirror.dat";
}
else if (theFinish == polishedteflonair) {
readFileName = "PolishedTeflon.dat";
readLUTFileName = "PolishedTeflon.dat";
}
else if (theFinish == polishedtioair) {
readFileName = "PolishedTiO.dat";
readLUTFileName = "PolishedTiO.dat";
}
else if (theFinish == polishedtyvekair) {
readFileName = "PolishedTyvek.dat";
readLUTFileName = "PolishedTyvek.dat";
}
else if (theFinish == polishedvm2000glue) {
readFileName = "PolishedVM2000Glue.dat";
readLUTFileName = "PolishedVM2000Glue.dat";
}
else if (theFinish == polishedvm2000air) {
readFileName = "PolishedVM2000.dat";
readLUTFileName = "PolishedVM2000.dat";
}
else if (theFinish == etchedlumirrorglue) {
readFileName = "EtchedLumirrorGlue.dat";
readLUTFileName = "EtchedLumirrorGlue.dat";
}
else if (theFinish == etchedlumirrorair) {
readFileName = "EtchedLumirror.dat";
readLUTFileName = "EtchedLumirror.dat";
}
else if (theFinish == etchedteflonair) {
readFileName = "EtchedTeflon.dat";
readLUTFileName = "EtchedTeflon.dat";
}
else if (theFinish == etchedtioair) {
readFileName = "EtchedTiO.dat";
readLUTFileName = "EtchedTiO.dat";
}
else if (theFinish == etchedtyvekair) {
readFileName = "EtchedTyvek.dat";
readLUTFileName = "EtchedTyvek.dat";
}
else if (theFinish == etchedvm2000glue) {
readFileName = "EtchedVM2000Glue.dat";
readLUTFileName = "EtchedVM2000Glue.dat";
}
else if (theFinish == etchedvm2000air) {
readFileName = "EtchedVM2000.dat";
readLUTFileName = "EtchedVM2000.dat";
}
else if (theFinish == groundlumirrorglue) {
readFileName = "GroundLumirrorGlue.dat";
readLUTFileName = "GroundLumirrorGlue.dat";
}
else if (theFinish == groundlumirrorair) {
readFileName = "GroundLumirror.dat";
readLUTFileName = "GroundLumirror.dat";
}
else if (theFinish == groundteflonair) {
readFileName = "GroundTeflon.dat";
readLUTFileName = "GroundTeflon.dat";
}
else if (theFinish == groundtioair) {
readFileName = "GroundTiO.dat";
readLUTFileName = "GroundTiO.dat";
}
else if (theFinish == groundtyvekair) {
readFileName = "GroundTyvek.dat";
readLUTFileName = "GroundTyvek.dat";
}
else if (theFinish == groundvm2000glue) {
readFileName = "GroundVM2000Glue.dat";
readLUTFileName = "GroundVM2000Glue.dat";
}
else if (theFinish == groundvm2000air) {
readFileName = "GroundVM2000.dat";
readLUTFileName = "GroundVM2000.dat";
}
if (readFileName == " ") return;
if (readLUTFileName == " ") return;
char* path = getenv("G4REALSURFACEDATA");
if (!path) {
G4String excep =
"G4OpBoundaryProcess - G4REALSURFACEDATA environment variable not set";
G4Exception("G4OpticalSurface::ReadFile()", "mat310",
G4Exception("G4OpticalSurface::ReadLUTFile()", "mat310",
FatalException, excep);
return;
}
G4String pathString(path);
readFileName = pathString + "/" + readFileName;
readLUTFileName = pathString + "/" + readLUTFileName;
readFileHandle = fopen(readFileName,"r");
readLUTFileHandle = fopen(readLUTFileName,"r");
if (readFileHandle) {
if (readLUTFileHandle) {
G4int ncols;
G4int idxmax = incidentIndexMax*thetaIndexMax*phiIndexMax;
for (G4int i = 0; i<idxmax; i++) {
ncols = fscanf(readFileHandle,"%6f", &AngularDistribution[i]);
ncols = fscanf(readLUTFileHandle,"%6f", &AngularDistribution[i]);
if (ncols < 0) break;
}
if (ncols >= 0) {
G4cout << "LUT - data file: " << readFileName << " read in! " << G4endl;
G4cout << "LUT - data file: " << readLUTFileName << " read in! " << G4endl;
}
else {
G4String excep = "LUT - data file: "+ readFileName +" not read propery";
G4Exception("G4OpticalSurface::ReadFile()", "mat312",
G4String excep = "LUT - data file: "+ readLUTFileName +" not read propery";
G4Exception("G4OpticalSurface::ReadLUTFile()", "mat312",
FatalException, excep);
return;
}
}
else {
G4String excep = "LUT - data file: " + readFileName + " not found";
G4Exception("G4OpticalSurface::ReadFile()", "mat311",
G4String excep = "LUT - data file: " + readLUTFileName + " not found";
G4Exception("G4OpticalSurface::ReadLUTFile()", "mat311",
FatalException, excep);
return;
}
fclose(readFileHandle);
fclose(readLUTFileHandle);
}
void G4OpticalSurface::ReadDichroicFile()
{
const char* datadir = getenv("G4DICHROICDATA");
if(!datadir) {
G4Exception("G4OpticalSurface::ReadDichroicFile()","mat313",
FatalException,"Environment variable G4DICHROICDATA not defined");
return;
}
std::ostringstream ost;
ost << datadir;
std::ifstream fin(ost.str().c_str());
if( !fin.is_open()) {
G4ExceptionDescription ed;
ed << "Dichroic surface data file <" << ost.str().c_str()
<< "> is not opened!" << G4endl;
G4Exception("G4OpticalSurface::ReadDichroicFile()","mat314",
FatalException,ed," ");
return;
}
if( !(DichroicVector->Retrieve(fin)) ) {
G4ExceptionDescription ed;
ed << "Dichroic surface data file <" << ost.str().c_str()
<< "> is not opened!" << G4endl;
G4Exception("G4OpticalSurface::ReadDichroicFile()","mat315",
FatalException,ed," ");
return;
}
// DichroicVector->SetBicubicInterpolation(true);
G4cout << " *** Dichroic surface data file *** " << G4endl;
size_t numberOfXNodes = DichroicVector->GetLengthX();
size_t numberOfYNodes = DichroicVector->GetLengthY();
G4cout << "numberOfXNodes: " << numberOfXNodes << G4endl;
G4cout << "numberOfYNodes: " << numberOfYNodes << G4endl;
G4PV2DDataVector xVector;
G4PV2DDataVector yVector;
xVector.resize(numberOfXNodes,0.);
yVector.resize(numberOfYNodes,0.);
for(size_t i = 0; i<numberOfXNodes; ++i) {
G4cout << "i: " << DichroicVector->GetX(i) << G4endl;
xVector[i] = DichroicVector->GetX(i);
}
for(size_t j = 0; j<numberOfYNodes; ++j) {
G4cout << "j: " << DichroicVector->GetY(j) << G4endl;
yVector[j] = DichroicVector->GetY(j);
}
for(size_t j = 0; j<numberOfYNodes; ++j) {
for(size_t i = 0; i<numberOfXNodes; ++i) {
G4cout << " i: " << i << " j: " << j << " "
<< DichroicVector->GetValue(i,j) << G4endl;
}
}
// size_t idx, idy;
// for(size_t j = 0; j<numberOfYNodes-1; ++j) {
// G4double y = (yVector[j] + yVector[j+1])/2.;
// for(size_t i = 0; i<numberOfXNodes-1; ++i) {
// G4double x = (xVector[i] + xVector[i+1])/2.;
// G4cout << " x: " << x << " y: " << y << " "
// << DichroicVector->Value(x,y,idx,idy) << G4endl;
// }
// }
}
+287 -135
View File
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4SandiaTable.cc 76289 2013-11-08 13:07:00Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -39,6 +38,7 @@
// 03.02.04 Update distructor V.Ivanchenko
// 05.03.04 New methods for old sorting algorithm for PAI model. V.Grichine
// 26.10.11 new scheme for G4Exception (mma)
// 22.05.13 preparation of material table without dynamical arrays. V. Grichine
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -47,16 +47,22 @@
#include "G4StaticSandiaData.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
// #include "G4MaterialCutsCouple.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
G4int G4SandiaTable::fCumulInterval[101] = {0};
G4double G4SandiaTable::fSandiaCofPerAtom[4] = {0.0};
G4double const G4SandiaTable::funitc[5] = {keV,
cm2*keV/g,
cm2*keV*keV/g,
cm2*keV*keV*keV/g,
cm2*keV*keV*keV*keV/g};
const G4double G4SandiaTable::funitc[5] =
{
CLHEP::keV,
CLHEP::cm2*CLHEP::keV/CLHEP::g,
CLHEP::cm2*CLHEP::keV*CLHEP::keV/CLHEP::g,
CLHEP::cm2*CLHEP::keV*CLHEP::keV*CLHEP::keV/CLHEP::g,
CLHEP::cm2*CLHEP::keV*CLHEP::keV*CLHEP::keV*CLHEP::keV/CLHEP::g
};
const G4double G4SandiaTable::fnulcof[] = {0.0};
G4int G4SandiaTable::fCumulInterval[] = {0};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -68,28 +74,24 @@ G4SandiaTable::G4SandiaTable(G4Material* material)
fPhotoAbsorptionCof = 0;
fMatNbOfIntervals = 0;
fMaxInterval = 0;
fVerbose = 0;
//build the CumulInterval array
if(0 == fCumulInterval[0]) {
fCumulInterval[0] = 1;
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];
}
}
//initialisation of fnulcof
fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
fMaxInterval = 0;
fSandiaCofPerAtom.resize(4,0.0);
fLowerI1 = false;
//compute macroscopic Sandia coefs for a material
ComputeMatSandiaMatrix(); // mma
// ComputeMatTable(); // vmg
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -98,24 +100,28 @@ G4SandiaTable::G4SandiaTable(G4Material* material)
// for usage restricted to object persistency
G4SandiaTable::G4SandiaTable(__void__&)
: fMaterial(0),fMatSandiaMatrix(0),fMatSandiaMatrixPAI(0),fPhotoAbsorptionCof(0)
: fMaterial(0),fMatSandiaMatrix(0),
fMatSandiaMatrixPAI(0),fPhotoAbsorptionCof(0)
{
fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
fMaxInterval = 0;
fMatNbOfIntervals = 0;
fLowerI1 = false;
fVerbose = 0;
fSandiaCofPerAtom.resize(4,0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4SandiaTable::~G4SandiaTable()
{
if(fMatSandiaMatrix) {
fMatSandiaMatrix->clearAndDestroy();
if(fMatSandiaMatrix)
{
//fMatSandiaMatrix->clearAndDestroy();
delete fMatSandiaMatrix;
}
if(fMatSandiaMatrixPAI) {
fMatSandiaMatrixPAI->clearAndDestroy();
if(fMatSandiaMatrixPAI)
{
//fMatSandiaMatrixPAI->clearAndDestroy();
delete fMatSandiaMatrixPAI;
}
if(fPhotoAbsorptionCof)
@@ -126,9 +132,11 @@ G4SandiaTable::~G4SandiaTable()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4double*
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4double energy)
void
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4double energy,
std::vector<G4double>& coeff)
{
assert(4 <= coeff.size());
G4double Emin = fSandiaTable[fCumulInterval[Z-1]][0]*keV;
G4double Iopot = fIonizationPotentials[Z]*eV;
if (Iopot > Emin) Emin = Iopot;
@@ -143,17 +151,15 @@ G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4double energy)
{
G4double AoverAvo = Z*amu/fZtoAratio[Z];
fSandiaCofPerAtom[0]=AoverAvo*funitc[1]*fSandiaTable[row][1];
fSandiaCofPerAtom[1]=AoverAvo*funitc[2]*fSandiaTable[row][2];
fSandiaCofPerAtom[2]=AoverAvo*funitc[3]*fSandiaTable[row][3];
fSandiaCofPerAtom[3]=AoverAvo*funitc[4]*fSandiaTable[row][4];
coeff[0]=AoverAvo*funitc[1]*fSandiaTable[row][1];
coeff[1]=AoverAvo*funitc[2]*fSandiaTable[row][2];
coeff[2]=AoverAvo*funitc[3]*fSandiaTable[row][3];
coeff[3]=AoverAvo*funitc[4]*fSandiaTable[row][4];
}
else
{
fSandiaCofPerAtom[0] = fSandiaCofPerAtom[1] = fSandiaCofPerAtom[2] =
fSandiaCofPerAtom[3] = 0.;
coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.;
}
return fSandiaCofPerAtom;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -196,7 +202,7 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
{
IonizationPot = GetIonizationPot(Z[elm]);
for (G4int row = fCumulInterval[ Z[elm]-1 ]; row < fCumulInterval[Z[elm]]; row++ )
for (G4int row = fCumulInterval[Z[elm]-1]; row < fCumulInterval[Z[elm]]; row++)
{
tmp1[interval1++] = std::max(fSandiaTable[row][0]*keV,IonizationPot);
}
@@ -239,7 +245,7 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
const G4double* NbOfAtomsPerVolume = fMaterial->GetVecNbOfAtomsPerVolume();
const G4double prec = 1.e-03*eV;
static const G4double prec = 1.e-03*eV;
G4double coef, oldsum(0.), newsum(0.);
fMatNbOfIntervals = 0;
@@ -254,7 +260,7 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
for ( elm = 0; elm < NbElm; elm++ )
{
GetSandiaCofPerAtom(Z[elm], Emin+prec);
GetSandiaCofPerAtom(Z[elm], Emin+prec, fSandiaCofPerAtom);
for ( G4int j = 1; j < 5; j++ )
{
@@ -271,6 +277,8 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
delete [] tmp1;
delete [] tmp2;
// fMaxInterval = fMatNbOfIntervals; // vmg 16.02.11
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
{
G4cout<<"mma, G4SandiaTable::ComputeMatSandiaMatrix(), mat = "
@@ -287,7 +295,9 @@ void G4SandiaTable::ComputeMatSandiaMatrix()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
///////////////////////////////////////////////////////////////////////////////////////
//
// Sandia matrix for PAI models based on vectors ...
void G4SandiaTable::ComputeMatSandiaMatrixPAI()
{
@@ -295,8 +305,9 @@ void G4SandiaTable::ComputeMatSandiaMatrixPAI()
G4int elm, c, i, j, jj, k, k1, k2, c1, n1;
const G4int noElm = fMaterial->GetNumberOfElements();
const G4ElementVector* ElementVector = fMaterial->GetElementVector();
G4int* Z = new G4int[noElm]; //Atomic number
const G4ElementVector* ElementVector = fMaterial->GetElementVector();
std::vector<G4int> Z(noElm); //Atomic number
for ( elm = 0; elm < noElm; elm++ )
{
@@ -304,16 +315,19 @@ void G4SandiaTable::ComputeMatSandiaMatrixPAI()
MaxIntervals += fNbOfIntervals[Z[elm]];
}
fMaxInterval = MaxIntervals + 2;
// fMaxInterval = MaxIntervals + 1;
// fMaxInterval = MaxIntervals;
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
if ( fVerbose > 0 )
{
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];
G4DataVector fPhotoAbsorptionCof0(fMaxInterval);
G4DataVector fPhotoAbsorptionCof1(fMaxInterval);
G4DataVector fPhotoAbsorptionCof2(fMaxInterval);
G4DataVector fPhotoAbsorptionCof3(fMaxInterval);
G4DataVector fPhotoAbsorptionCof4(fMaxInterval);
for( c = 0; c < fMaxInterval; c++ ) // just in case
{
@@ -422,15 +436,17 @@ void G4SandiaTable::ComputeMatSandiaMatrixPAI()
G4double E1 = fPhotoAbsorptionCof0[q];
G4double E2 = fPhotoAbsorptionCof0[q+1];
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
if ( fVerbose > 0 )
{
G4cout<<"k = "<<k<<", q = "<<q<<", B1 = "<<B1<<", B2 = "<<B2<<", E1 = "<<E1<<", E2 = "<<E2<<G4endl;
G4cout<<"k = "<<k<<", q = "<<q<<", B1 = "<<B1<<", B2 = "<<B2
<<", E1 = "<<E1<<", E2 = "<<E2<<G4endl;
}
if( B1 > E1 || B2 < E2 || E1 < I1 )
{
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
if ( fVerbose > 0 )
{
G4cout<<"continue for: B1 = "<<B1<<", B2 = "<<B2<<", E1 = "<<E1<<", E2 = "<<E2<<G4endl;
G4cout<<"continue for: B1 = "<<B1<<", B2 = "<<B2<<", E1 = "
<<E1<<", E2 = "<<E2<<G4endl;
}
continue;
}
@@ -458,7 +474,7 @@ void G4SandiaTable::ComputeMatSandiaMatrixPAI()
fPhotoAbsorptionCof3[c] != 0.0 ||
fPhotoAbsorptionCof4[c] != 0.0 ) continue;
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
if ( fVerbose > 0 )
{
G4cout<<c<<" = number with zero cofs"<<G4endl;
}
@@ -471,54 +487,93 @@ void G4SandiaTable::ComputeMatSandiaMatrixPAI()
fPhotoAbsorptionCof4[jj-1] = fPhotoAbsorptionCof4[jj];
}
fMaxInterval--;
c--;
// c--;
}
while( c < fMaxInterval - 1 );
while( c < fMaxInterval - 1 ); // was <
if( fPhotoAbsorptionCof0[fMaxInterval-1] == 0.0 ) fMaxInterval--;
// 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++)
for (i = 0; i < fMaxInterval; i++) // -> G4units
{
(*(*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;
fPhotoAbsorptionCof0[i+1] *= funitc[0];
fPhotoAbsorptionCof1[i+1] *= funitc[1]*density;
fPhotoAbsorptionCof2[i+1] *= funitc[2]*density;
fPhotoAbsorptionCof3[i+1] *= funitc[3]*density;
fPhotoAbsorptionCof4[i+1] *= funitc[4]*density;
}
if ( fVerbose > 0 && fMaterial->GetName() == "G4_Ar" )
if(fLowerI1)
{
G4cout<<"mma, G4SandiaTable::ComputeMatSandiaMatrixPAI(), mat = "<<fMaterial->GetName()<<G4endl;
if( fMaterial->GetName() == "G4_WATER")
{
fMaxInterval += fH2OlowerInt;
for (i = 0; i < fMaxInterval; i++) // init vector table
{
fMatSandiaMatrixPAI->push_back( new G4DataVector(5,0.) );
}
for (i = 0; i < fH2OlowerInt; i++)
{
(*(*fMatSandiaMatrixPAI)[i])[0] = fH2OlowerI1[i][0];
(*(*fMatSandiaMatrixPAI)[i])[1] = fH2OlowerI1[i][1]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[2] = fH2OlowerI1[i][2]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[3] = fH2OlowerI1[i][3]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[4] = fH2OlowerI1[i][4]; // *density;
}
for (i = fH2OlowerInt; i < fMaxInterval; i++)
{
(*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1-fH2OlowerInt];
(*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1-fH2OlowerInt]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1-fH2OlowerInt]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1-fH2OlowerInt]; // *density;
(*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1-fH2OlowerInt]; // *density;
}
}
}
else
{
for (i = 0; i < fMaxInterval; i++) // init vector table
{
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;
}
}
// fMaxInterval--; // to avoid duplicate at 500 keV or extra zeros in last interval
if ( fVerbose > 0 )
{
G4cout<<"vmg, G4SandiaTable::ComputeMatSandiaMatrixPAI(), mat = "
<<fMaterial->GetName()<<G4endl;
for( i = 0; i < fMaxInterval; i++)
{
G4cout<<i<<"\t"<<GetSandiaMatTablePAI(i,0)/keV<<" keV \t"<<this->GetSandiaMatTablePAI(i,1)
<<"\t"<<this->GetSandiaMatTablePAI(i,2)<<"\t"<<this->GetSandiaMatTablePAI(i,3)
<<"\t"<<this->GetSandiaMatTablePAI(i,4)<<G4endl;
G4cout<<i<<"\t"<<GetSandiaMatTablePAI(i,0)/keV<<" keV \t"
<<this->GetSandiaMatTablePAI(i,1)
<<"\t"<<this->GetSandiaMatTablePAI(i,2)
<<"\t"<<this->GetSandiaMatTablePAI(i,3)
<<"\t"<<this->GetSandiaMatTablePAI(i,4)<<G4endl;
}
}
delete [] Z;
delete [] fPhotoAbsorptionCof0;
delete [] fPhotoAbsorptionCof1;
delete [] fPhotoAbsorptionCof2;
delete [] fPhotoAbsorptionCof3;
delete [] fPhotoAbsorptionCof4;
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
//
// Methods for PAI model only
//
// Methods for PAI model
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
G4SandiaTable::G4SandiaTable(G4int matIndex)
{
@@ -527,13 +582,11 @@ G4SandiaTable::G4SandiaTable(G4int matIndex)
fMatSandiaMatrix = 0;
fMatSandiaMatrixPAI = 0;
fPhotoAbsorptionCof = 0;
fMaxInterval = 0;
fVerbose = 0;
//initialisation of fnulcof
fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
fSandiaCofPerAtom.resize(4,0.0);
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int numberOfMat = G4Material::GetNumberOfMaterials();
@@ -541,7 +594,7 @@ G4SandiaTable::G4SandiaTable(G4int matIndex)
if ( matIndex >= 0 && matIndex < numberOfMat)
{
fMaterial = (*theMaterialTable)[matIndex];
ComputeMatTable();
// ComputeMatTable();
}
else
{
@@ -550,14 +603,99 @@ G4SandiaTable::G4SandiaTable(G4int matIndex)
}
}
/////////////////////////////////////////////////////////////////////////////
G4SandiaTable::G4SandiaTable()
{
fMaterial = 0;
fMatNbOfIntervals = 0;
fMatSandiaMatrix = 0;
fMatSandiaMatrixPAI = 0;
fPhotoAbsorptionCof = 0;
fMaxInterval = 0;
fVerbose = 0;
fLowerI1 = false;
fSandiaCofPerAtom.resize(4,0.0);
}
////////////////////////////////////////////////////////////////////
void G4SandiaTable::Initialize(G4Material* mat)
{
fMaterial = mat;
ComputeMatSandiaMatrixPAI();
}
/////////////////////////////////////////////////////////////////////
/*
void G4SandiaTable::Initialize(G4MaterialCutsCouple* matcc)
{
fMaterial = matcc->GetMaterial();
ComputeMatSandiaMatrixPAI();
}
*/
///////////////////////////////////////////////////////////////////////
void G4SandiaTable::Initialize(G4int matIndex)
{
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int numberOfMat = G4Material::GetNumberOfMaterials();
if ( matIndex >= 0 && matIndex < numberOfMat )
{
fMaterial = (*theMaterialTable)[matIndex];
ComputeMatTable();
}
else
{
G4Exception("G4SandiaTable::Initialize(G4int matIndex)", "mat401",
FatalException, "wrong matIndex");
}
}
//////////////////////////////////////////////////////////////////////////////..
G4int G4SandiaTable::GetMaxInterval() const {
return fMaxInterval;
}
/////////////////////////////////////////////////////////////////////////////////..
G4double** G4SandiaTable::GetPointerToCof()
{
if(!fPhotoAbsorptionCof) { ComputeMatTable(); }
return fPhotoAbsorptionCof;
}
//////////////////////////////////////////////////////////////////////////////..
void G4SandiaTable::SandiaSwap( G4double** da ,
G4int i,
G4int j )
{
G4double tmp = da[i][0] ;
da[i][0] = da[j][0] ;
da[j][0] = tmp ;
}
/////////////////////////////////////////////////////////////////////////////////..
G4double G4SandiaTable::GetPhotoAbsorpCof(G4int i, G4int j) const
{
return fPhotoAbsorptionCof[i][j]*funitc[j];
}
//////////////////////////////////////////////////////////////////////////////////..
//
// Bubble sorting of left energy interval in SandiaTable in ascening order
//
void
G4SandiaTable::SandiaSort(G4double** da ,
G4int sz )
G4SandiaTable::SandiaSort(G4double** da, G4int sz)
{
for(G4int i = 1;i < sz; i++ )
{
@@ -568,14 +706,12 @@ G4SandiaTable::SandiaSort(G4double** da ,
}
}
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////..
//
// SandiaIntervals
//
G4int
G4SandiaTable::SandiaIntervals(G4int Z[],
G4int el )
G4int G4SandiaTable::SandiaIntervals(G4int Z[], G4int el )
{
G4int c, i, flag = 0, n1 = 1;
G4int j, c1, k1, k2;
@@ -586,15 +722,18 @@ G4SandiaTable::SandiaIntervals(G4int Z[],
fMaxInterval += 2;
if( fVerbose > 0 ) G4cout<<"begin sanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
if( fVerbose > 0 ) {
G4cout<<"begin sanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
}
fPhotoAbsorptionCof = new G4double* [fMaxInterval];
for( i = 0; i < fMaxInterval; i++ ) fPhotoAbsorptionCof[i] = new G4double[5];
for( i = 0; i < fMaxInterval; i++ ) {
fPhotoAbsorptionCof[i] = new G4double[5];
}
// for(c = 0; c < fIntervalLimit; c++) // just in case
for( c = 0; c < fMaxInterval; c++ ) fPhotoAbsorptionCof[c][0] = 0.;
for( c = 0; c < fMaxInterval; c++ ) { fPhotoAbsorptionCof[c][0] = 0.; }
c = 1;
@@ -645,7 +784,10 @@ G4SandiaTable::SandiaIntervals(G4int Z[],
if( flag == 0 )
{
fPhotoAbsorptionCof[c][0] = fSandiaTable[k2][0];
if( fVerbose > 0 ) G4cout<<"sanInt, c = "<<c<<", E_c = "<<fPhotoAbsorptionCof[c][0]<<G4endl;
if( fVerbose > 0 ) {
G4cout<<"sanInt, c = "<<c<<", E_c = "<<fPhotoAbsorptionCof[c][0]
<<G4endl;
}
c++;
}
}
@@ -653,11 +795,13 @@ G4SandiaTable::SandiaIntervals(G4int Z[],
SandiaSort(fPhotoAbsorptionCof,c);
fMaxInterval = c;
if( fVerbose > 0 ) G4cout<<"end SanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
if( fVerbose > 0 ) {
G4cout<<"end SanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
}
return c;
}
///////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////..
//
// SandiaMixing
//
@@ -701,7 +845,8 @@ G4SandiaTable::SandiaMixing( G4int Z[],
fPhotoAbsorptionCof[c][j] += fSandiaTable[k][j]*fractionW[i];
if( fVerbose > 0 )
{
G4cout<<"c="<<c<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]<<"; frW="<<fractionW[i]<<G4endl;
G4cout<<"c="<<c<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
<<"; frW="<<fractionW[i]<<G4endl;
}
}
}
@@ -711,7 +856,8 @@ G4SandiaTable::SandiaMixing( G4int Z[],
fPhotoAbsorptionCof[mi-1][j] += fSandiaTable[k][j]*fractionW[i];
if( fVerbose > 0 )
{
G4cout<<"mi-1="<<mi-1<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]<<"; frW="<<fractionW[i]<<G4endl;
G4cout<<"mi-1="<<mi-1<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
<<"; frW="<<fractionW[i]<<G4endl;
}
}
} // for(i)
@@ -728,7 +874,9 @@ G4SandiaTable::SandiaMixing( G4int Z[],
for( jj = 2; jj < mi; jj++ )
{
for( kk = 0; kk < 5; kk++ ) fPhotoAbsorptionCof[jj-1][kk] = fPhotoAbsorptionCof[jj][kk];
for( kk = 0; kk < 5; kk++ ) {
fPhotoAbsorptionCof[jj-1][kk] = fPhotoAbsorptionCof[jj][kk];
}
}
mi--;
c--;
@@ -740,14 +888,14 @@ G4SandiaTable::SandiaMixing( G4int Z[],
return mi;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
////////////////////////////////////////////////////////////////////////////..
G4int G4SandiaTable::GetMatNbOfIntervals()
{
return fMatNbOfIntervals;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//////////////////////////////////////////////////////////////////////////////..
G4int G4SandiaTable::GetNbOfIntervals(G4int Z)
{
@@ -755,10 +903,10 @@ G4int G4SandiaTable::GetNbOfIntervals(G4int Z)
return fNbOfIntervals[Z];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j)
G4SandiaTable::GetSandiaPerAtom(G4int Z, G4int interval, G4int j)
{
assert (Z>0 && Z<101 && interval>=0 && interval<fNbOfIntervals[Z]
&& j>=0 && j<5);
@@ -771,7 +919,7 @@ G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j)
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
/////////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j)
@@ -780,12 +928,12 @@ G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j)
return ((*(*fMatSandiaMatrix)[interval])[j]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
/////////////////////////////////////////////////////////////////////////////////..
G4double*
const G4double*
G4SandiaTable::GetSandiaCofForMaterial(G4double energy)
{
G4double* x = fnulcof;
const G4double* x = fnulcof;
if (energy >= (*(*fMatSandiaMatrix)[0])[0]) {
G4int interval = fMatNbOfIntervals - 1;
@@ -796,7 +944,7 @@ G4SandiaTable::GetSandiaCofForMaterial(G4double energy)
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
/////////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetSandiaMatTable(G4int interval, G4int j)
@@ -805,7 +953,7 @@ G4SandiaTable::GetSandiaMatTable(G4int interval, G4int j)
return ((*(*fMatSandiaMatrix)[interval])[j])*funitc[j];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//////////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetSandiaCofForMaterialPAI(G4int interval, G4int j)
@@ -815,13 +963,13 @@ G4SandiaTable::GetSandiaCofForMaterialPAI(G4int interval, G4int j)
return ((*(*fMatSandiaMatrixPAI)[interval])[j]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
////////////////////////////////////////////////////////////////////////////////..
G4double*
const G4double*
G4SandiaTable::GetSandiaCofForMaterialPAI(G4double energy)
{
if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI();
G4double* x = fnulcof;
const G4double* x = fnulcof;
if (energy >= (*(*fMatSandiaMatrixPAI)[0])[0]) {
G4int interval = fMatNbOfIntervals - 1;
@@ -832,17 +980,17 @@ G4SandiaTable::GetSandiaCofForMaterialPAI(G4double energy)
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
/////////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetSandiaMatTablePAI(G4int interval, G4int j)
{
assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
if(!fMatSandiaMatrixPAI) { ComputeMatSandiaMatrixPAI(); }
return ((*(*fMatSandiaMatrixPAI)[interval])[j])*funitc[j];
return ((*(*fMatSandiaMatrixPAI)[interval])[j]); // *funitc[j];-> to method
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
////////////////////////////////////////////////////////////////////////////////////..
G4double
G4SandiaTable::GetIonizationPot(G4int Z)
@@ -851,7 +999,7 @@ G4SandiaTable::GetIonizationPot(G4int Z)
return fIonizationPotentials[Z]*CLHEP::eV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
/////////////////////////////////////////////////////////////////////////////////..
G4OrderedTable*
G4SandiaTable::GetSandiaMatrixPAI()
@@ -860,7 +1008,7 @@ G4SandiaTable::GetSandiaMatrixPAI()
return fMatSandiaMatrixPAI;
}
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////..
//
// Sandia interval and mixing calculations for materialCutsCouple constructor
//
@@ -885,7 +1033,7 @@ void G4SandiaTable::ComputeMatTable()
fMaxInterval += 2;
// G4cout<<"fMaxInterval = "<<fMaxInterval<<G4endl;
// G4cout<<"fMaxInterval = "<<fMaxInterval<<G4endl;
fPhotoAbsorptionCof = new G4double* [fMaxInterval];
@@ -996,11 +1144,12 @@ void G4SandiaTable::ComputeMatTable()
}
for(j = 1; j < 5; j++) // Last interval
{
fPhotoAbsorptionCof[fMaxInterval-1][j] += fSandiaTable[k][j]*fractionW[i];
fPhotoAbsorptionCof[fMaxInterval-1][j] +=
fSandiaTable[k][j]*fractionW[i];
}
} // for(i)
c = 0; // Deleting of first intervals where all coefficients = 0
c = 0; // Deleting of first intervals where all coefficients = 0
do
{
@@ -1021,7 +1170,7 @@ void G4SandiaTable::ComputeMatTable()
fMaxInterval--;
c--;
}
while(c < fMaxInterval - 1);
while( c < fMaxInterval - 1 );
// create the sandia matrix for this material
@@ -1044,25 +1193,28 @@ void G4SandiaTable::ComputeMatTable()
if ( fVerbose > 0 )
{
G4cout<<"vmg, G4SandiaTable::ComputeMatTable(), mat = "<<fMaterial->GetName()<<G4endl;
G4cout<<"vmg, G4SandiaTable::ComputeMatTable(), mat = "
<<fMaterial->GetName()<<G4endl;
for ( i = 0; i < fMaxInterval; i++ )
{
// G4cout<<i<<"\t"<<(*(*fMatSandiaMatrix)[i])[0]<<" keV \t"<<(*(*fMatSandiaMatrix)[i])[1]
// <<"\t"<<(*(*fMatSandiaMatrix)[i])[2]<<"\t"<<(*(*fMatSandiaMatrix)[i])[3]
// G4cout<<i<<"\t"<<(*(*fMatSandiaMatrix)[i])[0]<<" keV \t"
// <<(*(*fMatSandiaMatrix)[i])[1]
// <<"\t"<<(*(*fMatSandiaMatrix)[i])[2]<<"\t"
// <<(*(*fMatSandiaMatrix)[i])[3]
// <<"\t"<<(*(*fMatSandiaMatrix)[i])[4]<<G4endl;
G4cout<<i<<"\t"<<GetSandiaCofForMaterial(i,0)/keV<<" keV \t"<<this->GetSandiaCofForMaterial(i,1)
<<"\t"<<this->GetSandiaCofForMaterial(i,2)<<"\t"<<this->GetSandiaCofForMaterial(i,3)
<<"\t"<<this->GetSandiaCofForMaterial(i,4)<<G4endl;
G4cout<<i<<"\t"<<GetSandiaCofForMaterial(i,0)/keV
<<" keV \t"<<this->GetSandiaCofForMaterial(i,1)
<<"\t"<<this->GetSandiaCofForMaterial(i,2)
<<"\t"<<this->GetSandiaCofForMaterial(i,3)
<<"\t"<<this->GetSandiaCofForMaterial(i,4)<<G4endl;
}
}
delete [] Z;
return;
}
// G4SandiaTable class -- end of implementation file
//
////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////..
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4SurfaceProperty.cc 66811 2013-01-12 16:04:23Z gcosmo $
//
//
////////////////////////////////////////////////////////////////////////