Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SandiaTable Class Reference

#include <G4SandiaTable.hh>

Public Member Functions

 G4SandiaTable (G4Material *)
 
 ~G4SandiaTable ()
 
void GetSandiaCofPerAtom (G4int Z, G4double energy, std::vector< G4double > &coeff) const
 
void GetSandiaCofWater (G4double energy, std::vector< G4double > &coeff) const
 
G4double GetWaterEnergyLimit () const
 
G4double GetWaterCofForMaterial (G4int, G4int) const
 
G4int GetMatNbOfIntervals () const
 
G4double GetSandiaCofForMaterial (G4int, G4int) const
 
G4double GetSandiaMatTable (G4int, G4int) const
 
const G4doubleGetSandiaCofForMaterial (G4double energy) const
 
G4double GetSandiaMatTablePAI (G4int, G4int) const
 
const G4doubleGetSandiaCofForMaterialPAI (G4double energy) const
 
void SetVerbose (G4int ver)
 
 G4SandiaTable (__void__ &)
 
 G4SandiaTable (G4int matIndex)
 
 G4SandiaTable ()
 
void Initialize (G4Material *)
 
G4int SandiaIntervals (G4int Z[], G4int el)
 
G4int SandiaMixing (G4int Z[], const G4double *fractionW, G4int el, G4int mi)
 
G4double GetPhotoAbsorpCof (G4int i, G4int j) const
 
G4int GetMaxInterval () const
 
G4bool GetLowerI1 ()
 
void SetLowerI1 (G4bool flag)
 

Static Public Member Functions

static G4double GetZtoA (G4int Z)
 

Detailed Description

Definition at line 66 of file G4SandiaTable.hh.

Constructor & Destructor Documentation

G4SandiaTable::G4SandiaTable ( G4Material material)

Definition at line 68 of file G4SandiaTable.cc.

69  : fMaterial(material)
70 {
71  fMatSandiaMatrix = nullptr;
72  fMatSandiaMatrixPAI = nullptr;
73  fPhotoAbsorptionCof = nullptr;
74 
75  fMatNbOfIntervals = 0;
76 
77  fMaxInterval = 0;
78  fVerbose = 0;
79 
80  //build the CumulInterval array
81  if(0 == fCumulInterval[0]) {
82  fCumulInterval[0] = 1;
83 
84  for (G4int Z=1; Z<101; ++Z) {
85  fCumulInterval[Z] = fCumulInterval[Z-1] + fNbOfIntervals[Z];
86  }
87  }
88 
89  fMaxInterval = 0;
90  fSandiaCofPerAtom.resize(4,0.0);
91  fLowerI1 = false;
92  //compute macroscopic Sandia coefs for a material
93  ComputeMatSandiaMatrix(); // mma
94 }
int G4int
Definition: G4Types.hh:78
static const G4int fNbOfIntervals[101]
G4SandiaTable::~G4SandiaTable ( )

Definition at line 114 of file G4SandiaTable.cc.

115 {
116  if(fMatSandiaMatrix)
117  {
118  fMatSandiaMatrix->clearAndDestroy();
119  delete fMatSandiaMatrix;
120  }
121  if(fMatSandiaMatrixPAI)
122  {
123  fMatSandiaMatrixPAI->clearAndDestroy();
124  delete fMatSandiaMatrixPAI;
125  }
126  if(fPhotoAbsorptionCof)
127  {
128  delete [] fPhotoAbsorptionCof;
129  }
130 }
void clearAndDestroy()

Here is the call graph for this function:

G4SandiaTable::G4SandiaTable ( __void__ &  )

Definition at line 101 of file G4SandiaTable.cc.

102  : fMaterial(nullptr),fMatSandiaMatrix(nullptr),
103  fMatSandiaMatrixPAI(nullptr),fPhotoAbsorptionCof(nullptr)
104 {
105  fMaxInterval = 0;
106  fMatNbOfIntervals = 0;
107  fLowerI1 = false;
108  fVerbose = 0;
109  fSandiaCofPerAtom.resize(4,0.0);
110 }
G4SandiaTable::G4SandiaTable ( G4int  matIndex)

Definition at line 661 of file G4SandiaTable.cc.

