86 for (
G4int Z=1; Z<101; ++Z) {
104 : fMaterial(0),fMatSandiaMatrix(0),
105 fMatSandiaMatrixPAI(0),fPhotoAbsorptionCof(0)
138 std::vector<G4double>& coeff)
const
140 assert(4 <= coeff.size());
146 if (energy <= Emin) {
161 coeff[1]=AoverAvo*
funitc[2]*fSandiaTable[row][2];
162 coeff[2]=AoverAvo*
funitc[3]*fSandiaTable[row][3];
163 coeff[3]=AoverAvo*
funitc[4]*fSandiaTable[row][4];
170 std::vector<G4double>& coeff)
const
172 assert(4 <= coeff.size());
181 coeff[1]=
funitc[2]*fH2OlowerI1[i][2];
182 coeff[2]=
funitc[3]*fH2OlowerI1[i][3];
183 coeff[3]=
funitc[4]*fH2OlowerI1[i][4];
204 assert (Z>0 && Z<101);
220 G4int MaxIntervals = 0;
223 for ( elm = 0; elm < NbElm; elm++ )
225 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
236 for ( elm = 0; elm < NbElm; elm++ )
257 for (
G4int i1 = 0; i1 < MaxIntervals; i1++ )
259 if (tmp1[i1] < Emin) Emin = tmp1[i1];
263 for (
G4int j1 = 0; j1 < MaxIntervals; j1++ )
265 if (tmp1[j1] <= Emin) tmp1[j1] =
DBL_MAX;
274 for (interval = 0; interval < interval2; interval++ )
284 G4double coef, oldsum(0.), newsum(0.);
287 for ( interval = 0; interval < interval2; interval++ )
291 for (
G4int k = 1; k < 5; ++k ) {
296 for ( elm = 0; elm < NbElm; elm++ )
300 for (
G4int j = 1; j < 5; ++j )
304 newsum += std::fabs(coef);
319 G4cout<<
"mma, G4SandiaTable::ComputeMatSandiaMatrix(), mat = "
339 G4int MaxIntervals = 0;
340 G4int elm, c, i, j, jj, k, k1, k2,
c1, n1;
345 std::vector<G4int> Z(noElm);
347 for ( elm = 0; elm < noElm; elm++ )
349 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
367 fPhotoAbsorptionCof0[c] = 0.;
368 fPhotoAbsorptionCof1[c] = 0.;
369 fPhotoAbsorptionCof2[c] = 0.;
370 fPhotoAbsorptionCof3[c] = 0.;
371 fPhotoAbsorptionCof4[c] = 0.;
375 for(i = 0; i < noElm; ++i)
384 for( k1 = n1; k1 < n2; k1++ )
394 for( c1 = 1; c1 < c; c1++ )
396 if( fPhotoAbsorptionCof0[c1] == I1 )
404 fPhotoAbsorptionCof0[c] = I1;
407 for( k2 = k1; k2 < n2; k2++ )
411 for( c1 = 1; c1 < c; c1++ )
428 for( i = 1; i < c; ++i )
430 for( j = i + 1; j < c; ++j )
432 if( fPhotoAbsorptionCof0[i] > fPhotoAbsorptionCof0[j] )
434 G4double tmp = fPhotoAbsorptionCof0[i];
435 fPhotoAbsorptionCof0[i] = fPhotoAbsorptionCof0[j];
436 fPhotoAbsorptionCof0[j] = tmp;
441 G4cout<<i<<
"\t energy = "<<fPhotoAbsorptionCof0[i]<<
G4endl;
450 for( i = 0; i < noElm; ++i )
454 for( i = 0; i < noElm; ++i )
463 for(k = n1; k < n2; ++k)
468 for(
G4int q = 1; q < fMaxInterval-1; q++)
470 G4double E1 = fPhotoAbsorptionCof0[q];
471 G4double E2 = fPhotoAbsorptionCof0[q+1];
475 G4cout<<
"k = "<<k<<
", q = "<<q<<
", B1 = "<<B1<<
", B2 = "<<B2
476 <<
", E1 = "<<E1<<
", E2 = "<<E2<<
G4endl;
478 if( B1 > E1 || B2 < E2 || E1 < I1 )
482 G4cout<<
"continue for: B1 = "<<B1<<
", B2 = "<<B2<<
", E1 = "
483 <<E1<<
", E2 = "<<E2<<
G4endl;
487 fPhotoAbsorptionCof1[q] +=
fSandiaTable[k][1]*fractionW[i];
488 fPhotoAbsorptionCof2[q] +=
fSandiaTable[k][2]*fractionW[i];
489 fPhotoAbsorptionCof3[q] +=
fSandiaTable[k][3]*fractionW[i];
490 fPhotoAbsorptionCof4[q] +=
fSandiaTable[k][4]*fractionW[i];
495 fPhotoAbsorptionCof1[fMaxInterval-1] +=
fSandiaTable[k][1]*fractionW[i];
496 fPhotoAbsorptionCof2[fMaxInterval-1] +=
fSandiaTable[k][2]*fractionW[i];
497 fPhotoAbsorptionCof3[fMaxInterval-1] +=
fSandiaTable[k][3]*fractionW[i];
498 fPhotoAbsorptionCof4[fMaxInterval-1] +=
fSandiaTable[k][4]*fractionW[i];
506 if( fPhotoAbsorptionCof1[c] != 0.0 ||
507 fPhotoAbsorptionCof2[c] != 0.0 ||
508 fPhotoAbsorptionCof3[c] != 0.0 ||
509 fPhotoAbsorptionCof4[c] != 0.0 )
continue;
517 fPhotoAbsorptionCof0[jj-1] = fPhotoAbsorptionCof0[jj];
518 fPhotoAbsorptionCof1[jj-1] = fPhotoAbsorptionCof1[jj];
519 fPhotoAbsorptionCof2[jj-1] = fPhotoAbsorptionCof2[jj];
520 fPhotoAbsorptionCof3[jj-1] = fPhotoAbsorptionCof3[jj];
521 fPhotoAbsorptionCof4[jj-1] = fPhotoAbsorptionCof4[jj];
526 while( c < fMaxInterval - 1 );
528 if( fPhotoAbsorptionCof0[fMaxInterval-1] == 0.0 ) fMaxInterval--;
538 fPhotoAbsorptionCof0[i+1] *=
funitc[0];
556 (*(*fMatSandiaMatrixPAI)[i])[0] =
fH2OlowerI1[i][0];
557 (*(*fMatSandiaMatrixPAI)[i])[1] =
fH2OlowerI1[i][1];
558 (*(*fMatSandiaMatrixPAI)[i])[2] =
fH2OlowerI1[i][2];
559 (*(*fMatSandiaMatrixPAI)[i])[3] =
fH2OlowerI1[i][3];
560 (*(*fMatSandiaMatrixPAI)[i])[4] =
fH2OlowerI1[i][4];
564 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1-fH2OlowerInt];
565 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1-fH2OlowerInt];
566 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1-fH2OlowerInt];
567 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1-fH2OlowerInt];
568 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1-fH2OlowerInt];
580 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1];
581 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1];
582 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1];
583 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1];
584 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1];
592 G4cout<<
"vmg, G4SandiaTable::ComputeMatSandiaMatrixPAI(), mat = "
627 if ( matIndex >= 0 && matIndex < numberOfMat)
629 fMaterial = (*theMaterialTable)[matIndex];
634 G4Exception(
"G4SandiaTable::G4SandiaTable(G4int matIndex)",
"mat401",
671 if ( matIndex >= 0 && matIndex < numberOfMat )
673 fMaterial = (*theMaterialTable)[matIndex];
678 G4Exception(
"G4SandiaTable::Initialize(G4int matIndex)",
"mat401",
705 da[i][0] = da[j][0] ;
724 for(
G4int i = 1;i < sz; ++i )
726 for(
G4int j = i + 1;j < sz; ++j )
740 G4int c, i, flag = 0, n1 = 1;
764 for( i = 0; i < el; ++i )
773 for( k1 = n1; k1 < n2; k1++ )
783 for( c1 = 1; c1 < c; c1++ )
796 for( k2 = k1; k2 < n2; k2++ )
800 for( c1 = 1; c1 < c; c1++ )
823 G4cout<<
"end SanInt, fMaxInterval = "<<fMaxInterval<<
G4endl;
839 G4int i, j, n1, k, c=1, jj, kk;
842 for( i = 0; i < mi; ++i )
846 for( i = 0; i < el; ++i )
855 for( k = n1; k < n2; ++k )
860 for( c = 1; c < mi-1; ++c )
865 if( B1 > E1 || B2 < E2 || E1 < I1 )
continue;
867 for( j = 1; j < 5; ++j )
873 <<
"; frW="<<fractionW[i]<<
G4endl;
878 for( j = 1; j < 5; ++j )
884 <<
"; frW="<<fractionW[i]<<
G4endl;
899 for( jj = 2; jj < mi; ++jj )
901 for( kk = 0; kk < 5; ++kk ) {
926 assert (Z>0 && Z<101);
951 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
966 return &((*(*fMatSandiaMatrix)[interval])[1]);
974 assert(interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
984 interval<fMatNbOfIntervals && j>=0 && j<5);
1000 x = &((*(*fMatSandiaMatrixPAI)[interval])[1]);
1011 interval < fMaxInterval && j >= 0 && j < 5 );
1020 assert (Z>0 && Z<101);
1040 G4int MaxIntervals = 0;
1041 G4int elm, c, i, j, jj, k, kk, k1, k2,
c1, n1;
1047 for (elm = 0; elm<noElm; ++elm)
1049 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
1075 for(i = 0; i < noElm; ++i)
1080 for(j = 1; j < Z[i]; ++j)
1086 for(k1 = n1; k1 < n2; ++k1)
1096 for(c1 = 1; c1 < c; ++
c1)
1109 for(k2 = k1; k2 < n2; ++k2)
1113 for(c1 = 1; c1 < c; ++
c1)
1138 for(i = 0; i < noElm; ++i)
1143 for(j = 1; j < Z[i]; ++j)
1149 for(k = n1; k < n2; ++k)
1153 for(
G4int q = 1; q < fMaxInterval-1; q++)
1157 if(B1 > E1 || B2 < E2 || E1 < I1)
1161 for(j = 1; j < 5; ++j)
1167 for(j = 1; j < 5; ++j)
1187 for(kk = 0; kk < 5; ++kk)
1195 while( c < fMaxInterval - 1 );
1209 for( j = 0; j < 5; ++j )
1218 G4cout<<
"vmg, G4SandiaTable::ComputeMatTable(), mat = "
G4OrderedTable * fMatSandiaMatrixPAI
void SandiaSwap(G4double **da, G4int i, G4int j)
void ComputeMatSandiaMatrix()
G4double GetSandiaPerAtom(G4int Z, G4int, G4int)
std::vector< G4Element * > G4ElementVector
G4double GetSandiaCofForMaterial(G4int, G4int) const
static const G4double funitc[5]
const G4String & GetName() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4double GetDensity() const
G4int GetMaxInterval() const
G4double GetSandiaMatTablePAI(G4int, G4int) const
G4double ** fPhotoAbsorptionCof
static const G4double fH2OlowerI1[23][5]
const G4ElementVector * GetElementVector() const
G4double GetIonizationPot(G4int Z) const
static const G4double fnulcof[4]
static G4int fCumulInterval[101]
G4int SandiaMixing(G4int Z[], const G4double *fractionW, G4int el, G4int mi)
const G4double * GetVecNbOfAtomsPerVolume() const
G4GLOB_DLL std::ostream G4cout
void SandiaSort(G4double **da, G4int sz)
G4double GetWaterCofForMaterial(G4int, G4int) const
static size_t GetNumberOfMaterials()
G4int GetMatNbOfIntervals() const
G4int SandiaIntervals(G4int Z[], G4int el)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const G4int fNbOfIntervals[101]
void ComputeMatSandiaMatrixPAI()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4OrderedTable * GetSandiaMatrixPAI()
G4double energy(const ThreeVector &p, const G4double m)
static G4double GetZtoA(G4int Z)
static const G4int fH2OlowerInt
G4double GetPhotoAbsorpCof(G4int i, G4int j) const
G4double GetSandiaCofForMaterialPAI(G4int, G4int) const
static const G4double fIonizationPotentials[101]
static const G4double Emin
G4double GetSandiaMatTable(G4int, G4int) const
size_t GetNumberOfElements() const
std::vector< G4double > fSandiaCofPerAtom
void GetSandiaCofWater(G4double energy, std::vector< G4double > &coeff) const
G4OrderedTable * fMatSandiaMatrix
G4double ** GetPointerToCof()
const G4double * GetFractionVector() const
static const G4double fSandiaTable[981][5]
void GetSandiaCofPerAtom(G4int Z, G4double energy, std::vector< G4double > &coeff) const
static const G4double fZtoAratio[101]
G4double GetWaterEnergyLimit() const
void Initialize(G4Material *)
G4int GetNbOfIntervals(G4int Z)