OUTPUT: double mXCenter, mYCenter, mFitRadius, mChi2Rad,mIterRad; bool HelixUtil::CircleFit(double x[],double y[], double wei[], int num){ ////////////////////////////////////////////////////////////////// // Circle fitting program // // This function will fit a circle to the points in the matrix x and y. // 'num' is the number of points in x and y // 'xc' is the found center in x // 'yc' is the found center in y // 'R' is the radius of the fitted circle // 'chi2' error in fit // // Written by Mike Heffner Sept 21 1998 // error calculation added Oct 3 1998, Mike Heffner // fit with point errors added May 1999 Holm Huemmler // Jan Balewski, January 2007 // - fix chi2 formula, // - relace weights in x & y by common weigth, were merged anyhow // - returns false only if # of points<4 // // Fitting algorithm by: N.Chernov,G.Ososkov, Computer Physics // Communications 33(1984) 329-333 //////////////////////////////////////////////////////////////////
example of one track (units=cm) & fit result IN: 0 -23.50 -23.17 IN: 1 -32.86 -32.47 IN: 2 -42.26 -41.75 IN: 3 -51.77 -50.89 IN: 4 -61.34 -59.99 IN: 5 -70.87 -69.13 IN: 6 -80.30 -78.37 IN: 7 -89.79 -87.53 IN: 8 -99.32 -96.67 IN: 9 -108.91 -105.74 IN Center xc=-4649.85 yc=4683.0 phi0/rad=2.352547 Fit: R=9207.21 xc=-6462.11 yc=6558.29 chi2dof=0.64692 nIter=2 len/cm=118.8 DEL: R=2607.21 xc=-1812.26 yc=1874.39Few distributions for 1000 tracks