Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4FastSimulationManager Class Reference

#include <G4FastSimulationManager.hh>

Public Member Functions

 G4FastSimulationManager (G4Envelope *anEnvelope, G4bool IsUnique=FALSE)
 
 ~G4FastSimulationManager ()
 
void AddFastSimulationModel (G4VFastSimulationModel *)
 
void RemoveFastSimulationModel (G4VFastSimulationModel *)
 
G4bool ActivateFastSimulationModel (const G4String &)
 
G4bool InActivateFastSimulationModel (const G4String &)
 
void ListTitle () const
 
void ListModels () const
 
void ListModels (const G4ParticleDefinition *) const
 
void ListModels (const G4String &aName) const
 
const G4EnvelopeGetEnvelope () const
 
G4VFastSimulationModelGetFastSimulationModel (const G4String &modelName, const G4VFastSimulationModel *previousFound, bool &foundPrevious) const
 
const std::vector
< G4VFastSimulationModel * > & 
GetFastSimulationModelList () const
 
G4bool PostStepGetFastSimulationManagerTrigger (const G4Track &, const G4Navigator *a=0)
 
G4VParticleChangeInvokePostStepDoIt ()
 
G4bool AtRestGetFastSimulationManagerTrigger (const G4Track &, const G4Navigator *a=0)
 
G4VParticleChangeInvokeAtRestDoIt ()
 
G4bool operator== (const G4FastSimulationManager &) const
 

Detailed Description

Definition at line 83 of file G4FastSimulationManager.hh.

Constructor & Destructor Documentation

G4FastSimulationManager::G4FastSimulationManager ( G4Envelope anEnvelope,
G4bool  IsUnique = FALSE 
)

Definition at line 53 of file G4FastSimulationManager.cc.

54  :
55  fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0),
56  fLastCrossedParticle(0)
57 {
58  // Communicates to the region that it becomes a
59  // envelope and with this fast simulation manager.
60  anEnvelope->SetFastSimulationManager(this);
61 
62  // Add itself to the GlobalFastSimulationManager
64  AddFastSimulationManager(this);
65 }
static G4GlobalFastSimulationManager * GetGlobalFastSimulationManager()
void SetFastSimulationManager(G4FastSimulationManager *fsm)
Definition: G4Region.cc:128

Here is the call graph for this function:

G4FastSimulationManager::~G4FastSimulationManager ( )

Definition at line 70 of file G4FastSimulationManager.cc.

71 {
72  //
73  // Check out the Envelope about this pointer. If in use,
74  // resets the Logical Volume IsEnvelope flag to avoid clash.
75  //
76  if(fFastTrack.GetEnvelope()->GetFastSimulationManager()==this)
78  // Remove itself from the GlobalFastSimulationManager
80  RemoveFastSimulationManager(this);
81 }
static G4GlobalFastSimulationManager * GetGlobalFastSimulationManager()
void ClearFastSimulationManager()
Definition: G4Region.cc:418
G4FastSimulationManager * GetFastSimulationManager() const
Definition: G4Region.cc:137
G4Envelope * GetEnvelope() const
Definition: G4FastTrack.hh:188

Here is the call graph for this function:

Member Function Documentation

G4bool G4FastSimulationManager::ActivateFastSimulationModel ( const G4String aName)

Definition at line 88 of file G4FastSimulationManager.cc.

89 {
90  size_t iModel;
91 
92  // If the model is already active, do nothing.
93  for (iModel=0; iModel<ModelList.size(); iModel++)
94  if(ModelList[iModel]->GetName() == aName)
95  return true;
96 
97  // Look for in the fInactivatedModels list, if found push_back it back to
98  // the ModelList
99  for (iModel=0; iModel<fInactivatedModels.size(); iModel++)
100  if(fInactivatedModels[iModel]->GetName() == aName) {
101  ModelList.
102  push_back (fInactivatedModels.removeAt(iModel));
103  // forces the fApplicableModelList to be rebuild
104  fLastCrossedParticle=0;
105  return true;
106  }
107  return false;
108 }

Here is the call graph for this function:

void G4FastSimulationManager::AddFastSimulationModel ( G4VFastSimulationModel fsm)
inline

Definition at line 184 of file G4FastSimulationManager.hh.

185 {
186  ModelList.push_back(fsm);
187  // forces the fApplicableModelList to be rebuild
188  fLastCrossedParticle = 0;
189 }

Here is the caller graph for this function:

