54 G4double yTemp[8], dydxTemp[6], yIn[8];
58 for(
G4int i=0; i<nvar; ++i)
72 for(
auto i=0; i<3; ++i)
89 for(
G4int i=0; i<nvar; ++i)
91 yErr[i] = yOut[i] - yTemp[i] ;
92 yOut[i] += yErr[i]*by15 ;
119 G4Exception(
"G4RKG3_Stepper::StepWithEst()",
"GeomField0001",
140 G4double K1[7], K2[7], K3[7], K4[7];
141 G4double tTemp[8]={0.0}, yderiv[6]={0.0};
147 const G4double c1=0.5, c2=0.125, c3=1./6.;
152 mom = std::sqrt(tIn[3]*tIn[3]+tIn[4]*tIn[4]+tIn[5]*tIn[5]);
153 inverse_mom = 1./mom;
154 for(
auto i=0; i<3; ++i)
156 K1[i] = Step * dydx[i+3]*inverse_mom;
157 tTemp[i] = tIn[i] + Step*(c1*tIn[i+3]*inverse_mom + c2*K1[i]) ;
158 tTemp[i+3] = tIn[i+3] + c1*K1[i]*mom ;
163 for(
auto i=0; i<3; ++i)
165 K2[i] = Step * yderiv[i+3]*inverse_mom;
166 tTemp[i+3] = tIn[i+3] + c1*K2[i]*mom ;
173 for(
auto i=0; i<3; ++i)
175 K3[i] = Step * yderiv[i+3]*inverse_mom;
176 tTemp[i] = tIn[i] + Step*(tIn[i+3]*inverse_mom + c1*K3[i]) ;
177 tTemp[i+3] = tIn[i+3] + K3[i]*mom ;
184 for(
auto i=0; i<3; ++i)
186 K4[i] = Step * yderiv[i+3]*inverse_mom;
187 tOut[i] = tIn[i] + Step*(tIn[i+3]*inverse_mom+ (K1[i]+K2[i]+K3[i])*c3) ;
188 tOut[i+3] = tIn[i+3] + mom*(K1[i] + 2*K2[i] + 2*K3[i] +K4[i])*c3 ;
203 if (fyInitial != fyFinal)
206 distChord = distLine;
210 distChord = (fyMidPoint-fyInitial).mag();
double B(double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
virtual void EvaluateRhsGivenB(const G4double y[], const G4double B[3], G4double dydx[]) const =0
void EvaluateRhsReturnB(const G4double y[], G4double dydx[], G4double Field[]) const
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4EquationOfMotion * GetEquationOfMotion()
void StepWithEst(const G4double tIn[8], const G4double dydx[6], G4double Step, G4double tOut[8], G4double &alpha2, G4double &beta2, const G4double B1[3], G4double B2[3])
void Stepper(const G4double yIn[], const G4double dydx[], G4double h, G4double yOut[], G4double yErr[])
G4double DistChord() const
void StepNoErr(const G4double tIn[8], const G4double dydx[6], G4double Step, G4double tOut[8], G4double B[3])
G4RKG3_Stepper(G4Mag_EqRhs *EqRhs)