#include <G4FastSimulationManager.hh>
Definition at line 83 of file G4FastSimulationManager.hh.
G4FastSimulationManager::G4FastSimulationManager | ( | G4Envelope * | anEnvelope, | |
G4bool | IsUnique = FALSE | |||
) |
Definition at line 53 of file G4FastSimulationManager.cc.
References G4GlobalFastSimulationManager::GetGlobalFastSimulationManager(), and G4Region::SetFastSimulationManager().
00054 : 00055 fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0), 00056 fLastCrossedParticle(0) 00057 { 00058 // Communicates to the region that it becomes a 00059 // envelope and with this fast simulation manager. 00060 anEnvelope->SetFastSimulationManager(this); 00061 00062 // Add itself to the GlobalFastSimulationManager 00063 G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()-> 00064 AddFastSimulationManager(this); 00065 }
G4FastSimulationManager::~G4FastSimulationManager | ( | ) |
Definition at line 70 of file G4FastSimulationManager.cc.
References G4Region::ClearFastSimulationManager(), G4FastTrack::GetEnvelope(), G4Region::GetFastSimulationManager(), and G4GlobalFastSimulationManager::GetGlobalFastSimulationManager().
00071 { 00072 // 00073 // Check out the Envelope about this pointer. If in use, 00074 // resets the Logical Volume IsEnvelope flag to avoid clash. 00075 // 00076 if(fFastTrack.GetEnvelope()->GetFastSimulationManager()==this) 00077 fFastTrack.GetEnvelope()->ClearFastSimulationManager(); 00078 // Remove itself from the GlobalFastSimulationManager 00079 G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()-> 00080 RemoveFastSimulationManager(this); 00081 }
Definition at line 88 of file G4FastSimulationManager.cc.
References G4FastSimulationVector< T >::removeAt().
00089 { 00090 size_t iModel; 00091 00092 // If the model is already active, do nothing. 00093 for (iModel=0; iModel<ModelList.size(); iModel++) 00094 if(ModelList[iModel]->GetName() == aName) 00095 return true; 00096 00097 // Look for in the fInactivatedModels list, if found push_back it back to 00098 // the ModelList 00099 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 00100 if(fInactivatedModels[iModel]->GetName() == aName) { 00101 ModelList. 00102 push_back (fInactivatedModels.removeAt(iModel)); 00103 // forces the fApplicableModelList to be rebuild 00104 fLastCrossedParticle=0; 00105 return true; 00106 } 00107 return false; 00108 }
void G4FastSimulationManager::AddFastSimulationModel | ( | G4VFastSimulationModel * | ) | [inline] |
Definition at line 184 of file G4FastSimulationManager.hh.
Referenced by G4VFastSimulationModel::G4VFastSimulationModel().
00185 { 00186 ModelList.push_back(fsm); 00187 // forces the fApplicableModelList to be rebuild 00188 fLastCrossedParticle = 0; 00189 }
G4bool G4FastSimulationManager::AtRestGetFastSimulationManagerTrigger | ( | const G4Track & | , | |
const G4Navigator * | a = 0 | |||
) |
Definition at line 249 of file G4FastSimulationManager.cc.
References G4Track::GetDefinition(), G4FastStep::Initialize(), and G4FastTrack::SetCurrentTrack().
Referenced by G4FastSimulationManagerProcess::AtRestGetPhysicalInteractionLength().
00251 { 00252 size_t iModel; 00253 00254 // If particle type changed re-build the fApplicableModelList. 00255 if(fLastCrossedParticle!=track.GetDefinition()) { 00256 fLastCrossedParticle=track.GetDefinition(); 00257 fApplicableModelList.clear(); 00258 // If Model List is empty, do nothing ! 00259 if(ModelList.size()==0) return false; 00260 for (iModel=0; iModel<ModelList.size(); iModel++) 00261 if(ModelList[iModel]->IsApplicable(*(track.GetDefinition()))) 00262 fApplicableModelList.push_back (ModelList[iModel]); 00263 } 00264 00265 // If Applicable Model List is empty, do nothing ! 00266 if(fApplicableModelList.size()==0) return false; 00267 00268 // -- Register current track 00269 fFastTrack.SetCurrentTrack(track,theNavigator); 00270 00271 // -- (note: compared to the PostStepGetFastSimulationManagerTrigger, 00272 // -- the test to see if the particle is on the boundary but leaving 00273 // -- is irrelevant here) 00274 00275 // Loops on the models to see if one of them wants to trigger: 00276 for (iModel=0; iModel < fApplicableModelList.size(); iModel++) 00277 if(fApplicableModelList[iModel]->AtRestModelTrigger(fFastTrack)) 00278 { 00279 fFastStep.Initialize(fFastTrack); 00280 fTriggedFastSimulationModel=fApplicableModelList[iModel]; 00281 return true; 00282 } 00283 00284 //-------------------------------------------- 00285 // Nobody asks to gain control, returns false 00286 //-------------------------------------------- 00287 return false; 00288 }
const G4Envelope * G4FastSimulationManager::GetEnvelope | ( | ) | const [inline] |
Definition at line 206 of file G4FastSimulationManager.hh.
References G4FastTrack::GetEnvelope().
00207 { 00208 return fFastTrack.GetEnvelope(); 00209 }
G4VFastSimulationModel * G4FastSimulationManager::GetFastSimulationModel | ( | const G4String & | modelName, | |
const G4VFastSimulationModel * | previousFound, | |||
bool & | foundPrevious | |||
) | const |
Definition at line 127 of file G4FastSimulationManager.cc.
00130 { 00131 G4VFastSimulationModel* model = 0; 00132 for (size_t iModel=0; iModel<ModelList.size(); iModel++) 00133 { 00134 if(ModelList[iModel]->GetName() == modelName) 00135 { 00136 if (previousFound == 0) 00137 { 00138 model = ModelList[iModel]; 00139 break; 00140 } 00141 else 00142 { 00143 if (ModelList[iModel] == previousFound) 00144 { 00145 foundPrevious = true; 00146 continue; 00147 } 00148 if (foundPrevious) 00149 { 00150 model = ModelList[iModel]; 00151 break; 00152 } 00153 } 00154 } 00155 } 00156 return model; 00157 }
const std::vector<G4VFastSimulationModel*>& G4FastSimulationManager::GetFastSimulationModelList | ( | ) | const [inline] |
Definition at line 111 of file G4FastSimulationManager.cc.
References G4FastSimulationVector< T >::removeAt().
00112 { 00113 // Look for in the ModelList, if found remove from it and keep the pointer 00114 // on the fInactivatedModels list. 00115 for (size_t iModel=0; iModel<ModelList.size(); iModel++) 00116 if(ModelList[iModel]->GetName() == aName) { 00117 fInactivatedModels. 00118 push_back (ModelList.removeAt(iModel)); 00119 // forces the fApplicableModelList to be rebuild 00120 fLastCrossedParticle=0; 00121 return true; 00122 } 00123 return false; 00124 }
G4VParticleChange * G4FastSimulationManager::InvokeAtRestDoIt | ( | ) |
Definition at line 290 of file G4FastSimulationManager.cc.
References G4VFastSimulationModel::AtRestDoIt().
Referenced by G4FastSimulationManagerProcess::AtRestDoIt().
00291 { 00292 fTriggedFastSimulationModel->AtRestDoIt(fFastTrack,fFastStep); 00293 return &fFastStep; 00294 }
G4VParticleChange * G4FastSimulationManager::InvokePostStepDoIt | ( | ) |
Definition at line 238 of file G4FastSimulationManager.cc.
References G4VFastSimulationModel::DoIt().
Referenced by G4FastSimulationManagerProcess::PostStepDoIt().
00239 { 00240 // const G4FastTrack& parFastTrack=fFastTrack; 00241 fTriggedFastSimulationModel->DoIt(fFastTrack,fFastStep); 00242 return &fFastStep; 00243 }
void G4FastSimulationManager::ListModels | ( | const G4String & | aName | ) | const |
Definition at line 324 of file G4FastSimulationManager.cc.
References G4ParticleTable::entries(), G4cout, G4endl, G4ParticleTable::GetParticleName(), G4ParticleTable::GetParticleTable(), and ListTitle().
00325 { 00326 size_t iModel; 00327 G4int titled = 0; 00328 G4ParticleTable* theParticleTable= 00329 G4ParticleTable::GetParticleTable(); 00330 00331 // Active Models 00332 for (iModel=0; iModel<ModelList.size(); iModel++) 00333 if(ModelList[iModel]->GetName() == aName || 00334 aName == "all" ) { 00335 if(!(titled++)){ 00336 G4cout << "In the envelope "; 00337 ListTitle(); 00338 G4cout << ",\n"; 00339 } 00340 G4cout << " the model " << ModelList[iModel]->GetName() 00341 << " is applicable for :\n "; 00342 00343 G4int list_started=0; 00344 for (G4int iParticle=0; iParticle<theParticleTable->entries(); 00345 iParticle++) 00346 if(ModelList[iModel]-> 00347 IsApplicable(*(theParticleTable-> 00348 GetParticle(iParticle)))) { 00349 if(list_started++) G4cout << ", "; 00350 G4cout << theParticleTable-> 00351 GetParticle(iParticle)->GetParticleName(); 00352 } 00353 G4cout <<G4endl; 00354 } 00355 00356 // Inactive Models 00357 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 00358 if(fInactivatedModels[iModel]->GetName() == aName || 00359 aName == "all" ) { 00360 if(!(titled++)){ 00361 G4cout << "In the envelope "; 00362 ListTitle(); 00363 G4cout << ",\n"; 00364 } 00365 G4cout << " the model " << fInactivatedModels[iModel]->GetName() 00366 << " (inactivated) is applicable for :\n "; 00367 00368 G4int list_started=0; 00369 for (G4int iParticle=0; iParticle<theParticleTable->entries(); 00370 iParticle++) 00371 if(fInactivatedModels[iModel]-> 00372 IsApplicable(*(theParticleTable-> 00373 GetParticle(iParticle)))) { 00374 if(list_started++) G4cout << ", "; 00375 G4cout << theParticleTable-> 00376 GetParticle(iParticle)->GetParticleName(); 00377 } 00378 G4cout <<G4endl; 00379 } 00380 }
void G4FastSimulationManager::ListModels | ( | const G4ParticleDefinition * | ) | const |
Definition at line 383 of file G4FastSimulationManager.cc.
References G4cout, G4endl, G4Exception(), JustWarning, and ListTitle().
00384 { 00385 size_t iModel; 00386 G4bool unique=true; 00387 00388 // Active Models 00389 for (iModel=0; iModel<ModelList.size(); iModel++) 00390 if(ModelList[iModel]->IsApplicable(*aPD)) { 00391 G4cout << "Envelope "; 00392 ListTitle(); 00393 G4cout << ", Model " 00394 << ModelList[iModel]->GetName() 00395 << "." << G4endl; 00396 } 00397 // inactive Models 00398 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 00399 if(fInactivatedModels[iModel]->IsApplicable(*aPD)) { 00400 G4cout << "Envelope "; 00401 ListTitle(); 00402 G4cout << ", Model " 00403 << fInactivatedModels[iModel]->GetName() 00404 << " (inactivated)." << G4endl; 00405 } 00406 00407 if( !unique ) 00408 { 00409 G4ExceptionDescription ed; 00410 ed << "Two or more Models are available for the same particle type, in the same envelope/region." << G4endl; 00411 G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* aPD) const", 00412 "FastSim001", 00413 JustWarning, ed, 00414 "Models risk to exclude each other."); 00415 } 00416 unique=false; 00417 }
void G4FastSimulationManager::ListModels | ( | ) | const |
Definition at line 307 of file G4FastSimulationManager.cc.
References G4cout, and ListTitle().
00308 { 00309 size_t iModel; 00310 00311 G4cout << "Current Models for the "; 00312 ListTitle(); 00313 G4cout << " envelope:\n"; 00314 00315 for (iModel=0; iModel<ModelList.size(); iModel++) 00316 G4cout << " " << ModelList[iModel]->GetName() << "\n"; 00317 00318 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 00319 G4cout << " " << fInactivatedModels[iModel]->GetName() 00320 << "(inactivated)\n"; 00321 }
void G4FastSimulationManager::ListTitle | ( | ) | const |
Definition at line 297 of file G4FastSimulationManager.cc.
References G4cout, G4FastTrack::GetEnvelope(), G4Region::GetName(), G4TransportationManager::GetNavigatorForTracking(), G4TransportationManager::GetTransportationManager(), G4Region::GetWorldPhysical(), and G4Navigator::GetWorldVolume().
Referenced by ListModels().
00298 { 00299 G4cout << fFastTrack.GetEnvelope()->GetName(); 00300 // if(GhostPlacements.size()!=0) G4cout << " (ghost)"; 00301 if (fFastTrack.GetEnvelope()->GetWorldPhysical() == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()) G4cout << " (mass geom.)"; 00302 else G4cout << " (// geom.)"; 00303 00304 }
G4bool G4FastSimulationManager::operator== | ( | const G4FastSimulationManager & | ) | const [inline] |
G4bool G4FastSimulationManager::PostStepGetFastSimulationManagerTrigger | ( | const G4Track & | , | |
const G4Navigator * | a = 0 | |||
) |
Definition at line 184 of file G4FastSimulationManager.cc.
References G4Track::GetDefinition(), G4FastStep::Initialize(), G4FastTrack::OnTheBoundaryButExiting(), and G4FastTrack::SetCurrentTrack().
Referenced by G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength().
00186 { 00187 size_t iModel; 00188 00189 // If particle type changed re-build the fApplicableModelList. 00190 if(fLastCrossedParticle!=track.GetDefinition()) { 00191 fLastCrossedParticle=track.GetDefinition(); 00192 fApplicableModelList.clear(); 00193 // If Model List is empty, do nothing ! 00194 if(ModelList.size()==0) return false; 00195 for (iModel=0; iModel<ModelList.size(); iModel++) 00196 if(ModelList[iModel]->IsApplicable(*(track.GetDefinition()))) 00197 fApplicableModelList.push_back (ModelList[iModel]); 00198 } 00199 00200 // If Applicable Model List is empty, do nothing ! 00201 if(fApplicableModelList.size()==0) return false; 00202 00203 // -- Register current track 00204 fFastTrack.SetCurrentTrack(track,theNavigator); 00205 00206 // tests if particle are on the boundary and leaving, 00207 // in this case do nothing ! 00208 if(fFastTrack.OnTheBoundaryButExiting()) return false; 00209 00210 // Loops on the ModelTrigger() methods 00211 for (iModel=0; iModel<fApplicableModelList.size(); iModel++) 00212 00213 //--------------------------------------------------- 00214 // Asks the ModelTrigger method if it must be trigged now. 00215 //--------------------------------------------------- 00216 00217 if(fApplicableModelList[iModel]->ModelTrigger(fFastTrack)) { 00218 //-------------------------------------------------- 00219 // The model will be applied. Initializes the G4FastStep 00220 // with the current state of the G4Track and 00221 // same usefull parameters. 00222 // In particular it does SetLocalEnergyDeposit(0.0). 00223 //-------------------------------------------------- 00224 fFastStep.Initialize(fFastTrack); 00225 00226 // Keeps the FastSimulationModel pointer to call the 00227 // DoIt() method. 00228 fTriggedFastSimulationModel=fApplicableModelList[iModel]; 00229 return true; 00230 } 00231 00232 //-------------------------------------------- 00233 // Nobody asks to gain control, returns false 00234 //-------------------------------------------- 00235 return false; 00236 }
void G4FastSimulationManager::RemoveFastSimulationModel | ( | G4VFastSimulationModel * | ) | [inline] |
Definition at line 192 of file G4FastSimulationManager.hh.
References G4FastSimulationVector< T >::remove().
00193 { 00194 if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm); 00195 // forces the fApplicableModelList to be rebuild 00196 fLastCrossedParticle = 0; 00197 }