30 if (nofHits >= MAX_NOF_HITS_IN_RING) {
31 cout <<
"-E- CbmRichRingFitterCOP::DoFit(), too many hits in the ring:"
40 float M0, Mx, My, Mz, Mxy, Mxx, Myy, Mxz, Myz, Mzz, Mxz2, Myz2, Cov_xy;
41 float A0, A1, A2, A22;
42 float epsilon = 0.00001;
43 float Dy, xnew, xold, ynew, yold = 10000000.;
49 for (
int i = 0;
i < nofHits;
i++) {
57 Mxx = Myy = Mxy = Mxz = Myz = Mzz = 0.;
59 for (
int i = 0;
i < nofHits;
i++) {
63 Zi = Xi * Xi + Yi * Yi;
81 Cov_xy = Mxx * Myy - Mxy * Mxy;
85 A2 = 4. * Cov_xy - 3. * Mz * Mz - Mzz;
86 A1 = Mzz * Mz + 4. * Cov_xy * Mz - Mxz2 - Myz2 - Mz * Mz * Mz;
87 A0 = Mxz2 * Myy + Myz2 * Mxx - Mzz * Cov_xy - 2. * Mxz * Myz * Mxy
95 for (iter = 0; iter < iterMax; iter++) {
96 ynew = A0 + xnew * (A1 + xnew * (A2 + 4. * xnew * xnew));
104 Dy = A1 + xnew * (A22 + 16. * xnew * xnew);
106 xnew = xold - ynew / Dy;
108 if (xnew == 0 ||
fabs((xnew - xold) / xnew) < epsilon) {
124 float GAM = -Mz - xnew - xnew;
125 float DET = xnew * xnew - xnew * Mz + Cov_xy;
127 centerX = (Mxz * (Myy - xnew) - Myz * Mxy) / DET / 2.;
128 centerY = (Myz * (Mxx - xnew) - Mxz * Mxy) / DET / 2.;
129 radius =
sqrt(centerX * centerX + centerY * centerY - GAM);