#include <G4NeutronHPorLCapture.hh>
Inheritance diagram for G4NeutronHPorLCapture:
Public Member Functions | |
G4NeutronHPorLCapture () | |
~G4NeutronHPorLCapture () | |
G4HadFinalState * | ApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) |
virtual const std::pair< G4double, G4double > | GetFatalEnergyCheckLevels () const |
G4int | GetNiso () |
G4bool | IsThisElementOK (G4String) |
G4VCrossSectionDataSet * | GiveXSectionDataSet () |
Definition at line 57 of file G4NeutronHPorLCapture.hh.
G4NeutronHPorLCapture::G4NeutronHPorLCapture | ( | ) |
Definition at line 43 of file G4NeutronHPorLCapture.cc.
References G4cout, G4endl, G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().
00044 :G4HadronicInteraction("NeutronHPorLCapture") 00045 { 00046 G4NeutronHPCaptureFS * theFS = new G4NeutronHPCaptureFS; 00047 if(!getenv("G4NEUTRONHPDATA")) 00048 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 00049 dirName = getenv("G4NEUTRONHPDATA"); 00050 G4String tString = "/Capture/"; 00051 dirName = dirName + tString; 00052 // G4cout <<"G4NeutronHPorLCapture::G4NeutronHPorLCapture testit "<<dirName<<G4endl; 00053 numEle = G4Element::GetNumberOfElements(); 00054 theCapture = new G4NeutronHPChannel[numEle]; 00055 unavailable_elements.clear(); 00056 for (G4int i=0; i<numEle; i++) 00057 { 00058 theCapture[i].Init((*(G4Element::GetElementTable()))[i], dirName); 00059 //G4cout << (*(G4Element::GetElementTable()))[i] -> GetName() << G4endl; 00060 //while(!theCapture[i].Register(theFS)); 00061 try { while(!theCapture[i].Register(theFS)) ; } 00062 catch ( G4HadronicException ) 00063 { 00064 unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() ); 00065 } 00066 } 00067 delete theFS; 00068 SetMinEnergy(0.*eV); 00069 SetMaxEnergy(20.*MeV); 00070 if ( unavailable_elements.size() > 0 ) 00071 { 00072 std::set< G4String>::iterator it; 00073 G4cout << "HP Capture data are not available for thess elements "<< G4endl; 00074 for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ ) 00075 G4cout << *it << G4endl; 00076 G4cout << "Low Energy Parameterization Models will be used."<< G4endl; 00077 } 00078 00079 createXSectionDataSet(); 00080 }
G4NeutronHPorLCapture::~G4NeutronHPorLCapture | ( | ) |
G4HadFinalState * G4NeutronHPorLCapture::ApplyYourself | ( | const G4HadProjectile & | aTrack, | |
G4Nucleus & | aTargetNucleus | |||
) | [virtual] |
Implements G4HadronicInteraction.
Definition at line 90 of file G4NeutronHPorLCapture.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.
Referenced by G4NeutronHPorLCaptureModel::ApplyYourself().
00091 { 00092 const G4Material * theMaterial = aTrack.GetMaterial(); 00093 G4int n = theMaterial->GetNumberOfElements(); 00094 G4int index = theMaterial->GetElement(0)->GetIndex(); 00095 if(n!=1) 00096 { 00097 G4int i; 00098 xSec = new G4double[n]; 00099 G4double sum=0; 00100 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); 00101 G4double rWeight; 00102 G4NeutronHPThermalBoost aThermalE; 00103 for (i=0; i<n; i++) 00104 { 00105 index = theMaterial->GetElement(i)->GetIndex(); 00106 rWeight = NumAtomsPerVolume[i]; 00107 G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature()); 00108 00109 //xSec[i] = theCapture[index].GetXsec(aThermalE.GetThermalEnergy(aTrack, 00110 // theMaterial->GetElement(i), 00111 // theMaterial->GetTemperature())); 00112 xSec[i] = theCapture[index].GetXsec(x); 00113 00114 xSec[i] *= rWeight; 00115 sum+=xSec[i]; 00116 } 00117 G4double random = G4UniformRand(); 00118 G4double running = 0; 00119 for (i=0; i<n; i++) 00120 { 00121 running += xSec[i]; 00122 index = theMaterial->GetElement(i)->GetIndex(); 00123 if(random<=running/sum) break; 00124 } 00125 delete [] xSec; 00126 // it is element-wise initialised. 00127 } 00128 return theCapture[index].ApplyYourself(aTrack); 00129 }
const std::pair< G4double, G4double > G4NeutronHPorLCapture::GetFatalEnergyCheckLevels | ( | ) | const [virtual] |
Reimplemented from G4HadronicInteraction.
Definition at line 147 of file G4NeutronHPorLCapture.cc.
References DBL_MAX.
00148 { 00149 //return std::pair<G4double, G4double>(10*perCent,10*GeV); 00150 return std::pair<G4double, G4double>(10*perCent,DBL_MAX); 00151 }
G4int G4NeutronHPorLCapture::GetNiso | ( | ) | [inline] |
Definition at line 69 of file G4NeutronHPorLCapture.hh.
References G4NeutronHPChannel::GetNiso().
00069 {return theCapture[0].GetNiso();}
G4VCrossSectionDataSet* G4NeutronHPorLCapture::GiveXSectionDataSet | ( | ) | [inline] |
Definition at line 83 of file G4NeutronHPorLCapture.hh.
Referenced by G4NeutronHPorLCaptureModel::GiveHPXSectionDataSet().
Definition at line 133 of file G4NeutronHPorLCapture.cc.
Referenced by G4NeutronHPorLCaptureModel::ApplyYourself().
00134 { 00135 if ( unavailable_elements.find( name ) == unavailable_elements.end() ) 00136 return TRUE; 00137 else 00138 return FALSE; 00139 }