Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////..
|
||||
|
||||
Reference in New Issue
Block a user