#include <G4NeutronHPInelastic.hh>
Inheritance diagram for G4NeutronHPInelastic:
Public Member Functions | |
G4NeutronHPInelastic () | |
~G4NeutronHPInelastic () | |
G4HadFinalState * | ApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) |
virtual const std::pair< G4double, G4double > | GetFatalEnergyCheckLevels () const |
Definition at line 87 of file G4NeutronHPInelastic.hh.
G4NeutronHPInelastic::G4NeutronHPInelastic | ( | ) |
Definition at line 45 of file G4NeutronHPInelastic.cc.
References G4cout, G4endl, G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().
00046 :G4HadronicInteraction("NeutronHPInelastic") 00047 { 00048 SetMinEnergy( 0.0 ); 00049 SetMaxEnergy( 20.*MeV ); 00050 00051 G4int istatus = system("echo $G4NEUTRONHPDATA"); 00052 if ( istatus < 0 ) 00053 { 00054 G4cout << "Warning! system(\"echo $G4NEUTRONHPDATA\") returns error value at G4NeutronHPInelastic" << G4endl; 00055 } 00056 00057 // G4cout << " entering G4NeutronHPInelastic constructor"<<G4endl; 00058 if(!getenv("G4NEUTRONHPDATA")) 00059 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 00060 dirName = getenv("G4NEUTRONHPDATA"); 00061 G4String tString = "/Inelastic"; 00062 dirName = dirName + tString; 00063 numEle = G4Element::GetNumberOfElements(); 00064 /* 00065 theInelastic = new G4NeutronHPChannelList[numEle]; 00066 for (G4int i=0; i<numEle; i++) 00067 { 00068 theInelastic[i].Init((*(G4Element::GetElementTable()))[i], dirName); 00069 G4int itry = 0; 00070 do 00071 { 00072 theInelastic[i].Register(&theNFS, "F01"); // has 00073 theInelastic[i].Register(&theNXFS, "F02"); 00074 theInelastic[i].Register(&the2NDFS, "F03"); 00075 theInelastic[i].Register(&the2NFS, "F04"); // has, E Done 00076 theInelastic[i].Register(&the3NFS, "F05"); // has, E Done 00077 theInelastic[i].Register(&theNAFS, "F06"); 00078 theInelastic[i].Register(&theN3AFS, "F07"); 00079 theInelastic[i].Register(&the2NAFS, "F08"); 00080 theInelastic[i].Register(&the3NAFS, "F09"); 00081 theInelastic[i].Register(&theNPFS, "F10"); 00082 theInelastic[i].Register(&theN2AFS, "F11"); 00083 theInelastic[i].Register(&the2N2AFS, "F12"); 00084 theInelastic[i].Register(&theNDFS, "F13"); 00085 theInelastic[i].Register(&theNTFS, "F14"); 00086 theInelastic[i].Register(&theNHe3FS, "F15"); 00087 theInelastic[i].Register(&theND2AFS, "F16"); 00088 theInelastic[i].Register(&theNT2AFS, "F17"); 00089 theInelastic[i].Register(&the4NFS, "F18"); // has, E Done 00090 theInelastic[i].Register(&the2NPFS, "F19"); 00091 theInelastic[i].Register(&the3NPFS, "F20"); 00092 theInelastic[i].Register(&theN2PFS, "F21"); 00093 theInelastic[i].Register(&theNPAFS, "F22"); 00094 theInelastic[i].Register(&thePFS, "F23"); 00095 theInelastic[i].Register(&theDFS, "F24"); 00096 theInelastic[i].Register(&theTFS, "F25"); 00097 theInelastic[i].Register(&theHe3FS, "F26"); 00098 theInelastic[i].Register(&theAFS, "F27"); 00099 theInelastic[i].Register(&the2AFS, "F28"); 00100 theInelastic[i].Register(&the3AFS, "F29"); 00101 theInelastic[i].Register(&the2PFS, "F30"); 00102 theInelastic[i].Register(&thePAFS, "F31"); 00103 theInelastic[i].Register(&theD2AFS, "F32"); 00104 theInelastic[i].Register(&theT2AFS, "F33"); 00105 theInelastic[i].Register(&thePDFS, "F34"); 00106 theInelastic[i].Register(&thePTFS, "F35"); 00107 theInelastic[i].Register(&theDAFS, "F36"); 00108 theInelastic[i].RestartRegistration(); 00109 itry++; 00110 } 00111 //while(!theInelastic[i].HasDataInAnyFinalState()); 00112 while( !theInelastic[i].HasDataInAnyFinalState() && itry < 6 ); 00113 // 6 is corresponding to the value(5) of G4NeutronHPChannel. TK 00114 00115 if ( itry == 6 ) 00116 { 00117 // No Final State at all. 00118 G4bool exceptional = false; 00119 if ( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() == 1 ) 00120 { 00121 if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true; //1H 00122 } 00123 if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element"); 00124 } 00125 } 00126 */ 00127 00128 for (G4int i=0; i<numEle; i++) 00129 { 00130 theInelastic.push_back( new G4NeutronHPChannelList ); 00131 (*theInelastic[i]).Init((*(G4Element::GetElementTable()))[i], dirName); 00132 G4int itry = 0; 00133 do 00134 { 00135 (*theInelastic[i]).Register(&theNFS, "F01"); // has 00136 (*theInelastic[i]).Register(&theNXFS, "F02"); 00137 (*theInelastic[i]).Register(&the2NDFS, "F03"); 00138 (*theInelastic[i]).Register(&the2NFS, "F04"); // has, E Done 00139 (*theInelastic[i]).Register(&the3NFS, "F05"); // has, E Done 00140 (*theInelastic[i]).Register(&theNAFS, "F06"); 00141 (*theInelastic[i]).Register(&theN3AFS, "F07"); 00142 (*theInelastic[i]).Register(&the2NAFS, "F08"); 00143 (*theInelastic[i]).Register(&the3NAFS, "F09"); 00144 (*theInelastic[i]).Register(&theNPFS, "F10"); 00145 (*theInelastic[i]).Register(&theN2AFS, "F11"); 00146 (*theInelastic[i]).Register(&the2N2AFS, "F12"); 00147 (*theInelastic[i]).Register(&theNDFS, "F13"); 00148 (*theInelastic[i]).Register(&theNTFS, "F14"); 00149 (*theInelastic[i]).Register(&theNHe3FS, "F15"); 00150 (*theInelastic[i]).Register(&theND2AFS, "F16"); 00151 (*theInelastic[i]).Register(&theNT2AFS, "F17"); 00152 (*theInelastic[i]).Register(&the4NFS, "F18"); // has, E Done 00153 (*theInelastic[i]).Register(&the2NPFS, "F19"); 00154 (*theInelastic[i]).Register(&the3NPFS, "F20"); 00155 (*theInelastic[i]).Register(&theN2PFS, "F21"); 00156 (*theInelastic[i]).Register(&theNPAFS, "F22"); 00157 (*theInelastic[i]).Register(&thePFS, "F23"); 00158 (*theInelastic[i]).Register(&theDFS, "F24"); 00159 (*theInelastic[i]).Register(&theTFS, "F25"); 00160 (*theInelastic[i]).Register(&theHe3FS, "F26"); 00161 (*theInelastic[i]).Register(&theAFS, "F27"); 00162 (*theInelastic[i]).Register(&the2AFS, "F28"); 00163 (*theInelastic[i]).Register(&the3AFS, "F29"); 00164 (*theInelastic[i]).Register(&the2PFS, "F30"); 00165 (*theInelastic[i]).Register(&thePAFS, "F31"); 00166 (*theInelastic[i]).Register(&theD2AFS, "F32"); 00167 (*theInelastic[i]).Register(&theT2AFS, "F33"); 00168 (*theInelastic[i]).Register(&thePDFS, "F34"); 00169 (*theInelastic[i]).Register(&thePTFS, "F35"); 00170 (*theInelastic[i]).Register(&theDAFS, "F36"); 00171 (*theInelastic[i]).RestartRegistration(); 00172 itry++; 00173 } 00174 while( !(*theInelastic[i]).HasDataInAnyFinalState() && itry < 6 ); 00175 // 6 is corresponding to the value(5) of G4NeutronHPChannel. TK 00176 00177 if ( itry == 6 ) 00178 { 00179 // No Final State at all. 00180 G4bool exceptional = false; 00181 if ( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() == 1 ) 00182 { 00183 if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true; //1H 00184 } 00185 if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element"); 00186 } 00187 00188 } 00189 }
G4NeutronHPInelastic::~G4NeutronHPInelastic | ( | ) |
Definition at line 191 of file G4NeutronHPInelastic.cc.
00192 { 00193 // delete [] theInelastic; 00194 for ( std::vector<G4NeutronHPChannelList*>::iterator 00195 it = theInelastic.begin() ; it != theInelastic.end() ; it++ ) 00196 { 00197 delete *it; 00198 } 00199 theInelastic.clear(); 00200 }
G4HadFinalState * G4NeutronHPInelastic::ApplyYourself | ( | const G4HadProjectile & | aTrack, | |
G4Nucleus & | aTargetNucleus | |||
) | [virtual] |
Implements G4HadronicInteraction.
Definition at line 204 of file G4NeutronHPInelastic.cc.
References G4NeutronHPManager::CloseReactionWhiteBoard(), G4UniformRand, G4Material::GetElement(), G4Element::GetIndex(), G4NeutronHPManager::GetInstance(), G4HadProjectile::GetMaterial(), G4Material::GetNumberOfElements(), G4Element::GetNumberOfElements(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4Material::GetVecNbOfAtomsPerVolume(), CLHEP::detail::n, G4NeutronHPManager::OpenReactionWhiteBoard(), and G4Nucleus::SetParameters().
00205 { 00206 if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement(); 00207 G4NeutronHPManager::GetInstance()->OpenReactionWhiteBoard(); 00208 const G4Material * theMaterial = aTrack.GetMaterial(); 00209 G4int n = theMaterial->GetNumberOfElements(); 00210 G4int index = theMaterial->GetElement(0)->GetIndex(); 00211 G4int it=0; 00212 if(n!=1) 00213 { 00214 xSec = new G4double[n]; 00215 G4double sum=0; 00216 G4int i; 00217 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume(); 00218 G4double rWeight; 00219 G4NeutronHPThermalBoost aThermalE; 00220 for (i=0; i<n; i++) 00221 { 00222 index = theMaterial->GetElement(i)->GetIndex(); 00223 rWeight = NumAtomsPerVolume[i]; 00224 //xSec[i] = theInelastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack, 00225 xSec[i] = (*theInelastic[index]).GetXsec(aThermalE.GetThermalEnergy(aTrack, 00226 theMaterial->GetElement(i), 00227 theMaterial->GetTemperature())); 00228 xSec[i] *= rWeight; 00229 sum+=xSec[i]; 00230 } 00231 G4double random = G4UniformRand(); 00232 G4double running = 0; 00233 for (i=0; i<n; i++) 00234 { 00235 running += xSec[i]; 00236 index = theMaterial->GetElement(i)->GetIndex(); 00237 it = i; 00238 //if(random<=running/sum) break; 00239 if( sum == 0 || random<=running/sum) break; 00240 } 00241 delete [] xSec; 00242 } 00243 00244 //return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack); 00245 G4HadFinalState* result = (*theInelastic[index]).ApplyYourself(theMaterial->GetElement(it), aTrack); 00246 // 00247 aNucleus.SetParameters(G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ()); 00248 G4NeutronHPManager::GetInstance()->CloseReactionWhiteBoard(); 00249 return result; 00250 }
const std::pair< G4double, G4double > G4NeutronHPInelastic::GetFatalEnergyCheckLevels | ( | ) | const [virtual] |
Reimplemented from G4HadronicInteraction.
Definition at line 252 of file G4NeutronHPInelastic.cc.
References DBL_MAX.
00253 { 00254 // max energy non-conservation is mass of heavy nucleus 00255 // if ( getenv("G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE") ) return std::pair<G4double, G4double>(5*perCent,250*GeV); 00256 // This should be same to the hadron default value 00257 // return std::pair<G4double, G4double>(10*perCent,10*GeV); 00258 return std::pair<G4double, G4double>(10*perCent,DBL_MAX); 00259 }