#include <G4NeutronHPElastic.hh>
Inheritance diagram for G4NeutronHPElastic:
Public Member Functions | |
G4NeutronHPElastic () | |
~G4NeutronHPElastic () | |
G4HadFinalState * | ApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) |
virtual const std::pair< G4double, G4double > | GetFatalEnergyCheckLevels () const |
G4int | GetNiso () |
void | DoNotSuspend () |
Definition at line 48 of file G4NeutronHPElastic.hh.
G4NeutronHPElastic::G4NeutronHPElastic | ( | ) |
Definition at line 38 of file G4NeutronHPElastic.cc.
References G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().
00039 :G4HadronicInteraction("NeutronHPElastic") 00040 { 00041 overrideSuspension = false; 00042 G4NeutronHPElasticFS * theFS = new G4NeutronHPElasticFS; 00043 if(!getenv("G4NEUTRONHPDATA")) 00044 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 00045 dirName = getenv("G4NEUTRONHPDATA"); 00046 G4String tString = "/Elastic"; 00047 dirName = dirName + tString; 00048 // G4cout <<"G4NeutronHPElastic::G4NeutronHPElastic testit "<<dirName<<G4endl; 00049 numEle = G4Element::GetNumberOfElements(); 00050 //theElastic = new G4NeutronHPChannel[numEle]; 00051 //for (G4int i=0; i<numEle; i++) 00052 //{ 00053 // theElastic[i].Init((*(G4Element::GetElementTable()))[i], dirName); 00054 // while(!theElastic[i].Register(theFS)) ; 00055 //} 00056 for ( G4int i = 0 ; i < numEle ; i++ ) 00057 { 00058 theElastic.push_back( new G4NeutronHPChannel ); 00059 (*theElastic[i]).Init((*(G4Element::GetElementTable()))[i], dirName); 00060 while(!(*theElastic[i]).Register(theFS)) ; 00061 } 00062 delete theFS; 00063 SetMinEnergy(0.*eV); 00064 SetMaxEnergy(20.*MeV); 00065 }
G4NeutronHPElastic::~G4NeutronHPElastic | ( | ) |
Definition at line 67 of file G4NeutronHPElastic.cc.
00068 { 00069 //delete [] theElastic; 00070 for ( std::vector<G4NeutronHPChannel*>::iterator 00071 it = theElastic.begin() ; it != theElastic.end() ; it++ ) 00072 { 00073 delete *it; 00074 } 00075 theElastic.clear(); 00076 }
G4HadFinalState * G4NeutronHPElastic::ApplyYourself | ( | const G4HadProjectile & | aTrack, | |
G4Nucleus & | aTargetNucleus | |||
) | [virtual] |
Implements G4HadronicInteraction.
Definition at line 80 of file G4NeutronHPElastic.cc.
References G4NeutronHPManager::CloseReactionWhiteBoard(), G4UniformRand, G4Material::GetElement(), G4Element::GetIndex(), G4NeutronHPManager::GetInstance(), G4HadProjectile::GetMaterial(), G4Material::GetNumberOfElements(), G4Element::GetNumberOfElements(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4Material::GetVecNbOfAtomsPerVolume(), isAlive, CLHEP::detail::n, G4NeutronHPManager::OpenReactionWhiteBoard(), G4Nucleus::SetParameters(), and G4HadFinalState::SetStatusChange().
00081 { 00082 00083 if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement(); 00084 00085 G4NeutronHPManager::GetInstance()->OpenReactionWhiteBoard(); 00086 const G4Material * theMaterial = aTrack.GetMaterial(); 00087 G4int n = theMaterial->GetNumberOfElements(); 00088 G4int index = theMaterial->GetElement(0)->GetIndex(); 00089 if(n!=1) 00090 { 00091 G4int i; 00092 xSec = new G4double[n]; 00093 G4double sum=0; 00094 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); 00095 G4double rWeight; 00096 G4NeutronHPThermalBoost aThermalE; 00097 for (i=0; i<n; i++) 00098 { 00099 index = theMaterial->GetElement(i)->GetIndex(); 00100 rWeight = NumAtomsPerVolume[i]; 00101 //xSec[i] = theElastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack, 00102 xSec[i] = (*theElastic[index]).GetXsec(aThermalE.GetThermalEnergy(aTrack, 00103 theMaterial->GetElement(i), 00104 theMaterial->GetTemperature())); 00105 xSec[i] *= rWeight; 00106 sum+=xSec[i]; 00107 } 00108 G4double random = G4UniformRand(); 00109 G4double running = 0; 00110 for (i=0; i<n; i++) 00111 { 00112 running += xSec[i]; 00113 index = theMaterial->GetElement(i)->GetIndex(); 00114 //if(random<=running/sum) break; 00115 if( sum == 0 || random <= running/sum ) break; 00116 } 00117 delete [] xSec; 00118 // it is element-wise initialised. 00119 } 00120 //G4HadFinalState* finalState = theElastic[index].ApplyYourself(aTrack); 00121 G4HadFinalState* finalState = (*theElastic[index]).ApplyYourself(aTrack); 00122 if (overrideSuspension) finalState->SetStatusChange(isAlive); 00123 aNucleus.SetParameters(G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ()); 00124 G4NeutronHPManager::GetInstance()->CloseReactionWhiteBoard(); 00125 return finalState; 00126 }
void G4NeutronHPElastic::DoNotSuspend | ( | ) | [inline] |
const std::pair< G4double, G4double > G4NeutronHPElastic::GetFatalEnergyCheckLevels | ( | ) | const [virtual] |
Reimplemented from G4HadronicInteraction.
Definition at line 128 of file G4NeutronHPElastic.cc.
References DBL_MAX.
00129 { 00130 //return std::pair<G4double, G4double>(10*perCent,10*GeV); 00131 return std::pair<G4double, G4double>(10*perCent,DBL_MAX); 00132 }
G4int G4NeutronHPElastic::GetNiso | ( | ) | [inline] |