Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:02

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ChordFinder inline implementations
0027 //
0028 // Author: J.Apostolakis - Design and implementation - 25.02.1997
0029 // --------------------------------------------------------------------
0030 
0031 inline 
0032 void G4ChordFinder::SetIntegrationDriver(G4VIntegrationDriver* driver)
0033 {
0034   fIntgrDriver = driver;
0035 }
0036 
0037 inline
0038 G4VIntegrationDriver* G4ChordFinder::GetIntegrationDriver()
0039 {
0040   return fIntgrDriver;
0041 }
0042 
0043 inline
0044 G4double G4ChordFinder::GetDeltaChord() const
0045 {
0046   return fDeltaChord;
0047 }
0048 
0049 inline
0050 void G4ChordFinder::SetDeltaChord(G4double newval)
0051 {
0052   fDeltaChord = newval;
0053 }
0054 
0055 inline
0056 void G4ChordFinder::ResetStepEstimate()
0057 { 
0058   fIntgrDriver->OnStartTracking();
0059 }
0060 
0061 inline
0062 G4int G4ChordFinder::SetVerbose( G4int newvalue )
0063 { 
0064   G4int oldval = fStatsVerbose; 
0065   fStatsVerbose = newvalue;
0066   return oldval; 
0067 }
0068 
0069 // A  member that calculates the inverse parabolic through
0070 // the three points (x,y) and returns the value x that, for the
0071 // inverse parabolic, corresponds to y=0.
0072 //
0073 inline
0074 G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
0075                                        const G4double xb, const G4double yb,
0076                                        const G4double xc, const G4double yc )
0077 {
0078   const G4double R = yb/yc,
0079                  S = yb/ya,
0080                  T = ya/yc;
0081   const G4double Q = (T-1)*(R-1)*(S-1);
0082   if (std::fabs(Q) <DBL_MIN ) { return  DBL_MAX; }
0083         
0084   const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));
0085   return xb + P/Q;
0086 }
0087 
0088 inline G4double
0089 G4ChordFinder::AdvanceChordLimited(G4FieldTrack& yCurrent,
0090                                    G4double stepInitial,
0091                                    G4double epsStep_Relative,
0092                              const G4ThreeVector& /*latestSafetyOrigin*/,
0093                                    G4double /*lasestSafetyRadius*/)
0094 {
0095   return fIntgrDriver->AdvanceChordLimited(yCurrent, stepInitial,
0096                                            epsStep_Relative, fDeltaChord);
0097 }
0098 
0099 inline
0100 void G4ChordFinder::OnComputeStep(const G4FieldTrack* track)
0101 { 
0102   fIntgrDriver->OnComputeStep(track);
0103 }