Geant4-11
G4ChordFinder.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// G4ChordFinder inline implementations
27//
28// Author: J.Apostolakis - Design and implementation - 25.02.1997
29// --------------------------------------------------------------------
30
31inline
32void G4ChordFinder::SetIntegrationDriver(G4VIntegrationDriver* driver)
33{
34 fIntgrDriver = driver;
35}
36
37inline
38G4VIntegrationDriver* G4ChordFinder::GetIntegrationDriver()
39{
40 return fIntgrDriver;
41}
42
43inline
44G4double G4ChordFinder::GetDeltaChord() const
45{
46 return fDeltaChord;
47}
48
49inline
50void G4ChordFinder::SetDeltaChord(G4double newval)
51{
52 fDeltaChord = newval;
53}
54
55inline
56void G4ChordFinder::ResetStepEstimate()
57{
58 fIntgrDriver->OnStartTracking();
59}
60
61inline
62G4int G4ChordFinder::SetVerbose( G4int newvalue )
63{
64 G4int oldval = fStatsVerbose;
65 fStatsVerbose = newvalue;
66 return oldval;
67}
68
69// A member that calculates the inverse parabolic through
70// the three points (x,y) and returns the value x that, for the
71// inverse parabolic, corresponds to y=0.
72//
73inline
74G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
75 const G4double xb, const G4double yb,
76 const G4double xc, const G4double yc )
77{
78 const G4double R = yb/yc,
79 S = yb/ya,
80 T = ya/yc;
81 const G4double Q = (T-1)*(R-1)*(S-1);
82 if (std::fabs(Q) <DBL_MIN ) return DBL_MAX;
83
84 const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));
85 return xb + P/Q;
86}
87
88inline G4double
89G4ChordFinder::AdvanceChordLimited(G4FieldTrack& yCurrent,
90 G4double stepInitial,
91 G4double epsStep_Relative,
92 const G4ThreeVector& /*latestSafetyOrigin*/,
93 G4double /*lasestSafetyRadius*/)
94{
95 return fIntgrDriver->AdvanceChordLimited(yCurrent, stepInitial,
96 epsStep_Relative, fDeltaChord);
97}
98
99inline
100void G4ChordFinder::OnComputeStep()
101{
102 fIntgrDriver->OnComputeStep();
103}