Geant4_10
G4Transportation.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: G4Transportation.hh 68048 2013-03-13 14:34:07Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 include file implementation
32 // ------------------------------------------------------------
33 //
34 // Class description:
35 //
36 // G4Transportation is a process responsible for the transportation of
37 // a particle, i.e. the geometrical propagation encountering the
38 // geometrical sub-volumes of the detectors.
39 // It is also tasked with part of updating the "safety".
40 
41 // =======================================================================
42 // Created: 19 March 1997, J. Apostolakis
43 // =======================================================================
44 #ifndef G4Transportation_hh
45 #define G4Transportation_hh 1
46 
47 #include "G4VProcess.hh"
48 #include "G4FieldManager.hh"
49 
50 #include "G4Navigator.hh"
52 #include "G4PropagatorInField.hh"
53 #include "G4Track.hh"
54 #include "G4Step.hh"
56 class G4SafetyHelper;
57 
59 {
60  // Concrete class that does the geometrical transport
61 
62  public: // with description
63 
64  G4Transportation( G4int verbosityLevel= 1);
66 
68  const G4Track& track,
69  G4double previousStepSize,
70  G4double currentMinimumStep,
71  G4double& currentSafety,
72  G4GPILSelection* selection
73  );
74 
76  const G4Track& track,
77  const G4Step& stepData
78  );
79 
81  const G4Track& track,
82  const G4Step& stepData
83  );
84  // Responsible for the relocation.
85 
87  const G4Track& ,
88  G4double previousStepSize,
89  G4ForceCondition* pForceCond
90  );
91  // Forces the PostStepDoIt action to be called,
92  // but does not limit the step.
93 
95  void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
96  // Access/set the assistant class that Propagate in a Field.
97 
98  inline void SetVerboseLevel( G4int verboseLevel );
99  inline G4int GetVerboseLevel() const;
100  // Level of warnings regarding eg energy conservation
101  // in field integration.
102 
103  inline G4double GetThresholdWarningEnergy() const;
104  inline G4double GetThresholdImportantEnergy() const;
105  inline G4int GetThresholdTrials() const;
106 
107  inline void SetThresholdWarningEnergy( G4double newEnWarn );
108  inline void SetThresholdImportantEnergy( G4double newEnImp );
109  inline void SetThresholdTrials(G4int newMaxTrials );
110 
111  // Get/Set parameters for killing loopers:
112  // Above 'important' energy a 'looping' particle in field will
113  // *NOT* be abandoned, except after fThresholdTrials attempts.
114  // Below Warning energy, no verbosity for looping particles is issued
115 
116  inline G4double GetMaxEnergyKilled() const;
117  inline G4double GetSumEnergyKilled() const;
118  inline void ResetKilledStatistics( G4int report = 1);
119  // Statistics for tracks killed (currently due to looping in field)
120 
121  inline void EnableShortStepOptimisation(G4bool optimise=true);
122  // Whether short steps < safety will avoid to call Navigator (if field=0)
123 
124  inline G4bool EnableUseMagneticMoment(G4bool useMoment=true);
125  // Whether to deflect particles with force due to magnetic moment
126 
127  public: // without description
128 
130  const G4Track& ,
132  ) { return -1.0; };
133  // No operation in AtRestDoIt.
134 
136  const G4Track& ,
137  const G4Step&
138  ) {return 0;};
139  // No operation in AtRestDoIt.
140 
141  void StartTracking(G4Track* aTrack);
142  // Reset state for new (potentially resumed) track
143 
144  protected:
145 
147  // Checks whether a field exists for the "global" field manager.
148 
149  private:
150 
151  G4Navigator* fLinearNavigator;
152  G4PropagatorInField* fFieldPropagator;
153  // The Propagators used to transport the particle
154 
155  // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC
156  // Field Manager for the whole Detector
157 
158  G4ThreeVector fTransportEndPosition;
159  G4ThreeVector fTransportEndMomentumDir;
160  G4double fTransportEndKineticEnergy;
161  G4ThreeVector fTransportEndSpin;
162  G4bool fMomentumChanged;
163  G4bool fEndGlobalTimeComputed;
164  G4double fCandidateEndGlobalTime;
165  // The particle's state after this Step, Store for DoIt
166 
167  G4bool fParticleIsLooping;
168 
169  G4TouchableHandle fCurrentTouchableHandle;
170 
171  // G4bool fFieldExists;
172  // Whether a magnetic field exists ...
173  // A data member for this is problematic: it is useful only if it
174  // can be initialised and updated -- and a scheme is not yet possible.
175 
176  G4bool fGeometryLimitedStep;
177  // Flag to determine whether a boundary was reached.
178 
179  G4ThreeVector fPreviousSftOrigin;
180  G4double fPreviousSafety;
181  // Remember last safety origin & value.
182 
183  G4ParticleChangeForTransport fParticleChange;
184  // New ParticleChange
185 
186  G4double fEndPointDistance;
187 
188  // Thresholds for looping particles:
189  //
190  G4double fThreshold_Warning_Energy; // Warn above this energy
191  G4double fThreshold_Important_Energy; // Hesitate above this
192  G4int fThresholdTrials; // for this no of trials
193  // Above 'important' energy a 'looping' particle in field will
194  // *NOT* be abandoned, except after fThresholdTrials attempts.
195 
196  // Counter for steps in which particle reports 'looping',
197  // if it is above 'Important' Energy
198  G4int fNoLooperTrials;
199  // Statistics for tracks abandoned
200  G4double fSumEnergyKilled;
201  G4double fMaxEnergyKilled;
202 
203  // Whether to avoid calling G4Navigator for short step ( < safety)
204  // If using it, the safety estimate for endpoint will likely be smaller.
205  G4bool fShortStepOptimisation;
206 
207  // Whether to track state change from magnetic moment in a B-field
208  G4bool fUseMagneticMoment;
209 
210  G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
211 
212  // Verbosity
213  G4int fVerboseLevel;
214  // Verbosity level for warnings
215  // eg about energy non-conservation in magnetic field.
216 };
217 
218 #include "G4Transportation.icc"
219 
220 #endif
void SetPropagatorInField(G4PropagatorInField *pFieldPropagator)
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4double GetThresholdWarningEnergy() const
G4int verboseLevel
Definition: G4VProcess.hh:368
void StartTracking(G4Track *aTrack)
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4PropagatorInField * GetPropagatorInField()
int G4int
Definition: G4Types.hh:78
void SetThresholdImportantEnergy(G4double newEnImp)
void SetThresholdWarningEnergy(G4double newEnWarn)
void SetThresholdTrials(G4int newMaxTrials)
bool G4bool
Definition: G4Types.hh:79
G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
G4bool DoesGlobalFieldExist()
Definition: G4Step.hh:76
G4Transportation(G4int verbosityLevel=1)
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
G4int GetVerboseLevel() const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &currentSafety, G4GPILSelection *selection)
G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &)
G4int GetThresholdTrials() const
void ResetKilledStatistics(G4int report=1)
double G4double
Definition: G4Types.hh:76
G4ForceCondition
void EnableShortStepOptimisation(G4bool optimise=true)
void SetVerboseLevel(G4int verboseLevel)
G4GPILSelection
G4double GetSumEnergyKilled() const
G4double GetThresholdImportantEnergy() const
G4bool EnableUseMagneticMoment(G4bool useMoment=true)
G4double GetMaxEnergyKilled() const