662 {
663  fMaterial = 0;
664  fMatNbOfIntervals = 0;
665  fMatSandiaMatrix = 0;
666  fMatSandiaMatrixPAI = 0;
667  fPhotoAbsorptionCof = 0;
668 
669  fMaxInterval = 0;
670  fVerbose = 0;
671  fLowerI1 = false;
672 
673  fSandiaCofPerAtom.resize(4,0.0);
674 
675  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
676  G4int numberOfMat = G4Material::GetNumberOfMaterials();
677 
678  if ( matIndex >= 0 && matIndex < numberOfMat)
679  {
680  fMaterial = (*theMaterialTable)[matIndex];
681  }
682  else
683  {
684  G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex)", "mat401",
685  FatalException, "wrong matIndex");
686  }
687 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:78
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

G4SandiaTable::G4SandiaTable ( )

Definition at line 691 of file G4SandiaTable.cc.

692 {
693  fMaterial = 0;
694  fMatNbOfIntervals = 0;
695  fMatSandiaMatrix = 0;
696  fMatSandiaMatrixPAI = 0;
697  fPhotoAbsorptionCof = 0;
698 
699  fMaxInterval = 0;
700  fVerbose = 0;
701  fLowerI1 = false;
702 
703  fSandiaCofPerAtom.resize(4,0.0);
704 }

Member Function Documentation

G4bool G4SandiaTable::GetLowerI1 ( )
inline

Definition at line 153 of file G4SandiaTable.hh.

153 {return fLowerI1;};

Here is the caller graph for this function:

G4int G4SandiaTable::GetMatNbOfIntervals ( ) const

Definition at line 949 of file G4SandiaTable.cc.

950 {
951  return fMatNbOfIntervals;
952 }
G4int G4SandiaTable::GetMaxInterval ( ) const

Definition at line 716 of file G4SandiaTable.cc.

717 {
718  return fMaxInterval;
719 }

Here is the caller graph for this function:

G4double G4SandiaTable::GetPhotoAbsorpCof ( G4int  i,
G4int  j 
) const

Definition at line 742 of file G4SandiaTable.cc.

743 {
744  return fPhotoAbsorptionCof[i][j]*funitc[j];
745 }

Here is the caller graph for this function:

G4double G4SandiaTable::GetSandiaCofForMaterial ( G4int  interval,
G4int  j 
) const

Definition at line 983 of file G4SandiaTable.cc.

984 {
985 #ifdef G4VERBOSE
986  if(interval<0 || interval>=fMatNbOfIntervals) {
987  PrintErrorV("GetSandiaCofForMaterial");
988  interval = (interval<0) ? 0 : fMatNbOfIntervals-1;
989  }
990  if(j<0 || j>4) {
991  PrintErrorV("GetSandiaCofForMaterial");
992  j = (j<0) ? 0 : 4;
993  }
994 #endif
995  return ((*(*fMatSandiaMatrix)[interval])[j]);
996 }

Here is the caller graph for this function:

const G4double * G4SandiaTable::GetSandiaCofForMaterial ( G4double  energy) const

Definition at line 1001 of file G4SandiaTable.cc.

1002 {
1003  G4int interval = 0;
1004  if (energy > (*(*fMatSandiaMatrix)[0])[0]) {
1005  interval = fMatNbOfIntervals - 1;
1006  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
1007  while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0]))
1008  { --interval; }
1009  }
1010  return &((*(*fMatSandiaMatrix)[interval])[1]);
1011 }
int G4int
Definition: G4Types.hh:78
G4double energy(const ThreeVector &p, const G4double m)
const G4double* G4SandiaTable::GetSandiaCofForMaterialPAI ( G4double  energy) const
void G4SandiaTable::GetSandiaCofPerAtom ( G4int  Z,
G4double  energy,
std::vector< G4double > &  coeff 
) const

Definition at line 135 of file G4SandiaTable.cc.

