85 for (
G4int Z=1; Z<101; ++Z) {
103 : fMaterial(0),fMatSandiaMatrix(0),
104 fMatSandiaMatrixPAI(0),fPhotoAbsorptionCof(0)
137 std::vector<G4double>& coeff)
139 assert(4 <= coeff.size());
142 if (Iopot > Emin) Emin = Iopot;
155 coeff[1]=AoverAvo*
funitc[2]*fSandiaTable[row][2];
156 coeff[2]=AoverAvo*
funitc[3]*fSandiaTable[row][3];
157 coeff[3]=AoverAvo*
funitc[4]*fSandiaTable[row][4];
161 coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.;
185 G4int MaxIntervals = 0;
188 for ( elm = 0; elm < NbElm; elm++ )
190 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
201 for ( elm = 0; elm < NbElm; elm++ )
222 for (
G4int i1 = 0; i1 < MaxIntervals; i1++ )
224 if (tmp1[i1] < Emin) Emin = tmp1[i1];
228 for (
G4int j1 = 0; j1 < MaxIntervals; j1++ )
230 if (tmp1[j1] <= Emin) tmp1[j1] =
DBL_MAX;
239 for (interval = 0; interval < interval2; interval++ )
249 G4double coef, oldsum(0.), newsum(0.);
252 for ( interval = 0; interval < interval2; interval++ )
256 for (
G4int k = 1; k < 5; k++ ) {
261 for ( elm = 0; elm < NbElm; elm++ )
265 for (
G4int j = 1; j < 5; j++ )
269 newsum += std::fabs(coef);
284 G4cout<<
"mma, G4SandiaTable::ComputeMatSandiaMatrix(), mat = "
304 G4int MaxIntervals = 0;
305 G4int elm, c, i, j, jj, k, k1, k2,
c1, n1;
310 std::vector<G4int> Z(noElm);
312 for ( elm = 0; elm < noElm; elm++ )
314 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
334 fPhotoAbsorptionCof0[c] = 0.;
335 fPhotoAbsorptionCof1[c] = 0.;
336 fPhotoAbsorptionCof2[c] = 0.;
337 fPhotoAbsorptionCof3[c] = 0.;
338 fPhotoAbsorptionCof4[c] = 0.;
342 for(i = 0; i < noElm; i++)
351 for( k1 = n1; k1 < n2; k1++ )
361 for( c1 = 1; c1 < c; c1++ )
363 if( fPhotoAbsorptionCof0[c1] == I1 )
371 fPhotoAbsorptionCof0[c] = I1;
374 for( k2 = k1; k2 < n2; k2++ )
378 for( c1 = 1; c1 < c; c1++ )
395 for( i = 1; i < c; i++ )
397 for( j = i + 1; j < c; j++ )
399 if( fPhotoAbsorptionCof0[i] > fPhotoAbsorptionCof0[j] )
401 G4double tmp = fPhotoAbsorptionCof0[i];
402 fPhotoAbsorptionCof0[i] = fPhotoAbsorptionCof0[j];
403 fPhotoAbsorptionCof0[j] = tmp;
408 G4cout<<i<<
"\t energy = "<<fPhotoAbsorptionCof0[i]<<
G4endl;
417 for( i = 0; i < noElm; i++ )
G4cout<<i<<
" = elN, fraction = "<<fractionW[i]<<
G4endl;
420 for( i = 0; i < noElm; i++ )
429 for(k = n1; k < n2; k++)
434 for(
G4int q = 1; q < fMaxInterval-1; q++)
436 G4double E1 = fPhotoAbsorptionCof0[q];
437 G4double E2 = fPhotoAbsorptionCof0[q+1];
441 G4cout<<
"k = "<<k<<
", q = "<<q<<
", B1 = "<<B1<<
", B2 = "<<B2
442 <<
", E1 = "<<E1<<
", E2 = "<<E2<<
G4endl;
444 if( B1 > E1 || B2 < E2 || E1 < I1 )
448 G4cout<<
"continue for: B1 = "<<B1<<
", B2 = "<<B2<<
", E1 = "
449 <<E1<<
", E2 = "<<E2<<
G4endl;
453 fPhotoAbsorptionCof1[q] +=
fSandiaTable[k][1]*fractionW[i];
454 fPhotoAbsorptionCof2[q] +=
fSandiaTable[k][2]*fractionW[i];
455 fPhotoAbsorptionCof3[q] +=
fSandiaTable[k][3]*fractionW[i];
456 fPhotoAbsorptionCof4[q] +=
fSandiaTable[k][4]*fractionW[i];
461 fPhotoAbsorptionCof1[fMaxInterval-1] +=
fSandiaTable[k][1]*fractionW[i];
462 fPhotoAbsorptionCof2[fMaxInterval-1] +=
fSandiaTable[k][2]*fractionW[i];
463 fPhotoAbsorptionCof3[fMaxInterval-1] +=
fSandiaTable[k][3]*fractionW[i];
464 fPhotoAbsorptionCof4[fMaxInterval-1] +=
fSandiaTable[k][4]*fractionW[i];
472 if( fPhotoAbsorptionCof1[c] != 0.0 ||
473 fPhotoAbsorptionCof2[c] != 0.0 ||
474 fPhotoAbsorptionCof3[c] != 0.0 ||
475 fPhotoAbsorptionCof4[c] != 0.0 )
continue;
483 fPhotoAbsorptionCof0[jj-1] = fPhotoAbsorptionCof0[jj];
484 fPhotoAbsorptionCof1[jj-1] = fPhotoAbsorptionCof1[jj];
485 fPhotoAbsorptionCof2[jj-1] = fPhotoAbsorptionCof2[jj];
486 fPhotoAbsorptionCof3[jj-1] = fPhotoAbsorptionCof3[jj];
487 fPhotoAbsorptionCof4[jj-1] = fPhotoAbsorptionCof4[jj];
492 while( c < fMaxInterval - 1 );
494 if( fPhotoAbsorptionCof0[fMaxInterval-1] == 0.0 ) fMaxInterval--;
504 fPhotoAbsorptionCof0[i+1] *=
funitc[0];
522 (*(*fMatSandiaMatrixPAI)[i])[0] =
fH2OlowerI1[i][0];
523 (*(*fMatSandiaMatrixPAI)[i])[1] =
fH2OlowerI1[i][1];
524 (*(*fMatSandiaMatrixPAI)[i])[2] =
fH2OlowerI1[i][2];
525 (*(*fMatSandiaMatrixPAI)[i])[3] =
fH2OlowerI1[i][3];
526 (*(*fMatSandiaMatrixPAI)[i])[4] =
fH2OlowerI1[i][4];
530 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1-fH2OlowerInt];
531 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1-fH2OlowerInt];
532 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1-fH2OlowerInt];
533 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1-fH2OlowerInt];
534 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1-fH2OlowerInt];
546 (*(*fMatSandiaMatrixPAI)[i])[0] = fPhotoAbsorptionCof0[i+1];
547 (*(*fMatSandiaMatrixPAI)[i])[1] = fPhotoAbsorptionCof1[i+1];
548 (*(*fMatSandiaMatrixPAI)[i])[2] = fPhotoAbsorptionCof2[i+1];
549 (*(*fMatSandiaMatrixPAI)[i])[3] = fPhotoAbsorptionCof3[i+1];
550 (*(*fMatSandiaMatrixPAI)[i])[4] = fPhotoAbsorptionCof4[i+1];
557 G4cout<<
"vmg, G4SandiaTable::ComputeMatSandiaMatrixPAI(), mat = "
594 if ( matIndex >= 0 && matIndex < numberOfMat)
596 fMaterial = (*theMaterialTable)[matIndex];
601 G4Exception(
"G4SandiaTable::G4SandiaTable(G4int matIndex)",
"mat401",
648 if ( matIndex >= 0 && matIndex < numberOfMat )
650 fMaterial = (*theMaterialTable)[matIndex];
655 G4Exception(
"G4SandiaTable::Initialize(G4int matIndex)",
"mat401",
681 da[i][0] = da[j][0] ;
700 for(
G4int i = 1;i < sz; i++ )
702 for(
G4int j = i + 1;j < sz; j++ )
716 G4int c, i, flag = 0, n1 = 1;
740 for( i = 0; i < el; i++ )
749 for( k1 = n1; k1 < n2; k1++ )
759 for( c1 = 1; c1 < c; c1++ )
772 for( k2 = k1; k2 < n2; k2++ )
776 for( c1 = 1; c1 < c; c1++ )
799 G4cout<<
"end SanInt, fMaxInterval = "<<fMaxInterval<<
G4endl;
815 G4int i, j, n1, k, c=1, jj, kk;
818 for( i = 0; i < mi; i++ )
822 for( i = 0; i < el; i++ )
831 for( k = n1; k < n2; k++ )
836 for( c = 1; c < mi-1; c++ )
841 if( B1 > E1 || B2 < E2 || E1 < I1 )
continue;
843 for( j = 1; j < 5; j++ )
849 <<
"; frW="<<fractionW[i]<<
G4endl;
854 for( j = 1; j < 5; j++ )
860 <<
"; frW="<<fractionW[i]<<
G4endl;
875 for( jj = 2; jj < mi; jj++ )
877 for( kk = 0; kk < 5; kk++ ) {
927 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
942 x = &((*(*fMatSandiaMatrix)[interval])[1]);
952 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
961 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
978 x = &((*(*fMatSandiaMatrixPAI)[interval])[1]);
988 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
1018 G4int MaxIntervals = 0;
1019 G4int elm, c, i, j, jj, k, kk, k1, k2,
c1, n1;
1025 for (elm = 0; elm<noElm; elm++)
1027 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
1053 for(i = 0; i < noElm; i++)
1058 for(j = 1; j < Z[i]; j++)
1064 for(k1 = n1; k1 < n2; k1++)
1074 for(c1 = 1; c1 < c; c1++)
1087 for(k2 = k1; k2 < n2; k2++)
1091 for(c1 = 1; c1 < c; c1++)
1116 for(i = 0; i < noElm; i++)
1121 for(j = 1; j < Z[i]; j++)
1127 for(k = n1; k < n2; k++)
1131 for(
G4int q = 1; q < fMaxInterval-1; q++)
1135 if(B1 > E1 || B2 < E2 || E1 < I1)
1139 for(j = 1; j < 5; j++)
1145 for(j = 1; j < 5; j++)
1165 for(kk = 0; kk < 5; kk++)
1173 while( c < fMaxInterval - 1 );
1187 for( j = 0; j < 5; j++ )
1196 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
static const G4double funitc[5]
const G4String & GetName() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4double GetDensity() const
G4int GetMaxInterval() const
G4double ** fPhotoAbsorptionCof
G4double GetSandiaMatTablePAI(G4int, G4int)
static const G4double fH2OlowerI1[23][5]
const G4ElementVector * GetElementVector() const
static const G4double fnulcof[4]
static G4int fCumulInterval[101]
G4int SandiaMixing(G4int Z[], const G4double *fractionW, G4int el, G4int mi)
G4double GetSandiaMatTable(G4int, G4int)
const G4double * GetVecNbOfAtomsPerVolume() const
G4GLOB_DLL std::ostream G4cout
void SandiaSort(G4double **da, G4int sz)
G4double GetSandiaCofForMaterial(G4int, G4int)
static size_t GetNumberOfMaterials()
G4double GetIonizationPot(G4int Z)
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()
void GetSandiaCofPerAtom(G4int Z, G4double energy, std::vector< G4double > &coeff)
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)
G4int GetMatNbOfIntervals()
static G4double GetZtoA(G4int Z)
static const G4int fH2OlowerInt
G4double GetPhotoAbsorpCof(G4int i, G4int j) const
static const G4double fIonizationPotentials[101]
static const G4double Emin
size_t GetNumberOfElements() const
std::vector< G4double > fSandiaCofPerAtom
G4double GetSandiaCofForMaterialPAI(G4int, G4int)
G4OrderedTable * fMatSandiaMatrix
G4double ** GetPointerToCof()
const G4double * GetFractionVector() const
static const G4double fSandiaTable[981][5]
static const G4double fZtoAratio[101]
void Initialize(G4Material *)
G4int GetNbOfIntervals(G4int Z)