G4SandiaTable Class Reference

#include <G4SandiaTable.hh>


Public Member Functions

 G4SandiaTable (G4Material *)
 ~G4SandiaTable ()
G4int GetMatNbOfIntervals ()
G4double GetSandiaCofForMaterial (G4int, G4int)
G4double * GetSandiaCofForMaterial (G4double energy)
G4double GetSandiaMatTable (G4int, G4int)
G4double GetSandiaCofForMaterialPAI (G4int, G4int)
G4double * GetSandiaCofForMaterialPAI (G4double energy)
G4double GetSandiaMatTablePAI (G4int, G4int)
G4OrderedTable * GetSandiaMatrixPAI ()
void SetVerbose (G4int ver)
 G4SandiaTable (__void__ &)
 G4SandiaTable (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 ()

Static Public Member Functions

static G4double * GetSandiaCofPerAtom (G4int Z, G4double energy)
static G4double GetZtoA (G4int Z)


Detailed Description

Definition at line 64 of file G4SandiaTable.hh.


Constructor & Destructor Documentation

G4SandiaTable::G4SandiaTable ( G4Material *   ) 

Definition at line 63 of file G4SandiaTable.cc.

00064   : fMaterial(material)
00065 {
00066   fMatSandiaMatrix    = 0; 
00067   fMatSandiaMatrixPAI = 0;
00068   fPhotoAbsorptionCof = 0;
00069 
00070   fMatNbOfIntervals   = 0;
00071 
00072  
00073   fMaxInterval        = 0;
00074   fVerbose            = 0;  
00075 
00076   //build the CumulInterval array
00077 
00078   fCumulInterval[0] = 1;
00079 
00080   for (G4int Z=1; Z<101; ++Z) {
00081     fCumulInterval[Z] = fCumulInterval[Z-1] + fNbOfIntervals[Z];
00082   }
00083   
00084   //initialisation of fnulcof
00085   fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
00086 
00087   fMaxInterval = 0;
00088 
00089   //compute macroscopic Sandia coefs for a material   
00090   ComputeMatSandiaMatrix(); // mma
00091 
00092   // ComputeMatTable();  // vmg
00093 }

G4SandiaTable::~G4SandiaTable (  ) 

Definition at line 111 of file G4SandiaTable.cc.

References G4OrderedTable::clearAndDestroy().

00112 { 
00113   if(fMatSandiaMatrix) {
00114     fMatSandiaMatrix->clearAndDestroy();
00115     delete fMatSandiaMatrix;
00116   }
00117   if(fMatSandiaMatrixPAI) {
00118     fMatSandiaMatrixPAI->clearAndDestroy();
00119     delete fMatSandiaMatrixPAI;
00120   }
00121   if(fPhotoAbsorptionCof)
00122   {
00123     delete [] fPhotoAbsorptionCof;
00124   }
00125 }

G4SandiaTable::G4SandiaTable ( __void__ &   ) 

Definition at line 100 of file G4SandiaTable.cc.

00101   : fMaterial(0),fMatSandiaMatrix(0),fMatSandiaMatrixPAI(0),fPhotoAbsorptionCof(0)
00102 {
00103   fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
00104   fMaxInterval = 0;
00105   fMatNbOfIntervals = 0;
00106   fVerbose          = 0;  
00107 }

G4SandiaTable::G4SandiaTable ( G4int   ) 

Definition at line 523 of file G4SandiaTable.cc.

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

00524 { 
00525   fMaterial           = 0;
00526   fMatNbOfIntervals   = 0;
00527   fMatSandiaMatrix    = 0; 
00528   fMatSandiaMatrixPAI = 0;
00529   fPhotoAbsorptionCof = 0;
00530 
00531  
00532   fMaxInterval        = 0;
00533   fVerbose            = 0;  
00534 
00535   //initialisation of fnulcof
00536   fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.;
00537 
00538   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
00539   G4int numberOfMat = G4Material::GetNumberOfMaterials();
00540 
00541   if ( matIndex >= 0 && matIndex < numberOfMat)
00542     {
00543       fMaterial = (*theMaterialTable)[matIndex];
00544       ComputeMatTable();
00545     }
00546   else
00547     {
00548       G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex)", "mat401",
00549        FatalException, "wrong matIndex");
00550     }
00551 }


Member Function Documentation

G4int G4SandiaTable::GetMatNbOfIntervals (  ) 

Definition at line 745 of file G4SandiaTable.cc.

00746 {
00747   return fMatNbOfIntervals;
00748 }

G4int G4SandiaTable::GetMaxInterval (  )  const [inline]

Definition at line 189 of file G4SandiaTable.hh.

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

00189                                     { 
00190   return fMaxInterval;
00191 }

G4double G4SandiaTable::GetPhotoAbsorpCof ( G4int  i,
G4int  j 
) const [inline]

Definition at line 211 of file G4SandiaTable.hh.

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