137 {
138 #ifdef G4VERBOSE
139  if(Z < 1 || Z > 100) {
140  Z = PrintErrorZ(Z, "GetSandiaCofPerAtom");
141  }
142  if(4 > coeff.size()) {
143  PrintErrorV("GetSandiaCofPerAtom(): input vector is resized");
144  coeff.resize(4);
145  }
146 #endif
147  G4double Emin = fSandiaTable[fCumulInterval[Z-1]][0]*CLHEP::keV;
148  //G4double Iopot = fIonizationPotentials[Z]*eV;
149  //if (Emin < Iopot) Emin = Iopot;
150 
151  G4int row = 0;
152  if (energy <= Emin) {
153  energy = Emin;
154 
155  } else {
156  G4int interval = fNbOfIntervals[Z] - 1;
157  row = fCumulInterval[Z-1] + interval;
158  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
159  while ((interval>0) && (energy<fSandiaTable[row][0]*CLHEP::keV)) {
160  --interval;
161  row = fCumulInterval[Z-1] + interval;
162  }
163  }
164 
165  G4double AoverAvo = Z*amu/fZtoAratio[Z];
166 
167  coeff[0]=AoverAvo*funitc[1]*fSandiaTable[row][1];
168  coeff[1]=AoverAvo*funitc[2]*fSandiaTable[row][2];
169  coeff[2]=AoverAvo*funitc[3]*fSandiaTable[row][3];
170  coeff[3]=AoverAvo*funitc[4]*fSandiaTable[row][4];
171 }
static constexpr double keV
int G4int
Definition: G4Types.hh:78
static const G4double fZtoAratio[101]
G4double energy(const ThreeVector &p, const G4double m)
static const G4double Emin
double G4double
Definition: G4Types.hh:76
static const G4int fNbOfIntervals[101]

Here is the caller graph for this function:

void G4SandiaTable::GetSandiaCofWater ( G4double  energy,
std::vector< G4double > &  coeff 
) const

Definition at line 176 of file G4SandiaTable.cc.

178 {
179 #ifdef G4VERBOSE
180  if(4 > coeff.size()) {
181  PrintErrorV("GetSandiaCofWater: input vector is resized");
182  coeff.resize(4);
183  }
184 #endif
185  G4int i = 0;
186  if(energy > fH2OlowerI1[0][0]*CLHEP::keV) {
187  i = fH2OlowerInt - 1;
188  for(; i>0; --i) {
189  if(energy >= fH2OlowerI1[i][0]*CLHEP::keV) { break; }
190  }
191  }
192  coeff[0]=funitc[1]*fH2OlowerI1[i][1];
193  coeff[1]=funitc[2]*fH2OlowerI1[i][2];
194  coeff[2]=funitc[3]*fH2OlowerI1[i][3];
195  coeff[3]=funitc[4]*fH2OlowerI1[i][4];
196 }
static const G4double fH2OlowerI1[23][5]
static constexpr double keV
int G4int
Definition: G4Types.hh:78
G4double energy(const ThreeVector &p, const G4double m)

Here is the caller graph for this function:

G4double G4SandiaTable::GetSandiaMatTable ( G4int  interval,
G4int  j 
) const

Definition at line 1016 of file G4SandiaTable.cc.

1017 {
1018 #ifdef G4VERBOSE
1019  if(interval<0 || interval>=fMatNbOfIntervals) {
1020  PrintErrorV("GetSandiaCofForMaterial");
1021  interval = (interval<0) ? 0 : fMatNbOfIntervals-1;
1022  }
1023  if(j<0 || j>4) {
1024  PrintErrorV("GetSandiaCofForMaterial");
1025  j = (j<0) ? 0 : 4;
1026  }
1027 #endif
1028  return ((*(*fMatSandiaMatrix)[interval])[j])*funitc[j];
1029 }

Here is the caller graph for this function:

G4double G4SandiaTable::GetSandiaMatTablePAI ( G4int  interval,
G4int  j 
) const

Definition at line 1034 of file G4SandiaTable.cc.

1035 {
1036 #ifdef G4VERBOSE
1037  if(interval<0 || interval>=fMaxInterval) {
1038  PrintErrorV("GetSandiaCofForMaterialPAI");
1039  interval = (interval<0) ? 0 : fMaxInterval-1;
1040  }
1041  if(j<0 || j>4) {
1042  PrintErrorV("GetSandiaCofForMaterialPAI");
1043  j = (j<0) ? 0 : 4;
1044  }
1045 #endif
1046  return ((*(*fMatSandiaMatrixPAI)[interval])[j]);
1047 }

