G4NeutronCaptureXS Class Reference

#include <G4NeutronCaptureXS.hh>

Inheritance diagram for G4NeutronCaptureXS:

G4VCrossSectionDataSet

Public Member Functions

 G4NeutronCaptureXS ()
virtual ~G4NeutronCaptureXS ()
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *)
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *)
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat)
virtual G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy)
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
virtual void CrossSectionDescription (std::ostream &) const

Detailed Description

Definition at line 59 of file G4NeutronCaptureXS.hh.


Constructor & Destructor Documentation

G4NeutronCaptureXS::G4NeutronCaptureXS (  ) 

Definition at line 78 of file G4NeutronCaptureXS.cc.

References G4cout, G4endl, G4ElementData::SetName(), and G4VCrossSectionDataSet::verboseLevel.

00079  : G4VCrossSectionDataSet("G4NeutronCaptureXS"),
00080    emax(20*MeV),maxZ(92)
00081 {
00082   //  verboseLevel = 0;
00083   if(verboseLevel > 0){
00084     G4cout  << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
00085             << maxZ + 1 << G4endl;
00086   }
00087   //data.resize(maxZ+1, 0);
00088   data.SetName("NeutronCapture");
00089   work.resize(13,0);
00090   temp.resize(13,0.0);
00091   isInitialized = false;
00092 }

G4NeutronCaptureXS::~G4NeutronCaptureXS (  )  [virtual]

Definition at line 94 of file G4NeutronCaptureXS.cc.

00095 {
00096   /*
00097   for(G4int i=0; i<=maxZ; ++i) {
00098     delete data[i];
00099   }
00100   */
00101 }


Member Function Documentation

