23 #include <TDatabasePDG.h>
31 using namespace genfit;
35 m_magCharge(magCharge),
36 m_mass(TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass())
46 if (dynamic_cast<const MeasurementOnPlane*>(&state) !=
nullptr) {
47 Exception exc(
"RKTrackRep::getCharge - cannot get charge from MeasurementOnPlane",__LINE__,__FILE__);
55 if (state.
getState()(0) * pdgCharge < 0)
82 static const double EC ( 0.000149896229 );
83 static const double P3 ( 1./3. );
84 static const double DLT ( .0002 );
85 double sign = state7[6] > 0 ? 1.0 : -1.0;
89 double S3(0), S4(0), PS2(0);
90 M1x3 H0 = {{0.,0.,0.}}, H1 = {{0.,0.,0.}}, H2 = {{0.,0.,0.}};
91 M1x3 r = {{0.,0.,0.}};
93 double A0(0), A1(0), A2(0), A3(0), A4(0), A5(0), A6(0);
94 double B0(0), B1(0), B2(0), B3(0), B4(0), B5(0), B6(0);
95 double C0(0), C1(0), C2(0), C3(0), C4(0), C5(0), C6(0);
97 double D0(0),
D1(0),
D2(0),
D3(0),
D4(0), D5(0);
98 double F0(0),
F1(0),
F2(0),
F3(0);
99 double AH0(0), AH1(0), AH2(0), AH3(0);
109 r[0] = R[0]; r[1] = R[1]; r[2]=R[2];
111 H0[0] *= PS2; H0[1] *= PS2; H0[2] *= PS2;
114 AH0 = A[0]*H0[0] + A[1]*H0[1] + A[2]*H0[2];
116 A0 = F0 * (H0[0] - A[0] * AH0); B0 = F0 * (H0[1] - A[1] * AH0); C0 = F0 * (H0[2] - A[2] * AH0);
117 A2 = A[0]+A0 ; B2 = A[1]+B0 ; C2 = A[2]+C0 ;
118 A1 = A2+A[0] ; B1 = B2+A[1] ; C1 = C2+A[2] ;
122 r[0] += A1*S4; r[1] += B1*S4; r[2] += C1*S4;
124 H1[0] *= PS2; H1[1] *= PS2; H1[2] *= PS2;
127 D1 = D0 + F0 * D0 * AH0;
129 AH1 = A2*H1[0] + B2*H1[1] + C2*H1[2];
131 A3 = A[0] +
F1*(H1[0] - A2*AH1); B3 = A[1] +
F1*(H1[1] - B2*AH1); C3 = A[2] +
F1*(H1[2] - C2*AH1);
132 D2 = D0 +
F1 * D1 * AH1;
134 AH2 = A3*H1[0] + B3*H1[1] + C3*H1[2];
136 A4 = A[0] +
F2*(H1[0] - A3*AH2); B4 = A[1] +
F2*(H1[1] - B3*AH2); C4 = A[2] +
F2*(H1[2] - C3*AH2);
137 A5 = A4-A[0]+A4 ; B5 = B4-A[1]+B4 ; C5 = C4-A[2]+C4 ;
138 D3 = D0 + 2.0 *
F2 * D2 * AH2;
140 AH3 = A4*H1[0] + B4*H1[1] + C4*H1[2];
144 r[0]=R[0]+S*A4; r[1]=R[1]+S*B4; r[2]=R[2]+S*C4;
146 H2[0] *= PS2; H2[1] *= PS2; H2[2] *= PS2;
149 A6 = F3 * (H2[0] - A5*AH3); B6 = F3 * (H2[1] - B5*AH3); C6 = F3 * (H2[2] - C5*AH3);
150 D4 = F3 * D3 * AH3 - D0;
151 D5 = P3*(D1 + 2*D2 + D3 +
D4);
156 if(jacobianT !=
nullptr){
166 M7x7&
J = *jacobianT;
169 double dA0(0), dA2(0), dA3(0), dA4(0), dA5(0), dA6(0);
171 double dB0(0), dB2(0), dB3(0), dB4(0), dB5(0), dB6(0);
173 double dC0(0), dC2(0), dC3(0), dC4(0), dC5(0), dC6(0);
175 double dD0(0), dD1(0), dD2(0), dD3(0), dD4(0);
189 for(
int i=start;
i<7; ++
i) {
193 dA0 = (1/(F0*F0*D0*D0*D0) - 2/D0)*A0*dD0 - (D1-D0)/D0*
J(
i,3) - F0*A[0]*(
J(
i,3)*H0[0] +
J(
i,4)*H0[1] +
J(
i,5)*H0[2]);
194 dB0 = (1/(F0*F0*D0*D0*D0) - 2/D0)*B0*dD0 - (D1-D0)/D0*
J(
i,4) - F0*A[1]*(
J(
i,3)*H0[0] +
J(
i,4)*H0[1] +
J(
i,5)*H0[2]);
195 dC0 = (1/(F0*F0*D0*D0*D0) - 2/D0)*C0*dD0 - (D1-D0)/D0*
J(
i,5) -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] + dB3*H1[1] + dC3*H1[2]);
214 dA5 = dA4+dA4-
J(
i, 3);
215 dB5 = dB4+dB4-
J(
i, 4);
216 dC5 = dC4+dC4-
J(
i, 5);
218 dD4 = -dD0+(1/(F3*F3*D3*D3*D3) - 1/D3)*(D4+D0)*dD3 + F3*D3*(dA5*H2[0] + dB5*H2[1] + dC5*H2[2]);
219 dA6 = (1/(F3*F3*D3*D3*D3) - 2/D3)*(A4-A[0])*dD3 - (D4+D0)/D3*dA5 - F3*A5*(dA5*H2[0] + dB5*H2[1] + dC5*H2[2]);
220 dB6 = (1/(F3*F3*D3*D3*D3) - 2/D3)*(B4-A[1])*dD3 - (D4+D0)/D3*dB5 - F3*B5*(dA5*H2[0] + dB5*H2[1] + dC5*H2[2]);
221 dC6 = (1/(F3*F3*D3*D3*D3) - 2/D3)*(C4-A[2])*dD3 - (D4+D0)/D3*dC5 - F3*C5*(dA5*H2[0] + dB5*H2[1] + dC5*H2[2]);
224 J(
i, 0) += (dA2+dA3+dA4)*S3;
J(
i, 3) = ((dA0+2.*dA3)+(dA5+dA6))*P3;
225 J(
i, 1) += (dB2+dB3+dB4)*S3;
J(
i, 4) = ((dB0+2.*dB3)+(dB5+dB6))*P3;
226 J(
i, 2) += (dC2+dC3+dC4)*S3;
J(
i, 5) = ((dC0+2.*dC3)+(dC5+dC6))*P3;
227 J(
i,6) = -
m_magCharge*sign/D5/D5*P3*(dD1 + 2*dD2 + dD3 + dD4);
236 R[0] += (A2+A3+A4)*S3; A[0] += (SA[0]=((A0+2.*A3)+(A5+A6))*P3-A[0]);
237 R[1] += (B2+B3+B4)*S3; A[1] += (SA[1]=((B0+2.*B3)+(B5+B6))*P3-A[1]);
238 R[2] += (C2+C3+C4)*S3; A[2] += (SA[2]=((C0+2.*C3)+(C5+C6))*P3-A[2]);
242 double CBA ( 1./sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]) );
243 A[0] *= CBA; A[1] *= CBA; A[2] *= CBA;
247 double EST ( fabs((A1+A6)-(A3+A4)) +
248 fabs((B1+B6)-(B3+B4)) +
249 fabs((C1+C6)-(C3+C4)) );
251 debugOut <<
" RKTrackRep::RKPropagate. Step = "<< S <<
"; quality EST = " << EST <<
" \n";
261 return pow(DLT/EST, 1./5.);
264 void MplTrackRep::Streamer(TBuffer &R__b)
267 typedef ::genfit::MplTrackRep thisClass;
269 if (R__b.IsReading()) {
270 ::genfit::AbsTrackRep::Streamer(R__b);
271 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) { }
272 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
276 ::genfit::AbsTrackRep::Streamer(R__b);
277 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
278 R__b.SetByteCount(R__c, kTRUE);