8 #include "CbmRichRingLight.h"
42 if (nofHits >= MAX_NOF_HITS_IN_RING) {
43 cout <<
"-E- CbmRichRingFitterCOP::DoFit(), too many hits in the ring:" << nofHits <<endl;
51 float M0, Mx, My, Mz, Mxy, Mxx, Myy, Mxz, Myz, Mzz, Mxz2, Myz2, Cov_xy;
52 float A0, A1,
A2, A22;
54 float Dy, xnew, xold, ynew, yold = 10000000.;
60 for (
int i = 0; i < nofHits; i++) {
68 Mxx = Myy = Mxy = Mxz = Myz = Mzz = 0.;
70 for (
int i = 0; i < nofHits; i++) {
74 Zi = Xi * Xi + Yi * Yi;
92 Cov_xy = Mxx * Myy - Mxy * Mxy;
96 A2 = 4. * Cov_xy - 3. * Mz * Mz - Mzz;
97 A1 = Mzz * Mz + 4. * Cov_xy * Mz - Mxz2 - Myz2 - Mz * Mz * Mz;
98 A0 = Mxz2 * Myy + Myz2 * Mxx - Mzz * Cov_xy - 2. * Mxz * Myz * Mxy + Mz
106 for (iter = 0; iter < iterMax; iter++) {
107 ynew = A0 + xnew * (A1 + xnew * (A2 + 4. * xnew * xnew));
109 if (fabs(ynew) > fabs(yold)) {
115 Dy = A1 + xnew * (A22 + 16. * xnew * xnew);
117 xnew = xold - ynew /
Dy;
119 if (xnew == 0 || fabs((xnew - xold) / xnew) <
epsilon){
135 float GAM = -Mz - xnew - xnew;
136 float DET = xnew * xnew - xnew * Mz + Cov_xy;
138 centerX = (Mxz * (Myy - xnew) - Myz * Mxy) / DET / 2.;
139 centerY = (Myz * (Mxx - xnew) - Mxz * Mxy) / DET / 2.;
140 radius = sqrt(centerX * centerX + centerY * centerY - GAM);