00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "G4NeutronHPorLFission.hh"
00039 #include "G4SystemOfUnits.hh"
00040 #include "G4NeutronHPFissionFS.hh"
00041
00042 G4NeutronHPorLFission::G4NeutronHPorLFission()
00043 :G4HadronicInteraction("NeutronHPorLFission")
00044 {
00045 SetMinEnergy(0.*eV);
00046 SetMaxEnergy(20.*MeV);
00047
00048 if( !getenv("G4NEUTRONHPDATA") )
00049 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
00050
00051 dirName = getenv("G4NEUTRONHPDATA");
00052 G4String tString = "/Fission/";
00053 dirName = dirName + tString;
00054
00055 unavailable_elements.clear();
00056
00057 numEle = G4Element::GetNumberOfElements();
00058 theFission = new G4NeutronHPChannel[numEle];
00059
00060 for ( G4int i = 0; i < numEle ; i++)
00061 {
00062 if ( (*(G4Element::GetElementTable()))[i]-> GetZ() > 87 )
00063 {
00064 theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
00065 try { while(!theFission[i].Register(&theFS)) ; }
00066 catch ( G4HadronicException )
00067 {
00068 unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() );
00069 }
00070 }
00071 }
00072
00073 if ( unavailable_elements.size() > 0 )
00074 {
00075 std::set< G4String>::iterator it;
00076 G4cout << "HP Fission data are not available for thess elements "<< G4endl;
00077 for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
00078 {
00079 G4cout << *it << G4endl;
00080 }
00081 G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
00082 }
00083
00084 createXSectionDataSet();
00085 }
00086
00087 G4NeutronHPorLFission::~G4NeutronHPorLFission()
00088 {
00089 delete [] theFission;
00090 delete theDataSet;
00091 }
00092
00093 #include "G4NeutronHPThermalBoost.hh"
00094
00095 G4HadFinalState * G4NeutronHPorLFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
00096 {
00097 const G4Material * theMaterial = aTrack.GetMaterial();
00098 G4int n = theMaterial->GetNumberOfElements();
00099 G4int index = theMaterial->GetElement(0)->GetIndex();
00100 if(n!=1)
00101 {
00102 G4int i;
00103 xSec = new G4double[n];
00104 G4double sum=0;
00105 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
00106 G4double rWeight;
00107 G4NeutronHPThermalBoost aThermalE;
00108 for (i=0; i<n; i++)
00109 {
00110 index = theMaterial->GetElement(i)->GetIndex();
00111 rWeight = NumAtomsPerVolume[i];
00112 G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
00113
00114
00115
00116
00117 xSec[i] = theFission[index].GetXsec(x);
00118
00119 xSec[i] *= rWeight;
00120 sum+=xSec[i];
00121 }
00122 G4double random = G4UniformRand();
00123 G4double running = 0;
00124 for (i=0; i<n; i++)
00125 {
00126 running += xSec[i];
00127 index = theMaterial->GetElement(i)->GetIndex();
00128 if(random<=running/sum) break;
00129 }
00130 delete [] xSec;
00131
00132 }
00133 return theFission[index].ApplyYourself(aTrack);
00134 }
00135
00136
00137
00138 G4bool G4NeutronHPorLFission::IsThisElementOK( G4String name )
00139 {
00140 if ( unavailable_elements.find( name ) == unavailable_elements.end() )
00141 return TRUE;
00142 else
00143 return FALSE;
00144 }
00145
00146
00147
00148 void G4NeutronHPorLFission::createXSectionDataSet()
00149 {
00150 theDataSet = new G4NeutronHPorLFissionData ( theFission , &unavailable_elements );
00151 }
00152 const std::pair<G4double, G4double> G4NeutronHPorLFission::GetFatalEnergyCheckLevels() const
00153 {
00154
00155 return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
00156 }