Files
geant4/source/geometry/magneticfield/include/G4MagHelicalStepper.icc
T
2016-06-08 16:57:27 +02:00

56 lines
2.3 KiB
Plaintext

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4MagHelicalStepper.icc,v 1.7 2002/05/31 16:22:54 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// linear Step in regions of no field
inline void
G4MagHelicalStepper::LinearStep( const G4double yIn[],
G4double h,
G4double yLinear[])
{
G4double momentum_val = sqrt(yIn[3]*yIn[3] + yIn[4]*yIn[4] + yIn[5]*yIn[5]) ;
G4double inv_momentum = 1.0 / momentum_val ;
G4double yDir[3];
// G4double h_div_momentum = 1.0 / momentum_val ;
for( G4int i = 0; i < 3; i++ ) {
yDir[i] = inv_momentum * yIn[i+3];
yLinear[i] = yIn[i] + h * yDir[i];
// yLinear[i] = yIn[i] + h_div_momentum * yIn[i+3];
yLinear[i+3] = yIn[i+3];
}
}
inline void
G4MagHelicalStepper::MagFieldEvaluate(const G4double y[],
G4ThreeVector& Bfield )
{
G4double B[3];
GetEquationOfMotion()-> GetFieldValue(y, B);
Bfield= G4ThreeVector( B[0], B[1], B[2] );
}