#include <G4AdjointSimManager.hh>
Definition at line 149 of file G4AdjointSimManager.hh.
void G4AdjointSimManager::ConsiderParticleAsPrimary | ( | const G4String & | particle_name | ) |
Definition at line 422 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::ConsiderParticleAsPrimary().
Referenced by G4AdjointSimMessenger::SetNewValue().
00423 { 00424 theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name); 00425 }
G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume | ( | const G4String & | volume_name | ) |
Definition at line 398 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), G4AdjointCrossSurfChecker::GetInstance(), and G4AdjointPrimaryGeneratorAction::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume().
Referenced by G4AdjointSimMessenger::SetNewValue().
00399 { 00400 G4double area; 00401 G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "AdjointSource", volume_name,area); 00402 area_of_the_adjoint_source=area; 00403 if (aBool) { 00404 theAdjointPrimaryGeneratorAction->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name); 00405 } 00406 return aBool; 00407 }
G4bool G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume | ( | const G4String & | volume_name | ) |
Definition at line 364 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), and G4AdjointCrossSurfChecker::GetInstance().
Referenced by G4AdjointSimMessenger::SetNewValue().
00365 { 00366 G4double area; 00367 return G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "ExternalSource", volume_name,area); 00368 }
G4bool G4AdjointSimManager::DefineSphericalAdjointSource | ( | G4double | radius, | |
G4ThreeVector | pos | |||
) |
Definition at line 377 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddaSphericalSurface(), G4AdjointCrossSurfChecker::GetInstance(), and G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource().
Referenced by G4AdjointSimMessenger::SetNewValue().
00378 { 00379 G4double area; 00380 G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("AdjointSource", radius, pos, area); 00381 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, pos); 00382 area_of_the_adjoint_source=area; 00383 return aBool; 00384 }
G4bool G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume | ( | G4double | radius, | |
const G4String & | volume_name | |||
) |
Definition at line 387 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(), G4AdjointCrossSurfChecker::GetInstance(), and G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource().
Referenced by G4AdjointSimMessenger::SetNewValue().
00388 { 00389 G4double area; 00390 G4ThreeVector center; 00391 G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "AdjointSource", radius, volume_name,center, area); 00392 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, center); 00393 area_of_the_adjoint_source=area; 00394 return aBool; 00395 }
G4bool G4AdjointSimManager::DefineSphericalExtSource | ( | G4double | radius, | |
G4ThreeVector | pos | |||
) |
Definition at line 349 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddaSphericalSurface(), and G4AdjointCrossSurfChecker::GetInstance().
Referenced by G4AdjointSimMessenger::SetNewValue().
00350 { 00351 G4double area; 00352 return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("ExternalSource", radius, pos, area); 00353 }
G4bool G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume | ( | G4double | radius, | |
const G4String & | volume_name | |||
) |
Definition at line 356 of file G4AdjointSimManager.cc.
References G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(), and G4AdjointCrossSurfChecker::GetInstance().
Referenced by G4AdjointSimMessenger::SetNewValue().
00357 { 00358 G4double area; 00359 G4ThreeVector center; 00360 return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "ExternalSource", radius, volume_name,center, area); 00361 }
G4bool G4AdjointSimManager::GetAdjointSimMode | ( | ) | [inline] |
G4double G4AdjointSimManager::GetAdjointSourceArea | ( | ) | [inline] |
Definition at line 195 of file G4AdjointSimManager.hh.
Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().
G4bool G4AdjointSimManager::GetAdjointTrackingMode | ( | ) | [inline] |
G4double G4AdjointSimManager::GetCosthAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource | ( | ) |
Definition at line 277 of file G4AdjointSimManager.cc.
References G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource().
Referenced by SetAdjointTrackingMode().
00278 { 00279 return theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource(); 00280 }
G4ThreeVector G4AdjointSimManager::GetDirectionAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4double G4AdjointSimManager::GetEkinAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4double G4AdjointSimManager::GetEkinNucAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4int G4AdjointSimManager::GetFwdParticleIndexAtEndOfLastAdjointTrack | ( | ) | [inline] |
const G4String& G4AdjointSimManager::GetFwdParticleNameAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4int G4AdjointSimManager::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack | ( | ) | [inline] |
G4int G4AdjointSimManager::GetIDOfLastAdjParticleReachingExtSource | ( | ) | [inline] |
G4AdjointSimManager * G4AdjointSimManager::GetInstance | ( | ) | [static] |
Definition at line 116 of file G4AdjointSimManager.cc.
Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().
00117 { 00118 if (instance == 0) instance = new G4AdjointSimManager; 00119 return instance; 00120 }
std::vector< G4ParticleDefinition * > G4AdjointSimManager::GetListOfPrimaryFwdParticles | ( | ) |
Definition at line 283 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles().
00284 { 00285 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles(); 00286 }
G4int G4AdjointSimManager::GetNbEvtOfLastRun | ( | ) | [inline] |
G4int G4AdjointSimManager::GetNormalisationMode | ( | ) | [inline] |
G4double G4AdjointSimManager::GetNumberNucleonsInIon | ( | ) | [inline] |
G4ThreeVector G4AdjointSimManager::GetPositionAtEndOfLastAdjointTrack | ( | ) | [inline] |
const G4String & G4AdjointSimManager::GetPrimaryIonName | ( | ) |
Definition at line 447 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::GetPrimaryIonName().
00448 { 00449 return theAdjointPrimaryGeneratorAction->GetPrimaryIonName(); 00450 }
G4double G4AdjointSimManager::GetWeightAtEndOfLastAdjointTrack | ( | ) | [inline] |
void G4AdjointSimManager::NeglectParticleAsPrimary | ( | const G4String & | particle_name | ) |
Definition at line 428 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::NeglectParticleAsPrimary().
Referenced by G4AdjointSimMessenger::SetNewValue().
00429 { 00430 theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name); 00431 }
void G4AdjointSimManager::RegisterAdjointPrimaryWeight | ( | G4double | aWeight | ) |
Definition at line 453 of file G4AdjointSimManager.cc.
References G4AdjointSteppingAction::SetPrimWeight().
Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().
00454 { 00455 theAdjointPrimaryWeight = aWeight; 00456 theAdjointSteppingAction->SetPrimWeight(aWeight); 00457 }
void G4AdjointSimManager::RegisterAtEndOfAdjointTrack | ( | ) |
Definition at line 289 of file G4AdjointSimManager.cc.
References G4ParticleTable::FindParticle(), G4ParticleDefinition::GetBaryonNumber(), G4AdjointSteppingAction::GetLastEkin(), G4AdjointSteppingAction::GetLastMomentum(), G4AdjointSteppingAction::GetLastPartDef(), G4AdjointSteppingAction::GetLastPosition(), G4AdjointSteppingAction::GetLastWeight(), G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetParticleType(), G4ParticleDefinition::GetPDGEncoding(), and G4String::remove().
Referenced by SetAdjointTrackingMode().
00290 { 00291 last_pos = theAdjointSteppingAction->GetLastPosition(); 00292 last_direction = theAdjointSteppingAction->GetLastMomentum(); 00293 last_direction /=last_direction.mag(); 00294 last_cos_th = last_direction.z(); 00295 G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef(); 00296 00297 last_fwd_part_name= aPartDef->GetParticleName(); 00298 00299 last_fwd_part_name.remove(0,4); 00300 00301 last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding(); 00302 00303 std::vector<G4ParticleDefinition*> aList = theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles(); 00304 last_fwd_part_index=-1; 00305 size_t i=0; 00306 while(i<aList.size() && last_fwd_part_index<0) { 00307 if (aList[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i; 00308 i++; 00309 } 00310 00311 last_ekin = theAdjointSteppingAction->GetLastEkin(); 00312 last_ekin_nuc = last_ekin; 00313 if (aPartDef->GetParticleType() == "adjoint_nucleus") { 00314 nb_nuc=double(aPartDef->GetBaryonNumber()); 00315 last_ekin_nuc /=nb_nuc; 00316 } 00317 00318 last_weight = theAdjointSteppingAction->GetLastWeight(); 00319 00320 /* G4PhysicsLogVector* theWeightVector=0; 00321 if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector; 00322 else if (last_fwd_part_name =="gamma") theWeightVector=gamma_last_weight_vector; 00323 else if (last_fwd_part_name =="proton") theWeightVector=proton_last_weight_vector; 00324 00325 if (theWeightVector){ 00326 00327 size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. + 200); 00328 G4double low_val =theWeightVector->GetLowEdgeEnergy(ind); 00329 G4bool aBool = true; 00330 G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.; 00331 theWeightVector->PutValue(ind, bin_weight); 00332 } 00333 */ 00334 /*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ; 00335 else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ; 00336 else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/ 00337 00338 00339 //G4cout <<"Last Weight "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl; 00340 /*if (last_weight/theAdjointPrimaryWeight >10.) { 00341 G4cout<<"Warning a weight increase by a factor : "<<last_weight/theAdjointPrimaryWeight<<std::endl; 00342 } 00343 */ 00344 00345 ID_of_last_particle_that_reach_the_ext_source++; 00346 }
void G4AdjointSimManager::RunAdjointSimulation | ( | G4int | nb_evt | ) |
Definition at line 123 of file G4AdjointSimManager.cc.
References G4RunManager::BeamOn(), G4cout, G4AdjointPrimaryGeneratorAction::GetNbOfAdjointPrimaryTypes(), G4RunManager::GetRunManager(), and G4AdjointPrimaryGeneratorAction::UpdateListOfPrimaryParticles().
Referenced by G4AdjointSimMessenger::SetNewValue().
00124 { 00125 if (welcome_message) { 00126 G4cout<<"****************************************************************"<<std::endl; 00127 G4cout<<"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl; 00128 G4cout<<"*** Author: L.Desorgher ***"<<std::endl; 00129 G4cout<<"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl; 00130 G4cout<<"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl; 00131 G4cout<<"****************************************************************"<<std::endl; 00132 welcome_message=false; 00133 } 00134 00135 //Replace the user defined actions by the adjoint actions 00136 //--------------------------------------------------------- 00137 SetAdjointPrimaryRunAndStackingActions(); 00138 SetRestOfAdjointActions(); 00139 00140 //Update the list of primaries 00141 //----------------------------- 00142 theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles(); 00143 00144 adjoint_sim_mode=true; 00145 00146 ID_of_last_particle_that_reach_the_ext_source=0; 00147 00148 //Make the run 00149 //------------ 00150 00151 nb_evt_of_last_run =nb_evt; 00152 G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt); 00153 00154 //Restore the user defined actions 00155 //-------------------------------- 00156 ResetRestOfUserActions(); 00157 ResetUserPrimaryRunAndStackingActions(); 00158 adjoint_sim_mode=false; 00159 00160 /* 00161 //Register the weight vector 00162 //-------------------------- 00163 std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out); 00164 FileOutputElectronWeight<<std::setiosflags(std::ios::scientific); 00165 FileOutputElectronWeight<<std::setprecision(6); 00166 G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight, true); 00167 FileOutputElectronWeight.close(); 00168 00169 std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out); 00170 FileOutputProtonWeight<<std::setiosflags(std::ios::scientific); 00171 FileOutputProtonWeight<<std::setprecision(6); 00172 aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true); 00173 FileOutputProtonWeight.close(); 00174 00175 std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out); 00176 FileOutputGammaWeight<<std::setiosflags(std::ios::scientific); 00177 FileOutputGammaWeight<<std::setprecision(6); 00178 aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true); 00179 FileOutputGammaWeight.close(); 00180 */ 00181 }
void G4AdjointSimManager::SetAdjointEventAction | ( | G4UserEventAction * | anAction | ) |
void G4AdjointSimManager::SetAdjointRunAction | ( | G4UserRunAction * | anAction | ) |
void G4AdjointSimManager::SetAdjointSourceEmax | ( | G4double | Emax | ) |
Definition at line 416 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::SetEmax().
Referenced by G4AdjointSimMessenger::SetNewValue().
00417 { 00418 theAdjointPrimaryGeneratorAction->SetEmax(Emax); 00419 }
void G4AdjointSimManager::SetAdjointSourceEmin | ( | G4double | Emin | ) |
Definition at line 410 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::SetEmin().
Referenced by G4AdjointSimMessenger::SetNewValue().
00411 { 00412 theAdjointPrimaryGeneratorAction->SetEmin(Emin); 00413 }
void G4AdjointSimManager::SetAdjointStackingAction | ( | G4UserStackingAction * | anAction | ) |
Definition at line 473 of file G4AdjointSimManager.cc.
References G4AdjointStackingAction::SetUserAdjointStackingAction().
00474 { 00475 theAdjointStackingAction->SetUserAdjointStackingAction(anAction); 00476 }
void G4AdjointSimManager::SetAdjointSteppingAction | ( | G4UserSteppingAction * | anAction | ) |
Definition at line 467 of file G4AdjointSimManager.cc.
References G4AdjointSteppingAction::SetUserAdjointSteppingAction().
00468 { 00469 theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction); 00470 }
void G4AdjointSimManager::SetAdjointTrackingAction | ( | G4UserTrackingAction * | anAction | ) |
void G4AdjointSimManager::SetAdjointTrackingMode | ( | G4bool | aBool | ) |
Definition at line 254 of file G4AdjointSimManager.cc.
References GetDidAdjParticleReachTheExtSource(), RegisterAtEndOfAdjointTrack(), G4AdjointStackingAction::SetAdjointMode(), and G4AdjointStackingAction::SetKillTracks().
Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().
00255 { 00256 adjoint_tracking_mode = aBool; 00257 00258 if (adjoint_tracking_mode) { 00259 SetRestOfAdjointActions(); 00260 theAdjointStackingAction->SetAdjointMode(true); 00261 theAdjointStackingAction->SetKillTracks(false); 00262 00263 } 00264 else { 00265 00266 ResetRestOfUserActions(); 00267 theAdjointStackingAction->SetAdjointMode(false); 00268 if (GetDidAdjParticleReachTheExtSource()){ 00269 theAdjointStackingAction->SetKillTracks(false); 00270 RegisterAtEndOfAdjointTrack(); 00271 } 00272 else theAdjointStackingAction->SetKillTracks(true); 00273 } 00274 }
void G4AdjointSimManager::SetExtSourceEmax | ( | G4double | Emax | ) |
Definition at line 371 of file G4AdjointSimManager.cc.
References G4AdjointSteppingAction::SetExtSourceEMax().
Referenced by G4AdjointSimMessenger::SetNewValue().
00372 { 00373 theAdjointSteppingAction->SetExtSourceEMax(Emax); 00374 }
void G4AdjointSimManager::SetNormalisationMode | ( | G4int | n | ) | [inline] |
void G4AdjointSimManager::SetPrimaryIon | ( | G4ParticleDefinition * | adjointIon, | |
G4ParticleDefinition * | fwdIon | |||
) |
Definition at line 441 of file G4AdjointSimManager.cc.
References G4AdjointPrimaryGeneratorAction::SetPrimaryIon().
00442 { 00443 theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon); 00444 }
void G4AdjointSimManager::UseUserStackingActionInFwdTrackingPhase | ( | G4bool | aBool | ) | [inline] |