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");
149 if (energy <= Emin) {
156 while ((interval>0) && (energy<
fSandiaTable[row][0]*CLHEP::keV)) {
165 coeff[1]=AoverAvo*
funitc[2]*fSandiaTable[row][2];
166 coeff[2]=AoverAvo*
funitc[3]*fSandiaTable[row][3];
167 coeff[3]=AoverAvo*
funitc[4]*fSandiaTable[row][4];
174 std::vector<G4double>& coeff)
const
177 if(4 > coeff.size()) {
178 PrintErrorV(
"GetSandiaCofWater: input vector is resized");
186 if(energy >=
fH2OlowerI1[i][0]*CLHEP::keV) {
break; }
190 coeff[1]=
funitc[2]*fH2OlowerI1[i][2];
191 coeff[2]=
funitc[3]*fH2OlowerI1[i][3];
192 coeff[3]=
funitc[4]*fH2OlowerI1[i][4];
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;
236 void G4SandiaTable::PrintErrorV(
const G4String& ss)
238 G4String sss =
"G4SandiaTable::"+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)
308 if (tmp1[j1] <= Emin) { tmp1[j1] =
DBL_MAX; }
318 for (interval = 0; interval < interval2; ++interval)
328 G4double coef, oldsum(0.), newsum(0.);
331 for ( interval = 0; interval < interval2; ++interval)
340 for ( elm = 0; elm < NbElm; elm++ )
344 for (
G4int j = 1; j < 5; ++j )
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] )
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)
514 for(
G4int q = 1; q < fMaxInterval-1; q++)
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;
541 fPhotoAbsorptionCof1[fMaxInterval-1] +=
fSandiaTable[
k][1]*fractionW[i];
542 fPhotoAbsorptionCof2[fMaxInterval-1] +=
fSandiaTable[
k][2]*fractionW[i];
543 fPhotoAbsorptionCof3[fMaxInterval-1] +=
fSandiaTable[
k][3]*fractionW[i];
544 fPhotoAbsorptionCof4[fMaxInterval-1] +=
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];
573 while( c < fMaxInterval - 1 );
575 if( fPhotoAbsorptionCof0[fMaxInterval-1] == 0.0 ) fMaxInterval--;
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 )
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++ )
851 G4cout<<
"end SanInt, fMaxInterval = "<<fMaxInterval<<
G4endl;
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 MaxIntervals = 0;
1054 G4int elm,
c, i, j, jj,
k, kk,
k1,
k2,
c1,
n1;
1060 for (elm = 0; elm<noElm; ++elm)
1062 Z[elm] = (
G4int)(*ElementVector)[elm]->GetZ();
1088 for(i = 0; i < noElm; ++i)
1093 for(j = 1; j < Z[i]; ++j)
1099 for(k1 = n1; k1 < n2; ++
k1)
1109 for(c1 = 1; c1 <
c; ++
c1)
1122 for(k2 = k1; k2 < n2; ++
k2)
1126 for(c1 = 1; c1 <
c; ++
c1)
1151 for(i = 0; i < noElm; ++i)
1156 for(j = 1; j < Z[i]; ++j)
1162 for(k = n1; k < n2; ++
k)
1166 for(
G4int q = 1; q < fMaxInterval-1; q++)
1170 if(B1 > E1 || B2 < E2 || E1 < I1)
1174 for(j = 1; j < 5; ++j)
1180 for(j = 1; j < 5; ++j)
1200 for(kk = 0; kk < 5; ++kk)
1209 while( c < fMaxInterval - 1 );
1223 for( j = 0; j < 5; ++j )
1232 G4cout<<
"vmg, G4SandiaTable::ComputeMatTable(), mat = "