void G4NeutronCaptureXS::BuildPhysicsTable ( const G4ParticleDefinition  )  [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 239 of file G4NeutronCaptureXS.cc.

References G4cout, G4endl, G4ElementData::GetElementData(), G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4ParticleDefinition::GetParticleName(), and G4VCrossSectionDataSet::verboseLevel.

00240 {
00241   if(isInitialized) { return; }
00242   if(verboseLevel > 0){
00243     G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for " 
00244            << p.GetParticleName() << G4endl;
00245   }
00246   if(p.GetParticleName() != "neutron") { 
00247     throw G4HadronicException(__FILE__, __LINE__,"Wrong particle type");
00248     return; 
00249   }
00250   isInitialized = true;
00251 
00252   // check environment variable 
00253   // Build the complete string identifying the file with the data set
00254   char* path = getenv("G4NEUTRONXSDATA");
00255   if (!path){
00256     throw G4HadronicException(__FILE__, __LINE__, 
00257                               "G4NEUTRONXSDATA environment variable not defined");
00258     return;
00259   }
00260 
00261   // Access to elements
00262   const G4ElementTable* theElmTable = G4Element::GetElementTable();
00263   size_t numOfElm = G4Element::GetNumberOfElements();
00264   if(numOfElm > 0) {
00265     for(size_t i=0; i<numOfElm; ++i) {
00266       G4int Z = G4int(((*theElmTable)[i])->GetZ());
00267       if(Z < 1)         { Z = 1; }
00268       else if(Z > maxZ) { Z = maxZ; }
00269       //G4cout << "Z= " << Z << G4endl;
00270       // Initialisation 
00271       //      if(!data[Z]) { Initialise(Z, path); }
00272       if(!data.GetElementData(Z)) { Initialise(Z, path); }
00273     }
00274   }
00275 }

void G4NeutronCaptureXS::CrossSectionDescription ( std::ostream &   )  const [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 103 of file G4NeutronCaptureXS.cc.

00104 {
00105   outFile << "G4NeutronCaptureXS calculates the neutron capture cross sections\n"
00106           << "on nuclei using data from the high precision neutron database.\n"
00107           << "These data are simplified and smoothed over the resonance region\n"
00108           << "in order to reduce CPU time.  G4NeutronCaptureXS is valid up to\n"
00109           << "20 MeV for all targets through U.\n";
00110 }

G4double G4NeutronCaptureXS::GetElementCrossSection ( const G4DynamicParticle ,
G4int  Z,
const G4Material mat = 0 
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 128 of file G4NeutronCaptureXS.cc.

References G4PhysicsVector::Energy(), G4cout, G4endl, G4ElementData::GetElementData(), G4DynamicParticle::GetKineticEnergy(), G4PhysicsVector::Value(), and G4VCrossSectionDataSet::verboseLevel.

00130 {
00131   G4double xs = 0.0;
00132   G4double ekin = aParticle->GetKineticEnergy();
00133   if(ekin > emax || Z < 1 || Z > maxZ) { return xs; }
00134   const G4double elimit = 1.0e-10*eV;
00135   if(ekin < elimit) { ekin = elimit; }
00136 
00137   //  G4PhysicsVector* pv = data[Z];
00138   G4PhysicsVector* pv = data.GetElementData(Z);
00139 
00140   // element was not initialised
00141   if(!pv) {
00142     Initialise(Z);
00143     //    pv = data[Z];
00144     pv = data.GetElementData(Z);
00145     if(!pv) { return xs; }
00146   }
00147 
00148   G4double e1 = pv->Energy(0);
00149   if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
00150   else          { xs = pv->Value(ekin); }
00151 
00152   if(verboseLevel > 0){
00153     G4cout  << "ekin= " << ekin << ",  xs= " << xs << G4endl;
00154   }
00155   return xs;
00156 }

G4double G4NeutronCaptureXS::GetIsoCrossSection ( const G4DynamicParticle ,
G4int  Z,
G4int  A,
const G4Isotope iso,
const G4Element elm,
const G4Material mat 
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 159 of file G4NeutronCaptureXS.cc.

References G4PhysicsVector::Energy(), G4cout, G4endl, G4ElementData::GetComponentDataByID(), G4ElementData::GetElementData(), G4DynamicParticle::GetKineticEnergy(), G4PhysicsVector::Value(), and G4VCrossSectionDataSet::verboseLevel.

00163 {
00164   G4double xs = 0.0;
00165   G4double ekin = aParticle->GetKineticEnergy();
00166   if(ekin > emax || Z < 1 || Z > maxZ) { return xs; }
00167   const G4double elimit = 1.0e-10*eV;
00168   if(ekin < elimit) { ekin = elimit; }
00169 
00170   //  G4PhysicsVector* pv = data[Z];
00171   G4PhysicsVector* pv = data.GetElementData(Z);
00172 
00173   // element was not initialised
00174   if(!pv) {
00175     Initialise(Z);
00176     //    pv = data[Z];
00177     pv = data.GetElementData(Z);
00178     if(!pv) { return xs; }
00179   }
00180   pv = data.GetComponentDataByID(Z, A);
00181   if(!pv) { return xs; }
00182 
00183   G4double e1 = pv->Energy(0);
00184   if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
00185   else          { xs = pv->Value(ekin); }
00186 
00187   if(verboseLevel > 0){
00188     G4cout  << "ekin= " << ekin << ",  xs= " << xs << G4endl;
00189   }
00190   return xs;
00191 }

G4bool G4NeutronCaptureXS::IsElementApplicable ( const G4DynamicParticle ,
G4int  Z,
const G4Material  
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 113 of file G4NeutronCaptureXS.cc.

00115 {
00116   return true;
00117 }

G4bool G4NeutronCaptureXS::IsIsoApplicable ( const G4DynamicParticle ,
G4int  Z,
G4int  A,
const G4Element ,
const G4Material  
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 120 of file G4NeutronCaptureXS.cc.

00123 {
00124   return false;
00125 }

G4Isotope * G4NeutronCaptureXS::SelectIsotope ( const G4Element ,
G4double  kinEnergy 
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 193 of file G4NeutronCaptureXS.cc.

References G4lrint(), G4UniformRand, G4ElementData::GetComponentDataByID(), G4Element::GetIsotopeVector(), G4ElementData::GetNumberOfComponents(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZ(), and G4PhysicsVector::Value().

00195 {
00196   G4int nIso = anElement->GetNumberOfIsotopes();
00197   G4IsotopeVector* isoVector = anElement->GetIsotopeVector();
00198   G4Isotope* iso = (*isoVector)[0];
00199 
00200   // more than 1 isotope
00201   if(1 < nIso) {
00202     G4int Z = G4lrint(anElement->GetZ());
00203     if(Z > maxZ) { Z = maxZ; }
00204     G4double* abundVector = anElement->GetRelativeAbundanceVector();
00205     G4double q = G4UniformRand();
00206     G4double sum = 0.0;
00207 
00208     // is there isotope wise cross section?
00209     if(0 == amin[Z]) {
00210       for (G4int j = 0; j<nIso; ++j) {
00211         sum += abundVector[j];
00212         if(q <= sum) {
00213           iso = (*isoVector)[j];
00214           break;
00215         }
00216       }
00217     } else {
00218       size_t nmax = data.GetNumberOfComponents(Z);
00219       if(temp.size() < nmax) { temp.resize(nmax,0.0); }
00220       for (size_t i=0; i<nmax; ++i) {
00221         G4int A = (*isoVector)[i]->GetN();
00222         G4PhysicsVector* v = data.GetComponentDataByID(Z, A);
00223         if(v) { sum += abundVector[i]*v->Value(kinEnergy); }
00224         temp[i] = sum;
00225       }
00226       sum *= q;
00227       for (size_t j = 0; j<nmax; ++j) {
00228         if(temp[j] >= sum) {
00229           iso = (*isoVector)[j];
00230           break;
00231         }
00232       }
00233     }
00234   }
00235   return iso;
00236 }


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