54 if (distanceConstField > 0)
73 const G4double S6 = hstep * one_sixth;
93 y[0] + S5 * (dydx[0] + S4 * K1[0]),
94 y[1] + S5 * (dydx[1] + S4 * K1[1]),
95 y[2] + S5 * (dydx[2] + S4 * K1[2]),
102 dydx[0] + S5 * K1[0],
103 dydx[1] + S5 * K1[1],
117 dydx[0] + S5 * K2[0],
118 dydx[1] + S5 * K2[1],
129 p[0] = y[0] + hstep * (dydx[0] + S5 * K3[0]);
130 p[1] = y[1] + hstep * (dydx[1] + S5 * K3[1]);
131 p[2] = y[2] + hstep * (dydx[2] + S5 * K3[2]);
136 dydx[0] + hstep * K3[0],
137 dydx[1] + hstep * K3[1],
138 dydx[2] + hstep * K3[2]
148 yOut[0] = y[0] + hstep * (dydx[0] + S6 * (K1[0] + K2[0] + K3[0]));
149 yOut[1] = y[1] + hstep * (dydx[1] + S6 * (K1[1] + K2[1] + K3[1]));
150 yOut[2] = y[2] + hstep * (dydx[2] + S6 * (K1[2] + K2[2] + K3[2]));
152 yOut[3] = dydx[0] + S6 * (K1[0] + K4[0] + 2. * (K2[0] + K3[0]));
153 yOut[4] = dydx[1] + S6 * (K1[1] + K4[1] + 2. * (K2[1] + K3[1]));
154 yOut[5] = dydx[2] + S6 * (K1[2] + K4[2] + 2. * (K2[2] + K3[2]));
159 fEndPoint = { yOut[0], yOut[1], yOut[2] };
162 yError[3] = hstep * std::fabs(K1[0] - K2[0] - K3[0] + K4[0]);
163 yError[4] = hstep * std::fabs(K1[1] - K2[1] - K3[1] + K4[1]);
164 yError[5] = hstep * std::fabs(K1[2] - K2[2] - K3[2] + K4[2]);
165 yError[0] = hstep * yError[3];
166 yError[1] = hstep * yError[4];
167 yError[2] = hstep * yError[5];
192 G4Exception(
"G4NystromRK4::SetDistanceForConstantField",
194 "Provided field is not G4CachedMagneticField. Changing field type.");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static constexpr double perMillion
G4double GetConstDistance() const
void SetConstDistance(G4double dist)
const G4Field * GetFieldObj() const
void SetFieldObj(G4Field *pField)
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4EquationOfMotion * GetEquationOfMotion()
void GetFieldValue(const G4double point[4], G4double field[3])
G4double fInverseMomentum
G4ThreeVector fInitialPoint
std::unique_ptr< G4CachedMagneticField > fCachedField
G4double GetDistanceForConstantField() const
virtual void Stepper(const G4double y[], const G4double dydx[], G4double hstep, G4double yOut[], G4double yError[]) override
virtual G4double DistChord() const override
void SetDistanceForConstantField(G4double length)
G4CachedMagneticField * GetField()
G4NystromRK4(G4Mag_EqRhs *EquationMotion, G4double distanceConstField=0.0)
G4bool notEquals(G4double p1, G4double p2)
constexpr G4int INTEGRATED_COMPONENTS
G4double getValue(const ArrayType &array, Value1D value)
G4double getValue2(const ArrayType &array, Value1D value)