179 const G4double b21 = 0.2, b31 = 3.0 / 40.0, b32 = 9.0 / 40.0, b41 = 0.3,
180 b42 = -0.9, b43 = 1.2,
182 b51 = -11.0 / 54.0, b52 = 2.5, b53 = -70.0 / 27.0,
185 b61 = 1631.0 / 55296.0, b62 = 175.0 / 512.0,
186 b63 = 575.0 / 13824.0, b64 = 44275.0 / 110592.0,
187 b65 = 253.0 / 4096.0,
189 c1 = 37.0 / 378.0, c3 = 250.0 / 621.0, c4 = 125.0 / 594.0,
190 c6 = 512.0 / 1771.0, dc5 = -277.0 / 14336.0;
192 const G4double dc1 = c1 - 2825.0 / 27648.0, dc3 = c3 - 18575.0 / 48384.0,
193 dc4 = c4 - 13525.0 / 55296.0, dc6 = c6 - 0.25;
201 for(
unsigned int i = 0; i <
N; ++i)
207 for(
unsigned int i = 0; i <
N; ++i)
209 yTemp[i] = yIn[i] + b21 * Step * dydx[i];
211 this->RightHandSideInl(yTemp, ak2);
213 for(
unsigned int i = 0; i <
N; ++i)
215 yTemp[i] = yIn[i] + Step * (b31 * dydx[i] + b32 * ak2[i]);
217 this->RightHandSideInl(yTemp, ak3);
219 for(
unsigned int i = 0; i <
N; ++i)
221 yTemp[i] = yIn[i] + Step * (b41 * dydx[i] + b42 * ak2[i] + b43 * ak3[i]);
223 this->RightHandSideInl(yTemp, ak4);
225 for(
unsigned int i = 0; i <
N; ++i)
227 yTemp[i] = yIn[i] + Step * (b51 * dydx[i] + b52 * ak2[i] + b53 * ak3[i] +
230 this->RightHandSideInl(yTemp, ak5);
232 for(
unsigned int i = 0; i <
N; ++i)
234 yTemp[i] = yIn[i] + Step * (b61 * dydx[i] + b62 * ak2[i] + b63 * ak3[i] +
235 b64 * ak4[i] + b65 * ak5[i]);
237 this->RightHandSideInl(yTemp, ak6);
239 for(
unsigned int i = 0; i <
N; ++i)
244 Step * (c1 * dydx[i] + c3 * ak3[i] + c4 * ak4[i] + c6 * ak6[i]);
246 for(
unsigned int i = 0; i <
N; ++i)
251 yErr[i] = Step * (dc1 * dydx[i] + dc3 * ak3[i] + dc4 * ak4[i] +
252 dc5 * ak5[i] + dc6 * ak6[i]);
254 for(
unsigned int i = 0; i <
N; ++i)
257 fLastInitialVector[i] = yIn[i];
258 fLastFinalVector[i] = yOut[i];
259 fLastDyDx[i] = dydx[i];
263 fLastStepLength = Step;
277 initialPoint =
G4ThreeVector(fLastInitialVector[0], fLastInitialVector[1],
278 fLastInitialVector[2]);
279 finalPoint =
G4ThreeVector(fLastFinalVector[0], fLastFinalVector[1],
280 fLastFinalVector[2]);
284 fAuxStepper->G4TCashKarpRKF45::Stepper(fLastInitialVector, fLastDyDx,
285 0.5 * fLastStepLength, fMidVector,
288 midPoint =
G4ThreeVector(fMidVector[0], fMidVector[1], fMidVector[2]);
293 if(initialPoint != finalPoint)
296 distChord = distLine;
300 distChord = (midPoint - initialPoint).mag();