source: trunk/source/geometry/navigation/include/G4PropagatorInField.icc @ 1350

Last change on this file since 1350 was 1347, checked in by garnier, 14 years ago

geant4 tag 9.4

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