#include <G4FissLib.hh>
Inheritance diagram for G4FissLib:
Public Member Functions | |
G4FissLib () | |
~G4FissLib () | |
G4HadFinalState * | ApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) |
Definition at line 133 of file G4FissLib.hh.
G4FissLib::G4FissLib | ( | ) |
Definition at line 65 of file G4FissLib.cc.
References G4cout, G4endl, G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4NeutronHPChannel::Register(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().
00066 :xSec(0) 00067 { 00068 SetMinEnergy(0.0); 00069 SetMaxEnergy(20.*MeV); 00070 if(!getenv("G4NEUTRONHPDATA")) { 00071 G4cout << "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files." << G4endl; 00072 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 00073 } 00074 dirName = getenv("G4NEUTRONHPDATA"); 00075 G4String tString = "/Fission/"; 00076 dirName = dirName + tString; 00077 numEle = G4Element::GetNumberOfElements(); 00078 theFission = new G4NeutronHPChannel[numEle]; 00079 00080 for (G4int i=0; i<numEle; i++) 00081 { 00082 // G4cout << "G4FissLib::G4FissLib(): element "<< i << " : " << (*(G4Element::GetElementTable()))[i]->GetZ()<< G4endl; 00083 if((*(G4Element::GetElementTable()))[i]->GetZ()>89) 00084 { 00085 theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName); 00086 theFission[i].Register(&theLibrary); 00087 } 00088 } 00089 }
G4FissLib::~G4FissLib | ( | ) |
G4HadFinalState * G4FissLib::ApplyYourself | ( | const G4HadProjectile & | aTrack, | |
G4Nucleus & | aTargetNucleus | |||
) | [virtual] |
Implements G4HadronicInteraction.
Definition at line 97 of file G4FissLib.cc.
References G4NeutronHPChannel::ApplyYourself(), G4UniformRand, G4Material::GetElement(), G4Element::GetIndex(), G4HadProjectile::GetMaterial(), G4Material::GetNumberOfElements(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4Material::GetVecNbOfAtomsPerVolume(), G4NeutronHPChannel::GetXsec(), and CLHEP::detail::n.
00098 { 00099 const G4Material* theMaterial = aTrack.GetMaterial(); 00100 G4int n = theMaterial->GetNumberOfElements(); 00101 G4int index = theMaterial->GetElement(0)->GetIndex(); 00102 00103 if (n != 1) { 00104 xSec = new G4double[n]; 00105 G4double sum = 0; 00106 G4int i; 00107 G4int imat; 00108 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); 00109 G4double rWeight; 00110 G4NeutronHPThermalBoost aThermalE; 00111 for (i = 0; i < n; i++) { 00112 imat = theMaterial->GetElement(i)->GetIndex(); 00113 rWeight = NumAtomsPerVolume[i]; 00114 xSec[i] = theFission[imat].GetXsec(aThermalE.GetThermalEnergy(aTrack, 00115 theMaterial->GetElement(i), 00116 theMaterial->GetTemperature())); 00117 xSec[i] *= rWeight; 00118 sum+=xSec[i]; 00119 } 00120 00121 G4double random = G4UniformRand(); 00122 G4double running = 0; 00123 for (i = 0; i < n; i++) { 00124 running += xSec[i]; 00125 index = theMaterial->GetElement(i)->GetIndex(); 00126 if(random<=running/sum) break; 00127 } 00128 delete [] xSec; 00129 } 00130 00131 return theFission[index].ApplyYourself(aTrack); 00132 }