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: G4ChordFinder.icc 69699 2013-05-13 08:50:30Z gcosmo $
29 // G4ChordFinder inline implementations
31 // --------------------------------------------------------------------
34 void G4ChordFinder::SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver)
36 fIntgrDriver=IntegrationDriver;
40 G4MagInt_Driver* G4ChordFinder::GetIntegrationDriver()
46 G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep) const
48 return (dChordStep <= fDeltaChord) ;
52 G4double G4ChordFinder::GetDeltaChord() const
58 void G4ChordFinder::SetDeltaChord(G4double newval)
63 // ......................................................................
65 G4double G4ChordFinder::GetLastStepEstimateUnc()
67 return fLastStepEstimate_Unconstrained;
70 void G4ChordFinder::SetLastStepEstimateUnc( G4double stepEst )
72 fLastStepEstimate_Unconstrained = stepEst;
75 void G4ChordFinder::ResetStepEstimate()
77 fLastStepEstimate_Unconstrained = DBL_MAX;
80 // ......................................................................
81 inline G4int G4ChordFinder::GetNoCalls() { return fNoCalls_FNC; }
82 inline G4int G4ChordFinder::GetNoTrials() { return fTotalNoTrials_FNC; }
83 inline G4int G4ChordFinder::GetNoMaxTrials() { return fmaxTrials_FNC; }
85 inline G4double G4ChordFinder::GetFirstFraction() { return fFirstFraction; }
86 inline G4double G4ChordFinder::GetFractionLast() { return fFractionLast; }
87 inline G4double G4ChordFinder::GetFractionNextEstimate()
88 { return fFractionNextEstimate; }
89 inline G4double G4ChordFinder::GetMultipleRadius()
90 { return fMultipleRadius; }
92 inline void G4ChordFinder::SetFirstFraction(G4double val){ fFirstFraction=val; }
94 inline G4int G4ChordFinder::SetVerbose( G4int newvalue )
96 G4int oldval= fStatsVerbose;
97 fStatsVerbose = newvalue;
102 void G4ChordFinder::AccumulateStatistics( G4int noTrials )
105 fTotalNoTrials_FNC += noTrials;
107 // if( noTrials >= fmaxTrials_FNC ){
108 if (noTrials > fmaxTrials_FNC ) {
109 fmaxTrials_FNC=noTrials;
110 // fnoTimesMaxTrFNC=0;
112 // fnoTimesMaxTrFNC++;
116 // A member that calculates the inverse parabolic through
117 // the three points (x,y) and returns the value x that, for the
118 // inverse parabolic, corresponds to y=0.
120 inline G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
121 const G4double xb, const G4double yb,
122 const G4double xc, const G4double yc )
123 { const G4double R = yb/yc,
126 const G4double Q = (T-1)*(R-1)*(S-1);
127 if (std::fabs(Q) <DBL_MIN ) return DBL_MAX;
129 const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));