Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SteppingManager.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4SteppingManager.hh 66241 2012-12-13 18:34:42Z gunter $
28 //
29 //---------------------------------------------------------------
30 //
31 // G4SteppingManager.hh
32 //
33 // class description:
34 // This is the class which plays an essential role in tracking
35 // the particle. It takes cares all message passing between
36 // objects in the different categories (for example,
37 // geometry(including transportation), interactions in
38 // matter, etc). It's public method 'stepping' steers to step
39 // the particle.
40 // Geant4 kernel use only
41 //
42 // Contact:
43 // Questions and comments to this code should be sent to
44 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
45 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
46 //
47 //---------------------------------------------------------------
48 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige
49 
50 
51 class G4SteppingManager;
52 
53 #ifndef G4SteppingManager_h
54 #define G4SteppingManager_h 1
55 
57 
58 #include "G4ios.hh" // Include from 'system'
59 #include <iomanip> // Include from 'system'
60 #include <vector> // Include from 'system'
61 #include "globals.hh" // Include from 'global'
62 #include "Randomize.hh" // Include from 'global'
63 
64 #include "G4Navigator.hh" // Include from 'geometry'
65 #include "G4LogicalVolume.hh" // Include from 'geometry'
66 #include "G4VPhysicalVolume.hh" // Include from 'geometry'
67 #include "G4ProcessManager.hh" // Include from 'piim'
68 
69 #include "G4Track.hh" // Include from 'tracking'
70 #include "G4TrackVector.hh" // Include from 'tracking'
71 #include "G4TrackStatus.hh" // Include from 'tracking'
72 #include "G4StepStatus.hh" // Include from 'tracking'
73 #include "G4UserSteppingAction.hh" // Include from 'tracking'
74 #include "G4Step.hh" // Include from 'tracking'
75 #include "G4StepPoint.hh" // Include from 'tracking'
76 #include "G4VSteppingVerbose.hh" // Include from 'tracking'
77 #include "G4TouchableHandle.hh" // Include from 'geometry'
78 #include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
79 
80 //
81  typedef std::vector<G4int>
83  typedef std::vector<G4int>
85  typedef std::vector<G4int>
87 
88  static const size_t SizeOfSelectedDoItVector=100;
89  // In global scope for porting on WIN-VC compiler...
90 
91 ///////////////////////
93 ///////////////////////
94 {
95 
96 //--------
97 public: //without description
98 //--------
99 
100 // Constructor/Destructor
101 
103  // SteppingManger should be dynamically persistent, therefore
104  // you need to invoke new() when you call this constructor.
105  // "Secodary track vector" will be dynamically created by this
106  // cosntructor. "G4UserSteppingAction" will be also constructed
107  // in this constructor, and "this" pointer will be passed to
108  // "G4UserSteppingAction".
109 
111 
112 // Get/Set functions
113 
114  const G4TrackVector* GetSecondary() const;
115  void SetUserAction(G4UserSteppingAction* apAction);
116  G4Track* GetTrack() const;
117  void SetVerboseLevel(G4int vLevel);
119  G4Step* GetStep() const;
121 
122 
123 // Other member functions
124 
126  // Steers to move the give particle from the TrackingManger
127  // by one Step.
128 
129  void SetInitialStep(G4Track* valueTrack);
130  // Sets up initial track information (enegry, position, etc) to
131  // the PreStepPoint of the G4Step. This funciton has to be called
132  // just once before the stepping loop in the "TrackingManager".
133 
134  void GetProcessNumber();
135 
136 // Get methods
145  G4double GetMass();
148  G4Track* GetfTrack();
150  G4Step* GetfStep();
172  size_t GetMAXofAtRestLoops();
173  size_t GetMAXofAlongStepLoops();
174  size_t GetMAXofPostStepLoops();
185  //
187 //---------
188  private:
189 //---------
190 
191 // Member functions
192 
193  void DefinePhysicalStepLength();
194  // Calculate corresponding physical length from the mean free path
195  // left for each discrete phyiscs process. The minimum allowable
196  // Step for each continious process will be also calculated.
197  void InvokeAtRestDoItProcs();
198  void InvokeAlongStepDoItProcs();
199  void InvokePostStepDoItProcs();
200  void InvokePSDIP(size_t); //
201  G4double CalculateSafety();
202  // Return the estimated safety value at the PostStepPoint
203  void ApplyProductionCut(G4Track*);
204 
205 // Member data
206 
207  G4UserSteppingAction* fUserSteppingAction;
208 
209  G4VSteppingVerbose* fVerbose;
210 
211  G4double PhysicalStep;
212  G4double GeometricalStep;
213  G4double CorrectedStep;
214  G4bool PreStepPointIsGeom;
215  G4bool FirstStep;
216  G4StepStatus fStepStatus;
217 
218  G4double TempInitVelocity;
219  G4double TempVelocity;
220  G4double Mass;
221 
222  G4double sumEnergyChange;
223 
224  G4VParticleChange* fParticleChange;
225  G4Track* fTrack;
226  G4TrackVector* fSecondary;
227  G4Step* fStep;
228  G4StepPoint* fPreStepPoint;
229  G4StepPoint* fPostStepPoint;
230 
231  G4VPhysicalVolume* fCurrentVolume;
232  G4VSensitiveDetector* fSensitive;
233  G4VProcess* fCurrentProcess;
234  // The pointer to the process of which DoIt or
235  // GetPhysicalInteractionLength has been just executed.
236 
237 
238  G4ProcessVector* fAtRestDoItVector;
239  G4ProcessVector* fAlongStepDoItVector;
240  G4ProcessVector* fPostStepDoItVector;
241 
242  G4ProcessVector* fAtRestGetPhysIntVector;
243  G4ProcessVector* fAlongStepGetPhysIntVector;
244  G4ProcessVector* fPostStepGetPhysIntVector;
245 
246  size_t MAXofAtRestLoops;
247  size_t MAXofAlongStepLoops;
248  size_t MAXofPostStepLoops;
249 
250  size_t fAtRestDoItProcTriggered;
251  size_t fAlongStepDoItProcTriggered;
252  size_t fPostStepDoItProcTriggered;
253 
254  G4int fN2ndariesAtRestDoIt;
255  G4int fN2ndariesAlongStepDoIt;
256  G4int fN2ndariesPostStepDoIt;
257  // These are the numbers of secondaries generated by the process
258  // just executed.
259 
260  G4Navigator *fNavigator;
261 
262  G4int verboseLevel;
263 
264  G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector;
265  G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector;
266  G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector;
267 
268  G4double fPreviousStepSize;
269 
270  G4TouchableHandle fTouchableHandle;
271 
272  G4SteppingControl StepControlFlag;
273 
274  G4double kCarTolerance;
275  // Cached geometrical tolerance on surface
276  G4double proposedSafety;
277  // This keeps the minimum safety value proposed by AlongStepGPILs.
278  G4ThreeVector endpointSafOrigin;
279  G4double endpointSafety;
280  // To get the true safety value at the PostStepPoint, you have
281  // to subtract the distance to 'endpointSafOrigin' from this value.
282  G4double physIntLength;
283  G4ForceCondition fCondition;
284  G4GPILSelection fGPILSelection;
285  // Above three variables are for the method
286  // DefinePhysicalStepLength(). To pass these information to
287  // the method Verbose, they are kept at here. Need a more
288  // elegant mechanism.
289 
290 };
291 
292 
293 //*******************************************************************
294 //
295 // Inline function
296 //
297 //*******************************************************************
298 
300  return PhysicalStep;
301  }
302 
304  return GeometricalStep;
305  }
306 
308  return CorrectedStep;
309  }
310 
312  return PreStepPointIsGeom;
313  }
314 
316  return FirstStep;
317  }
318 
320  return fStepStatus;
321  }
322 
324  return TempInitVelocity;
325  }
327  return TempVelocity;
328  }
330  return Mass;
331  }
332 
334  return sumEnergyChange;
335  }
336 
338  return fParticleChange;
339  }
340 
342  return fTrack;
343  }
344 
346  return fStep->GetfSecondary();
347  }
349  return fStep;
350  }
352  return fPreStepPoint;
353  }
355  return fPostStepPoint;
356  }
357 
359  return fCurrentVolume;
360  }
362  return fSensitive;
363  }
365  return fCurrentProcess;
366  }
367 
369  return fAtRestDoItVector;
370  }
372  return fAlongStepDoItVector;
373  }
375  return fPostStepDoItVector;
376  }
377 
379  return fAtRestGetPhysIntVector;
380  }
381 
383  return fAlongStepGetPhysIntVector;
384  }
385 
387  return fPostStepGetPhysIntVector;
388  }
389 
391  return MAXofAtRestLoops;
392  }
394  return MAXofAlongStepLoops;
395  }
397  return MAXofPostStepLoops;
398  }
399 
401  return fAtRestDoItProcTriggered;
402  }
404  return fAtRestDoItProcTriggered;
405  }
407  return fPostStepDoItProcTriggered;
408  }
410  return fN2ndariesAtRestDoIt;
411  }
413  return fN2ndariesAlongStepDoIt;
414  }
416  return fN2ndariesPostStepDoIt;
417  }
418 
420  return fNavigator;
421  }
423  return verboseLevel;
424  }
425 
427  return fSelectedAtRestDoItVector;
428  }
429 
431  return fSelectedAlongStepDoItVector;
432  }
433 
435  return fSelectedPostStepDoItVector;
436  }
437 
439  return fPreviousStepSize;
440  }
441 
443  return fTouchableHandle;
444  }
445 
447  return StepControlFlag;
448  }
450  return physIntLength;
451  }
453  return fCondition;
454  }
456  return fGPILSelection;
457  }
458 
460  return fStep->GetSecondary();
461  }
462 
464  fNavigator = value;
465  }
466 
468  fUserSteppingAction = apAction;
469  }
471  return fUserSteppingAction;
472  }
473 
475  return fTrack;
476  }
477 
479  verboseLevel = vLevel;
480  }
481 
483  fVerbose = yourVerbose;
484  }
485 
487  return fStep;
488  }
489 
490  inline G4double G4SteppingManager::CalculateSafety(){
491  return std::max( endpointSafety -
492  (endpointSafOrigin - fPostStepPoint->GetPosition()).mag(),
493  kCarTolerance );
494  }
495 
496 
497 #endif
G4StepPoint * GetfPreStepPoint()
G4ProcessVector * GetfAlongStepDoItVector()
G4double GetcurrentMinimumStep()
void SetNavigator(G4Navigator *value)
G4double GetTempInitVelocity()
G4double GetGeometricalStep()
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
void SetVerboseLevel(G4int vLevel)
std::vector< G4int > G4SelectedAlongStepDoItVector
class std::vector< int, std::allocator< int > > G4SelectedAlongStepDoItVector
G4SteppingControl
std::vector< G4int > G4SelectedAtRestDoItVector
const G4TrackVector * GetSecondary() const
G4VSensitiveDetector * GetfSensitive()
G4StepPoint * GetfPostStepPoint()
G4ForceCondition GetfCondition()
int G4int
Definition: G4Types.hh:78
G4StepStatus GetfStepStatus()
G4Navigator * GetfNavigator()
G4double GetnumberOfInteractionLengthLeft()
G4StepStatus
Definition: G4StepStatus.hh:49
void SetVerbose(G4VSteppingVerbose *)
size_t GetfPostStepDoItProcTriggered()
G4double GetsumEnergyChange()
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
G4double GetfPreviousStepSize()
G4SelectedPostStepDoItVector * GetfSelectedPostStepDoItVector()
const G4TouchableHandle & GetTouchableHandle()
const G4ThreeVector & GetPosition() const
G4ProcessVector * GetfPostStepDoItVector()
G4SelectedAtRestDoItVector * GetfSelectedAtRestDoItVector()
G4VParticleChange * GetfParticleChange()
bool G4bool
Definition: G4Types.hh:79
std::vector< G4int > G4SelectedPostStepDoItVector
Definition: G4Step.hh:76
G4int GetfN2ndariesAlongStepDoIt()
G4StepStatus Stepping()
void SetInitialStep(G4Track *valueTrack)
G4VPhysicalVolume * GetfCurrentVolume()
G4TrackVector * GetfSecondary()
std::vector< G4Track * > G4TrackVector
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ProcessVector * GetfAlongStepGetPhysIntVector()
void SetUserAction(G4UserSteppingAction *apAction)
size_t GetfAtRestDoItProcTriggered()
const XML_Char int const XML_Char * value
size_t GetfAlongStepDoItProcTriggered()
G4ProcessVector * GetfAtRestDoItVector()
G4VProcess * GetfCurrentProcess()
double G4double
Definition: G4Types.hh:76
G4ProcessVector * GetfAtRestGetPhysIntVector()
G4ForceCondition
G4SelectedAlongStepDoItVector * GetfSelectedAlongStepDoItVector()
G4TrackVector * GetfSecondary()
G4SteppingControl GetStepControlFlag()
G4ProcessVector * GetfPostStepGetPhysIntVector()
const G4TrackVector * GetSecondary() const
G4Step * GetStep() const
G4GPILSelection
G4Track * GetTrack() const
G4GPILSelection GetfGPILSelection()
G4UserSteppingAction * GetUserAction()