37 cout <<
"-E- CbmRichRingFitterCOP::DoFit(), too many hits in the ring:" << nofHits << endl;
45 float M0, Mx, My, Mz, Mxy, Mxx, Myy, Mxz, Myz, Mzz, Mxz2, Myz2, Cov_xy;
46 float A0, A1, A2, A22;
47 float epsilon = 0.00001;
48 float Dy, xnew, xold, ynew, yold = 10000000.;
54 for (
int i = 0; i < nofHits; i++) {
62 Mxx = Myy = Mxy = Mxz = Myz = Mzz = 0.;
64 for (
int i = 0; i < nofHits; i++) {
68 Zi = Xi * Xi + Yi * Yi;
86 Cov_xy = Mxx * Myy - Mxy * Mxy;
90 A2 = 4. * Cov_xy - 3. * Mz * Mz - Mzz;
91 A1 = Mzz * Mz + 4. * Cov_xy * Mz - Mxz2 - Myz2 - Mz * Mz * Mz;
92 A0 = Mxz2 * Myy + Myz2 * Mxx - Mzz * Cov_xy - 2. * Mxz * Myz * Mxy + Mz * Mz * Cov_xy;
99 for (iter = 0; iter < iterMax; iter++) {
100 ynew = A0 + xnew * (A1 + xnew * (A2 + 4. * xnew * xnew));
102 if (fabs(ynew) > fabs(yold)) {
108 Dy = A1 + xnew * (A22 + 16. * xnew * xnew);
110 xnew = xold - ynew / Dy;
112 if (xnew == 0 || fabs((xnew - xold) / xnew) < epsilon) {
128 float GAM = -Mz - xnew - xnew;
129 float DET = xnew * xnew - xnew * Mz + Cov_xy;
131 centerX = (Mxz * (Myy - xnew) - Myz * Mxy) / DET / 2.;
132 centerY = (Myz * (Mxx - xnew) - Mxz * Mxy) / DET / 2.;
133 radius =
sqrt(centerX * centerX + centerY * centerY - GAM);