38 G4int noIntegrationVariables,
42 const G4int numberOfVariables = noIntegrationVariables;
48 ak2 =
new G4double[numberOfVariables];
49 ak3 =
new G4double[numberOfVariables];
50 ak4 =
new G4double[numberOfVariables];
51 ak5 =
new G4double[numberOfVariables];
52 ak6 =
new G4double[numberOfVariables];
54 yTemp =
new G4double[numberOfVariables] ;
55 yIn =
new G4double[numberOfVariables] ;
57 fLastInitialVector =
new G4double[numberOfVariables] ;
58 fLastFinalVector =
new G4double[numberOfVariables] ;
59 fLastDyDx =
new G4double[numberOfVariables];
61 fMidVector =
new G4double[numberOfVariables];
62 fMidError =
new G4double[numberOfVariables];
84 delete [] fLastInitialVector;
85 delete [] fLastFinalVector;
112 b41 = 3043.0/3528.0 ,
113 b42 = -3757.0/1176.0 ,
116 b51 = 17617.0/11662.0 ,
117 b52 = -4023.0/686.0 ,
118 b53 = 9372.0/1715.0 ,
127 dc1 = 363.0/2975.0 - b61 ,
129 dc3 = 981.0/1750.0 - b63,
130 dc4 = 2709.0/4250.0 - b64 ,
131 dc5 = -3.0/10.0 - b65 ,
138 yOut[7] = yTemp[7] = yIn[7];
142 for(i=0; i<numberOfVariables; ++i)
149 for(i=0; i<numberOfVariables; ++i)
151 yTemp[i] = yIn[i] + b21*Step*DyDx[i] ;
155 for(i=0; i<numberOfVariables; ++i)
157 yTemp[i] = yIn[i] + Step*(b31*DyDx[i] + b32*ak2[i]) ;
161 for(i=0; i<numberOfVariables; ++i)
163 yTemp[i] = yIn[i] + Step*(b41*DyDx[i] + b42*ak2[i] + b43*ak3[i]) ;
167 for(i=0; i<numberOfVariables; ++i)
169 yTemp[i] = yIn[i] + Step*(b51*DyDx[i] + b52*ak2[i]
170 + b53*ak3[i] + b54*ak4[i]) ;
174 for(i=0; i<numberOfVariables; ++i)
176 yOut[i] = yIn[i] + Step*(b61*DyDx[i] + b62*ak2[i] + b63*ak3[i]
177 + b64*ak4[i] + b65*ak5[i]) ;
181 for(i=0; i<numberOfVariables; ++i)
184 yErr[i] = Step*(dc1*DyDx[i] + dc2*ak2[i] + dc3*ak3[i] + dc4*ak4[i]
185 + dc5*ak5[i] + dc6*ak6[i] ) ;
189 fLastInitialVector[i] = yIn[i] ;
190 fLastFinalVector[i] = yOut[i];
191 fLastDyDx[i] = DyDx[i];
194 fLastStepLength = Step;
210 fLastInitialVector[1], fLastInitialVector[2] );
212 fLastFinalVector[1], fLastFinalVector[2] );
216 fAuxStepper->
Stepper( fLastInitialVector, fLastDyDx, 0.5 * fLastStepLength,
217 fMidVector, fMidError );
219 midPoint =
G4ThreeVector( fMidVector[0], fMidVector[1], fMidVector[2]);
224 if (initialPoint != finalPoint)
227 distChord = distLine;
231 distChord = (midPoint-initialPoint).mag();
250 Interpolate( fLastInitialVector, fLastDyDx, fLastStepLength, yOut, tau );
261 G4double bf1, bf2, bf3, bf4, bf5, bf6;
265 for(
G4int i=0; i<numberOfVariables; ++i)
270 G4double tau_2 = tau*tau, tau_3 = tau*tau_2;
274 bf1 = -(162.0*tau_3 - 504.0*tau_2 + 551.0*tau - 238.0)/238.0 ,
276 bf3 = 27.0*tau*(27.0*tau_2 - 70.0*tau + 51.0 )/385.0 ,
277 bf4 = -27*tau*(27.0*tau_2 - 50.0*tau + 21.0)/85.0 ,
278 bf5 = 7.0*tau*(2232.0*tau_2 - 4166.0*tau + 1785.0 )/3278.0 ,
279 bf6 = tau*(tau - 1.0)*(387.0*tau - 238.0)/149.0 ;
281 for(
G4int i=0; i<numberOfVariables; ++i)
283 yOut[i] = yIn[i] + Step*tau*(bf1*dydx[i] + bf2*ak2[i] + bf3*ak3[i]
284 + bf4*ak4[i] + bf5*ak5[i] + bf6*ak6[i] ) ;
CLHEP::Hep3Vector G4ThreeVector
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
void Interpolate(const G4double yInput[], const G4double dydx[], const G4double Step, G4double yOut[], G4double tau)
G4DoLoMcPriRK34(G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
void SetupInterpolate(const G4double yInput[], const G4double dydx[], const G4double Step)
void SetupInterpolation()
G4double DistChord() const
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4int GetNumberOfVariables() const
void RightHandSide(const G4double y[], G4double dydx[]) const