source: trunk/source/tracking/include/G4SteppingManager.hh @ 1340

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 15.8 KB
Line 
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,v 1.32 2010/10/06 13:17:15 kurasige Exp $
28// GEANT4 tag $Name: tracking-V09-03-08 $
29//
30//---------------------------------------------------------------
31//
32// G4SteppingManager.hh
33//
34// class description:
35//  This is the class which plays an essential role in tracking
36//  the particle. It takes cares all message passing between
37//  objects in the different categories (for example,
38//  geometry(including transportation), interactions in
39//  matter, etc). It's public method 'stepping' steers to step
40//  the particle.
41//  Geant4 kernel use only
42//
43// Contact:
44//   Questions and comments to this code should be sent to
45//     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
46//     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
47//
48//---------------------------------------------------------------
49//   modified for new ParticleChange 12 Mar. 1998  H.Kurashige
50
51
52class G4SteppingManager;
53
54#ifndef G4SteppingManager_h
55#define G4SteppingManager_h 1
56
57class G4VSensitiveDetector;
58
59#include "G4ios.hh"                   // Include from 'system'
60#include <iomanip>              // Include from 'system'
61#include <vector>               // Include from 'system'
62#include "globals.hh"                 // Include from 'global'
63#include "Randomize.hh"               // Include from 'global'
64
65#include "G4Navigator.hh"             // Include from 'geometry'
66#include "G4LogicalVolume.hh"         // Include from 'geometry'
67#include "G4VPhysicalVolume.hh"       // Include from 'geometry'
68#include "G4ProcessManager.hh"        // Include from 'piim'
69
70#include "G4Track.hh"                 // Include from 'tracking'
71#include "G4TrackVector.hh"           // Include from 'tracking'
72#include "G4TrackStatus.hh"           // Include from 'tracking'
73#include "G4StepStatus.hh"            // Include from 'tracking'
74#include "G4UserSteppingAction.hh"    // Include from 'tracking'
75#include "G4Step.hh"                  // Include from 'tracking'
76#include "G4StepPoint.hh"             // Include from 'tracking'
77#include "G4VSteppingVerbose.hh"      // Include from 'tracking'
78#include "G4TouchableHandle.hh"             // Include from 'geometry'
79#include "G4TouchableHistoryHandle.hh"      // Include from 'geometry'
80
81//
82   typedef std::vector<G4int> 
83             G4SelectedAtRestDoItVector;
84   typedef std::vector<G4int> 
85             G4SelectedAlongStepDoItVector;
86   typedef std::vector<G4int>
87             G4SelectedPostStepDoItVector;
88
89   static const size_t SizeOfSelectedDoItVector=100;
90     // In global scope for porting on WIN-VC compiler...
91
92///////////////////////
93class G4SteppingManager 
94///////////////////////
95{
96
97//--------
98public: //without description
99//--------
100
101// Constructor/Destructor
102
103   G4SteppingManager();
104      // SteppingManger should be dynamically persistent, therefore
105      // you need to invoke new() when you call this constructor.
106      // "Secodary track vector" will be dynamically created by this
107      // cosntructor. "G4UserSteppingAction" will be also constructed
108      // in this constructor, and "this" pointer will be passed to
109      // "G4UserSteppingAction".
110
111   ~G4SteppingManager();
112
113// Get/Set functions
114
115   const G4TrackVector* GetSecondary() const;
116   void SetUserAction(G4UserSteppingAction* apAction);
117   G4Track* GetTrack() const;
118   void SetVerboseLevel(G4int vLevel);
119   void SetVerbose(G4VSteppingVerbose*);
120   G4Step* GetStep() const;
121
122
123// Other member functions
124
125   G4StepStatus Stepping();
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
137   G4double GetPhysicalStep();
138   G4double GetGeometricalStep();
139   G4double GetCorrectedStep();
140   G4bool GetPreStepPointIsGeom();
141   G4bool GetFirstStep();
142   G4StepStatus GetfStepStatus();
143   G4double GetTempInitVelocity();
144   G4double GetTempVelocity();
145   G4double GetMass();
146   G4double GetsumEnergyChange();
147   G4VParticleChange* GetfParticleChange();
148   G4Track* GetfTrack();
149   G4TrackVector* GetfSecondary();
150   G4Step* GetfStep();
151   G4StepPoint* GetfPreStepPoint();
152   G4StepPoint* GetfPostStepPoint();
153   G4VPhysicalVolume* GetfCurrentVolume();
154   G4VSensitiveDetector* GetfSensitive();
155   G4VProcess* GetfCurrentProcess();
156   G4ProcessVector* GetfAtRestDoItVector();
157   G4ProcessVector* GetfAlongStepDoItVector();
158   G4ProcessVector* GetfPostStepDoItVector();
159   G4ProcessVector* GetfAlongStepGetPhysIntVector();
160   G4ProcessVector* GetfPostStepGetPhysIntVector();
161   G4ProcessVector* GetfAtRestGetPhysIntVector();
162   G4double GetcurrentMinimumStep();
163   G4double GetnumberOfInteractionLengthLeft();
164   size_t GetfAtRestDoItProcTriggered();
165   size_t GetfAlongStepDoItProcTriggered();
166   size_t GetfPostStepDoItProcTriggered();
167   G4int GetfN2ndariesAtRestDoIt();
168   G4int GetfN2ndariesAlongStepDoIt();
169   G4int GetfN2ndariesPostStepDoIt();
170   G4Navigator* GetfNavigator();
171   G4int GetverboseLevel();
172   size_t GetMAXofAtRestLoops();
173   size_t GetMAXofAlongStepLoops();
174   size_t GetMAXofPostStepLoops();
175   G4SelectedAtRestDoItVector* GetfSelectedAtRestDoItVector();
176   G4SelectedAlongStepDoItVector* GetfSelectedAlongStepDoItVector();
177   G4SelectedPostStepDoItVector* GetfSelectedPostStepDoItVector();
178   G4double   GetfPreviousStepSize();
179   const G4TouchableHandle& GetTouchableHandle();
180   G4SteppingControl GetStepControlFlag();
181   G4Navigator GetNavigator();
182   G4UserSteppingAction* GetUserAction();
183   G4double GetphysIntLength();
184   G4ForceCondition GetfCondition();
185   G4GPILSelection  GetfGPILSelection();
186  //
187   G4bool KillVerbose;
188//---------   
189   private:
190//---------   
191
192// Member functions
193
194   void DefinePhysicalStepLength();
195      // Calculate corresponding physical length from the mean free path
196      // left for each discrete phyiscs process. The minimum allowable
197      // Step for each continious process will be also calculated.
198   void InvokeAtRestDoItProcs();
199   void InvokeAlongStepDoItProcs();
200   void InvokePostStepDoItProcs();
201   void InvokePSDIP(size_t); //
202   void SetNavigator(G4Navigator* value);
203   G4double CalculateSafety();
204      // Return the estimated safety value at the PostStepPoint
205   void ApplyProductionCut(G4Track*);
206
207// Member data
208   
209   G4UserSteppingAction* fUserSteppingAction;
210
211   G4VSteppingVerbose* fVerbose;
212
213   G4double PhysicalStep;
214   G4double GeometricalStep;
215   G4double CorrectedStep;
216   G4bool PreStepPointIsGeom;
217   G4bool FirstStep;
218   G4StepStatus fStepStatus;
219
220   G4double TempInitVelocity;
221   G4double TempVelocity;
222   G4double Mass;
223
224   G4double sumEnergyChange;
225
226   G4VParticleChange* fParticleChange;
227   G4Track* fTrack;
228   G4TrackVector* fSecondary;
229   G4Step* fStep;
230   G4StepPoint* fPreStepPoint;
231   G4StepPoint* fPostStepPoint;
232
233   G4VPhysicalVolume* fCurrentVolume;
234   G4VSensitiveDetector* fSensitive;
235   G4VProcess* fCurrentProcess;
236      // The pointer to the process of which DoIt or
237      // GetPhysicalInteractionLength has been just executed.
238
239
240   G4ProcessVector* fAtRestDoItVector;
241   G4ProcessVector* fAlongStepDoItVector;
242   G4ProcessVector* fPostStepDoItVector;
243
244   G4ProcessVector* fAtRestGetPhysIntVector;
245   G4ProcessVector* fAlongStepGetPhysIntVector;
246   G4ProcessVector* fPostStepGetPhysIntVector;
247
248   size_t MAXofAtRestLoops;
249   size_t MAXofAlongStepLoops;
250   size_t MAXofPostStepLoops;
251
252   size_t fAtRestDoItProcTriggered;
253   size_t fAlongStepDoItProcTriggered;
254   size_t fPostStepDoItProcTriggered;
255
256   G4int fN2ndariesAtRestDoIt;
257   G4int fN2ndariesAlongStepDoIt;
258   G4int fN2ndariesPostStepDoIt;
259      // These are the numbers of secondaries generated by the process
260      // just executed.
261
262   G4Navigator *fNavigator;
263
264   G4int verboseLevel;
265
266   G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector;
267   G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector;
268   G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector;
269
270   G4double   fPreviousStepSize;
271
272   G4TouchableHandle fTouchableHandle;
273
274   G4SteppingControl StepControlFlag;
275
276   G4double kCarTolerance;
277      // Cached geometrical tolerance on surface
278   G4double proposedSafety;
279      // This keeps the minimum safety value proposed by AlongStepGPILs.
280   G4ThreeVector endpointSafOrigin;
281   G4double endpointSafety;
282      // To get the true safety value at the PostStepPoint, you have
283      // to subtract the distance to 'endpointSafOrigin' from this value.
284   G4double physIntLength;
285   G4ForceCondition fCondition;
286   G4GPILSelection  fGPILSelection;
287      // Above three variables are for the method
288      // DefinePhysicalStepLength(). To pass these information to
289      // the method Verbose, they are kept at here. Need a more
290      // elegant mechanism.
291
292};
293
294
295//*******************************************************************
296//
297//  Inline function
298//
299//*******************************************************************
300
301  inline G4double G4SteppingManager::GetPhysicalStep(){
302    return PhysicalStep;
303  }
304
305  inline  G4double G4SteppingManager::GetGeometricalStep(){
306    return GeometricalStep;
307  }
308
309  inline  G4double G4SteppingManager::GetCorrectedStep(){
310    return CorrectedStep;
311  }
312 
313  inline G4bool G4SteppingManager::GetPreStepPointIsGeom(){
314   return PreStepPointIsGeom;
315  }
316
317  inline G4bool G4SteppingManager::GetFirstStep(){
318   return FirstStep;
319  }
320
321  inline G4StepStatus G4SteppingManager::GetfStepStatus(){
322   return fStepStatus;
323  }
324
325  inline G4double G4SteppingManager::GetTempInitVelocity(){
326   return TempInitVelocity;
327  }
328  inline G4double G4SteppingManager::GetTempVelocity(){
329   return TempVelocity;
330  }
331  inline G4double G4SteppingManager::GetMass(){
332   return Mass;
333  }
334
335  inline G4double G4SteppingManager::GetsumEnergyChange(){
336   return sumEnergyChange;
337  }
338
339  inline G4VParticleChange* G4SteppingManager::GetfParticleChange(){
340   return fParticleChange;
341  }
342
343  inline G4Track* G4SteppingManager::GetfTrack(){
344   return fTrack;
345  }
346
347  inline G4TrackVector* G4SteppingManager::GetfSecondary(){
348   return fStep->GetfSecondary();
349  }
350  inline G4Step* G4SteppingManager::GetfStep(){
351   return fStep;
352  }
353  inline G4StepPoint* G4SteppingManager::GetfPreStepPoint(){
354   return fPreStepPoint;
355  }
356  inline G4StepPoint* G4SteppingManager::GetfPostStepPoint(){
357   return fPostStepPoint;
358  }
359
360  inline G4VPhysicalVolume* G4SteppingManager::GetfCurrentVolume(){
361   return fCurrentVolume;
362  }
363  inline G4VSensitiveDetector* G4SteppingManager::GetfSensitive(){
364   return fSensitive;
365  }
366  inline G4VProcess* G4SteppingManager::GetfCurrentProcess(){
367   return fCurrentProcess;
368  }
369
370  inline G4ProcessVector* G4SteppingManager::GetfAtRestDoItVector(){
371   return fAtRestDoItVector;
372  }
373  inline G4ProcessVector* G4SteppingManager::GetfAlongStepDoItVector(){
374   return fAlongStepDoItVector;
375  }
376  inline G4ProcessVector* G4SteppingManager::GetfPostStepDoItVector(){
377   return fPostStepDoItVector;
378  }
379
380  inline G4ProcessVector* G4SteppingManager::GetfAtRestGetPhysIntVector(){
381   return fAtRestGetPhysIntVector;
382  }
383
384  inline G4ProcessVector* G4SteppingManager::GetfAlongStepGetPhysIntVector(){
385   return fAlongStepGetPhysIntVector;
386  }
387
388  inline G4ProcessVector* G4SteppingManager::GetfPostStepGetPhysIntVector(){
389   return fPostStepGetPhysIntVector;
390  }
391
392  inline size_t G4SteppingManager::GetMAXofAtRestLoops(){
393   return MAXofAtRestLoops;
394  }
395  inline size_t G4SteppingManager::GetMAXofAlongStepLoops(){
396   return MAXofAlongStepLoops;
397  }
398  inline size_t G4SteppingManager::GetMAXofPostStepLoops(){
399   return MAXofPostStepLoops;
400  }
401
402  inline size_t G4SteppingManager::GetfAtRestDoItProcTriggered(){
403   return fAtRestDoItProcTriggered;
404  }
405  inline size_t G4SteppingManager::GetfAlongStepDoItProcTriggered(){
406   return fAtRestDoItProcTriggered;
407  }
408  inline size_t G4SteppingManager::GetfPostStepDoItProcTriggered(){
409   return fPostStepDoItProcTriggered;
410  }
411  inline G4int G4SteppingManager::GetfN2ndariesAtRestDoIt(){
412   return fN2ndariesAtRestDoIt;
413  }
414  inline G4int G4SteppingManager::GetfN2ndariesAlongStepDoIt(){
415   return fN2ndariesAlongStepDoIt;
416  }
417  inline G4int G4SteppingManager::GetfN2ndariesPostStepDoIt(){
418   return fN2ndariesPostStepDoIt;
419  }
420
421  inline G4Navigator* G4SteppingManager::GetfNavigator(){
422   return fNavigator;
423  }
424  inline G4int G4SteppingManager::GetverboseLevel(){
425   return verboseLevel;
426  }
427
428  inline G4SelectedAtRestDoItVector* G4SteppingManager::GetfSelectedAtRestDoItVector(){
429   return fSelectedAtRestDoItVector;
430  }
431
432  inline G4SelectedAlongStepDoItVector* G4SteppingManager::GetfSelectedAlongStepDoItVector(){
433   return fSelectedAlongStepDoItVector;
434  }
435
436  inline G4SelectedPostStepDoItVector* G4SteppingManager::GetfSelectedPostStepDoItVector(){
437   return fSelectedPostStepDoItVector;
438  }
439
440  inline G4double   G4SteppingManager::GetfPreviousStepSize(){
441   return fPreviousStepSize;
442  }
443
444  inline const G4TouchableHandle& G4SteppingManager::GetTouchableHandle() {
445   return fTouchableHandle;
446  }
447
448  inline G4SteppingControl G4SteppingManager::GetStepControlFlag(){
449   return StepControlFlag;
450  }
451  inline G4double G4SteppingManager::GetphysIntLength(){
452   return physIntLength;
453  }
454  inline G4ForceCondition G4SteppingManager::GetfCondition(){
455   return fCondition;
456  }
457  inline G4GPILSelection  G4SteppingManager::GetfGPILSelection(){
458   return fGPILSelection;
459  }
460
461  inline const G4TrackVector* G4SteppingManager::GetSecondary() const {
462    return fStep->GetSecondary(); 
463  }
464
465  inline void G4SteppingManager::SetNavigator(G4Navigator* value){
466    fNavigator = value; 
467  }
468
469  inline void G4SteppingManager::SetUserAction(G4UserSteppingAction* apAction){
470    fUserSteppingAction = apAction;
471  }
472  inline G4UserSteppingAction* G4SteppingManager::GetUserAction(){
473    return fUserSteppingAction;
474  }
475
476  inline G4Track* G4SteppingManager::GetTrack() const {
477    return fTrack; 
478  }
479
480  inline void G4SteppingManager::SetVerboseLevel(G4int vLevel){
481    verboseLevel = vLevel; 
482  }
483
484  inline void G4SteppingManager::SetVerbose(G4VSteppingVerbose* yourVerbose){
485     fVerbose = yourVerbose;
486  }
487
488  inline G4Step* G4SteppingManager::GetStep() const {
489    return fStep;
490  }
491
492  inline G4double G4SteppingManager::CalculateSafety(){
493    return std::max( endpointSafety -
494                (endpointSafOrigin - fPostStepPoint->GetPosition()).mag(),
495                kCarTolerance );
496  }
497
498
499#endif
Note: See TracBrowser for help on using the repository browser.