2 // ********************************************************************
3 // * License and Disclaimer *
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. *
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. *
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 // ********************************************************************
27 // $Id: G4PropagatorInField.icc 81596 2014-06-03 14:08:49Z gcosmo $
30 // ------------------------------------------------------------------------
31 // GEANT 4 inline implementation
33 // ------------------------------------------------------------------------
35 // 25.10.96 John Apostolakis, design and implementation
36 // 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
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 // ------------------------------------------------------------------------
45 G4ChordFinder* G4PropagatorInField::GetChordFinder()
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();
53 // Obtain the final space-point and velocity (normal) at the end of the Step
56 G4ThreeVector G4PropagatorInField::EndPosition() const
58 return End_PointAndTangent.GetPosition();
62 G4ThreeVector G4PropagatorInField::EndMomentumDir() const
64 return End_PointAndTangent.GetMomentumDir();
68 G4double G4PropagatorInField::GetEpsilonStep() const
74 void G4PropagatorInField::SetEpsilonStep( G4double newEps )
80 G4bool G4PropagatorInField::IsParticleLooping() const
82 return fParticleIsLooping;
86 G4int G4PropagatorInField::GetMaxLoopCount() const
88 return fMax_loop_count;
92 void G4PropagatorInField::SetMaxLoopCount( G4int new_max )
94 fMax_loop_count = new_max;
99 G4double G4PropagatorInField::GetDeltaIntersection() const
101 return fCurrentFieldMgr->GetDeltaIntersection();
105 G4double G4PropagatorInField::GetDeltaOneStep() const
107 return fCurrentFieldMgr->GetDeltaOneStep();
112 G4int G4PropagatorInField::GetVerboseLevel() const
114 return fVerboseLevel;
117 G4int G4PropagatorInField::Verbose() const // Obsolete
119 return GetVerboseLevel();
123 G4FieldTrack G4PropagatorInField::GetEndState() const
125 return End_PointAndTangent;
128 // Minimum for Relative accuracy of a Step in volumes of global field
130 G4double G4PropagatorInField::GetMinimumEpsilonStep() const
132 return fDetectorFieldMgr->GetMinimumEpsilonStep();
136 void G4PropagatorInField::SetMinimumEpsilonStep( G4double newEpsMin )
138 fDetectorFieldMgr->SetMinimumEpsilonStep(newEpsMin);
141 // Maximum for Relative accuracy of any Step
143 G4double G4PropagatorInField::GetMaximumEpsilonStep() const
145 return fDetectorFieldMgr->GetMaximumEpsilonStep();
149 void G4PropagatorInField::SetMaximumEpsilonStep( G4double newEpsMax )
151 fDetectorFieldMgr->SetMaximumEpsilonStep( newEpsMax );
155 void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist )
157 if( fLargestAcceptableStep>0.0 )
159 fLargestAcceptableStep = newBigDist;
164 G4double G4PropagatorInField::GetLargestAcceptableStep()
166 return fLargestAcceptableStep;
170 G4FieldManager* G4PropagatorInField::GetCurrentFieldManager()
172 return fCurrentFieldMgr;
176 void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct,
181 fActionThreshold_NoZeroSteps = noAct;
183 if( noHarsh > fActionThreshold_NoZeroSteps )
184 fSevereActionThreshold_NoZeroSteps = noHarsh;
186 fSevereActionThreshold_NoZeroSteps = 2*(fActionThreshold_NoZeroSteps+1);
188 if( noAbandon > fSevereActionThreshold_NoZeroSteps+5 )
189 fAbandonThreshold_NoZeroSteps = noAbandon;
191 fAbandonThreshold_NoZeroSteps = 2*(fSevereActionThreshold_NoZeroSteps+3);
195 G4int G4PropagatorInField::GetThresholdNoZeroSteps( G4int i )
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; }
206 inline G4double G4PropagatorInField::GetZeroStepThreshold(){ return fZeroStepThreshold; }
207 inline void G4PropagatorInField::SetZeroStepThreshold( G4double newLength )
209 fZeroStepThreshold= newLength;
213 void G4PropagatorInField::SetDetectorFieldManager(G4FieldManager* newDetectorFieldManager)
215 fDetectorFieldMgr = newDetectorFieldManager;
220 void G4PropagatorInField:: SetUseSafetyForOptimization( G4bool value )
222 fUseSafetyForOptimisation= value;
226 G4bool G4PropagatorInField::GetUseSafetyForOptimization()
228 return fUseSafetyForOptimisation;
232 void G4PropagatorInField::
233 SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator )
235 if(SimpleOrMultiNavigator) {
236 fNavigator= SimpleOrMultiNavigator;
237 if( fIntersectionLocator ) {
238 fIntersectionLocator->SetNavigatorFor( SimpleOrMultiNavigator );
244 G4Navigator* G4PropagatorInField::GetNavigatorForPropagating()
250 void G4PropagatorInField::
251 SetIntersectionLocator( G4VIntersectionLocator *pIntLoc )
254 fIntersectionLocator= pIntLoc;
256 // Ensure that the Intersection Locator uses the correct Navigator
257 pIntLoc->SetNavigatorFor( fNavigator );
262 G4VIntersectionLocator* G4PropagatorInField::GetIntersectionLocator()
264 return fIntersectionLocator;
268 G4bool G4PropagatorInField::IntersectChord( const G4ThreeVector& StartPointA,
269 const G4ThreeVector& EndPointB,
271 G4double &LinearStepLength,
272 G4ThreeVector &IntersectionPoint )
274 // Calculate the direction and length of the chord AB
276 return fIntersectionLocator
277 ->IntersectChord(StartPointA,EndPointB,NewSafety,
278 fPreviousSafety,fPreviousSftOrigin,
279 LinearStepLength,IntersectionPoint);