54 fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0),
55 fLastCrossedParticle(0)
63 AddFastSimulationManager(
this);
79 RemoveFastSimulationManager(
this);
92 for (iModel=0; iModel<(
G4int)ModelList.size(); ++iModel)
93 if(ModelList[iModel]->GetName() == aName)
98 for (iModel=0; iModel<(
G4int)fInactivatedModels.size(); ++iModel)
99 if(fInactivatedModels[iModel]->GetName() == aName) {
101 push_back (fInactivatedModels.
removeAt(iModel));
103 fLastCrossedParticle=0;
114 for (
G4int iModel=0; iModel<(
G4int)ModelList.size(); ++iModel)
115 if(ModelList[iModel]->GetName() == aName) {
116 fInactivatedModels.push_back (ModelList.
removeAt(iModel));
118 fLastCrossedParticle=0;
127 bool &foundPrevious)
const
130 for (std::size_t iModel=0; iModel<ModelList.size(); ++iModel)
132 if(ModelList[iModel]->GetName() == modelName)
134 if (previousFound == 0)
136 model = ModelList[iModel];
141 if (ModelList[iModel] == previousFound)
143 foundPrevious =
true;
148 model = ModelList[iModel];
159 for (std::size_t iModel=0; iModel<ModelList.size(); ++iModel)
161 ModelList[iModel]->Flush();
199 fApplicableModelList.clear();
201 if(ModelList.size()==0)
return false;
202 for (iModel=0; iModel<ModelList.size(); ++iModel)
203 if(ModelList[iModel]->IsApplicable(*(track.
GetDefinition())))
204 fApplicableModelList.push_back (ModelList[iModel]);
208 if(fApplicableModelList.size()==0)
return false;
218 for (iModel=0; iModel<fApplicableModelList.size(); ++iModel)
224 if(fApplicableModelList[iModel]->ModelTrigger(fFastTrack)) {
235 fTriggedFastSimulationModel=fApplicableModelList[iModel];
248 fTriggedFastSimulationModel->
DoIt(fFastTrack,fFastStep);
264 fApplicableModelList.clear();
266 if(ModelList.size()==0)
return false;
267 for (iModel=0; iModel<ModelList.size(); ++iModel)
268 if(ModelList[iModel]->IsApplicable(*(track.
GetDefinition())))
269 fApplicableModelList.push_back (ModelList[iModel]);
273 if(fApplicableModelList.size()==0)
return false;
283 for (iModel=0; iModel < fApplicableModelList.size(); ++iModel)
284 if(fApplicableModelList[iModel]->AtRestModelTrigger(fFastTrack))
287 fTriggedFastSimulationModel=fApplicableModelList[iModel];
299 fTriggedFastSimulationModel->
AtRestDoIt(fFastTrack,fFastStep);
309 else G4cout <<
" (// geom.)";
318 G4cout <<
"Current Models for the ";
322 for (iModel=0; iModel<ModelList.size(); ++iModel)
323 G4cout <<
" " << ModelList[iModel]->GetName() <<
"\n";
325 for (iModel=0; iModel<fInactivatedModels.size(); ++iModel)
326 G4cout <<
" " << fInactivatedModels[iModel]->GetName()
327 <<
"(inactivated)\n";
337 for ( iModel=0; iModel<ModelList.size(); ++iModel )
338 if( ModelList[iModel]->GetName() == modelName || modelName ==
"all" )
342 G4cout <<
"In the envelope ";
346 G4cout <<
" the model " << ModelList[iModel]->GetName()
347 <<
" is applicable for :\n ";
349 G4int list_started=0;
350 for (
G4int iParticle = 0; iParticle<theParticleTable->
entries(); iParticle++)
351 if( ModelList[iModel] -> IsApplicable( *(theParticleTable->
GetParticle(iParticle))) )
353 if(list_started++)
G4cout <<
", ";
354 G4cout << theParticleTable->
361 for (iModel=0; iModel<fInactivatedModels.size(); ++iModel)
362 if(fInactivatedModels[iModel]->GetName() == modelName || modelName ==
"all" )
366 G4cout <<
"In the envelope ";
370 G4cout <<
" the model " << fInactivatedModels[iModel]->GetName()
371 <<
" (inactivated) is applicable for :\n ";
373 G4int list_started=0;
374 for (
G4int iParticle=0; iParticle<theParticleTable->
entries(); iParticle++ )
375 if( fInactivatedModels[iModel] -> IsApplicable( *(theParticleTable->
GetParticle(iParticle))) )
377 if(list_started++)
G4cout <<
", ";
378 G4cout << theParticleTable->
391 for ( iModel=0; iModel<ModelList.size(); ++iModel )
392 if ( ModelList[iModel]->IsApplicable(*particleDefinition) )
397 << ModelList[iModel]->GetName()
400 for (
auto jModel = iModel + 1; jModel < ModelList.size(); jModel++ )
401 if ( ModelList[jModel]->IsApplicable(*particleDefinition) ) unique =
false;
405 for ( iModel=0; iModel<fInactivatedModels.size(); ++iModel )
406 if( fInactivatedModels[iModel]->IsApplicable(*particleDefinition) )
411 << fInactivatedModels[iModel]->GetName()
412 <<
" (inactivated)." <<
G4endl;
418 ed <<
"Two or more active Models are available for the same particle type, in the same envelope/region." <<
G4endl;
419 G4Exception(
"G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const",
422 "Models risk to exclude each other.");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4FastSimulationManager(G4Envelope *anEnvelope, G4bool IsUnique=FALSE)
G4VParticleChange * InvokePostStepDoIt()
G4VParticleChange * InvokeAtRestDoIt()
G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &, const G4Navigator *a=0)
G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &, const G4Navigator *a=0)
G4bool ActivateFastSimulationModel(const G4String &)
G4VFastSimulationModel * GetFastSimulationModel(const G4String &modelName, const G4VFastSimulationModel *previousFound, bool &foundPrevious) const
~G4FastSimulationManager()
G4bool InActivateFastSimulationModel(const G4String &)
void Initialize(const G4FastTrack &)
G4Envelope * GetEnvelope() const
G4bool OnTheBoundaryButExiting() const
void SetCurrentTrack(const G4Track &, const G4Navigator *a=0)
static G4GlobalFastSimulationManager * GetGlobalFastSimulationManager()
G4VPhysicalVolume * GetWorldVolume() const
G4ParticleDefinition * GetParticle(G4int index) const
static G4ParticleTable * GetParticleTable()
const G4String & GetParticleName(G4int index) const
G4FastSimulationManager * GetFastSimulationManager() const
G4VPhysicalVolume * GetWorldPhysical() const
const G4String & GetName() const
void SetFastSimulationManager(G4FastSimulationManager *fsm)
void ClearFastSimulationManager()
G4ParticleDefinition * GetDefinition() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
virtual void DoIt(const G4FastTrack &, G4FastStep &)=0
virtual void AtRestDoIt(const G4FastTrack &, G4FastStep &)