#include <G4NeutronIsotopeProduction.hh>
Inheritance diagram for G4NeutronIsotopeProduction:
Public Member Functions | |
G4NeutronIsotopeProduction () | |
G4NeutronIsotopeProduction (const G4NeutronIsotopeProduction &nip) | |
virtual | ~G4NeutronIsotopeProduction () |
G4IsoResult * | GetIsotope (const G4HadProjectile *aTrack, const G4Nucleus &aNucleus) |
Definition at line 44 of file G4NeutronIsotopeProduction.hh.
G4NeutronIsotopeProduction::G4NeutronIsotopeProduction | ( | ) |
Definition at line 29 of file G4NeutronIsotopeProduction.cc.
References G4cout, G4endl, G4Element::GetElementTable(), and G4Element::GetNumberOfElements().
00030 { 00031 numberOfElements = G4Element::GetNumberOfElements(); 00032 theData = new G4ElementIsoCrossSections<G4NeutronIsoIsoCrossSections>* [numberOfElements]; 00033 for (G4int i = 0; i < numberOfElements; i++) { 00034 theData[i] = new G4ElementIsoCrossSections<G4NeutronIsoIsoCrossSections>; 00035 if((*(G4Element::GetElementTable()))[i]->GetZ() > 9 && 00036 (*(G4Element::GetElementTable()))[i]->GetZ() < 84) { 00037 // Workaround to be fixed in G4NeutronHPNames. 00038 theData[i]->Init((*(G4Element::GetElementTable()))[i]); 00039 } 00040 } 00041 G4cout << "WARNING: G4NeutronIsotopeProduction is deprecated and will be removed with Geant4 version 10" 00042 << G4endl; 00043 }
G4NeutronIsotopeProduction::G4NeutronIsotopeProduction | ( | const G4NeutronIsotopeProduction & | nip | ) |
G4NeutronIsotopeProduction::~G4NeutronIsotopeProduction | ( | ) | [virtual] |
Definition at line 46 of file G4NeutronIsotopeProduction.cc.
00047 { 00048 for (G4int i = 0; i < numberOfElements; i++) delete theData[i]; 00049 if (theData) delete [] theData; 00050 }
G4IsoResult * G4NeutronIsotopeProduction::GetIsotope | ( | const G4HadProjectile * | aTrack, | |
const G4Nucleus & | aNucleus | |||
) | [virtual] |
Implements G4VIsotopeProduction.
Definition at line 54 of file G4NeutronIsotopeProduction.cc.
References G4UniformRand, G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetCrossSection(), G4HadProjectile::GetDefinition(), G4Material::GetElement(), G4Element::GetIndex(), G4HadProjectile::GetKineticEnergy(), G4HadProjectile::GetMaterial(), G4Material::GetNumberOfElements(), G4ElementIsoCrossSections< IsoIsoCrossSectionType >::GetProductIsotope(), G4Element::GetZ(), and G4Neutron::Neutron().
00056 { 00057 G4IsoResult* result = 0; 00058 // is applicable? 00059 if (aTrack->GetDefinition() != G4Neutron::Neutron()) return result; 00060 G4double incidentKE = aTrack->GetKineticEnergy(); 00061 if (incidentKE > 100*MeV) return result; 00062 00063 // get the isotope 00064 const G4Material* theMaterial = aTrack->GetMaterial(); 00065 G4int nEleInMat = theMaterial->GetNumberOfElements(); 00066 for (G4int check = 0; check < nEleInMat; check++) { 00067 // Workaround to be fixed in G4NeutronHPNames 00068 if (theMaterial->GetElement(check)->GetZ() < 10) return result; 00069 // Workaround to be fixed in G4NeutronHPNames. 00070 if (theMaterial->GetElement(check)->GetZ() > 83) return result; 00071 } 00072 G4int index(0); 00073 G4double* xSec = new G4double[nEleInMat]; 00074 G4double sum = 0; 00075 00076 for (G4int i = 0; i < nEleInMat; i++) { 00077 index = theMaterial->GetElement(i)->GetIndex(); 00078 xSec[i] = theData[index]->GetCrossSection(incidentKE); 00079 sum += xSec[i]; 00080 } 00081 00082 G4double random = G4UniformRand(); 00083 G4double running = 0; 00084 00085 for (G4int i = 0; i < nEleInMat; i++) { 00086 running += xSec[i]; 00087 index = theMaterial->GetElement(i)->GetIndex(); 00088 if (random <= running/sum) break; 00089 } 00090 00091 delete [] xSec; 00092 result = theData[index]->GetProductIsotope(incidentKE); 00093 return result; 00094 }