44 m_magdistance( distanceConstField ),
75 G4double R[3] = { P[0], P[1] , P[2]};
76 G4double A[3] = {dPdS[0], dPdS[1], dPdS[2]};
78 m_iPoint[0]=R[0]; m_iPoint[1]=R[1]; m_iPoint[2]=R[2];
94 G4double K1[3] = { m_imom*dPdS[3], m_imom*dPdS[4], m_imom*dPdS[5] };
98 G4double p[4] = {R[0]+S5*(A[0]+S4*K1[0]),
99 R[1]+S5*(A[1]+S4*K1[1]),
100 R[2]+S5*(A[2]+S4*K1[2]),
104 G4double A2[3] = {A[0]+S5*K1[0],A[1]+S5*K1[1],A[2]+S5*K1[2]};
105 G4double K2[3] = {(A2[1]*m_lastField[2]-A2[2]*m_lastField[1])*m_cof,
106 (A2[2]*m_lastField[0]-A2[0]*m_lastField[2])*m_cof,
107 (A2[0]*m_lastField[1]-A2[1]*m_lastField[0])*m_cof};
109 m_mPoint[0]=p[0]; m_mPoint[1]=p[1]; m_mPoint[2]=p[2];
113 G4double A3[3] = {A[0]+S5*K2[0],A[1]+S5*K2[1],A[2]+S5*K2[2]};
114 G4double K3[3] = {(A3[1]*m_lastField[2]-A3[2]*m_lastField[1])*m_cof,
115 (A3[2]*m_lastField[0]-A3[0]*m_lastField[2])*m_cof,
116 (A3[0]*m_lastField[1]-A3[1]*m_lastField[0])*m_cof};
120 p[0] = R[0]+S*(A[0]+S5*K3[0]);
121 p[1] = R[1]+S*(A[1]+S5*K3[1]);
122 p[2] = R[2]+S*(A[2]+S5*K3[2]);
126 G4double A4[3] = {A[0]+S*K3[0],A[1]+S*K3[1],A[2]+S*K3[2]};
127 G4double K4[3] = {(A4[1]*m_lastField[2]-A4[2]*m_lastField[1])*m_cof,
128 (A4[2]*m_lastField[0]-A4[0]*m_lastField[2])*m_cof,
129 (A4[0]*m_lastField[1]-A4[1]*m_lastField[0])*m_cof};
133 Po[0] = P[0]+S*(A[0]+S6*(K1[0]+K2[0]+K3[0]));
134 Po[1] = P[1]+S*(A[1]+S6*(K1[1]+K2[1]+K3[1]));
135 Po[2] = P[2]+S*(A[2]+S6*(K1[2]+K2[2]+K3[2]));
137 m_fPoint[0]=Po[0]; m_fPoint[1]=Po[1]; m_fPoint[2]=Po[2];
141 Po[3] = A[0]+S6*(K1[0]+K4[0]+2.*(K2[0]+K3[0]));
142 Po[4] = A[1]+S6*(K1[1]+K4[1]+2.*(K2[1]+K3[1]));
143 Po[5] = A[2]+S6*(K1[2]+K4[2]+2.*(K2[2]+K3[2]));
147 Err[3] = S*std::fabs(K1[0]-K2[0]-K3[0]+K4[0]);
148 Err[4] = S*std::fabs(K1[1]-K2[1]-K3[1]+K4[1]);
149 Err[5] = S*std::fabs(K1[2]-K2[2]-K3[2]+K4[2]);
159 G4double normF = m_mom/std::sqrt(Po[3]*Po[3]+Po[4]*Po[4]+Po[5]*Po[5]);
160 Po [3]*=normF; Po[4]*=normF; Po[5]*=normF;
163 Po[6]=P[6]; Po[7]=P[7];
177 G4double dx = m_mPoint[0]-m_iPoint[0];
178 G4double dy = m_mPoint[1]-m_iPoint[1];
179 G4double dz = m_mPoint[2]-m_iPoint[2];
183 G4double ds = (ax*dx+ay*dy+az*dz)/d2;
188 return std::sqrt(dx*dx+dy*dy+dz*dz);
198 G4double P4vec[4]= { P[0], P[1], P[2], P[7] };
200 m_mom = std::sqrt(P[3]*P[3]+P[4]*P[4]+P[5]*P[5]) ;
207 dPdS[3] =
m_cof*(P[4]*m_lastField[2]-P[5]*m_lastField[1]) ;
208 dPdS[4] =
m_cof*(P[5]*m_lastField[0]-P[3]*m_lastField[2]) ;
209 dPdS[5] =
m_cof*(P[3]*m_lastField[1]-P[4]*m_lastField[0]) ;
virtual void ComputeRightHandSide(const double P[], double dPdS[])
G4NystromRK4(G4Mag_EqRhs *EquationMotion, G4double distanceConstField=0.0)
static const G4double A[nN]
G4double m_fldPosition[4]
G4double DistChord() const
void getField(const G4double P[4])
void Stepper(const G4double P[], const G4double dPdS[], G4double step, G4double Po[], G4double Err[])