00212 {
00213   return  fPhotoAbsorptionCof[i][j]*funitc[j];
00214 }

G4double ** G4SandiaTable::GetPointerToCof (  )  [inline]

Definition at line 194 of file G4SandiaTable.hh.

00195 { 
00196   if(!fPhotoAbsorptionCof) { ComputeMatTable(); }
00197   return fPhotoAbsorptionCof;
00198 }

G4double * G4SandiaTable::GetSandiaCofForMaterial ( G4double  energy  ) 

Definition at line 786 of file G4SandiaTable.cc.

00787 {
00788   G4double* x = fnulcof;
00789   if (energy >= (*(*fMatSandiaMatrix)[0])[0]) {
00790    
00791     G4int interval = fMatNbOfIntervals - 1;
00792     while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0])) 
00793       {interval--;} 
00794     x = &((*(*fMatSandiaMatrix)[interval])[1]);
00795   }
00796   return x;
00797 }

G4double G4SandiaTable::GetSandiaCofForMaterial ( G4int  ,
G4int   
)

Definition at line 777 of file G4SandiaTable.cc.

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

00778 {
00779   assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
00780   return ((*(*fMatSandiaMatrix)[interval])[j]); 
00781 }

G4double * G4SandiaTable::GetSandiaCofForMaterialPAI ( G4double  energy  ) 

Definition at line 821 of file G4SandiaTable.cc.

00822 {
00823   if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI();
00824   G4double* x = fnulcof;
00825   if (energy >= (*(*fMatSandiaMatrixPAI)[0])[0]) {
00826    
00827     G4int interval = fMatNbOfIntervals - 1;
00828     while ((interval>0)&&(energy<(*(*fMatSandiaMatrixPAI)[interval])[0])) 
00829       {interval--;} 
00830     x = &((*(*fMatSandiaMatrixPAI)[interval])[1]);
00831   }
00832   return x;
00833 }

G4double G4SandiaTable::GetSandiaCofForMaterialPAI ( G4int  ,
G4int   
)

Definition at line 811 of file G4SandiaTable.cc.

Referenced by G4PAIModel::BuildPAIonisationTable().

00812 {
00813   assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5);
00814   if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI();
00815   return ((*(*fMatSandiaMatrixPAI)[interval])[j]); 
00816 }

G4double * G4SandiaTable::GetSandiaCofPerAtom ( G4int  Z,
G4double  energy 
) [static]

Definition at line 130 of file G4SandiaTable.cc.

Referenced by G4PEEffectModel::ComputeCrossSectionPerAtom(), and G4PEEffectFluoModel::ComputeCrossSectionPerAtom().

00131 {
00132   G4double Emin  = fSandiaTable[fCumulInterval[Z-1]][0]*keV;
00133   G4double Iopot = fIonizationPotentials[Z]*eV;
00134   if (Iopot > Emin) Emin = Iopot;
00135    
00136   G4int interval = fNbOfIntervals[Z] - 1;
00137   G4int row = fCumulInterval[Z-1] + interval;
00138   while ((interval>0) && (energy<fSandiaTable[row][0]*keV)) {
00139     --interval;
00140     row = fCumulInterval[Z-1] + interval;
00141   }
00142   if (energy >= Emin)
00143     {        
00144       G4double AoverAvo = Z*amu/fZtoAratio[Z];
00145          
00146       fSandiaCofPerAtom[0]=AoverAvo*funitc[1]*fSandiaTable[row][1];     
00147       fSandiaCofPerAtom[1]=AoverAvo*funitc[2]*fSandiaTable[row][2];     
00148       fSandiaCofPerAtom[2]=AoverAvo*funitc[3]*fSandiaTable[row][3];     
00149       fSandiaCofPerAtom[3]=AoverAvo*funitc[4]*fSandiaTable[row][4];
00150     }
00151   else 
00152     {
00153       fSandiaCofPerAtom[0] = fSandiaCofPerAtom[1] = fSandiaCofPerAtom[2] =
00154         fSandiaCofPerAtom[3] = 0.;
00155     }                
00156   return fSandiaCofPerAtom;     
00157 }

G4OrderedTable * G4SandiaTable::GetSandiaMatrixPAI (  ) 

Definition at line 857 of file G4SandiaTable.cc.

00858 {
00859   if(!fMatSandiaMatrixPAI) { ComputeMatSandiaMatrixPAI(); }
00860   return fMatSandiaMatrixPAI;
00861 }

G4double G4SandiaTable::GetSandiaMatTable ( G4int  ,
G4int   
)

Definition at line 802 of file G4SandiaTable.cc.

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

00803 {
00804   assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
00805   return ((*(*fMatSandiaMatrix)[interval])[j])*funitc[j]; 
00806 }

G4double G4SandiaTable::GetSandiaMatTablePAI ( G4int  ,
G4int   
)

Definition at line 838 of file G4SandiaTable.cc.

Referenced by G4PAIySection::Initialize().