Here is the caller graph for this function:

G4double G4SandiaTable::GetWaterCofForMaterial ( G4int  i,
G4int  j 
) const

Definition at line 207 of file G4SandiaTable.cc.

208 {
209  return fH2OlowerI1[i][j]*funitc[j];
210 }
static const G4double fH2OlowerI1[23][5]
G4double G4SandiaTable::GetWaterEnergyLimit ( ) const

Definition at line 200 of file G4SandiaTable.cc.

201 {
202  return fH2OlowerI1[fH2OlowerInt - 1][0]*CLHEP::keV;
203 }
static const G4double fH2OlowerI1[23][5]
static constexpr double keV
G4double G4SandiaTable::GetZtoA ( G4int  Z)
static

Definition at line 214 of file G4SandiaTable.cc.

215 {
216 #ifdef G4VERBOSE
217  if(Z < 1 || Z > 100) {
218  Z = PrintErrorZ(Z, "GetSandiaCofPerAtom");
219  }
220 #endif
221  return fZtoAratio[Z];
222 }
static const G4double fZtoAratio[101]

Here is the caller graph for this function:

void G4SandiaTable::Initialize ( G4Material mat)

Definition at line 708 of file G4SandiaTable.cc.

709 {
710  fMaterial = mat;
711  ComputeMatSandiaMatrixPAI();
712 }
G4int G4SandiaTable::SandiaIntervals ( G4int  Z[],
G4int  el 
)

Definition at line 769 of file G4SandiaTable.cc.

770 {
771  G4int c, i, flag = 0, n1 = 1;
772  G4int j, c1, k1, k2;
773  G4double I1;
774  fMaxInterval = 0;
775 
776  for( i = 0; i < el; ++i ) fMaxInterval += fNbOfIntervals[ Z[i] ];
777 
778  fMaxInterval += 2;
779 
780  if( fVerbose > 0 ) {
781  G4cout<<"begin sanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
782  }
783 
784  fPhotoAbsorptionCof = new G4double* [fMaxInterval];
785 
786  for( i = 0; i < fMaxInterval; ++i ) {
787  fPhotoAbsorptionCof[i] = new G4double[5];
788  }
789  // for(c = 0; c < fIntervalLimit; ++c) // just in case
790 
791  for( c = 0; c < fMaxInterval; ++c ) { fPhotoAbsorptionCof[c][0] = 0.; }
792 
793  c = 1;
794 
795  for( i = 0; i < el; ++i )
796  {
797  I1 = fIonizationPotentials[ Z[i] ]*keV; // First ionization
798  n1 = 1; // potential in keV
799 
800  for( j = 1; j < Z[i]; ++j ) n1 += fNbOfIntervals[j];
801 
802  G4int n2 = n1 + fNbOfIntervals[Z[i]];
803 
804  for( k1 = n1; k1 < n2; k1++ )
805  {
806  if( I1 > fSandiaTable[k1][0] )
807  {
808  continue; // no ionization for energies smaller than I1 (first
809  } // ionisation potential)
810  break;
811  }
812  flag = 0;
813 
814  for( c1 = 1; c1 < c; c1++ )
815  {
816  if( fPhotoAbsorptionCof[c1][0] == I1 ) // this value already has existed
817  {
818  flag = 1;
819  break;
820  }
821  }
822  if( flag == 0 )
823  {
824  fPhotoAbsorptionCof[c][0] = I1;
825  ++c;
826  }
827  for( k2 = k1; k2 < n2; k2++ )
828  {
829  flag = 0;
830 
831  for( c1 = 1; c1 < c; c1++ )
832  {
833  if( fPhotoAbsorptionCof[c1][0] == fSandiaTable[k2][0] )
834  {
835  flag = 1;
836  break;
837  }
838  }
839  if( flag == 0 )
840  {
841  fPhotoAbsorptionCof[c][0] = fSandiaTable[k2][0];
842  if( fVerbose > 0 ) {
843  G4cout<<"sanInt, c = "<<c<<", E_c = "<<fPhotoAbsorptionCof[c][0]
844  <<G4endl;
845  }
846  ++c;
847  }
848  }
849  } // end for(i)
850 
851  SandiaSort(fPhotoAbsorptionCof,c);
852  fMaxInterval = c;
853  if( fVerbose > 0 ) {
854  G4cout<<"end SanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
855  }
856  return c;
857 }
int G4int
Definition: G4Types.hh:78
static const G4double fIonizationPotentials[101]
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13
static constexpr double keV
Definition: G4SIunits.hh:216
static const G4int fNbOfIntervals[101]
tuple c1
Definition: plottest35.py:14

