#include <G4NeutronHPChannelList.hh>
Public Member Functions | |
G4NeutronHPChannelList (G4int n) | |
G4NeutronHPChannelList () | |
void | Init (G4int n) |
~G4NeutronHPChannelList () | |
G4HadFinalState * | ApplyYourself (const G4Element *theElement, const G4HadProjectile &aTrack) |
void | Init (G4Element *anElement, const G4String &dirName) |
void | Register (G4NeutronHPFinalState *theFS, const G4String &aName) |
G4double | GetXsec (G4double anEnergy) |
G4int | GetNumberOfChannels () |
G4bool | HasDataInAnyFinalState () |
void | RestartRegistration () |
Definition at line 45 of file G4NeutronHPChannelList.hh.
G4NeutronHPChannelList::G4NeutronHPChannelList | ( | G4int | n | ) |
Definition at line 40 of file G4NeutronHPChannelList.cc.
00041 { 00042 nChannels = n; 00043 theChannels = new G4NeutronHPChannel * [n]; 00044 allChannelsCreated = false; 00045 theInitCount = 0; 00046 }
G4NeutronHPChannelList::G4NeutronHPChannelList | ( | ) |
Definition at line 48 of file G4NeutronHPChannelList.cc.
00049 { 00050 nChannels = 0; 00051 theChannels = 0; 00052 allChannelsCreated = false; 00053 theInitCount = 0; 00054 }
G4NeutronHPChannelList::~G4NeutronHPChannelList | ( | ) |
Definition at line 56 of file G4NeutronHPChannelList.cc.
00057 { 00058 if(theChannels!=0) 00059 { 00060 for(G4int i=0;i<nChannels; i++) 00061 { 00062 delete theChannels[i]; 00063 } 00064 delete [] theChannels; 00065 } 00066 }
G4HadFinalState * G4NeutronHPChannelList::ApplyYourself | ( | const G4Element * | theElement, | |
const G4HadProjectile & | aTrack | |||
) |
Definition at line 70 of file G4NeutronHPChannelList.cc.
References G4HadFinalState::AddSecondary(), G4NeutronHPChannel::ApplyYourself(), G4HadFinalState::Clear(), G4cout, G4endl, G4UniformRand, G4HadProjectile::Get4Momentum(), G4NeutronHPManager::GetInstance(), G4ParticleTable::GetIon(), G4HadProjectile::GetKineticEnergy(), G4HadProjectile::GetMaterial(), G4NeutronHPChannel::GetN(), G4ParticleTable::GetParticleTable(), G4NeutronHPManager::GetReactionWhiteBoard(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4NeutronHPChannel::GetZ(), G4HadFinalState::SetEnergyChange(), G4HadFinalState::SetMomentumChange(), G4NeutronHPReactionWhiteBoard::SetTargA(), and G4NeutronHPReactionWhiteBoard::SetTargZ().
Referenced by G4NeutronHPorLEInelastic::ApplyYourself().
00071 { 00072 G4NeutronHPThermalBoost aThermalE; 00073 G4int i, ii; 00074 // decide on the isotope 00075 G4int numberOfIsos(0); 00076 for(ii=0; ii<nChannels; ii++) 00077 { 00078 numberOfIsos = theChannels[ii]->GetNiso(); 00079 if(numberOfIsos!=0) break; 00080 } 00081 G4double * running= new G4double [numberOfIsos]; 00082 running[0] = 0; 00083 for(i=0;i<numberOfIsos; i++) 00084 { 00085 if(i!=0) running[i] = running[i-1]; 00086 for(ii=0; ii<nChannels; ii++) 00087 { 00088 if(theChannels[ii]->HasAnyData(i)) 00089 { 00090 running[i] +=theChannels[ii]->GetWeightedXsec(aThermalE.GetThermalEnergy(aTrack, 00091 theChannels[ii]->GetN(i), 00092 theChannels[ii]->GetZ(i), 00093 aTrack.GetMaterial()->GetTemperature()), 00094 i); 00095 } 00096 } 00097 } 00098 G4int isotope=nChannels-1; 00099 G4double random=G4UniformRand(); 00100 for(i=0;i<numberOfIsos; i++) 00101 { 00102 isotope = i; 00103 //if(random<running[i]/running[numberOfIsos-1]) break; 00104 if(running[numberOfIsos-1] != 0) if(random<running[i]/running[numberOfIsos-1]) break; 00105 } 00106 delete [] running; 00107 00108 // decide on the channel 00109 running = new G4double[nChannels]; 00110 running[0]=0; 00111 G4int targA=-1; // For production of unChanged 00112 G4int targZ=-1; 00113 for(i=0; i<nChannels; i++) 00114 { 00115 if(i!=0) running[i] = running[i-1]; 00116 if(theChannels[i]->HasAnyData(isotope)) 00117 { 00118 running[i] += theChannels[i]->GetFSCrossSection(aThermalE.GetThermalEnergy(aTrack, 00119 theChannels[i]->GetN(isotope), 00120 theChannels[i]->GetZ(isotope), 00121 aTrack.GetMaterial()->GetTemperature()), 00122 isotope); 00123 targA=(G4int)theChannels[i]->GetN(isotope); //Will be simply used the last valid value 00124 targZ=(G4int)theChannels[i]->GetZ(isotope); 00125 } 00126 } 00127 00128 //TK120607 00129 if ( running[nChannels-1] == 0 ) 00130 { 00131 //This happened usually by the miss match between the cross section data and model 00132 if ( targA == -1 && targZ == -1 ) { 00133 throw G4HadronicException(__FILE__, __LINE__, "NeutronHP model encounter lethal discrepancy with cross section data"); 00134 } 00135 00136 //TK121106 00137 G4cout << "Warning from NeutronHP: could not find proper reaction channel. This may cause by inconsistency between cross section and model. Unchanged final states are returned." << G4endl; 00138 unChanged.Clear(); 00139 00140 //For Ep Check create unchanged final state including rest target 00141 G4ParticleDefinition* targ_pd = G4ParticleTable::GetParticleTable()->GetIon ( targZ , targA , 0.0 ); 00142 G4DynamicParticle* targ_dp = new G4DynamicParticle( targ_pd , G4ThreeVector(1,0,0), 0.0 ); 00143 unChanged.SetEnergyChange(aTrack.GetKineticEnergy()); 00144 unChanged.SetMomentumChange(aTrack.Get4Momentum().vect() ); 00145 unChanged.AddSecondary(targ_dp); 00146 //TK121106 00147 G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->SetTargA( targA ); 00148 G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->SetTargZ( targZ ); 00149 return &unChanged; 00150 } 00151 //TK120607 00152 00153 00154 G4int lChan=0; 00155 random=G4UniformRand(); 00156 for(i=0; i<nChannels; i++) 00157 { 00158 lChan = i; 00159 if(running[nChannels-1] != 0) if(random<running[i]/running[nChannels-1]) break; 00160 } 00161 delete [] running; 00162 return theChannels[lChan]->ApplyYourself(aTrack, isotope); 00163 }
G4int G4NeutronHPChannelList::GetNumberOfChannels | ( | ) | [inline] |
Definition at line 64 of file G4NeutronHPChannelList.hh.
Referenced by G4NeutronHPorLEInelastic::ApplyYourself(), and G4NeutronHPorLEInelasticData::GetCrossSection().
00065 { 00066 G4double result=0; 00067 G4int i; 00068 for(i=0; i<nChannels; i++) 00069 { 00070 result+=std::max(0., theChannels[i]->GetXsec(anEnergy)); 00071 } 00072 return result; 00073 }
G4bool G4NeutronHPChannelList::HasDataInAnyFinalState | ( | ) | [inline] |
Definition at line 77 of file G4NeutronHPChannelList.hh.
00078 { 00079 G4bool result = false; 00080 G4int i; 00081 for(i=0; i<nChannels; i++) 00082 { 00083 if(theChannels[i]->HasDataInAnyFinalState()) result = true; 00084 } 00085 return result; 00086 }
Definition at line 165 of file G4NeutronHPChannelList.cc.
00166 { 00167 theDir = dirName; 00168 // G4cout << theDir << G4endl; 00169 theElement = anElement; 00170 // G4cout << theElement << G4endl; 00171 ; 00172 }
void G4NeutronHPChannelList::Init | ( | G4int | n | ) |
void G4NeutronHPChannelList::Register | ( | G4NeutronHPFinalState * | theFS, | |
const G4String & | aName | |||
) |
Definition at line 174 of file G4NeutronHPChannelList.cc.
References G4NeutronHPChannel::Init(), and G4NeutronHPChannel::Register().
Referenced by G4NeutronHPorLEInelastic::G4NeutronHPorLEInelastic().
00176 { 00177 if(!allChannelsCreated) 00178 { 00179 if(nChannels!=0) 00180 { 00181 G4NeutronHPChannel ** theBuffer = new G4NeutronHPChannel * [nChannels+1]; 00182 G4int i; 00183 for(i=0; i<nChannels; i++) 00184 { 00185 theBuffer[i] = theChannels[i]; 00186 } 00187 delete [] theChannels; 00188 theChannels = theBuffer; 00189 } 00190 else 00191 { 00192 theChannels = new G4NeutronHPChannel * [nChannels+1]; 00193 } 00194 G4String name; 00195 name = aName+"/"; 00196 theChannels[nChannels] = new G4NeutronHPChannel; 00197 theChannels[nChannels]->Init(theElement, theDir, name); 00198 nChannels++; 00199 } 00200 00201 //110527TKDB Unnessary codes, Detected by gcc4.6 compiler 00202 //G4bool result; 00203 //result = theChannels[theInitCount]->Register(theFS); 00204 theChannels[theInitCount]->Register(theFS); 00205 theInitCount++; 00206 }
void G4NeutronHPChannelList::RestartRegistration | ( | ) | [inline] |
Definition at line 87 of file G4NeutronHPChannelList.hh.
Referenced by G4NeutronHPorLEInelastic::G4NeutronHPorLEInelastic().