G4ChordFinder.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4ChordFinder.icc 69786 2013-05-15 09:38:51Z gcosmo $
00028 //
00029 // G4ChordFinder inline implementations
00030 //
00031 // --------------------------------------------------------------------
00032 
00033 inline 
00034 void G4ChordFinder::SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver)
00035 {
00036   fIntgrDriver=IntegrationDriver;
00037 }
00038 
00039 inline
00040 G4MagInt_Driver* G4ChordFinder::GetIntegrationDriver()
00041 {
00042   return fIntgrDriver;
00043 }
00044 
00045 inline
00046 G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep) const
00047 { 
00048   return (dChordStep <= fDeltaChord) ;
00049 }
00050 
00051 inline
00052 void G4ChordFinder::SetChargeMomentumMass(G4double pCharge, // in e+ units
00053                                           G4double pMomentum,
00054                                           G4double pMass)
00055 {
00056   fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
00057 }
00058 
00059 inline
00060 G4double G4ChordFinder::GetDeltaChord() const
00061 {
00062   return fDeltaChord;
00063 }
00064 
00065 inline
00066 void G4ChordFinder::SetDeltaChord(G4double newval)
00067 {
00068   fDeltaChord=newval;
00069 }
00070 
00071 // ......................................................................
00072 inline 
00073 G4double G4ChordFinder::GetLastStepEstimateUnc()
00074 {
00075   return fLastStepEstimate_Unconstrained;   
00076 } 
00077 inline 
00078 void G4ChordFinder::SetLastStepEstimateUnc( G4double stepEst )
00079 {
00080   fLastStepEstimate_Unconstrained = stepEst;    
00081 }
00082 inline
00083 void G4ChordFinder::ResetStepEstimate()
00084 {
00085   fLastStepEstimate_Unconstrained = DBL_MAX;    
00086 }
00087 
00088 // ......................................................................
00089 inline G4int G4ChordFinder::GetNoCalls()     { return fNoCalls_FNC; }
00090 inline G4int G4ChordFinder::GetNoTrials()    { return fTotalNoTrials_FNC; }
00091 inline G4int G4ChordFinder::GetNoMaxTrials() { return fmaxTrials_FNC; } 
00092 
00093 inline G4double G4ChordFinder::GetFirstFraction() { return fFirstFraction; } 
00094 inline G4double G4ChordFinder::GetFractionLast()  { return fFractionLast; } 
00095 inline G4double G4ChordFinder::GetFractionNextEstimate() 
00096 { return fFractionNextEstimate; } 
00097 inline G4double G4ChordFinder::GetMultipleRadius()
00098 { return fMultipleRadius; } 
00099 
00100 inline void G4ChordFinder::SetFirstFraction(G4double val){ fFirstFraction=val; }
00101 
00102 inline G4int G4ChordFinder::SetVerbose( G4int newvalue )
00103 { 
00104   G4int oldval= fStatsVerbose; 
00105   fStatsVerbose = newvalue;
00106   return oldval; 
00107 }
00108 
00109 inline  
00110 void    G4ChordFinder::AccumulateStatistics( G4int noTrials ) 
00111 {
00112   // Statistics 
00113   fTotalNoTrials_FNC += noTrials; 
00114   fNoCalls_FNC++; 
00115   // if( noTrials >= fmaxTrials_FNC ){
00116     if (noTrials > fmaxTrials_FNC ) { 
00117       fmaxTrials_FNC=noTrials; 
00118       // fnoTimesMaxTrFNC=0; 
00119     } else { 
00120       // fnoTimesMaxTrFNC++; 
00121     } 
00122   // } 
00123 }
00124 // A  member that calculates the inverse parabolic through
00125 // the three points (x,y) and returns the value x that, for the
00126 // inverse parabolic, corresponds to y=0.
00127 //
00128 inline G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
00129                                     const G4double xb, const G4double yb,
00130                                     const G4double xc, const G4double yc )
00131 {       const G4double R = yb/yc,
00132                        S = yb/ya,
00133                        T = ya/yc;
00134         const G4double Q = (T-1)*(R-1)*(S-1);
00135         if (std::fabs(Q) <DBL_MIN ) return  DBL_MAX;
00136         
00137         const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));
00138         return xb + P/Q;
00139 }

Generated on Mon May 27 17:47:53 2013 for Geant4 by  doxygen 1.4.7