Here is the caller graph for this function:

G4int G4SandiaTable::SandiaMixing ( G4int  Z[],
const G4double fractionW,
G4int  el,
G4int  mi 
)

Definition at line 865 of file G4SandiaTable.cc.

869 {
870  G4int i, j, n1, k, c=1, jj, kk;
871  G4double I1, B1, B2, E1, E2;
872 
873  for( i = 0; i < mi; ++i )
874  {
875  for( j = 1; j < 5; ++j ) fPhotoAbsorptionCof[i][j] = 0.;
876  }
877  for( i = 0; i < el; ++i )
878  {
879  n1 = 1;
880  I1 = fIonizationPotentials[Z[i]]*keV;
881 
882  for( j = 1; j < Z[i]; ++j ) n1 += fNbOfIntervals[j];
883 
884  G4int n2 = n1 + fNbOfIntervals[Z[i]] - 1;
885 
886  for( k = n1; k < n2; ++k )
887  {
888  B1 = fSandiaTable[k][0];
889  B2 = fSandiaTable[k+1][0];
890 
891  for( c = 1; c < mi-1; ++c )
892  {
893  E1 = fPhotoAbsorptionCof[c][0];
894  E2 = fPhotoAbsorptionCof[c+1][0];
895 
896  if( B1 > E1 || B2 < E2 || E1 < I1 ) continue;
897 
898  for( j = 1; j < 5; ++j )
899  {
900  fPhotoAbsorptionCof[c][j] += fSandiaTable[k][j]*fractionW[i];
901  if( fVerbose > 0 )
902  {
903  G4cout<<"c="<<c<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
904  <<"; frW="<<fractionW[i]<<G4endl;
905  }
906  }
907  }
908  }
909  for( j = 1; j < 5; ++j ) // Last interval
910  {
911  fPhotoAbsorptionCof[mi-1][j] += fSandiaTable[k][j]*fractionW[i];
912  if( fVerbose > 0 )
913  {
914  G4cout<<"mi-1="<<mi-1<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
915  <<"; frW="<<fractionW[i]<<G4endl;
916  }
917  }
918  } // for(i)
919  c = 0; // Deleting of first intervals where all coefficients = 0
920 
921  do
922  {
923  ++c;
924 
925  if( fPhotoAbsorptionCof[c][1] != 0.0 ||
926  fPhotoAbsorptionCof[c][2] != 0.0 ||
927  fPhotoAbsorptionCof[c][3] != 0.0 ||
928  fPhotoAbsorptionCof[c][4] != 0.0 ) continue;
929 
930  for( jj = 2; jj < mi; ++jj )
931  {
932  for( kk = 0; kk < 5; ++kk ) {
933  fPhotoAbsorptionCof[jj-1][kk] = fPhotoAbsorptionCof[jj][kk];
934  }
935  }
936  mi--;
937  c--;
938  }
939  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
940  while( c < mi - 1 );
941 
942  if( fVerbose > 0 ) G4cout<<"end SanMix, mi = "<<mi<<G4endl;
943 
944  return mi;
945 }
int G4int
Definition: G4Types.hh:78
static const G4double fIonizationPotentials[101]
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13
static constexpr double keV
Definition: G4SIunits.hh:216
static const G4int fNbOfIntervals[101]

Here is the caller graph for this function:

void G4SandiaTable::SetLowerI1 ( G4bool  flag)
inline

Definition at line 154 of file G4SandiaTable.hh.

154 {fLowerI1=flag;};
void G4SandiaTable::SetVerbose ( G4int  ver)
inline

Definition at line 95 of file G4SandiaTable.hh.

95 { fVerbose = ver; };

The documentation for this class was generated from the following files: