source: trunk/source/geometry/magneticfield/include/G4ChordFinder.icc@ 1044

Last change on this file since 1044 was 921, checked in by garnier, 17 years ago

en test de gl2ps. Problemes de libraries

File size: 4.7 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: G4ChordFinder.icc,v 1.14 2008/10/29 14:34:35 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-cand-01 $
29//
30// G4ChordFinder inline implementations
31//
32// --------------------------------------------------------------------
33
34inline
35void G4ChordFinder::SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver)
36{
37 fIntgrDriver=IntegrationDriver;
38}
39
40inline
41G4MagInt_Driver* G4ChordFinder::GetIntegrationDriver()
42{
43 return fIntgrDriver;
44}
45
46inline
47G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep) const
48{
49 return (dChordStep <= fDeltaChord) ;
50}
51
52inline
53void G4ChordFinder::SetChargeMomentumMass(G4double pCharge, // in e+ units
54 G4double pMomentum,
55 G4double pMass)
56{
57 fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
58}
59
60inline
61G4double G4ChordFinder::GetDeltaChord() const
62{
63 return fDeltaChord;
64}
65
66inline
67void G4ChordFinder::SetDeltaChord(G4double newval)
68{
69 fDeltaChord=newval;
70}
71
72// ......................................................................
73inline
74G4double G4ChordFinder::GetLastStepEstimateUnc()
75{
76 return fLastStepEstimate_Unconstrained;
77}
78inline
79void G4ChordFinder::SetLastStepEstimateUnc( G4double stepEst )
80{
81 fLastStepEstimate_Unconstrained = stepEst;
82}
83inline
84void G4ChordFinder::ResetStepEstimate()
85{
86 fLastStepEstimate_Unconstrained = DBL_MAX;
87}
88
89// ......................................................................
90inline G4int G4ChordFinder::GetNoCalls() { return fNoCalls_FNC; }
91inline G4int G4ChordFinder::GetNoTrials() { return fTotalNoTrials_FNC; }
92inline G4int G4ChordFinder::GetNoMaxTrials() { return fmaxTrials_FNC; }
93
94inline G4double G4ChordFinder::GetFirstFraction() { return fFirstFraction; }
95inline G4double G4ChordFinder::GetFractionLast() { return fFractionLast; }
96inline G4double G4ChordFinder::GetFractionNextEstimate()
97{ return fFractionNextEstimate; }
98inline G4double G4ChordFinder::GetMultipleRadius()
99{ return fMultipleRadius; }
100
101inline void G4ChordFinder::SetFirstFraction(G4double val){ fFirstFraction=val; }
102
103inline G4int G4ChordFinder::SetVerbose( G4int newvalue )
104{
105 G4int oldval= fStatsVerbose;
106 fStatsVerbose = newvalue;
107 return oldval;
108}
109
110inline
111void G4ChordFinder::AccumulateStatistics( G4int noTrials )
112{
113 // Statistics
114 fTotalNoTrials_FNC += noTrials;
115 fNoCalls_FNC++;
116 // if( noTrials >= fmaxTrials_FNC ){
117 if (noTrials > fmaxTrials_FNC ) {
118 fmaxTrials_FNC=noTrials;
119 // fnoTimesMaxTrFNC=0;
120 } else {
121 // fnoTimesMaxTrFNC++;
122 }
123 // }
124}
125// A member that calculates the inverse parabolic through
126// the three points (x,y) and returns the value x that, for the
127// inverse parabolic, corresponds to y=0.
128//
129inline G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
130 const G4double xb, const G4double yb,
131 const G4double xc, const G4double yc )
132{ const G4double R = yb/yc,
133 S = yb/ya,
134 T = ya/yc;
135 const G4double Q = (T-1)*(R-1)*(S-1);
136 if (std::fabs(Q) <DBL_MIN ) return DBL_MAX;
137
138 const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));
139 return xb + P/Q;
140}
Note: See TracBrowser for help on using the repository browser.