30 return Update(parOut, hit, chiSq);
67 / ((cIn[0] + dxx) * ((cIn[6] + dyy) * (cIn[20] + dtt) - cIn[10] * cIn[10])
68 - (cIn[1] + dxy) * ((cIn[1] + dxy) * (cIn[20] + dtt) - cIn[5] * cIn[10])
69 + cIn[5] * ((cIn[1] + dxy) * cIn[10] - (cIn[6] + dyy) * cIn[5]));
73 litfloat R00 = ((cIn[6] + dyy) * (cIn[20] + dtt) - cIn[10] * cIn[10]) * t;
74 litfloat R01 = (cIn[5] * cIn[10] - (cIn[1] + dxy) * (cIn[20] + dtt)) * t;
75 litfloat R02 = ((cIn[1] + dxy) * cIn[10] - (cIn[6] + dyy) * cIn[5]) * t;
76 litfloat R11 = ((cIn[0] + dxx) * (cIn[20] + dtt) - cIn[5] * cIn[5]) * t;
77 litfloat R12 = ((cIn[1] + dxy) * cIn[5] - (cIn[0] + dxx) * cIn[10]) * t;
79 ((cIn[0] + dxx) * (cIn[6] + dyy) - (cIn[1] + dxy) * (cIn[1] + dxy)) * t;
101 litfloat K00 = cIn[0] * R00 + cIn[1] * R01 + cIn[5] * R02;
102 litfloat K01 = cIn[0] * R01 + cIn[1] * R11 + cIn[5] * R12;
103 litfloat K02 = cIn[0] * R02 + cIn[1] * R12 + cIn[5] * R22;
104 litfloat K10 = cIn[1] * R00 + cIn[6] * R01 + cIn[10] * R02;
105 litfloat K11 = cIn[1] * R01 + cIn[6] * R11 + cIn[10] * R12;
106 litfloat K12 = cIn[1] * R02 + cIn[6] * R12 + cIn[10] * R22;
107 litfloat K20 = cIn[2] * R00 + cIn[7] * R01 + cIn[14] * R02;
108 litfloat K21 = cIn[2] * R01 + cIn[7] * R11 + cIn[14] * R12;
109 litfloat K22 = cIn[2] * R02 + cIn[7] * R12 + cIn[14] * R22;
110 litfloat K30 = cIn[3] * R00 + cIn[8] * R01 + cIn[17] * R02;
111 litfloat K31 = cIn[3] * R01 + cIn[8] * R11 + cIn[17] * R12;
112 litfloat K32 = cIn[3] * R02 + cIn[8] * R12 + cIn[17] * R22;
113 litfloat K40 = cIn[4] * R00 + cIn[9] * R01 + cIn[19] * R02;
114 litfloat K41 = cIn[4] * R01 + cIn[9] * R11 + cIn[19] * R12;
115 litfloat K42 = cIn[4] * R02 + cIn[9] * R12 + cIn[19] * R22;
116 litfloat K50 = cIn[5] * R00 + cIn[10] * R01 + cIn[20] * R02;
117 litfloat K51 = cIn[5] * R01 + cIn[10] * R11 + cIn[20] * R12;
118 litfloat K52 = cIn[5] * R02 + cIn[10] * R12 + cIn[20] * R22;
127 xOut[0] += K00 * dx + K01 * dy + K02 * dt;
128 xOut[1] += K10 * dx + K11 * dy + K12 * dt;
129 xOut[2] += K20 * dx + K21 * dy + K22 * dt;
130 xOut[3] += K30 * dx + K31 * dy + K32 * dt;
131 xOut[4] += K40 * dx + K41 * dy + K42 * dt;
132 xOut[5] += K50 * dx + K51 * dy + K52 * dt;
135 std::vector<litfloat> cOut = cIn;
137 cOut[0] -= K00 * cIn[0] + K01 * cIn[1] + K02 * cIn[5];
138 cOut[1] -= K00 * cIn[1] + K01 * cIn[6] + K02 * cIn[10];
139 cOut[2] -= K00 * cIn[2] + K01 * cIn[7] + K02 * cIn[14];
140 cOut[3] -= K00 * cIn[3] + K01 * cIn[8] + K02 * cIn[17];
141 cOut[4] -= K00 * cIn[4] + K01 * cIn[9] + K02 * cIn[19];
142 cOut[5] -= K00 * cIn[5] + K01 * cIn[10] + K02 * cIn[20];
144 cOut[6] -= K10 * cIn[1] + K11 * cIn[6] + K12 * cIn[10];
145 cOut[7] -= K10 * cIn[2] + K11 * cIn[7] + K12 * cIn[14];
146 cOut[8] -= K10 * cIn[3] + K11 * cIn[8] + K12 * cIn[17];
147 cOut[9] -= K10 * cIn[4] + K11 * cIn[9] + K12 * cIn[19];
148 cOut[10] -= K10 * cIn[5] + K11 * cIn[10] + K12 * cIn[20];
150 cOut[11] -= K20 * cIn[2] + K21 * cIn[7] + K22 * cIn[14];
151 cOut[12] -= K20 * cIn[3] + K21 * cIn[8] + K22 * cIn[17];
152 cOut[13] -= K20 * cIn[4] + K21 * cIn[9] + K22 * cIn[19];
153 cOut[14] -= K20 * cIn[5] + K21 * cIn[10] + K22 * cIn[20];
155 cOut[15] -= K30 * cIn[3] + K31 * cIn[8] + K32 * cIn[17];
156 cOut[16] -= K30 * cIn[4] + K31 * cIn[9] + K32 * cIn[19];
157 cOut[17] -= K30 * cIn[5] + K31 * cIn[10] + K32 * cIn[20];
159 cOut[18] -= K40 * cIn[4] + K41 * cIn[9] + K42 * cIn[19];
160 cOut[19] -= K40 * cIn[5] + K41 * cIn[10] + K42 * cIn[20];
162 cOut[20] -= K50 * cIn[5] + K51 * cIn[10] + K52 * cIn[20];
188 (dxx - cOut[0]) * ((dyy - cOut[6]) * (dtt - cOut[20]) - cOut[10] * cOut[10])
190 * (cOut[5] * cOut[10] - (dxy - cOut[1]) * (dtt - cOut[20]))
191 + cOut[5] * ((dxy - cOut[1]) * cOut[10] - (dyy - cOut[6]) * cOut[5]);
193 if (norm == 0.) { norm = 1e-10; }
197 ((dyy - cOut[6]) * (dtt - cOut[20]) - cOut[10] * cOut[10]) / norm;
199 ((dxy - cOut[1]) * (dtt - cOut[20]) - cOut[5] * cOut[10]) / norm;
201 ((dxy - cOut[1]) * cOut[10] - (dyy - cOut[6]) * cOut[5]) / norm;
203 ((dxx - cOut[0]) * (dtt - cOut[20]) - cOut[5] * cOut[5]) / norm;
205 ((dxx - cOut[0]) * cOut[10] - (dxy - cOut[1]) * cOut[5]) / norm;
207 ((dxx - cOut[0]) * (dyy - cOut[6]) - (dxy - cOut[1]) * (dxy - cOut[1]))
228 chiSq = xmx * (xmx * M00 + ymy * M01 + tmt * M02)
229 + ymy * (xmx * M01 + ymy * M11 + tmt * M12)
230 + tmt * (xmx * M02 + ymy * M12 + tmt * M22);
251 std::vector<litfloat> C1 = cInInv;
252 litfloat det = dxx * dyy - dxy * dxy;
259 std::vector<litfloat> t(5);
260 t[0] = cInInv[0] * par->
GetX() + cInInv[1] * par->
GetY()
261 + cInInv[2] * par->
GetTx() + cInInv[3] * par->
GetTy()
262 + cInInv[4] * par->
GetQp()
263 + (dyy * hit->
GetX() - dxy * hit->
GetY()) / det;
264 t[1] = cInInv[1] * par->
GetX() + cInInv[5] * par->
GetY()
265 + cInInv[6] * par->
GetTx() + cInInv[7] * par->
GetTy()
266 + cInInv[8] * par->
GetQp()
267 + (-dxy * hit->
GetX() + dxx * hit->
GetY()) / det;
268 t[2] = cInInv[2] * par->
GetX() + cInInv[6] * par->
GetY()
269 + cInInv[9] * par->
GetTx() + cInInv[10] * par->
GetTy()
270 + cInInv[11] * par->
GetQp();
271 t[3] = cInInv[3] * par->
GetX() + cInInv[7] * par->
GetY()
272 + cInInv[10] * par->
GetTx() + cInInv[12] * par->
GetTy()
273 + cInInv[13] * par->
GetQp();
274 t[4] = cInInv[4] * par->
GetX() + cInInv[8] * par->
GetY()
275 + cInInv[11] * par->
GetTx() + cInInv[13] * par->
GetTy()
276 + cInInv[14] * par->
GetQp();
278 std::vector<litfloat> xOut(5);
297 chiSq = ((xmx * dyy - ymy * dxy) * xmx + (-xmx * dxy + ymy * dxx) * ymy) / det
298 + (dx0 * cInInv[0] + dx1 * cInInv[1] + dx2 * cInInv[2]
299 + dx3 * cInInv[3] + dx4 * cInInv[4])
301 + (dx0 * cInInv[1] + dx1 * cInInv[5] + dx2 * cInInv[6]
302 + dx3 * cInInv[7] + dx4 * cInInv[8])
304 + (dx0 * cInInv[2] + dx1 * cInInv[6] + dx2 * cInInv[9]
305 + dx3 * cInInv[10] + dx4 * cInInv[11])
307 + (dx0 * cInInv[3] + dx1 * cInInv[7] + dx2 * cInInv[10]
308 + dx3 * cInInv[12] + dx4 * cInInv[13])
310 + (dx0 * cInInv[4] + dx1 * cInInv[8] + dx2 * cInInv[11]
311 + dx3 * cInInv[13] + dx4 * cInInv[14])
328 litfloat phiCosSq = phiCos * phiCos;
329 litfloat phiSinSq = phiSin * phiSin;
330 litfloat phi2SinCos = 2 * phiCos * phiSin;
334 1. / (duu + cIn[0] * phiCosSq + phi2SinCos * cIn[1] + cIn[5] * phiSinSq);
337 litfloat K0 = cIn[0] * phiCos + cIn[1] * phiSin;
338 litfloat K1 = cIn[1] * phiCos + cIn[5] * phiSin;
339 litfloat K2 = cIn[2] * phiCos + cIn[6] * phiSin;
340 litfloat K3 = cIn[3] * phiCos + cIn[7] * phiSin;
341 litfloat K4 = cIn[4] * phiCos + cIn[8] * phiSin;
350 litfloat r = u - xIn[0] * phiCos - xIn[1] * phiSin;
353 std::vector<litfloat> xOut(5);
354 xOut[0] = xIn[0] + KR0 * r;
355 xOut[1] = xIn[1] + KR1 * r;
356 xOut[2] = xIn[2] + KR2 * r;
357 xOut[3] = xIn[3] + KR3 * r;
358 xOut[4] = xIn[4] + KR4 * r;
361 std::vector<litfloat> cOut(15);
362 cOut[0] = cIn[0] - KR0 * K0;
363 cOut[1] = cIn[1] - KR0 * K1;
364 cOut[2] = cIn[2] - KR0 * K2;
365 cOut[3] = cIn[3] - KR0 * K3;
366 cOut[4] = cIn[4] - KR0 * K4;
368 cOut[5] = cIn[5] - KR1 * K1;
369 cOut[6] = cIn[6] - KR1 * K2;
370 cOut[7] = cIn[7] - KR1 * K3;
371 cOut[8] = cIn[8] - KR1 * K4;
373 cOut[9] = cIn[9] - KR2 * K2;
374 cOut[10] = cIn[10] - KR2 * K3;
375 cOut[11] = cIn[11] - KR2 * K4;
377 cOut[12] = cIn[12] - KR3 * K3;
378 cOut[13] = cIn[13] - KR3 * K4;
380 cOut[14] = cIn[14] - KR4 * K4;
391 litfloat ru = u - xOut[0] * phiCos - xOut[1] * phiSin;
396 / (duu - phiCosSq * cOut[0] - phi2SinCos * cOut[1] - phiSinSq * cOut[5]);
417 std::vector<litfloat> C1 = cInInv;
418 C1[0] += phiCos * phiCos / duu;
419 C1[1] += phiCos * phiSin / duu;
420 C1[5] += phiSin * phiSin / duu;
424 std::vector<litfloat> t(5);
425 t[0] = cInInv[0] * par->
GetX() + cInInv[1] * par->
GetY()
426 + cInInv[2] * par->
GetTx() + cInInv[3] * par->
GetTy()
427 + cInInv[4] * par->
GetQp() + phiCos * hit->
GetU() / duu;
428 t[1] = cInInv[1] * par->
GetX() + cInInv[5] * par->
GetY()
429 + cInInv[6] * par->
GetTx() + cInInv[7] * par->
GetTy()
430 + cInInv[8] * par->
GetQp() + phiSin * hit->
GetU() / duu;
431 t[2] = cInInv[2] * par->
GetX() + cInInv[6] * par->
GetY()
432 + cInInv[9] * par->
GetTx() + cInInv[10] * par->
GetTy()
433 + cInInv[11] * par->
GetQp();
434 t[3] = cInInv[3] * par->
GetX() + cInInv[7] * par->
GetY()
435 + cInInv[10] * par->
GetTx() + cInInv[12] * par->
GetTy()
436 + cInInv[13] * par->
GetQp();
437 t[4] = cInInv[4] * par->
GetX() + cInInv[8] * par->
GetY()
438 + cInInv[11] * par->
GetTx() + cInInv[13] * par->
GetTy()
439 + cInInv[14] * par->
GetQp();
441 std::vector<litfloat> xOut(5);
453 litfloat zeta = hit->
GetU() - phiCos * xOut[0] - phiSin * xOut[1];
459 chiSq = zeta * zeta / duu
460 + (dx0 * cInInv[0] + dx1 * cInInv[1] + dx2 * cInInv[2]
461 + dx3 * cInInv[3] + dx4 * cInInv[4])
463 + (dx0 * cInInv[1] + dx1 * cInInv[5] + dx2 * cInInv[6]
464 + dx3 * cInInv[7] + dx4 * cInInv[8])
466 + (dx0 * cInInv[2] + dx1 * cInInv[6] + dx2 * cInInv[9]
467 + dx3 * cInInv[10] + dx4 * cInInv[11])
469 + (dx0 * cInInv[3] + dx1 * cInInv[7] + dx2 * cInInv[10]
470 + dx3 * cInInv[12] + dx4 * cInInv[13])
472 + (dx0 * cInInv[4] + dx1 * cInInv[8] + dx2 * cInInv[11]
473 + dx3 * cInInv[13] + dx4 * cInInv[14])