Geant4  10.00.p01
G4PropagatorInField.icc
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: G4PropagatorInField.icc 69711 2013-05-13 09:22:17Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------------------
31 // GEANT 4 inline implementation
32 //
33 // ------------------------------------------------------------------------
34 //
35 // 25.10.96 John Apostolakis, design and implementation
36 // 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
37 //
38 // To create an object of this type, must have:
39 // - an object that calculates the Curved paths
40 // - the navigator to find (linear) intersections
41 // - and ?? also must know the value of the maximum displacement allowed
42 // ------------------------------------------------------------------------
43 
44 inline
45 G4ChordFinder* G4PropagatorInField::GetChordFinder()
46 {
47  // The "Chord Finder" of the current Field Mgr is used
48  // -- this could be of the global field manager
49  // or that of another, from the current volume
50  return fCurrentFieldMgr->GetChordFinder();
51 }
52 
53 // Obtain the final space-point and velocity (normal) at the end of the Step
54 //
55 inline
56 G4ThreeVector G4PropagatorInField::EndPosition() const
57 {
58  return End_PointAndTangent.GetPosition();
59 }
60 
61 inline
62 G4ThreeVector G4PropagatorInField::EndMomentumDir() const
63 {
64  return End_PointAndTangent.GetMomentumDir();
65 }
66 
67 inline
68 G4double G4PropagatorInField::GetEpsilonStep() const
69 {
70  return fEpsilonStep;
71 }
72 
73 inline
74 void G4PropagatorInField::SetEpsilonStep( G4double newEps )
75 {
76  fEpsilonStep=newEps;
77 }
78 
79 inline
80 G4bool G4PropagatorInField::IsParticleLooping() const
81 {
82  return fParticleIsLooping;
83 }
84 
85 inline
86 G4int G4PropagatorInField::GetMaxLoopCount() const
87 {
88  return fMax_loop_count;
89 }
90 
91 inline
92 void G4PropagatorInField::SetMaxLoopCount( G4int new_max )
93 {
94  fMax_loop_count = new_max;
95 }
96 
97 // #if 0
98 inline
99 G4double G4PropagatorInField::GetDeltaIntersection() const
100 {
101  return fCurrentFieldMgr->GetDeltaIntersection();
102 }
103 
104 inline
105 G4double G4PropagatorInField::GetDeltaOneStep() const
106 {
107  return fCurrentFieldMgr->GetDeltaOneStep();
108 }
109 // #endif
110 
111 inline
112 G4int G4PropagatorInField::GetVerboseLevel() const
113 {
114  return fVerboseLevel;
115 }
116 inline
117 G4int G4PropagatorInField::Verbose() const // Obsolete
118 {
119  return GetVerboseLevel();
120 }
121 
122 inline
123 G4FieldTrack G4PropagatorInField::GetEndState() const
124 {
125  return End_PointAndTangent;
126 }
127 
128 // Minimum for Relative accuracy of a Step in volumes of global field
129 inline
130 G4double G4PropagatorInField::GetMinimumEpsilonStep() const
131 {
132  return fDetectorFieldMgr->GetMinimumEpsilonStep();
133 }
134 
135 inline
136 void G4PropagatorInField::SetMinimumEpsilonStep( G4double newEpsMin )
137 {
138  fDetectorFieldMgr->SetMinimumEpsilonStep(newEpsMin);
139 }
140 
141 // Maximum for Relative accuracy of any Step
142 inline
143 G4double G4PropagatorInField::GetMaximumEpsilonStep() const
144 {
145  return fDetectorFieldMgr->GetMaximumEpsilonStep();
146 }
147 
148 inline
149 void G4PropagatorInField::SetMaximumEpsilonStep( G4double newEpsMax )
150 {
151  fDetectorFieldMgr->SetMaximumEpsilonStep( newEpsMax );
152 }
153 
154 inline
155 void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist )
156 {
157  if( fLargestAcceptableStep>0.0 )
158  {
159  fLargestAcceptableStep = newBigDist;
160  }
161 }
162 
163 inline
164 G4double G4PropagatorInField::GetLargestAcceptableStep()
165 {
166  return fLargestAcceptableStep;
167 }
168 
169 inline
170 G4FieldManager* G4PropagatorInField::GetCurrentFieldManager()
171 {
172  return fCurrentFieldMgr;
173 }
174 
175 inline
176 void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct,
177  G4int noHarsh,
178  G4int noAbandon )
179 {
180  if( noAct>0 )
181  fActionThreshold_NoZeroSteps = noAct;
182 
183  if( noHarsh > fActionThreshold_NoZeroSteps )
184  fSevereActionThreshold_NoZeroSteps = noHarsh;
185  else
186  fSevereActionThreshold_NoZeroSteps = 2*(fActionThreshold_NoZeroSteps+1);
187 
188  if( noAbandon > fSevereActionThreshold_NoZeroSteps+5 )
189  fAbandonThreshold_NoZeroSteps = noAbandon;
190  else
191  fAbandonThreshold_NoZeroSteps = 2*(fSevereActionThreshold_NoZeroSteps+3);
192 }
193 
194 inline
195 G4int G4PropagatorInField::GetThresholdNoZeroSteps( G4int i )
196 {
197  G4int t=0;
198  if( i==0 ) { t = 3; } // No of parameters
199  else if (i==1) { t = fActionThreshold_NoZeroSteps; }
200  else if (i==2) { t = fSevereActionThreshold_NoZeroSteps; }
201  else if (i==3) { t = fAbandonThreshold_NoZeroSteps; }
202 
203  return t;
204 }
205 
206 inline G4double G4PropagatorInField::GetZeroStepThreshold(){ return fZeroStepThreshold; }
207 inline void G4PropagatorInField::SetZeroStepThreshold( G4double newLength )
208 {
209  fZeroStepThreshold= newLength;
210 }
211 
212 inline
213 void G4PropagatorInField::SetDetectorFieldManager(G4FieldManager* newDetectorFieldManager)
214 {
215  fDetectorFieldMgr = newDetectorFieldManager;
216 }
217 
218 
219 inline
220 void G4PropagatorInField:: SetUseSafetyForOptimization( G4bool value )
221 {
222  fUseSafetyForOptimisation= value;
223 }
224 
225 inline
226 G4bool G4PropagatorInField::GetUseSafetyForOptimization()
227 {
228  return fUseSafetyForOptimisation;
229 }
230 
231 inline
232 void G4PropagatorInField::
233 SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator )
234 {
235  if(SimpleOrMultiNavigator) {
236  fNavigator= SimpleOrMultiNavigator;
237  if( fIntersectionLocator ) {
238  fIntersectionLocator->SetNavigatorFor( SimpleOrMultiNavigator );
239  }
240  }
241 }
242 
243 inline
244 G4Navigator* G4PropagatorInField::GetNavigatorForPropagating()
245 {
246  return fNavigator;
247 }
248 
249 inline
250 void G4PropagatorInField::
251 SetIntersectionLocator( G4VIntersectionLocator *pIntLoc )
252 {
253  if(pIntLoc) { fIntersectionLocator= pIntLoc; }
254 }
255 
256 inline
257 G4VIntersectionLocator* G4PropagatorInField::GetIntersectionLocator()
258 {
259  return fIntersectionLocator;
260 }
261 
262 inline
263 G4bool G4PropagatorInField::IntersectChord( const G4ThreeVector& StartPointA,
264  const G4ThreeVector& EndPointB,
265  G4double &NewSafety,
266  G4double &LinearStepLength,
267  G4ThreeVector &IntersectionPoint )
268 {
269  // Calculate the direction and length of the chord AB
270  //
271  return fIntersectionLocator
272  ->IntersectChord(StartPointA,EndPointB,NewSafety,
273  fPreviousSafety,fPreviousSftOrigin,
274  LinearStepLength,IntersectionPoint);
275 }
276