104 lines
3.6 KiB
Plaintext
104 lines
3.6 KiB
Plaintext
//
|
|
// ********************************************************************
|
|
// * License and Disclaimer *
|
|
// * *
|
|
// * The Geant4 software is copyright of the Copyright Holders of *
|
|
// * the Geant4 Collaboration. It is provided under the terms and *
|
|
// * conditions of the Geant4 Software License, included in the file *
|
|
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
|
// * include a list of copyright holders. *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. Please see the license in the file LICENSE and URL above *
|
|
// * for the full disclaimer and the limitation of liability. *
|
|
// * *
|
|
// * This code implementation is the result of the scientific and *
|
|
// * technical work of the GEANT4 collaboration. *
|
|
// * By using, copying, modifying or distributing the software (or *
|
|
// * any work based on the software) you agree to acknowledge its *
|
|
// * use in resulting scientific publications, and indicate your *
|
|
// * acceptance of all terms of the Geant4 Software license. *
|
|
// ********************************************************************
|
|
//
|
|
// G4ChordFinder inline implementations
|
|
//
|
|
// Author: John Apostolakis (CERN), 25.02.1997 - Design and implementation
|
|
// --------------------------------------------------------------------
|
|
|
|
inline
|
|
void G4ChordFinder::SetIntegrationDriver(G4VIntegrationDriver* driver)
|
|
{
|
|
fIntgrDriver = driver;
|
|
}
|
|
|
|
inline
|
|
G4VIntegrationDriver* G4ChordFinder::GetIntegrationDriver()
|
|
{
|
|
return fIntgrDriver;
|
|
}
|
|
|
|
inline
|
|
G4double G4ChordFinder::GetDeltaChord() const
|
|
{
|
|
return fDeltaChord;
|
|
}
|
|
|
|
inline
|
|
void G4ChordFinder::SetDeltaChord(G4double newval)
|
|
{
|
|
fDeltaChord = newval;
|
|
}
|
|
|
|
inline
|
|
void G4ChordFinder::ResetStepEstimate()
|
|
{
|
|
fIntgrDriver->OnStartTracking();
|
|
}
|
|
|
|
inline
|
|
G4int G4ChordFinder::SetVerbose( G4int newvalue )
|
|
{
|
|
G4int oldval = fStatsVerbose;
|
|
fStatsVerbose = newvalue;
|
|
return oldval;
|
|
}
|
|
|
|
// A member that calculates the inverse parabolic through
|
|
// the three points (x,y) and returns the value x that, for the
|
|
// inverse parabolic, corresponds to y=0.
|
|
//
|
|
inline
|
|
G4double G4ChordFinder::InvParabolic ( const G4double xa, const G4double ya,
|
|
const G4double xb, const G4double yb,
|
|
const G4double xc, const G4double yc )
|
|
{
|
|
const G4double R = yb/yc,
|
|
S = yb/ya,
|
|
T = ya/yc;
|
|
const G4double Q = (T-1)*(R-1)*(S-1);
|
|
if (std::fabs(Q) <DBL_MIN ) { return DBL_MAX; }
|
|
|
|
const G4double P = S*(T*(R-T)*(xc-xb) - (1-R)*(xb-xa));
|
|
return xb + P/Q;
|
|
}
|
|
|
|
inline G4double
|
|
G4ChordFinder::AdvanceChordLimited(G4FieldTrack& yCurrent,
|
|
G4double stepInitial,
|
|
G4double epsStep_Relative,
|
|
const G4ThreeVector& /*latestSafetyOrigin*/,
|
|
G4double /*lasestSafetyRadius*/)
|
|
{
|
|
return fIntgrDriver->AdvanceChordLimited(yCurrent, stepInitial,
|
|
epsStep_Relative, fDeltaChord);
|
|
}
|
|
|
|
inline
|
|
void G4ChordFinder::OnComputeStep(const G4FieldTrack* track)
|
|
{
|
|
fIntgrDriver->OnComputeStep(track);
|
|
}
|