00839 {
00840   assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 );
00841   if(!fMatSandiaMatrixPAI) { ComputeMatSandiaMatrixPAI(); }
00842   return ((*(*fMatSandiaMatrixPAI)[interval])[j])*funitc[j]; 
00843 }

G4double G4SandiaTable::GetZtoA ( G4int  Z  )  [static]

Definition at line 161 of file G4SandiaTable.cc.

Referenced by G4NeutronHPNames::GetName().

00162 {
00163   assert (Z>0 && Z<101);
00164   return fZtoAratio[Z];
00165 }

G4int G4SandiaTable::SandiaIntervals ( G4int  Z[],
G4int  el 
)

Definition at line 577 of file G4SandiaTable.cc.

References G4cout, G4endl, and SandiaSort().

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

00579 {
00580   G4int c,  i, flag = 0, n1 = 1;
00581   G4int j, c1, k1, k2;
00582   G4double I1;
00583   fMaxInterval = 0;
00584 
00585   for( i = 0; i < el; i++ )  fMaxInterval += fNbOfIntervals[ Z[i] ]; 
00586 
00587   fMaxInterval += 2;
00588 
00589   if( fVerbose > 0 ) G4cout<<"begin sanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
00590 
00591   fPhotoAbsorptionCof = new G4double* [fMaxInterval];
00592 
00593   for( i = 0; i < fMaxInterval; i++ )   fPhotoAbsorptionCof[i] = new G4double[5];
00594  
00595   //  for(c = 0; c < fIntervalLimit; c++)   // just in case
00596 
00597   for( c = 0; c < fMaxInterval; c++ )     fPhotoAbsorptionCof[c][0] = 0.;
00598   
00599   c = 1;
00600 
00601   for( i = 0; i < el; i++ )
00602   {
00603     I1 = fIonizationPotentials[ Z[i] ]*keV;  // First ionization
00604     n1 = 1;                                  // potential in keV
00605 
00606     for( j = 1; j < Z[i]; j++ )  n1 += fNbOfIntervals[j];
00607     
00608     G4int n2 = n1 + fNbOfIntervals[Z[i]];
00609     
00610     for( k1 = n1; k1 < n2; k1++ )
00611     {
00612       if( I1  > fSandiaTable[k1][0] )
00613       {
00614          continue;    // no ionization for energies smaller than I1 (first
00615       }                // ionisation potential)              
00616       break;
00617     }
00618     flag = 0;
00619     
00620     for( c1 = 1; c1 < c; c1++ )
00621     {
00622       if( fPhotoAbsorptionCof[c1][0] == I1 ) // this value already has existed
00623       {
00624         flag = 1;                      
00625         break;                         
00626       }
00627     }
00628     if( flag == 0 )
00629     {
00630       fPhotoAbsorptionCof[c][0] = I1;
00631       c++;
00632     }
00633     for( k2 = k1; k2 < n2; k2++ )
00634     {
00635       flag = 0;
00636 
00637       for( c1 = 1; c1 < c; c1++ )
00638       {
00639         if( fPhotoAbsorptionCof[c1][0] == fSandiaTable[k2][0] )
00640         {
00641           flag = 1;
00642           break;
00643         }
00644       }
00645       if( flag == 0 )
00646       {
00647         fPhotoAbsorptionCof[c][0] = fSandiaTable[k2][0];
00648         if( fVerbose > 0 ) G4cout<<"sanInt, c = "<<c<<", E_c = "<<fPhotoAbsorptionCof[c][0]<<G4endl;
00649         c++;
00650       }
00651     }       
00652   }   // end for(i)
00653   
00654   SandiaSort(fPhotoAbsorptionCof,c);
00655   fMaxInterval = c;
00656   if( fVerbose > 0 ) G4cout<<"end SanInt, fMaxInterval = "<<fMaxInterval<<G4endl;
00657   return c;
00658 }   

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

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

void G4SandiaTable::SandiaSort ( G4double **  da,
G4int  sz 
)

Definition at line 559 of file G4SandiaTable.cc.

References SandiaSwap().

Referenced by SandiaIntervals().

00561 {
00562   for(G4int i = 1;i < sz; i++ ) 
00563    {
00564      for(G4int j = i + 1;j < sz; j++ )
00565      {
00566        if(da[i][0] > da[j][0])   SandiaSwap(da,i,j);      
00567      }
00568    }
00569 }

void G4SandiaTable::SandiaSwap ( G4double **  da,
G4int  i,
G4int  j 
) [inline]

Definition at line 201 of file G4SandiaTable.hh.

Referenced by SandiaSort().

00204 {
00205   G4double tmp = da[i][0] ;
00206   da[i][0] = da[j][0] ;
00207   da[j][0] = tmp ;
00208 }

void G4SandiaTable::SetVerbose ( G4int  ver  )  [inline]

Definition at line 87 of file G4SandiaTable.hh.

00087 {fVerbose = ver;};


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:20 2013 for Geant4 by  doxygen 1.4.7