107 ring->
SetXYABP(-1., -1., -1., -1., -1.);
131 TMatrixD PQ(5,5,PQa);
148 TMatrixDEigen eig(PQ);
149 TMatrixD evc = eig.GetEigenVectors();
151 Double_t AlgParF = 0.;
152 AlgParF -= evc(0,0) *
fM[
GA05];
155 AlgParF -= evc(1,0) *
fM[
GA15];
158 AlgParF -= evc(2,0) *
fM[
GA25];
161 AlgParF -= evc(3,0) *
fM[
GA35];
164 AlgParF -= evc(4,0) *
fM[
GA45];
173 const unsigned int numHits = ring->
GetNofHits();
174 const unsigned int numHits2 = 2* numHits;
175 const unsigned int numHits3 = 3* numHits;
176 const unsigned int numHits4 = 4* numHits;
177 const unsigned int numHits5 = 5* numHits;
178 const unsigned int numHits6 = 6* numHits;
179 const double oneOverNumHits = 1./ numHits;
181 for(
unsigned int i = 0; i < numHits; i++){
186 fZ[i6+1] =
fZT[i+numHits] = x*
y;
187 fZ[i6+2] =
fZT[i+numHits2] = y*
y;
188 fZ[i6+3] =
fZT[i+numHits3] =
x;
189 fZ[i6+4] =
fZT[i+numHits4] =
y;
190 fZ[i6+5] =
fZT[i+numHits5] = 1.;
193 for (
int i = 0; i < numHits6;i++)
fM[i] = oneOverNumHits*
fM[i];
195 for (
int i = 0; i < 25; i++)
fP[i]=0.;
218 for (
int i = 0; i < 25; i++)
fQ[i]=0.;
240 CalcChi2(Pxx, Pxy, Pyy, Px, Py, P, ring);
241 ring->
SetABCDEF(Pxx, Pxy, Pyy, Px, Py, P);
244 double QQx, QQy, Qxx, Qyy, Qx, Qy, Q;
245 double cosa, sina, cca, ssa, sin2a;
247 if (fabs(Pxx - Pyy) > 0.1
e-10) {
248 alpha = atan(Pxy / (Pxx - Pyy));
257 sin2a = sin(2. * alpha);
258 Pxy = Pxy * sin2a / 2.;
259 Qx = Px * cosa + Py * sina;
260 Qy = -Px * sina + Py * cosa;
263 Qxx = 1. / (Pxx * cca + Pxy + Pyy * ssa);
264 Qyy = 1. / (Pxx * ssa - Pxy + Pyy * cca);
265 Q = -P + Qxx * QQx / 4. + Qyy * QQy / 4.;
269 double axisA = TMath::Sqrt(Q * Qxx);
270 double axisB = TMath::Sqrt(Q * Qyy);
271 double centerX = -xc * cosa / 2. + yc * sina / 2.;
272 double centerY = -xc * sina / 2. - yc * cosa / 2.;
274 ring->
SetXYABP(centerX, centerY, axisA, axisB, alpha);
325 const double det3_123_012 = fP[
GM10] * det2_23_12 - fP[
GM11] * det2_23_02
326 + fP[
GM12] * det2_23_01;
327 const double det3_123_013 = fP[
GM10] * det2_23_13 - fP[
GM11] * det2_23_03
328 + fP[
GM13] * det2_23_01;
329 const double det3_123_014 = fP[
GM10] * det2_23_14 - fP[
GM11] * det2_23_04
330 + fP[
GM14] * det2_23_01;
331 const double det3_123_023 = fP[
GM10] * det2_23_23 - fP[
GM12] * det2_23_03
332 + fP[
GM13] * det2_23_02;
333 const double det3_123_024 = fP[
GM10] * det2_23_24 - fP[
GM12] * det2_23_04
334 + fP[
GM14] * det2_23_02;
335 const double det3_123_034 = fP[
GM10] * det2_23_34 - fP[
GM13] * det2_23_04
336 + fP[
GM14] * det2_23_03;
337 const double det3_123_123 = fP[
GM11] * det2_23_23 - fP[
GM12] * det2_23_13
338 + fP[
GM13] * det2_23_12;
339 const double det3_123_124 = fP[
GM11] * det2_23_24 - fP[
GM12] * det2_23_14
340 + fP[
GM14] * det2_23_12;
341 const double det3_123_134 = fP[
GM11] * det2_23_34 - fP[
GM13] * det2_23_14
342 + fP[
GM14] * det2_23_13;
343 const double det3_123_234 = fP[
GM12] * det2_23_34 - fP[
GM13] * det2_23_24
344 + fP[
GM14] * det2_23_23;
345 const double det3_124_012 = fP[
GM10] * det2_24_12 - fP[
GM11] * det2_24_02
346 + fP[
GM12] * det2_24_01;
347 const double det3_124_013 = fP[
GM10] * det2_24_13 - fP[
GM11] * det2_24_03
348 + fP[
GM13] * det2_24_01;
349 const double det3_124_014 = fP[
GM10] * det2_24_14 - fP[
GM11] * det2_24_04
350 + fP[
GM14] * det2_24_01;
351 const double det3_124_023 = fP[
GM10] * det2_24_23 - fP[
GM12] * det2_24_03
352 + fP[
GM13] * det2_24_02;
353 const double det3_124_024 = fP[
GM10] * det2_24_24 - fP[
GM12] * det2_24_04
354 + fP[
GM14] * det2_24_02;
355 const double det3_124_034 = fP[
GM10] * det2_24_34 - fP[
GM13] * det2_24_04
356 + fP[
GM14] * det2_24_03;
357 const double det3_124_123 = fP[
GM11] * det2_24_23 - fP[
GM12] * det2_24_13
358 + fP[
GM13] * det2_24_12;
359 const double det3_124_124 = fP[
GM11] * det2_24_24 - fP[
GM12] * det2_24_14
360 + fP[
GM14] * det2_24_12;
361 const double det3_124_134 = fP[
GM11] * det2_24_34 - fP[
GM13] * det2_24_14
362 + fP[
GM14] * det2_24_13;
363 const double det3_124_234 = fP[
GM12] * det2_24_34 - fP[
GM13] * det2_24_24
364 + fP[
GM14] * det2_24_23;
365 const double det3_134_012 = fP[
GM10] * det2_34_12 - fP[
GM11] * det2_34_02
366 + fP[
GM12] * det2_34_01;
367 const double det3_134_013 = fP[
GM10] * det2_34_13 - fP[
GM11] * det2_34_03
368 + fP[
GM13] * det2_34_01;
369 const double det3_134_014 = fP[
GM10] * det2_34_14 - fP[
GM11] * det2_34_04
370 + fP[
GM14] * det2_34_01;
371 const double det3_134_023 = fP[
GM10] * det2_34_23 - fP[
GM12] * det2_34_03
372 + fP[
GM13] * det2_34_02;
373 const double det3_134_024 = fP[
GM10] * det2_34_24 - fP[
GM12] * det2_34_04
374 + fP[
GM14] * det2_34_02;
375 const double det3_134_034 = fP[
GM10] * det2_34_34 - fP[
GM13] * det2_34_04
376 + fP[
GM14] * det2_34_03;
377 const double det3_134_123 = fP[
GM11] * det2_34_23 - fP[
GM12] * det2_34_13
378 + fP[
GM13] * det2_34_12;
379 const double det3_134_124 = fP[
GM11] * det2_34_24 - fP[
GM12] * det2_34_14
380 + fP[
GM14] * det2_34_12;
381 const double det3_134_134 = fP[
GM11] * det2_34_34 - fP[
GM13] * det2_34_14
382 + fP[
GM14] * det2_34_13;
383 const double det3_134_234 = fP[
GM12] * det2_34_34 - fP[
GM13] * det2_34_24
384 + fP[
GM14] * det2_34_23;
385 const double det3_234_012 = fP[
GM20] * det2_34_12 - fP[
GM21] * det2_34_02
386 + fP[
GM22] * det2_34_01;
387 const double det3_234_013 = fP[
GM20] * det2_34_13 - fP[
GM21] * det2_34_03
388 + fP[
GM23] * det2_34_01;
389 const double det3_234_014 = fP[
GM20] * det2_34_14 - fP[
GM21] * det2_34_04
390 + fP[
GM24] * det2_34_01;
391 const double det3_234_023 = fP[
GM20] * det2_34_23 - fP[
GM22] * det2_34_03
392 + fP[
GM23] * det2_34_02;
393 const double det3_234_024 = fP[
GM20] * det2_34_24 - fP[
GM22] * det2_34_04
394 + fP[
GM24] * det2_34_02;
395 const double det3_234_034 = fP[
GM20] * det2_34_34 - fP[
GM23] * det2_34_04
396 + fP[
GM24] * det2_34_03;
397 const double det3_234_123 = fP[
GM21] * det2_34_23 - fP[
GM22] * det2_34_13
398 + fP[
GM23] * det2_34_12;
399 const double det3_234_124 = fP[
GM21] * det2_34_24 - fP[
GM22] * det2_34_14
400 + fP[
GM24] * det2_34_12;
401 const double det3_234_134 = fP[
GM21] * det2_34_34 - fP[
GM23] * det2_34_14
402 + fP[
GM24] * det2_34_13;
403 const double det3_234_234 = fP[
GM22] * det2_34_34 - fP[
GM23] * det2_34_24
404 + fP[
GM24] * det2_34_23;
407 const double det4_0123_0123 = fP[
GM00] * det3_123_123 - fP[
GM01]
408 * det3_123_023 + fP[
GM02] * det3_123_013 - fP[
GM03] * det3_123_012;
409 const double det4_0123_0124 = fP[
GM00] * det3_123_124 - fP[
GM01]
410 * det3_123_024 + fP[
GM02] * det3_123_014 - fP[
GM04] * det3_123_012;
411 const double det4_0123_0134 = fP[
GM00] * det3_123_134 - fP[
GM01]
412 * det3_123_034 + fP[
GM03] * det3_123_014 - fP[
GM04] * det3_123_013;
413 const double det4_0123_0234 = fP[
GM00] * det3_123_234 - fP[
GM02]
414 * det3_123_034 + fP[
GM03] * det3_123_024 - fP[
GM04] * det3_123_023;
415 const double det4_0123_1234 = fP[
GM01] * det3_123_234 - fP[
GM02]
416 * det3_123_134 + fP[
GM03] * det3_123_124 - fP[
GM04] * det3_123_123;
417 const double det4_0124_0123 = fP[
GM00] * det3_124_123 - fP[
GM01]
418 * det3_124_023 + fP[
GM02] * det3_124_013 - fP[
GM03] * det3_124_012;
419 const double det4_0124_0124 = fP[
GM00] * det3_124_124 - fP[
GM01]
420 * det3_124_024 + fP[
GM02] * det3_124_014 - fP[
GM04] * det3_124_012;
421 const double det4_0124_0134 = fP[
GM00] * det3_124_134 - fP[
GM01]
422 * det3_124_034 + fP[
GM03] * det3_124_014 - fP[
GM04] * det3_124_013;
423 const double det4_0124_0234 = fP[
GM00] * det3_124_234 - fP[
GM02]
424 * det3_124_034 + fP[
GM03] * det3_124_024 - fP[
GM04] * det3_124_023;
425 const double det4_0124_1234 = fP[
GM01] * det3_124_234 - fP[
GM02]
426 * det3_124_134 + fP[
GM03] * det3_124_124 - fP[
GM04] * det3_124_123;
427 const double det4_0134_0123 = fP[
GM00] * det3_134_123 - fP[
GM01]
428 * det3_134_023 + fP[
GM02] * det3_134_013 - fP[
GM03] * det3_134_012;
429 const double det4_0134_0124 = fP[
GM00] * det3_134_124 - fP[
GM01]
430 * det3_134_024 + fP[
GM02] * det3_134_014 - fP[
GM04] * det3_134_012;
431 const double det4_0134_0134 = fP[
GM00] * det3_134_134 - fP[
GM01]
432 * det3_134_034 + fP[
GM03] * det3_134_014 - fP[
GM04] * det3_134_013;
433 const double det4_0134_0234 = fP[
GM00] * det3_134_234 - fP[
GM02]
434 * det3_134_034 + fP[
GM03] * det3_134_024 - fP[
GM04] * det3_134_023;
435 const double det4_0134_1234 = fP[
GM01] * det3_134_234 - fP[
GM02]
436 * det3_134_134 + fP[
GM03] * det3_134_124 - fP[
GM04] * det3_134_123;
437 const double det4_0234_0123 = fP[
GM00] * det3_234_123 - fP[
GM01]
438 * det3_234_023 + fP[
GM02] * det3_234_013 - fP[
GM03] * det3_234_012;
439 const double det4_0234_0124 = fP[
GM00] * det3_234_124 - fP[
GM01]
440 * det3_234_024 + fP[
GM02] * det3_234_014 - fP[
GM04] * det3_234_012;
441 const double det4_0234_0134 = fP[
GM00] * det3_234_134 - fP[
GM01]
442 * det3_234_034 + fP[
GM03] * det3_234_014 - fP[
GM04] * det3_234_013;
443 const double det4_0234_0234 = fP[
GM00] * det3_234_234 - fP[
GM02]
444 * det3_234_034 + fP[
GM03] * det3_234_024 - fP[
GM04] * det3_234_023;
445 const double det4_0234_1234 = fP[
GM01] * det3_234_234 - fP[
GM02]
446 * det3_234_134 + fP[
GM03] * det3_234_124 - fP[
GM04] * det3_234_123;
447 const double det4_1234_0123 = fP[
GM10] * det3_234_123 - fP[
GM11]
448 * det3_234_023 + fP[
GM12] * det3_234_013 - fP[
GM13] * det3_234_012;
449 const double det4_1234_0124 = fP[
GM10] * det3_234_124 - fP[
GM11]
450 * det3_234_024 + fP[
GM12] * det3_234_014 - fP[
GM14] * det3_234_012;
451 const double det4_1234_0134 = fP[
GM10] * det3_234_134 - fP[
GM11]
452 * det3_234_034 + fP[
GM13] * det3_234_014 - fP[
GM14] * det3_234_013;
453 const double det4_1234_0234 = fP[
GM10] * det3_234_234 - fP[
GM12]
454 * det3_234_034 + fP[
GM13] * det3_234_024 - fP[
GM14] * det3_234_023;
455 const double det4_1234_1234 = fP[
GM11] * det3_234_234 - fP[
GM12]
456 * det3_234_134 + fP[
GM13] * det3_234_124 - fP[
GM14] * det3_234_123;
459 const double det = fP[
GM00] * det4_1234_1234 - fP[
GM01] * det4_1234_0234
460 + fP[
GM02] * det4_1234_0134 - fP[
GM03] * det4_1234_0124 + fP[
GM04]
469 const double oneOverDet = 1.0 / det;
470 const double mn1OverDet = -oneOverDet;
472 fP[
GM00] = det4_1234_1234 * oneOverDet;
473 fP[
GM01] = det4_0234_1234 * mn1OverDet;
474 fP[
GM02] = det4_0134_1234 * oneOverDet;
475 fP[
GM03] = det4_0124_1234 * mn1OverDet;
476 fP[
GM04] = det4_0123_1234 * oneOverDet;
478 fP[
GM10] = det4_1234_0234 * mn1OverDet;
479 fP[
GM11] = det4_0234_0234 * oneOverDet;
480 fP[
GM12] = det4_0134_0234 * mn1OverDet;
481 fP[
GM13] = det4_0124_0234 * oneOverDet;
482 fP[
GM14] = det4_0123_0234 * mn1OverDet;
484 fP[
GM20] = det4_1234_0134 * oneOverDet;
485 fP[
GM21] = det4_0234_0134 * mn1OverDet;
486 fP[
GM22] = det4_0134_0134 * oneOverDet;
487 fP[
GM23] = det4_0124_0134 * mn1OverDet;
488 fP[
GM24] = det4_0123_0134 * oneOverDet;
490 fP[
GM30] = det4_1234_0124 * mn1OverDet;
491 fP[
GM31] = det4_0234_0124 * oneOverDet;
492 fP[
GM32] = det4_0134_0124 * mn1OverDet;
493 fP[
GM33] = det4_0124_0124 * oneOverDet;
494 fP[
GM34] = det4_0123_0124 * mn1OverDet;
496 fP[
GM40] = det4_1234_0123 * oneOverDet;
497 fP[
GM41] = det4_0234_0123 * mn1OverDet;
498 fP[
GM42] = det4_0134_0123 * oneOverDet;
499 fP[
GM43] = det4_0124_0123 * mn1OverDet;
500 fP[
GM44] = det4_0123_0123 * oneOverDet;
504 const double *
const ap,
507 const double *
const bp,
514 const double *arp0 = ap;
515 while (arp0 < ap+na) {
516 for (
const double *bcp = bp; bcp < bp+ncolsb; ) {
517 const double *arp = arp0;
519 while (bcp < bp+nb) {
520 cij += *arp++ * *bcp;
530 #define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);a[k][l]=h+s*(g-h*tau)
540 unsigned int ip, iq, i,j;
541 for (ip = 0; ip < 5; ip++) {
542 for (iq = 0; iq < 5; iq++)
547 for (ip = 0; ip < 5; ip++) {
556 for (sm = 0., ip = 0; ip < 5; ip++)
557 for (iq = ip + 1; iq < 5; iq++)
558 sm += fabs(a[ip][iq]);
563 tresh = (i < 4 ? 0.2 * sm / (5 * 5) : 0.);
565 for (ip = 0; ip < 4; ip++)
566 for (iq = ip + 1; iq < 5; iq++) {
568 g = 100. * fabs(a[ip][iq]);
569 if (i > 4 && (
float) fabs(d[ip] + g) == (
float) fabs(d[ip])
570 && (
float) fabs(d[iq] + g) == (
float) fabs(d[iq]))
573 else if (fabs(a[ip][iq]) > tresh) {
576 if ((
float) (fabs(h) + g) == (
float) fabs(h))
579 theta = 0.5 * h / a[
ip][iq];
580 t = 1. / (fabs(theta) + sqrt(1. + theta * theta));
584 c = 1. / sqrt(1 + t * t);
593 for (j = 0; j <
ip; j++) {
596 for (j = ip + 1; j < iq; j++) {
599 for (j = iq + 1; j < 5; j++) {
602 for (j = 0; j < 5; j++) {
608 for (ip = 0; ip < 5; ip++) {
622 for (i = 0; i < 5; i++) {
624 for (j = i + 1; j < 5; j++)
630 for (j = 0; j < 5; j++) {