G4bool G4FastSimulationManager::AtRestGetFastSimulationManagerTrigger ( const G4Track track,
const G4Navigator a = 0 
)

Definition at line 249 of file G4FastSimulationManager.cc.

251 {
252  size_t iModel;
253 
254  // If particle type changed re-build the fApplicableModelList.
255  if(fLastCrossedParticle!=track.GetDefinition()) {
256  fLastCrossedParticle=track.GetDefinition();
257  fApplicableModelList.clear();
258  // If Model List is empty, do nothing !
259  if(ModelList.size()==0) return false;
260  for (iModel=0; iModel<ModelList.size(); iModel++)
261  if(ModelList[iModel]->IsApplicable(*(track.GetDefinition())))
262  fApplicableModelList.push_back (ModelList[iModel]);
263  }
264 
265  // If Applicable Model List is empty, do nothing !
266  if(fApplicableModelList.size()==0) return false;
267 
268  // -- Register current track
269  fFastTrack.SetCurrentTrack(track,theNavigator);
270 
271  // -- (note: compared to the PostStepGetFastSimulationManagerTrigger,
272  // -- the test to see if the particle is on the boundary but leaving
273  // -- is irrelevant here)
274 
275  // Loops on the models to see if one of them wants to trigger:
276  for (iModel=0; iModel < fApplicableModelList.size(); iModel++)
277  if(fApplicableModelList[iModel]->AtRestModelTrigger(fFastTrack))
278  {
279  fFastStep.Initialize(fFastTrack);
280  fTriggedFastSimulationModel=fApplicableModelList[iModel];
281  return true;
282  }
283 
284  //--------------------------------------------
285  // Nobody asks to gain control, returns false
286  //--------------------------------------------
287  return false;
288 }
G4ParticleDefinition * GetDefinition() const
void Initialize(const G4FastTrack &)
Definition: G4FastStep.cc:54
void SetCurrentTrack(const G4Track &, const G4Navigator *a=0)
Definition: G4FastTrack.cc:71

Here is the call graph for this function:

Here is the caller graph for this function:

const G4Envelope * G4FastSimulationManager::GetEnvelope ( ) const
inline

Definition at line 206 of file G4FastSimulationManager.hh.

207 {
208  return fFastTrack.GetEnvelope();
209 }
G4Envelope * GetEnvelope() const
Definition: G4FastTrack.hh:188

Here is the call graph for this function:

G4VFastSimulationModel * G4FastSimulationManager::GetFastSimulationModel ( const G4String modelName,
const G4VFastSimulationModel previousFound,
bool &  foundPrevious 
) const

Definition at line 127 of file G4FastSimulationManager.cc.

130 {
132  for (size_t iModel=0; iModel<ModelList.size(); iModel++)
133  {
134  if(ModelList[iModel]->GetName() == modelName)
135  {
136  if (previousFound == 0)
137  {
138  model = ModelList[iModel];
139  break;
140  }
141  else
142  {
143  if (ModelList[iModel] == previousFound)
144  {
145  foundPrevious = true;
146  continue;
147  }
148  if (foundPrevious)
149  {
150  model = ModelList[iModel];
151  break;
152  }
153  }
154  }
155  }
156  return model;
157 }
const XML_Char XML_Content * model
Definition: expat.h:151
const std::vector<G4VFastSimulationModel*>& G4FastSimulationManager::GetFastSimulationModelList ( ) const
inline

Definition at line 146 of file G4FastSimulationManager.hh.

147  {return ModelList;}
G4bool G4FastSimulationManager::InActivateFastSimulationModel ( const G4String aName)

Definition at line 111 of file G4FastSimulationManager.cc.

112 {
113  // Look for in the ModelList, if found remove from it and keep the pointer
114  // on the fInactivatedModels list.
115  for (size_t iModel=0; iModel<ModelList.size(); iModel++)
116  if(ModelList[iModel]->GetName() == aName) {
117  fInactivatedModels.
118  push_back (ModelList.removeAt(iModel));
119  // forces the fApplicableModelList to be rebuild
120  fLastCrossedParticle=0;
121  return true;
122  }
123  return false;
124 }

Here is the call graph for this function:

G4VParticleChange * G4FastSimulationManager::InvokeAtRestDoIt ( )

Definition at line 290 of file G4FastSimulationManager.cc.

291 {
292  fTriggedFastSimulationModel->AtRestDoIt(fFastTrack,fFastStep);
293  return &fFastStep;
294 }
virtual void AtRestDoIt(const G4FastTrack &, G4FastStep &)

