99 : fMaterial(nullptr),fMatSandiaMatrix(nullptr),
100 fMatSandiaMatrixPAI(nullptr),fPhotoAbsorptionCof(nullptr)
133 std::vector<G4double>& coeff)
const
136 if(Z < 1 || Z > 100) {
137 Z = PrintErrorZ(
Z,
"GetSandiaCofPerAtom");
139 if(4 > coeff.size()) {
140 PrintErrorV(
"GetSandiaCofPerAtom(): input vector is resized");
174 std::vector<G4double>& coeff)
const
177 if(4 > coeff.size()) {
178 PrintErrorV(
"GetSandiaCofWater: input vector is resized");
214 if(Z < 1 || Z > 100) {
215 Z = PrintErrorZ(
Z,
"GetSandiaCofPerAtom");
229 ed <<
"Atomic number out of range Z= " <<
Z <<
"; closest value is used";
231 return (
Z > 100) ? 100 : 1;
236void G4SandiaTable::PrintErrorV(
const G4String& ss)
255 G4int MaxIntervals = 0;
260 for (elm = 0; elm < NbElm; ++elm)
262 z =
G4lrint((*ElementVector)[elm]->GetZ());
264 else if(z > 100) { z = 100; }
275 for (elm = 0; elm < NbElm; ++elm)
297 for (
G4int i1 = 0; i1 < MaxIntervals; ++i1)
302 tmp2[interval2] =
Emin;
306 for (
G4int j1 = 0; j1 < MaxIntervals; ++j1)
318 for (interval = 0; interval < interval2; ++interval)
328 G4double coef, oldsum(0.), newsum(0.);
331 for ( interval = 0; interval < interval2; ++interval)
335 for (
G4int k = 1; k < 5; ++k ) {
340 for ( elm = 0; elm < NbElm; elm++ )
344 for (
G4int j = 1; j < 5; ++j )
348 newsum += std::abs(coef);
361 G4cout<<
"G4SandiaTable::ComputeMatSandiaMatrix(), mat = "
381 G4int MaxIntervals = 0;
382 G4int elm, c, i, j, jj, k, k1, k2, c1, n1, z;
387 std::vector<G4int>
Z(noElm);
389 for ( elm = 0; elm < noElm; elm++ )
391 z =
G4lrint((*ElementVector)[elm]->GetZ());
393 else if(z > 100) { z = 100; }
401 G4cout<<
"G4SandiaTable::ComputeMatSandiaMatrixPAI: fMaxInterval = "
413 fPhotoAbsorptionCof0[c] = 0.;
414 fPhotoAbsorptionCof1[c] = 0.;
415 fPhotoAbsorptionCof2[c] = 0.;
416 fPhotoAbsorptionCof3[c] = 0.;
417 fPhotoAbsorptionCof4[c] = 0.;
421 for(i = 0; i < noElm; ++i)
430 for( k1 = n1; k1 < n2; k1++ )
440 for( c1 = 1; c1 < c; c1++ )
442 if( fPhotoAbsorptionCof0[c1] == I1 )
450 fPhotoAbsorptionCof0[c] = I1;
453 for( k2 = k1; k2 < n2; k2++ )
457 for( c1 = 1; c1 < c; c1++ )
474 for( i = 1; i < c; ++i )
476 for( j = i + 1; j < c; ++j )
478 if( fPhotoAbsorptionCof0[i] > fPhotoAbsorptionCof0[j] )
480 G4double tmp = fPhotoAbsorptionCof0[i];
481 fPhotoAbsorptionCof0[i] = fPhotoAbsorptionCof0[j];
482 fPhotoAbsorptionCof0[j] = tmp;
487 G4cout<<i<<
"\t energy = "<<fPhotoAbsorptionCof0[i]<<
G4endl;
496 for( i = 0; i < noElm; ++i )
500 for( i = 0; i < noElm; ++i )
509 for(k = n1; k < n2; ++k)
516 G4double E1 = fPhotoAbsorptionCof0[q];
517 G4double E2 = fPhotoAbsorptionCof0[q+1];
521 G4cout<<
"k = "<<k<<
", q = "<<q<<
", B1 = "<<B1<<
", B2 = "<<B2
522 <<
", E1 = "<<E1<<
", E2 = "<<E2<<
G4endl;
524 if( B1 > E1 || B2 < E2 || E1 < I1 )
528 G4cout<<
"continue for: B1 = "<<B1<<
", B2 = "<<B2<<
", E1 = "
529 <<E1<<
", E2 = "<<E2<<
G4endl;
533 fPhotoAbsorptionCof1[q] +=
fSandiaTable[k][1]*fractionW[i];
534 fPhotoAbsorptionCof2[q] +=
fSandiaTable[k][2]*fractionW[i];
535 fPhotoAbsorptionCof3[q] +=
fSandiaTable[k][3]*fractionW[i];
536 fPhotoAbsorptionCof4[q] +=
fSandiaTable[k][4]*fractionW[i];
552 if( fPhotoAbsorptionCof1[c] != 0.0 ||
553 fPhotoAbsorptionCof2[c] != 0.0 ||
554 fPhotoAbsorptionCof3[c] != 0.0 ||
555 fPhotoAbsorptionCof4[c] != 0.0 )
continue;
563 fPhotoAbsorptionCof0[jj-1] = fPhotoAbsorptionCof0[jj];
564 fPhotoAbsorptionCof1[jj-1] = fPhotoAbsorptionCof1[jj];
565 fPhotoAbsorptionCof2[jj-1] = fPhotoAbsorptionCof2[jj];
566 fPhotoAbsorptionCof3[jj-1] = fPhotoAbsorptionCof3[jj];
567 fPhotoAbsorptionCof4[jj-1] = fPhotoAbsorptionCof4[jj];
585 fPhotoAbsorptionCof0[i+1] *=
funitc[0];
586 fPhotoAbsorptionCof1[i+1] *=
funitc[1]*density;
587 fPhotoAbsorptionCof2[i+1] *=
funitc[2]*density;
588 fPhotoAbsorptionCof3[i+1] *=
funitc[3]*density;
589 fPhotoAbsorptionCof4[i+1] *=
funitc[4]*density;
603 (*(*fMatSandiaMatrixPAI)[i])[0] =
fH2OlowerI1[i][0];
604 (*(*fMatSandiaMatrixPAI)[i])[1] =
fH2OlowerI1[i][1];
605 (*(*fMatSandiaMatrixPAI)[i])[2] =
fH2OlowerI1[i][2];
606 (*(*fMatSandiaMatrixPAI)[i])[3] =
fH2OlowerI1[i][3];
607 (*(*fMatSandiaMatrixPAI)[i])[4] =
fH2OlowerI1[i][4];
611 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1-
fH2OlowerInt];
612 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1-
fH2OlowerInt];
613 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1-
fH2OlowerInt];
614 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1-
fH2OlowerInt];
615 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1-
fH2OlowerInt];
627 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1];
628 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1];
629 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1];
630 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1];
631 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1];
639 G4cout<<
"G4SandiaTable::ComputeMatSandiaMatrixPAI(), mat = "
675 if ( matIndex >= 0 && matIndex < numberOfMat)
677 fMaterial = (*theMaterialTable)[matIndex];
681 G4Exception(
"G4SandiaTable::G4SandiaTable(G4int matIndex)",
"mat401",
733 da[i][0] = da[j][0] ;
752 for(
G4int i = 1;i < sz; ++i )
754 for(
G4int j = i + 1;j < sz; ++j )
768 G4int c, i, flag = 0, n1 = 1;
792 for( i = 0; i < el; ++i )
801 for( k1 = n1; k1 < n2; k1++ )
811 for( c1 = 1; c1 < c; c1++ )
824 for( k2 = k1; k2 < n2; k2++ )
828 for( c1 = 1; c1 < c; c1++ )
867 G4int i, j, n1, k, c=1, jj, kk;
870 for( i = 0; i <
mi; ++i )
874 for( i = 0; i < el; ++i )
883 for( k = n1; k < n2; ++k )
888 for( c = 1; c <
mi-1; ++c )
893 if( B1 > E1 || B2 < E2 || E1 < I1 )
continue;
895 for( j = 1; j < 5; ++j )
901 <<
"; frW="<<fractionW[i]<<
G4endl;
906 for( j = 1; j < 5; ++j )
912 <<
"; frW="<<fractionW[i]<<
G4endl;
927 for( jj = 2; jj <
mi; ++jj )
929 for( kk = 0; kk < 5; ++kk ) {
957 if(Z < 1 || Z > 100) {
958 Z = PrintErrorZ(
Z,
"GetSandiaPerAtom");
961 PrintErrorV(
"GetSandiaPerAtom");
965 PrintErrorV(
"GetSandiaPerAtom");
984 PrintErrorV(
"GetSandiaCofForMaterial");
988 PrintErrorV(
"GetSandiaCofForMaterial");
1007 return &((*(*fMatSandiaMatrix)[interval])[1]);
1017 PrintErrorV(
"GetSandiaCofForMaterial");
1021 PrintErrorV(
"GetSandiaCofForMaterial");
1035 PrintErrorV(
"GetSandiaCofForMaterialPAI");
1039 PrintErrorV(
"GetSandiaCofForMaterialPAI");
1053 G4int elm, c, i, j, jj, k, kk, k1, k2, c1, n1;
1060 for (elm = 0; elm<noElm; ++elm)
1062 Z[elm] = (*ElementVector)[elm]->GetZasInt();
1084 for(i = 0; i < noElm; ++i)
1089 for(j = 1; j <
Z[i]; ++j)
1095 for(k1 = n1; k1 < n2; ++k1)
1105 for(c1 = 1; c1 < c; ++c1)
1118 for(k2 = k1; k2 < n2; ++k2)
1122 for(c1 = 1; c1 < c; ++c1)
1147 for(i = 0; i < noElm; ++i)
1152 for(j = 1; j <
Z[i]; ++j)
1158 for(k = n1; k < n2; ++k)
1166 if(B1 > E1 || B2 < E2 || E1 < I1)
1170 for(j = 1; j < 5; ++j)
1176 for(j = 1; j < 5; ++j)
1196 for(kk = 0; kk < 5; ++kk)
1219 for( j = 0; j < 5; ++j )
1228 G4cout<<
"vmg, G4SandiaTable::ComputeMatTable(), mat = "
static const char sss[MAX_N_PAR+2]
std::vector< const G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Material * > G4MaterialTable
static const G4double Emin
static constexpr double keV
static const G4double fZtoAratio[101]
static const G4int fNbOfIntervals[101]
static const G4double fH2OlowerI1[23][5]
static const G4double fIonizationPotentials[101]
G4GLOB_DLL std::ostream G4cout
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
static size_t GetNumberOfMaterials()
const G4double * GetFractionVector() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
void Initialize(const G4Material *)
void SandiaSwap(G4double **da, G4int i, G4int j)
G4int GetMaxInterval() const
void ComputeMatSandiaMatrix()
G4double GetWaterEnergyLimit() const
G4int GetMatNbOfIntervals() const
static G4double GetZtoA(G4int Z)
G4double GetWaterCofForMaterial(G4int, G4int) const
G4double GetSandiaCofForMaterial(G4int, G4int) const
G4OrderedTable * fMatSandiaMatrix
static G4int fCumulInterval[101]
const G4Material * fMaterial
G4double GetSandiaPerAtom(G4int Z, G4int, G4int) const
void GetSandiaCofWater(G4double energy, std::vector< G4double > &coeff) const
static const G4double fSandiaTable[981][5]
static const G4double funitc[5]
G4double GetSandiaMatTablePAI(G4int, G4int) const
G4int SandiaMixing(G4int Z[], const G4double *fractionW, G4int el, G4int mi)
void ComputeMatSandiaMatrixPAI()
static const G4int fH2OlowerInt
G4double ** fPhotoAbsorptionCof
G4OrderedTable * fMatSandiaMatrixPAI
std::vector< G4double > fSandiaCofPerAtom
void GetSandiaCofPerAtom(G4int Z, G4double energy, std::vector< G4double > &coeff) const
void SandiaSort(G4double **da, G4int sz)
G4int SandiaIntervals(G4int Z[], G4int el)
G4double GetSandiaMatTable(G4int, G4int) const
G4double GetPhotoAbsorpCof(G4int i, G4int j) const
G4double ** GetPointerToCof()
static constexpr double keV
static constexpr double g
static constexpr double cm2
static constexpr double eV
static constexpr double amu
G4double energy(const ThreeVector &p, const G4double m)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments