Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4SandiaTable Class Reference

#include <G4SandiaTable.hh>

Public Member Functions

 G4SandiaTable (G4Material *)
 
 ~G4SandiaTable ()
 
void GetSandiaCofPerAtom (G4int Z, G4double energy, std::vector< G4double > &coeff)
 
G4int GetMatNbOfIntervals ()
 
G4double GetSandiaCofForMaterial (G4int, G4int)
 
G4double GetSandiaMatTable (G4int, G4int)
 
const G4doubleGetSandiaCofForMaterial (G4double energy)
 
G4double GetSandiaCofForMaterialPAI (G4int, G4int)
 
G4double GetSandiaMatTablePAI (G4int, G4int)
 
const G4doubleGetSandiaCofForMaterialPAI (G4double energy)
 
G4OrderedTableGetSandiaMatrixPAI ()
 
void SetVerbose (G4int ver)
 
 G4SandiaTable (__void__ &)
 
 G4SandiaTable (G4int)
 
 G4SandiaTable ()
 
void Initialize (G4Material *)
 
void Initialize (G4int)
 
void SandiaSwap (G4double **da, G4int i, G4int j)
 
void SandiaSort (G4double **da, G4int sz)
 
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
 
G4double ** GetPointerToCof ()
 
G4bool GetLowerI1 ()
 
void SetLowerI1 (G4bool flag)
 

Static Public Member Functions

static G4double GetZtoA (G4int Z)
 

Detailed Description

Definition at line 68 of file G4SandiaTable.hh.

Constructor & Destructor Documentation

G4SandiaTable::G4SandiaTable ( G4Material material)

Definition at line 69 of file G4SandiaTable.cc.

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

Definition at line 115 of file G4SandiaTable.cc.

116 {
117  if(fMatSandiaMatrix)
118  {
119  //fMatSandiaMatrix->clearAndDestroy();
120  delete fMatSandiaMatrix;
121  }
122  if(fMatSandiaMatrixPAI)
123  {
124  //fMatSandiaMatrixPAI->clearAndDestroy();
125  delete fMatSandiaMatrixPAI;
126  }
127  if(fPhotoAbsorptionCof)
128  {
129  delete [] fPhotoAbsorptionCof;
130  }
131 }
G4SandiaTable::G4SandiaTable ( __void__ &  )

Definition at line 102 of file G4SandiaTable.cc.

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

Definition at line 578 of file G4SandiaTable.cc.

References FatalException, G4Exception(), G4Material::GetMaterialTable(), and G4Material::GetNumberOfMaterials().

579 {
580  fMaterial = 0;
581  fMatNbOfIntervals = 0;
582  fMatSandiaMatrix = 0;
583  fMatSandiaMatrixPAI = 0;
584  fPhotoAbsorptionCof = 0;
585 
586  fMaxInterval = 0;
587  fVerbose = 0;
588 
589  fSandiaCofPerAtom.resize(4,0.0);
590 
591  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
592  G4int numberOfMat = G4Material::GetNumberOfMaterials();
593 
594  if ( matIndex >= 0 && matIndex < numberOfMat)
595  {
596  fMaterial = (*theMaterialTable)[matIndex];
597  // ComputeMatTable();
598  }
599  else
600  {
601  G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex)", "mat401",
602  FatalException, "wrong matIndex");
603  }
604 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:78
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:571
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4SandiaTable::G4SandiaTable ( )

Definition at line 608 of file G4SandiaTable.cc.

609 {
610  fMaterial = 0;
611  fMatNbOfIntervals = 0;
612  fMatSandiaMatrix = 0;
613  fMatSandiaMatrixPAI = 0;
614  fPhotoAbsorptionCof = 0;
615 
616  fMaxInterval = 0;
617  fVerbose = 0;
618  fLowerI1 = false;
619 
620  fSandiaCofPerAtom.resize(4,0.0);
621 }

Member Function Documentation

G4bool G4SandiaTable::GetLowerI1 ( )
inline

Definition at line 168 of file G4SandiaTable.hh.

Referenced by G4PAIxSection::Initialize().

168 {return fLowerI1;};
G4int G4SandiaTable::GetMatNbOfIntervals ( )

Definition at line 893 of file G4SandiaTable.cc.

894 {
895  return fMatNbOfIntervals;
896 }
G4int G4SandiaTable::GetMaxInterval ( ) const

Definition at line 662 of file G4SandiaTable.cc.

Referenced by G4InitXscPAI::G4InitXscPAI(), G4PAIySection::Initialize(), and G4PAIxSection::Initialize().

662  {
663  return fMaxInterval;
664 }
G4double G4SandiaTable::GetPhotoAbsorpCof ( G4int  i,
G4int  j 
) const

Definition at line 687 of file G4SandiaTable.cc.

Referenced by G4PAIPhotonModel::ComputeSandiaPhotoAbsCof(), and G4PAIxSection::G4PAIxSection().

688 {
689  return fPhotoAbsorptionCof[i][j]*funitc[j];
690 }
G4double ** G4SandiaTable::GetPointerToCof ( )

Definition at line 668 of file G4SandiaTable.cc.

669 {
670  if(!fPhotoAbsorptionCof) { ComputeMatTable(); }
671  return fPhotoAbsorptionCof;
672 }
G4double G4SandiaTable::GetSandiaCofForMaterial ( G4int  interval,
G4int  j 
)

Definition at line 925 of file G4SandiaTable.cc.

References assert.

Referenced by G4PEEffectFluoModel::CrossSectionPerVolume(), G4VXTRenergyLoss::GetGasLinearPhotoAbs(), G4StrawTubeXTRadiator::GetMediumLinearPhotoAbs(), and G4VXTRenergyLoss::GetPlateLinearPhotoAbs().

926 {
927  assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
928  return ((*(*fMatSandiaMatrix)[interval])[j]);
929 }
#define assert(x)
Definition: mymalloc.cc:1309
const G4double * G4SandiaTable::GetSandiaCofForMaterial ( G4double  energy)

Definition at line 934 of file G4SandiaTable.cc.

References test::x.

935 {
936  const G4double* x = fnulcof;
937  if (energy >= (*(*fMatSandiaMatrix)[0])[0]) {
938 
939  G4int interval = fMatNbOfIntervals - 1;
940  while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0]))
941  {interval--;}
942  x = &((*(*fMatSandiaMatrix)[interval])[1]);
943  }
944  return x;
945 }
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
double G4double
Definition: G4Types.hh:76
G4double G4SandiaTable::GetSandiaCofForMaterialPAI ( G4int  interval,
G4int  j 
)

Definition at line 959 of file G4SandiaTable.cc.

References assert.

960 {
961  assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
962  if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI();
963  return ((*(*fMatSandiaMatrixPAI)[interval])[j]);
964 }
#define assert(x)
Definition: mymalloc.cc:1309
const G4double * G4SandiaTable::GetSandiaCofForMaterialPAI ( G4double  energy)

Definition at line 969 of file G4SandiaTable.cc.

References test::x.

970 {
971  if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI();
972  const G4double* x = fnulcof;
973  if (energy >= (*(*fMatSandiaMatrixPAI)[0])[0]) {
974 
975  G4int interval = fMatNbOfIntervals - 1;
976  while ((interval>0)&&(energy<(*(*fMatSandiaMatrixPAI)[interval])[0]))
977  {interval--;}
978  x = &((*(*fMatSandiaMatrixPAI)[interval])[1]);
979  }
980  return x;
981 }
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
double G4double
Definition: G4Types.hh:76
void G4SandiaTable::GetSandiaCofPerAtom ( G4int  Z,
G4double  energy,
std::vector< G4double > &  coeff 
)

Definition at line 136 of file G4SandiaTable.cc.

References python.hepunit::amu, assert, python.hepunit::eV, and python.hepunit::keV.

Referenced by G4PEEffectFluoModel::ComputeCrossSectionPerAtom().

138 {
139  assert(4 <= coeff.size());
140  G4double Emin = fSandiaTable[fCumulInterval[Z-1]][0]*keV;
141  G4double Iopot = fIonizationPotentials[Z]*eV;
142  if (Iopot > Emin) Emin = Iopot;
143 
144  G4int interval = fNbOfIntervals[Z] - 1;
145  G4int row = fCumulInterval[Z-1] + interval;
146  while ((interval>0) && (energy<fSandiaTable[row][0]*keV)) {
147  --interval;
148  row = fCumulInterval[Z-1] + interval;
149  }
150  if (energy >= Emin)
151  {
152  G4double AoverAvo = Z*amu/fZtoAratio[Z];
153 
154  coeff[0]=AoverAvo*funitc[1]*fSandiaTable[row][1];
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];
158  }
159  else
160  {
161  coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.;
162  }
163 }
#define assert(x)
Definition: mymalloc.cc:1309
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
double G4double
Definition: G4Types.hh:76
G4OrderedTable * G4SandiaTable::GetSandiaMatrixPAI ( )

Definition at line 1005 of file G4SandiaTable.cc.

1006 {
1007  if(!fMatSandiaMatrixPAI) { ComputeMatSandiaMatrixPAI(); }
1008  return fMatSandiaMatrixPAI;
1009 }
G4double G4SandiaTable::GetSandiaMatTable ( G4int  interval,
G4int  j 
)

Definition at line 950 of file G4SandiaTable.cc.

References assert.

Referenced by G4InitXscPAI::G4InitXscPAI().

951 {
952  assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
953  return ((*(*fMatSandiaMatrix)[interval])[j])*funitc[j];
954 }
#define assert(x)
Definition: mymalloc.cc:1309
G4double G4SandiaTable::GetSandiaMatTablePAI ( G4int  interval,
G4int  j 
)

Definition at line 986 of file G4SandiaTable.cc.

References assert.

Referenced by G4PAIPhotonModel::BuildPAIonisationTable(), G4PAIySection::Initialize(), and G4PAIxSection::Initialize().

987 {
988  assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
989  if(!fMatSandiaMatrixPAI) { ComputeMatSandiaMatrixPAI(); }
990  return ((*(*fMatSandiaMatrixPAI)[interval])[j]); // *funitc[j];-> to method
991 }
#define assert(x)
Definition: mymalloc.cc:1309
G4double G4SandiaTable::GetZtoA ( G4int  Z)
static

Definition at line 167 of file G4SandiaTable.cc.

References assert.

Referenced by G4NeutronHPNames::GetName().

168 {
169  assert (Z>0 && Z<101);
170  return fZtoAratio[Z];
171 }
#define assert(x)
Definition: mymalloc.cc:1309
void G4SandiaTable::Initialize ( G4Material mat)

Definition at line 625 of file G4SandiaTable.cc.

Referenced by G4PAIPhotonModel::Initialise(), and G4PAIPhotonModel::InitTest().

626 {
627  fMaterial = mat;
628  ComputeMatSandiaMatrixPAI();
629 }
void G4SandiaTable::Initialize ( G4int  matIndex)

Definition at line 643 of file G4SandiaTable.cc.

References FatalException, G4Exception(), G4Material::GetMaterialTable(), and G4Material::GetNumberOfMaterials().

644 {
645  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
646  G4int numberOfMat = G4Material::GetNumberOfMaterials();
647 
648  if ( matIndex >= 0 && matIndex < numberOfMat )
649  {
650  fMaterial = (*theMaterialTable)[matIndex];
651  ComputeMatTable();
652  }
653  else
654  {
655  G4Exception("G4SandiaTable::Initialize(G4int matIndex)", "mat401",
656  FatalException, "wrong matIndex");
657  }
658 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:78
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:571
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int G4SandiaTable::SandiaIntervals ( G4int  Z[],
G4int  el 
)

Definition at line 714 of file G4SandiaTable.cc.

References test::c, plottest35::c1, G4cout, G4endl, python.hepunit::keV, and SandiaSort().

Referenced by G4PAIPhotonModel::ComputeSandiaPhotoAbsCof(), and G4PAIxSection::G4PAIxSection().

715 {
716  G4int c, i, flag = 0, n1 = 1;
717  G4int j, c1, k1, k2;
718  G4double I1;
719  fMaxInterval = 0;
720 
721  for( i = 0; i < el; i++ ) fMaxInterval += fNbOfIntervals[ Z[i] ];
722 
723  fMaxInterval += 2;
724 
725  if( fVerbose > 0 ) {
726  G4cout<<"begin sanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
727  }
728 
729  fPhotoAbsorptionCof = new G4double* [fMaxInterval];
730 
731  for( i = 0; i < fMaxInterval; i++ ) {
732  fPhotoAbsorptionCof[i] = new G4double[5];
733  }
734  // for(c = 0; c < fIntervalLimit; c++) // just in case
735 
736  for( c = 0; c < fMaxInterval; c++ ) { fPhotoAbsorptionCof[c][0] = 0.; }
737 
738  c = 1;
739 
740  for( i = 0; i < el; i++ )
741  {
742  I1 = fIonizationPotentials[ Z[i] ]*keV; // First ionization
743  n1 = 1; // potential in keV
744 
745  for( j = 1; j < Z[i]; j++ ) n1 += fNbOfIntervals[j];
746 
747  G4int n2 = n1 + fNbOfIntervals[Z[i]];
748 
749  for( k1 = n1; k1 < n2; k1++ )
750  {
751  if( I1 > fSandiaTable[k1][0] )
752  {
753  continue; // no ionization for energies smaller than I1 (first
754  } // ionisation potential)
755  break;
756  }
757  flag = 0;
758 
759  for( c1 = 1; c1 < c; c1++ )
760  {
761  if( fPhotoAbsorptionCof[c1][0] == I1 ) // this value already has existed
762  {
763  flag = 1;
764  break;
765  }
766  }
767  if( flag == 0 )
768  {
769  fPhotoAbsorptionCof[c][0] = I1;
770  c++;
771  }
772  for( k2 = k1; k2 < n2; k2++ )
773  {
774  flag = 0;
775 
776  for( c1 = 1; c1 < c; c1++ )
777  {
778  if( fPhotoAbsorptionCof[c1][0] == fSandiaTable[k2][0] )
779  {
780  flag = 1;
781  break;
782  }
783  }
784  if( flag == 0 )
785  {
786  fPhotoAbsorptionCof[c][0] = fSandiaTable[k2][0];
787  if( fVerbose > 0 ) {
788  G4cout<<"sanInt, c = "<<c<<", E_c = "<<fPhotoAbsorptionCof[c][0]
789  <<G4endl;
790  }
791  c++;
792  }
793  }
794  } // end for(i)
795 
796  SandiaSort(fPhotoAbsorptionCof,c);
797  fMaxInterval = c;
798  if( fVerbose > 0 ) {
799  G4cout<<"end SanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
800  }
801  return c;
802 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void SandiaSort(G4double **da, G4int sz)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
tuple c1
Definition: plottest35.py:14
G4int G4SandiaTable::SandiaMixing ( G4int  Z[],
const G4double fractionW,
G4int  el,
G4int  mi 
)

Definition at line 810 of file G4SandiaTable.cc.

References test::c, G4cout, G4endl, and python.hepunit::keV.

Referenced by G4PAIPhotonModel::ComputeSandiaPhotoAbsCof(), and G4PAIxSection::G4PAIxSection().

814 {
815  G4int i, j, n1, k, c=1, jj, kk;
816  G4double I1, B1, B2, E1, E2;
817 
818  for( i = 0; i < mi; i++ )
819  {
820  for( j = 1; j < 5; j++ ) fPhotoAbsorptionCof[i][j] = 0.;
821  }
822  for( i = 0; i < el; i++ )
823  {
824  n1 = 1;
825  I1 = fIonizationPotentials[Z[i]]*keV;
826 
827  for( j = 1; j < Z[i]; j++ ) n1 += fNbOfIntervals[j];
828 
829  G4int n2 = n1 + fNbOfIntervals[Z[i]] - 1;
830 
831  for( k = n1; k < n2; k++ )
832  {
833  B1 = fSandiaTable[k][0];
834  B2 = fSandiaTable[k+1][0];
835 
836  for( c = 1; c < mi-1; c++ )
837  {
838  E1 = fPhotoAbsorptionCof[c][0];
839  E2 = fPhotoAbsorptionCof[c+1][0];
840 
841  if( B1 > E1 || B2 < E2 || E1 < I1 ) continue;
842 
843  for( j = 1; j < 5; j++ )
844  {
845  fPhotoAbsorptionCof[c][j] += fSandiaTable[k][j]*fractionW[i];
846  if( fVerbose > 0 )
847  {
848  G4cout<<"c="<<c<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
849  <<"; frW="<<fractionW[i]<<G4endl;
850  }
851  }
852  }
853  }
854  for( j = 1; j < 5; j++ ) // Last interval
855  {
856  fPhotoAbsorptionCof[mi-1][j] += fSandiaTable[k][j]*fractionW[i];
857  if( fVerbose > 0 )
858  {
859  G4cout<<"mi-1="<<mi-1<<"; j="<<j<<"; fST="<<fSandiaTable[k][j]
860  <<"; frW="<<fractionW[i]<<G4endl;
861  }
862  }
863  } // for(i)
864  c = 0; // Deleting of first intervals where all coefficients = 0
865 
866  do
867  {
868  c++;
869 
870  if( fPhotoAbsorptionCof[c][1] != 0.0 ||
871  fPhotoAbsorptionCof[c][2] != 0.0 ||
872  fPhotoAbsorptionCof[c][3] != 0.0 ||
873  fPhotoAbsorptionCof[c][4] != 0.0 ) continue;
874 
875  for( jj = 2; jj < mi; jj++ )
876  {
877  for( kk = 0; kk < 5; kk++ ) {
878  fPhotoAbsorptionCof[jj-1][kk] = fPhotoAbsorptionCof[jj][kk];
879  }
880  }
881  mi--;
882  c--;
883  }
884  while( c < mi - 1 );
885 
886  if( fVerbose > 0 ) G4cout<<"end SanMix, mi = "<<mi<<G4endl;
887 
888  return mi;
889 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4SandiaTable::SandiaSort ( G4double **  da,
G4int  sz 
)

Definition at line 698 of file G4SandiaTable.cc.

References SandiaSwap().

Referenced by SandiaIntervals().

699 {
700  for(G4int i = 1;i < sz; i++ )
701  {
702  for(G4int j = i + 1;j < sz; j++ )
703  {
704  if(da[i][0] > da[j][0]) SandiaSwap(da,i,j);
705  }
706  }
707 }
void SandiaSwap(G4double **da, G4int i, G4int j)
int G4int
Definition: G4Types.hh:78
void G4SandiaTable::SandiaSwap ( G4double **  da,
G4int  i,
G4int  j 
)

Definition at line 676 of file G4SandiaTable.cc.

Referenced by SandiaSort().

679 {
680  G4double tmp = da[i][0] ;
681  da[i][0] = da[j][0] ;
682  da[j][0] = tmp ;
683 }
double G4double
Definition: G4Types.hh:76
void G4SandiaTable::SetLowerI1 ( G4bool  flag)
inline

Definition at line 169 of file G4SandiaTable.hh.

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

Definition at line 91 of file G4SandiaTable.hh.

91 { fVerbose = ver; };

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