G4ElementIsoCrossSections< IsoIsoCrossSectionType > Class Template Reference

#include <G4ElementIsoCrossSections.hh>


Public Member Functions

 G4ElementIsoCrossSections ()
 ~G4ElementIsoCrossSections ()
void Init (const G4Element *anElement)
G4double GetCrossSection (G4double anEnergy)
G4IsoResultGetProductIsotope (G4double anEnergy)


Detailed Description

template<class IsoIsoCrossSectionType>
class G4ElementIsoCrossSections< IsoIsoCrossSectionType >

Definition at line 36 of file G4ElementIsoCrossSections.hh.


Constructor & Destructor Documentation

template<class IsoIsoCrossSectionType>
G4ElementIsoCrossSections< IsoIsoCrossSectionType >::G4ElementIsoCrossSections (  ) 

Definition at line 29 of file G4ElementIsoCrossSections.icc.

References G4cout, and G4endl.

00030 {
00031   nIsotopes = 0;
00032   crossSectionBuffer = 0.0;
00033   theData = NULL;
00034   G4cout << "WARNING: G4ElementIsoCrossSections is deprecated and will be removed with Geant4 version 10"
00035          << G4endl;
00036 }

template<class IsoIsoCrossSectionType>
G4ElementIsoCrossSections< IsoIsoCrossSectionType >::~G4ElementIsoCrossSections (  ) 

Definition at line 40 of file G4ElementIsoCrossSections.icc.

00041 {
00042   for(G4int i=0; i<nIsotopes; i++)
00043   {
00044     delete theData[i];
00045   }
00046   delete [] theData;
00047 }


Member Function Documentation

template<class IsoIsoCrossSectionType>
G4double G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetCrossSection ( G4double  anEnergy  ) 

Definition at line 87 of file G4ElementIsoCrossSections.icc.

Referenced by G4NeutronIsotopeProduction::GetIsotope(), and G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetProductIsotope().

00088 {
00089   G4double result = 0;
00090   for(G4int i=0; i<nIsotopes; i++)
00091   {
00092     result += theData[i]->GetCrossSection(anEnergy); // this is already weighted with relative abundance
00093   }
00094   crossSectionBuffer = result;
00095   return result;
00096 }

template<class IsoIsoCrossSectionType>
G4IsoResult * G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetProductIsotope ( G4double  anEnergy  ) 

Definition at line 100 of file G4ElementIsoCrossSections.icc.

References G4UniformRand, and G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetCrossSection().

Referenced by G4NeutronIsotopeProduction::GetIsotope().

00101 {
00102   G4double running = 0;
00103   G4int index(0);
00104   G4double random = G4UniformRand();
00105   for(G4int i=0; i<nIsotopes; i++)
00106   {
00107     running += theData[i]->GetCrossSection(anEnergy);
00108     index = i;
00109     if(running/crossSectionBuffer > random) break;
00110   }
00111   G4String result = theData[index]->GetProductIsotope(anEnergy);
00112   G4Nucleus nucleus(theData[index]->GetA(), theData[index]->GetZ());
00113   G4IsoResult * theResult = new G4IsoResult(result, nucleus);
00114   return theResult;
00115 }

template<class IsoIsoCrossSectionType>
void G4ElementIsoCrossSections< IsoIsoCrossSectionType >::Init ( const G4Element anElement  ) 

Definition at line 51 of file G4ElementIsoCrossSections.icc.

References G4StableIsotopes::GetAbundance(), G4StableIsotopes::GetFirstIsotope(), G4Element::GetIsotope(), G4StableIsotopes::GetIsotopeNucleonCount(), G4Isotope::GetN(), G4StableIsotopes::GetNumberOfIsotopes(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), and G4Element::GetZ().

00052 {
00053   G4int Z = G4int(anElement->GetZ()+0.001);
00054   nIsotopes = anElement->GetNumberOfIsotopes();
00055   G4bool useIsotopesFromElement = true;
00056   if( nIsotopes == 0 ) 
00057   {
00058     nIsotopes += theStableOnes.GetNumberOfIsotopes(Z);
00059     useIsotopesFromElement = false;
00060   }
00061   theData = new IsoIsoCrossSectionType * [nIsotopes];
00062   if(useIsotopesFromElement)
00063   {
00064     for (G4int i=0; i<nIsotopes; i++)
00065     {
00066       G4int A = anElement->GetIsotope(i)->GetN();
00067       G4double frac = anElement->GetRelativeAbundanceVector()[i]/CLHEP::perCent;
00068       theData[i] = new IsoIsoCrossSectionType;
00069       theData[i]->Init(A, Z, frac);
00070     }
00071   }
00072   else 
00073   {
00074     G4int first = theStableOnes.GetFirstIsotope(Z);
00075     for(G4int i=0; i<theStableOnes.GetNumberOfIsotopes(Z); i++)
00076     {
00077       G4int A = theStableOnes.GetIsotopeNucleonCount(first+i);
00078       G4double frac = theStableOnes.GetAbundance(first+i);
00079       theData[i] = new IsoIsoCrossSectionType;
00080       theData[i]->Init(A, Z, frac);
00081     }
00082   }
00083 }


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