19#include "BDSIntegratorEuler.hh"
20#include "BDSUtilities.hh"
23#include "G4Mag_EqRhs.hh"
24#include "G4ThreeVector.hh"
33 const G4double dydx[],
46 const G4ThreeVector a_start = G4ThreeVector(dydx[3], dydx[4], dydx[5]);
47 if (a_start.mag2() < 1e-60)
54 const G4ThreeVector pos = G4ThreeVector(yIn[0], yIn[1], yIn[2]);
55 const G4ThreeVector mom = G4ThreeVector(yIn[3], yIn[4], yIn[5]);
57 const G4ThreeVector momU = G4ThreeVector(dydx[0], dydx[1], dydx[2]);
58 const G4double hSqrd = std::pow(h, 2);
59 const G4double hHalf = h*0.5;
63 G4ThreeVector pos_phalf = pos + momU*hHalf;
67 G4double midPointDrift[8];
68 G4double midPointDriftErr[8];
71 G4double potential[8];
72 RightHandSide(midPointDrift, potential);
74 G4ThreeVector a_phalf = G4ThreeVector(potential[3], potential[4], potential[5]);
79 G4double factor = hSqrd*0.5/mom.mag();
80 G4ThreeVector pos_new = pos + momU*h + a_phalf*factor;
81 G4ThreeVector mom_new = mom + a_phalf*h;
86 G4ThreeVector a_diff = a_phalf - a_start;
87 G4ThreeVector pos_err = a_diff*factor;
88 G4ThreeVector mom_err = a_diff*h;
91 for (G4int i = 0; i < 3; i++)
94 yOut[i+3] = mom_new[i];
95 yErr[i] = std::abs(pos_err[i]);
96 yErr[i+3] = std::abs(mom_err[i]);
101 G4double dc = (0.5*(pos_new + pos) - pos_phalf).mag();
void AdvanceDriftMag(const G4double yIn[], const G4double h, G4double yOut[], G4double yErr[]) const
Error array [6] all 0.
virtual void Stepper(const G4double yIn[], const G4double dydx[], G4double h, G4double yOut[], G4double yErr[])
Calculate output coordinates.
BDSIntegratorEuler()=delete
Private default constructor to force use of provided one.
Common functionality to BDSIM integrators.
void SetDistChord(G4double distChordIn)
Setter for distChord to private member.
G4bool IsFiniteStrength(G4double variable)