Here is the call graph for this function:

Here is the caller graph for this function:

G4VParticleChange * G4FastSimulationManager::InvokePostStepDoIt ( )

Definition at line 238 of file G4FastSimulationManager.cc.

239 {
240  // const G4FastTrack& parFastTrack=fFastTrack;
241  fTriggedFastSimulationModel->DoIt(fFastTrack,fFastStep);
242  return &fFastStep;
243 }
virtual void DoIt(const G4FastTrack &, G4FastStep &)=0

Here is the call graph for this function:

Here is the caller graph for this function:

void G4FastSimulationManager::ListModels ( ) const

Definition at line 307 of file G4FastSimulationManager.cc.

308 {
309  size_t iModel;
310 
311  G4cout << "Current Models for the ";
312  ListTitle();
313  G4cout << " envelope:\n";
314 
315  for (iModel=0; iModel<ModelList.size(); iModel++)
316  G4cout << " " << ModelList[iModel]->GetName() << "\n";
317 
318  for (iModel=0; iModel<fInactivatedModels.size(); iModel++)
319  G4cout << " " << fInactivatedModels[iModel]->GetName()
320  << "(inactivated)\n";
321 }
G4GLOB_DLL std::ostream G4cout

Here is the call graph for this function:

void G4FastSimulationManager::ListModels ( const G4ParticleDefinition particleDefinition) const

Definition at line 378 of file G4FastSimulationManager.cc.

379 {
380  size_t iModel;
381  G4bool unique = true;
382 
383  // Active Models
384  for ( iModel=0; iModel<ModelList.size(); iModel++ )
385  if ( ModelList[iModel]->IsApplicable(*particleDefinition) )
386  {
387  G4cout << "Envelope ";
388  ListTitle();
389  G4cout << ", Model "
390  << ModelList[iModel]->GetName()
391  << "." << G4endl;
392  // -- Verify unicity of model attached to particleDefinition:
393  for ( auto jModel = iModel + 1; jModel < ModelList.size(); jModel++ )
394  if ( ModelList[jModel]->IsApplicable(*particleDefinition) ) unique = false;
395  }
396 
397  // Inactive Models
398  for ( iModel=0; iModel<fInactivatedModels.size(); iModel++ )
399  if( fInactivatedModels[iModel]->IsApplicable(*particleDefinition) )
400  {
401  G4cout << "Envelope ";
402  ListTitle();
403  G4cout << ", Model "
404  << fInactivatedModels[iModel]->GetName()
405  << " (inactivated)." << G4endl;
406  }
407 
408  if( !unique )
409  {
411  ed << "Two or more active Models are available for the same particle type, in the same envelope/region." << G4endl;
412  G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const",
413  "FastSim001",
414  JustWarning, ed,
415  "Models risk to exclude each other.");
416  }
417  unique=false;
418 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void G4FastSimulationManager::ListModels ( const G4String aName) const

Definition at line 323 of file G4FastSimulationManager.cc.

