20#include "BDSIntegratorOctupole.hh"
21#include "BDSMagnetStrength.hh"
23#include "BDSUtilities.hh"
25#include "G4Mag_EqRhs.hh"
26#include "G4MagIntegratorStepper.hh"
27#include "G4ThreeVector.hh"
29#include "CLHEP/Units/SystemOfUnits.h"
35 G4Mag_EqRhs* eqOfMIn):
39 bTriplePrime = brho * (*strength)[
"k3"] / (CLHEP::m3*CLHEP::m);
43 G4cout << __METHOD_NAME__ <<
"B''' = " << bTriplePrime << G4endl;
52 G4ThreeVector mom = G4ThreeVector(yIn[3], yIn[4], yIn[5]);
53 G4double momMag = mom.mag();
56 if(std::abs(kappa) < 1e-20)
63 G4ThreeVector pos = G4ThreeVector(yIn[0], yIn[1], yIn[2]);
67 G4ThreeVector localMomUnit = localMom.unit();
69 G4double x0 = localPos.x();
70 G4double y0 = localPos.y();
73 const G4double halfH = 0.5*h;
74 x0 = x0 + localMomUnit.x()*halfH;
75 y0 = y0 + localMomUnit.y()*halfH;
77 G4double xp = localMomUnit.x();
78 G4double yp = localMomUnit.y();
79 G4double zp = localMomUnit.z();
81 G4double y3fac = y0*(y0*y0 - 3*x0*x0);
82 G4double x3fac = x0*(x0*x0 - 3*y0*y0);
86 localA.setX(-zp*x3fac);
87 localA.setY(-zp*y3fac);
88 localA.setZ( xp*x3fac + yp*y3fac);
BDSStep ConvertToLocal(G4Step const *const step, G4bool useCurvilinear=true) const
void AdvanceDriftMag(const G4double yIn[], const G4double h, G4double yOut[], G4double yErr[]) const
Error array [6] all 0.
Common functionality for Euler integrators.
void AdvanceChord(const G4double h, G4ThreeVector &localPos, G4ThreeVector &localMom, const G4ThreeVector &localA)
void SetDistChord(G4double distChordIn)
Setter for distChord to private member.
void ConvertToGlobal(const G4ThreeVector &localPos, const G4ThreeVector &localMom, G4double yOut[], G4double yErr[], const G4double momScaling=1.0)
scaling of momentum in case localMom is a unit vector
virtual void AdvanceHelix(const G4double yIn[], G4double h, G4double yOut[], G4double yErr[])
Calculate the new particle coordinates.
G4double bTriplePrime
3rd differential of field.
Efficient storage of magnet strengths.
A simple class to represent the positions of a step.
G4ThreeVector PostStepPoint() const
Accessor.
G4ThreeVector PreStepPoint() const
Accessor.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())