Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ITStepProcessor.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 // $Id: G4ITStepProcessor.hh 100802 2016-11-02 14:55:27Z gcosmo $
27 //
28 // Author: Mathieu Karamitros
29 
30 // The code is developed in the framework of the ESA AO7146
31 //
32 // We would be very happy hearing from you, send us your feedback! :)
33 //
34 // In order for Geant4-DNA to be maintained and still open-source,
35 // article citations are crucial.
36 // If you use Geant4-DNA chemistry and you publish papers about your software,
37 // in addition to the general paper on Geant4-DNA:
38 //
39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
40 //
41 // we would be very happy if you could please also cite the following
42 // reference papers on chemistry:
43 //
44 // J. Comput. Phys. 274 (2014) 841-882
45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
46 
47 #ifndef G4ITSTEPPROCESSOR_H
48 #define G4ITSTEPPROCESSOR_H
49 
50 #include "G4ios.hh" // Include from 'system'
51 #include "globals.hh" // Include from 'global'
52 #include "Randomize.hh" // Include from 'global'
53 
54 #include "G4LogicalVolume.hh" // Include from 'geometry'
55 #include "G4VPhysicalVolume.hh" // Include from 'geometry'
56 #include "G4ProcessManager.hh" // Include from 'piim'
57 
58 #include "G4Track.hh" // Include from 'track'
59 #include "G4TrackVector.hh" // Include from 'track'
60 #include "G4TrackStatus.hh" // Include from 'track'
61 #include "G4StepStatus.hh" // Include from 'track'
62 //#include "G4UserSteppingAction.hh" // Include from 'tracking'
63 //#include "G4UserTrackingAction.hh" // Include from 'tracking'
64 #include "G4Step.hh" // Include from 'track'
65 #include "G4StepPoint.hh" // Include from 'track'
66 #include "G4TouchableHandle.hh" // Include from 'geometry'
67 #include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
68 
70 #include "G4ITLeadingTracks.hh"
71 
72 class G4ITNavigator;
75 class G4IT;
77 class G4ITTransportation;
78 class G4VITProcess;
80 class G4ITTrackHolder;
81 typedef class std::vector<int, std::allocator<int> > G4SelectedAtRestDoItVector;
82 typedef class std::vector<int, std::allocator<int> > G4SelectedAlongStepDoItVector;
83 typedef class std::vector<int, std::allocator<int> > G4SelectedPostStepDoItVector;
84 
85 //________________________________________________
86 //
87 // Members related to ParticleDefinition and not
88 // proper to a track
89 //________________________________________________
91 {
95 
99  //
100  // Note: DoItVector has inverse order against GetPhysIntVector
101  // and SelectedPostStepDoItVector.
102  //
103  // * Max number of processes
107  // Maximum number of processes for each type of process
108  // These depend on the G4ParticleDefinition, so on the track
109 
110  // * Transportation process
112 };
113 
114 //________________________________________________
115 //
116 // Members proper to a track
117 //________________________________________________
119 {
120 public:
122  virtual ~G4ITStepProcessorState();
123 
126 
127  // * Max Number of Process
130 
134 
136 
137  // * Safety
139  // This keeps the minimum safety value proposed by AlongStepGPILs.
142  // To get the true safety value at the PostStepPoint, you have
143  // to subtract the distance to 'endpointSafOrigin' from this value.
144 
146 };
147 
155 {
156 friend class G4Scheduler;
157 public:
159  virtual ~G4ITStepProcessor();
160 
161  inline void SetPreviousStepTime(G4double);
162 
163  inline G4Track* GetTrack()
164  {
165  return fpTrack;
166  }
167  inline G4Step* GetStep()
168  {
169  return fpStep;
170  }
171  inline const G4Step* GetStep() const
172  {
173  return fpStep;
174  }
175  inline void SetStep(G4Step* val)
176  {
177  fpStep = val;
178  }
179 
181  {
182  return fpSecondary;
183  }
185  {
186  fpTrackingManager = trackMan;
187  }
189  {
190  return fpTrackingManager;
191  }
192 
193  //___________________________________
194 
195  virtual void Initialize();
196  void ForceReInitialization();
197 
198  void ResetLeadingTracks();
199  void PrepareLeadingTracks();
200 
201  //___________________________________
202  G4double ComputeInteractionLength(double previousTimeStep);
205  {
206  return fILTimeStep;
207  }
208 
209  //___________________________________
210  // DoIt
211  void DoIt(double timeStep);
212  void ExtractDoItData();
213  void Stepping(G4Track*, const double&);
214  void FindTransportationStep();
215  //___________________________________
216 
217  inline double GetInteractionTime();
218  inline const G4Track* GetTrack() const;
219  inline void CleanProcessor();
220 
222  {
223  return fAtRestDoItProcTriggered;
224  }
225 
227  {
228  return fGPILSelection;
229  }
230 
232  {
233  return fN2ndariesAlongStepDoIt;
234  }
235 
237  {
238  return fN2ndariesAtRestDoIt;
239  }
240 
242  {
243  return fN2ndariesPostStepDoIt;
244  }
245 
247  {
248  return fpCurrentProcess;
249  }
250 
252  {
253  return fPhysIntLength;
254  }
255 
257  {
258  return fPostStepAtTimeDoItProcTriggered;
259  }
260 
262  {
263  return fPostStepDoItProcTriggered;
264  }
265 
267  {
268  return fpProcessInfo;
269  }
270 
272  {
273  return fpState;
274  }
275 
277  {
278  return fpParticleChange;
279  }
280 
282  {
283  return fpCurrentVolume;
284  }
285 
287  {
288  return fCondition;
289  }
290 
291 protected:
292 
293  void ExtractILData();
294 
296  void ClearProcessInfo();
297  void SetTrack(G4Track*);
298 
299  void GetProcessInfo();
300 
301  void SetupMembers();
302  void ResetSecondaries();
303  void InitDefineStep();
304 
305  void SetInitialStep();
306 
307  void GetAtRestIL();
309  void DoStepping();
310  void PushSecondaries();
311 
312  // void CalculateStep();
313  // void DoCalculateStep();
314 
315  // void CloneProcesses();
316  void ActiveOnlyITProcess();
318 
319  void DealWithSecondaries(G4int&);
320  void InvokeAtRestDoItProcs();
323  void InvokePSDIP(size_t); //
325  void SetNavigator(G4ITNavigator *value);
327 
328  // Return the estimated safety value at the PostStepPoint
330 
331  G4ITStepProcessor(const G4ITStepProcessor& other);
333 
334 private:
335  //________________________________________________
336  //
337  // General members
338  //________________________________________________
339 
340  G4bool fInitialized;
341 
342  G4ITTrackingManager* fpTrackingManager;
343 
345  // Cached geometrical tolerance on surface
346 
347  G4ITNavigator* fpNavigator;
348  G4int fStoreTrajectory;
349  G4VITSteppingVerbose* fpVerbose;
350 
351  G4ITTrackHolder* fpTrackContainer;
352  G4ITLeadingTracks fLeadingTracks;
353 
354  //________________________________________________
355  //
356  // Members used as temporaries (= not proper to a track)
357  //________________________________________________
358 
359  G4double fTimeStep; // not proper to a track
360  G4double fILTimeStep; // proper to a track ensemble
361 
362  G4double fPreviousTimeStep;
363  G4TrackVector* fpSecondary; // get from fpStep at every configuration setup
364  G4VParticleChange* fpParticleChange;
365 
366  G4VITProcess* fpCurrentProcess;
367  // The pointer to the process of which DoIt or
368  // GetPhysicalInteractionLength has been just executed
369 
370  // * Secondaries
371  G4int fN2ndariesAtRestDoIt;
372  G4int fN2ndariesAlongStepDoIt;
373  G4int fN2ndariesPostStepDoIt;
374  // These are the numbers of secondaries generated by the process
375  // just executed.
376 
377  // * Process selection
378  size_t fAtRestDoItProcTriggered;
379  size_t fPostStepDoItProcTriggered;
380  size_t fPostStepAtTimeDoItProcTriggered;
381  // Record the selected process
382 
383  G4ForceCondition fCondition;
384  G4GPILSelection fGPILSelection;
385  // Above three variables are for the method
386  // DefinePhysicalStepLength(). To pass these information to
387  // the method Verbose, they are kept at here. Need a more
388  // elegant mechanism.
389 
390  G4double fPhysIntLength;
391  // The minimum physical interaction length over all possible processes
392 
393  // * Sensitive detector
394  // G4SteppingControl StepControlFlag;
395  // G4VSensitiveDetector* fpSensitive;
396 
397  G4VPhysicalVolume* fpCurrentVolume;
398  // Get from fpStep or touchable, keep as member for user interface
399 
400  //________________________________________________
401  //
402  // Members related to ParticleDefinition and not
403  // proper to a track
404  //________________________________________________
405 
406  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> fProcessGeneralInfoMap;
407  ProcessGeneralInfo* fpProcessInfo;
408  G4ITTransportation* fpTransportation;
409 
410  //________________________________________________
411  //
412  // Members used for setting up the processor
413  //________________________________________________
414 
415  G4Track* fpTrack; // Set track
416  G4IT* fpITrack; // Set track
417  G4TrackingInformation* fpTrackingInfo; // Set track
418 
419  G4ITStepProcessorState* fpState; // SetupMembers or InitDefineStep
420  G4Step* fpStep; // Set track or InitDefineStep
421 
422  G4StepPoint* fpPreStepPoint; // SetupMembers
423  G4StepPoint* fpPostStepPoint; // SetupMembers
424 };
425 
426 //______________________________________________________________________________
427 
429 {
430  fPreviousTimeStep = previousTimeStep;
431 }
432 
433 //______________________________________________________________________________
434 
436 {
437  return fpTrack;
438 }
439 
440 //______________________________________________________________________________
441 
443 {
444  return std::max(fpState->fEndpointSafety - (fpState->fEndpointSafOrigin
445  - fpPostStepPoint->GetPosition()).mag(),
446  kCarTolerance);
447 }
448 
449 //______________________________________________________________________________
450 
451 inline void G4ITStepProcessor::SetNavigator(G4ITNavigator *value)
452 {
453  fpNavigator = value;
454 }
455 
456 //______________________________________________________________________________
457 
459 {
460  fTimeStep = DBL_MAX;
461  fPhysIntLength = DBL_MAX;
462 
463  fpState = 0;
464  fpTrack = 0;
465  fpTrackingInfo = 0;
466  fpITrack = 0;
467  fpStep = 0;
468  fpPreStepPoint = 0;
469  fpPostStepPoint = 0;
470 
471  fpParticleChange = 0;
472 
473  fpCurrentVolume = 0;
474  // fpSensitive = 0;
475 
476  fpSecondary = 0;
477 
478  fpTransportation = 0;
479 
480  fpCurrentProcess= 0;
481  fpProcessInfo = 0;
482 
483  fAtRestDoItProcTriggered = INT_MAX;
484  fPostStepDoItProcTriggered = INT_MAX;
485  fPostStepAtTimeDoItProcTriggered = INT_MAX;
486  fGPILSelection = NotCandidateForSelection;
487  fCondition = NotForced;
488 }
489 
490 //______________________________________________________________________________
491 
493 {
494  return fTimeStep;
495 }
496 
497 #endif // G4ITSTEPPROCESSOR_H
Definition: G4IT.hh:88
void SetStep(G4Step *val)
size_t GetPostStepDoItProcTriggered() const
G4ProcessVector * fpAtRestGetPhysIntVector
size_t GetAtRestDoItProcTriggered() const
G4ThreeVector fEndpointSafOrigin
size_t GetPostStepAtTimeDoItProcTriggered() const
void SetTrackingManager(G4ITTrackingManager *trackMan)
G4ITTransportation * fpTransportation
const G4ITStepProcessorState * GetProcessorState() const
const G4VParticleChange * GetParticleChange() const
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
class std::vector< int, std::allocator< int > > G4SelectedAlongStepDoItVector
G4TouchableHandle fTouchableHandle
void SetNavigator(G4ITNavigator *value)
G4int GetN2ndariesAtRestDoIt() const
G4ProcessVector * fpAlongStepDoItVector
G4ProcessVector * fpPostStepDoItVector
void SetPreviousStepTime(G4double)
int G4int
Definition: G4Types.hh:78
G4StepStatus
Definition: G4StepStatus.hh:49
G4SelectedAtRestDoItVector fSelectedAtRestDoItVector
G4SelectedPostStepDoItVector fSelectedPostStepDoItVector
void SetTrack(G4Track *)
void DefinePhysicalStepLength(G4Track *)
G4double GetPhysIntLength() const
G4ITTrackingManager * GetTrackingManager()
G4int GetN2ndariesAlongStepDoIt() const
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
G4ProcessVector * fpAlongStepGetPhysIntVector
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4ThreeVector & GetPosition() const
G4ProcessVector * fpAtRestDoItVector
G4TrackVector * GetSecondaries() const
void DoIt(double timeStep)
void ApplyProductionCut(G4Track *)
bool G4bool
Definition: G4Types.hh:79
const G4VITProcess * GetCurrentProcess() const
void DealWithSecondaries(G4int &)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4ProcessVector * fpPostStepGetPhysIntVector
const G4double kCarTolerance
Definition: G4Step.hh:76
#define INT_MAX
Definition: templates.hh:111
virtual void Initialize()
G4double ComputeInteractionLength(double previousTimeStep)
G4GPILSelection GetGPILSelection() const
std::vector< G4Track * > G4TrackVector
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ForceCondition GetCondition() const
G4ITStepProcessorState & operator=(const G4ITStepProcessorState &)
void Stepping(G4Track *, const double &)
G4ITStepProcessor & operator=(const G4ITStepProcessor &other)
double G4double
Definition: G4Types.hh:76
G4int GetN2ndariesPostStepDoIt() const
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)
const ProcessGeneralInfo * GetCurrentProcessInfo() const
G4ForceCondition
#define DBL_MAX
Definition: templates.hh:83
const G4VPhysicalVolume * GetCurrentVolume() const
const G4Step * GetStep() const
G4GPILSelection