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,v 1.16 2007/11/08 17:59:38 japost Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-01-patch-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // ------------------------------------------------------------ |
---|
32 | // GEANT 4 include file implementation |
---|
33 | // ------------------------------------------------------------ |
---|
34 | // |
---|
35 | // Class description: |
---|
36 | // |
---|
37 | // G4Transportation is a process responsible for the transportation of |
---|
38 | // a particle, i.e. the geometrical propagation encountering the |
---|
39 | // geometrical sub-volumes of the detectors. |
---|
40 | // It is also tasked with part of updating the "safety". |
---|
41 | |
---|
42 | // ======================================================================= |
---|
43 | // Created: 19 March 1997, J. Apostolakis |
---|
44 | // ======================================================================= |
---|
45 | #ifndef G4Transportation_hh |
---|
46 | #define G4Transportation_hh 1 |
---|
47 | |
---|
48 | #include "G4VProcess.hh" |
---|
49 | #include "G4FieldManager.hh" |
---|
50 | |
---|
51 | #include "G4Navigator.hh" |
---|
52 | #include "G4TransportationManager.hh" |
---|
53 | #include "G4PropagatorInField.hh" |
---|
54 | #include "G4Track.hh" |
---|
55 | #include "G4Step.hh" |
---|
56 | #include "G4ParticleChangeForTransport.hh" |
---|
57 | |
---|
58 | class G4Transportation : public G4VProcess |
---|
59 | { |
---|
60 | // Concrete class that does the geometrical transport |
---|
61 | |
---|
62 | public: // with description |
---|
63 | |
---|
64 | G4Transportation( G4int verbosityLevel= 1); |
---|
65 | ~G4Transportation(); |
---|
66 | |
---|
67 | G4double AlongStepGetPhysicalInteractionLength( |
---|
68 | const G4Track& track, |
---|
69 | G4double previousStepSize, |
---|
70 | G4double currentMinimumStep, |
---|
71 | G4double& currentSafety, |
---|
72 | G4GPILSelection* selection |
---|
73 | ); |
---|
74 | |
---|
75 | G4VParticleChange* AlongStepDoIt( |
---|
76 | const G4Track& track, |
---|
77 | const G4Step& stepData |
---|
78 | ); |
---|
79 | |
---|
80 | G4VParticleChange* PostStepDoIt( |
---|
81 | const G4Track& track, |
---|
82 | const G4Step& stepData |
---|
83 | ); |
---|
84 | // Responsible for the relocation. |
---|
85 | |
---|
86 | G4double PostStepGetPhysicalInteractionLength( |
---|
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 | |
---|
94 | G4PropagatorInField* GetPropagatorInField(); |
---|
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 | public: // without description |
---|
125 | |
---|
126 | G4double AtRestGetPhysicalInteractionLength( |
---|
127 | const G4Track& , |
---|
128 | G4ForceCondition* |
---|
129 | ) { return -1.0; }; |
---|
130 | // No operation in AtRestDoIt. |
---|
131 | |
---|
132 | G4VParticleChange* AtRestDoIt( |
---|
133 | const G4Track& , |
---|
134 | const G4Step& |
---|
135 | ) {return 0;}; |
---|
136 | // No operation in AtRestDoIt. |
---|
137 | |
---|
138 | void StartTracking(G4Track* aTrack); |
---|
139 | // Reset state for new (potentially resumed) track |
---|
140 | |
---|
141 | protected: |
---|
142 | |
---|
143 | G4bool DoesGlobalFieldExist(); |
---|
144 | // Checks whether a field exists for the "global" field manager. |
---|
145 | |
---|
146 | private: |
---|
147 | |
---|
148 | G4Navigator* fLinearNavigator; |
---|
149 | G4PropagatorInField* fFieldPropagator; |
---|
150 | // The Propagators used to transport the particle |
---|
151 | |
---|
152 | // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC |
---|
153 | // Field Manager for the whole Detector |
---|
154 | |
---|
155 | G4ThreeVector fTransportEndPosition; |
---|
156 | G4ThreeVector fTransportEndMomentumDir; |
---|
157 | G4double fTransportEndKineticEnergy; |
---|
158 | G4ThreeVector fTransportEndSpin; |
---|
159 | G4bool fMomentumChanged; |
---|
160 | G4bool fEnergyChanged; |
---|
161 | G4bool fEndGlobalTimeComputed; |
---|
162 | G4double fCandidateEndGlobalTime; |
---|
163 | // The particle's state after this Step, Store for DoIt |
---|
164 | |
---|
165 | G4bool fParticleIsLooping; |
---|
166 | |
---|
167 | G4TouchableHandle fCurrentTouchableHandle; |
---|
168 | |
---|
169 | // G4bool fFieldExists; |
---|
170 | // Whether a magnetic field exists ... |
---|
171 | // A data member for this is problematic: it is useful only if it |
---|
172 | // can be initialised and updated -- and a scheme is not yet possible. |
---|
173 | |
---|
174 | G4bool fGeometryLimitedStep; |
---|
175 | // Flag to determine whether a boundary was reached. |
---|
176 | |
---|
177 | G4ThreeVector fPreviousSftOrigin; |
---|
178 | G4double fPreviousSafety; |
---|
179 | // Remember last safety origin & value. |
---|
180 | |
---|
181 | G4ParticleChangeForTransport fParticleChange; |
---|
182 | // New ParticleChange |
---|
183 | |
---|
184 | G4double endpointDistance; |
---|
185 | |
---|
186 | // Thresholds for looping particles: |
---|
187 | // |
---|
188 | G4double fThreshold_Warning_Energy; // Warn above this energy |
---|
189 | G4double fThreshold_Important_Energy; // Hesitate above this |
---|
190 | G4int fThresholdTrials; // for this no of trials |
---|
191 | // Above 'important' energy a 'looping' particle in field will |
---|
192 | // *NOT* be abandoned, except after fThresholdTrials attempts. |
---|
193 | G4double fUnimportant_Energy; |
---|
194 | // Below this energy, no verbosity for looping particles is issued |
---|
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 | // Verbosity |
---|
208 | G4int fVerboseLevel; |
---|
209 | // Verbosity level for warnings |
---|
210 | // eg about energy non-conservation in magnetic field. |
---|
211 | }; |
---|
212 | |
---|
213 | #include "G4Transportation.icc" |
---|
214 | |
---|
215 | #endif |
---|