324 {
325  size_t iModel;
326  G4int titled = 0;
328 
329  // Active Models
330  for ( iModel=0; iModel<ModelList.size(); iModel++ )
331  if( ModelList[iModel]->GetName() == modelName || modelName == "all" )
332  {
333  if( !(titled++) )
334  {
335  G4cout << "In the envelope ";
336  ListTitle();
337  G4cout << ",\n";
338  }
339  G4cout << " the model " << ModelList[iModel]->GetName()
340  << " is applicable for :\n ";
341 
342  G4int list_started=0;
343  for ( G4int iParticle = 0; iParticle<theParticleTable->entries(); iParticle++)
344  if( ModelList[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
345  {
346  if(list_started++) G4cout << ", ";
347  G4cout << theParticleTable->
348  GetParticle(iParticle)->GetParticleName();
349  }
350  G4cout <<G4endl;
351  }
352 
353  // Inactive Models
354  for (iModel=0; iModel<fInactivatedModels.size(); iModel++)
355  if(fInactivatedModels[iModel]->GetName() == modelName || modelName == "all" )
356  {
357  if( !(titled++) )
358  {
359  G4cout << "In the envelope ";
360  ListTitle();
361  G4cout << ",\n";
362  }
363  G4cout << " the model " << fInactivatedModels[iModel]->GetName()
364  << " (inactivated) is applicable for :\n ";
365 
366  G4int list_started=0;
367  for ( G4int iParticle=0; iParticle<theParticleTable->entries(); iParticle++ )
368  if( fInactivatedModels[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
369  {
370  if(list_started++) G4cout << ", ";
371  G4cout << theParticleTable->
372  GetParticle(iParticle)->GetParticleName();
373  }
374  G4cout <<G4endl;
375  }
376 }
const G4String & GetParticleName(G4int index) const
int G4int
Definition: G4Types.hh:78
G4ParticleDefinition * GetParticle(G4int index) const
G4GLOB_DLL std::ostream G4cout
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
G4int entries() const

Here is the call graph for this function:

void G4FastSimulationManager::ListTitle ( ) const

Definition at line 297 of file G4FastSimulationManager.cc.

298 {
299  G4cout << fFastTrack.GetEnvelope()->GetName();
300  // if(GhostPlacements.size()!=0) G4cout << " (ghost)";
302  else G4cout << " (// geom.)";
303 
304 }
const G4String & GetName() const
G4Navigator * GetNavigatorForTracking() const
G4VPhysicalVolume * GetWorldPhysical() const
G4GLOB_DLL std::ostream G4cout
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * GetWorldVolume() const
G4Envelope * GetEnvelope() const
Definition: G4FastTrack.hh:188

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4FastSimulationManager::operator== ( const G4FastSimulationManager fsm) const
inline

Definition at line 200 of file G4FastSimulationManager.hh.

201 {
202  return (this==&fsm) ? true : false;
203 }
G4bool G4FastSimulationManager::PostStepGetFastSimulationManagerTrigger ( const G4Track track,
const G4Navigator a = 0 
)

Definition at line 184 of file G4FastSimulationManager.cc.

186 {
187  size_t iModel;
188 
189  // If particle type changed re-build the fApplicableModelList.
190  if(fLastCrossedParticle!=track.GetDefinition()) {
191  fLastCrossedParticle=track.GetDefinition();
192  fApplicableModelList.clear();
193  // If Model List is empty, do nothing !
194  if(ModelList.size()==0) return false;
195  for (iModel=0; iModel<ModelList.size(); iModel++)
196  if(ModelList[iModel]->IsApplicable(*(track.GetDefinition())))
197  fApplicableModelList.push_back (ModelList[iModel]);
198  }
199 
200  // If Applicable Model List is empty, do nothing !
201  if(fApplicableModelList.size()==0) return false;
202 
203  // -- Register current track
204  fFastTrack.SetCurrentTrack(track,theNavigator);
205 
206  // tests if particle are on the boundary and leaving,
207  // in this case do nothing !
208  if(fFastTrack.OnTheBoundaryButExiting()) return false;
209 
210  // Loops on the ModelTrigger() methods
211  for (iModel=0; iModel<fApplicableModelList.size(); iModel++)
212 
213  //---------------------------------------------------
214  // Asks the ModelTrigger method if it must be trigged now.
215  //---------------------------------------------------
216 
217  if(fApplicableModelList[iModel]->ModelTrigger(fFastTrack)) {
218  //--------------------------------------------------
219  // The model will be applied. Initializes the G4FastStep
220  // with the current state of the G4Track and
221  // same usefull parameters.
222  // In particular it does SetLocalEnergyDeposit(0.0).
223  //--------------------------------------------------
224  fFastStep.Initialize(fFastTrack);
225 
226  // Keeps the FastSimulationModel pointer to call the
227  // DoIt() method.
228  fTriggedFastSimulationModel=fApplicableModelList[iModel];
229  return true;
230  }
231 
232  //--------------------------------------------
233  // Nobody asks to gain control, returns false
234  //--------------------------------------------
235  return false;
236 }
G4ParticleDefinition * GetDefinition() const
G4bool OnTheBoundaryButExiting() const
Definition: G4FastTrack.hh:243
void Initialize(const G4FastTrack &)
Definition: G4FastStep.cc:54
void SetCurrentTrack(const G4Track &, const G4Navigator *a=0)
Definition: G4FastTrack.cc:71

Here is the call graph for this function:

Here is the caller graph for this function:

void G4FastSimulationManager::RemoveFastSimulationModel ( G4VFastSimulationModel fsm)
inline

Definition at line 192 of file G4FastSimulationManager.hh.

193 {
194  if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm);
195  // forces the fApplicableModelList to be rebuild
196  fLastCrossedParticle = 0;
197 }
T * remove(const T *)

Here is the call graph for this function:


The documentation for this class was generated from the following files: