19#include "BDSIntegratorEulerOld.hh"
20#include "BDSUtilities.hh"
23#include "G4AffineTransform.hh"
24#include "G4Mag_EqRhs.hh"
25#include "G4ThreeVector.hh"
30BDSIntegratorEulerOld::BDSIntegratorEulerOld(G4Mag_EqRhs* eqOfMIn):
35 const G4double dydx[],
50 G4ThreeVector pos = G4ThreeVector(yIn[0], yIn[1], yIn[2]);
51 G4ThreeVector mom = G4ThreeVector(yIn[3], yIn[4], yIn[5]);
52 G4ThreeVector momUnit = mom.unit();
55 G4AffineTransform GlobalAffine =
auxNavigator->GetGlobalToLocalTransform();
56 G4ThreeVector localMomUnit = GlobalAffine.TransformAxis(momUnit);
58 if (localMomUnit.z() < 0.9 || mom.mag() < 40.0)
77 {yErr[i] = yOut[i] - yTemp[i];}
79 catch (
const std::exception&)
87 G4ThreeVector& localPos,
88 G4ThreeVector& localMom,
89 const G4ThreeVector& localA)
92 G4double localAMag = localA.mag();
97 G4double dc = h2*localAMag/8;
100 G4double dx = localMom.x()*h + localA.x()*h2/2;
101 G4double dy = localMom.y()*h + localA.y()*h2/2;
107 G4double dz = std::sqrt(h2*(1.-h2*localAMag*localAMag/12)-dx*dx-dy*dy);
109 {
throw std::out_of_range(
"non-paraxial in old euler method");}
112 G4double ScaleFac=(dx*dx+dy*dy+dz*dz)/h2;
113 if (ScaleFac>1.0000001)
115 ScaleFac=std::sqrt(ScaleFac);
121 localPos.setX(localPos.x()+dx);
122 localPos.setY(localPos.y()+dy);
123 localPos.setZ(localPos.z()+dz);
125 localMom = localMom + h*localA;
129 localPos += h*localMom;
static G4Navigator * auxNavigator
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[], const G4double h, G4double yOut[], G4double yErr[])
void AdvanceChord(const G4double h, G4ThreeVector &localPos, G4ThreeVector &localMom, const G4ThreeVector &localA)
virtual void AdvanceHelix(const G4double yIn[], G4double h, G4double yOut[], G4double yErr[])=0
Common functionality to BDSIM integrators.
void SetDistChord(G4double distChordIn)
Setter for distChord to private member.
G4MagIntegratorStepper * backupStepper
const G4int nVariables
Cache of the number of variables.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
G4bool IsFiniteStrength(G4double variable)