00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "StFastCircleFitter.hh"
00021 #include <Stiostream.h>
00022 #include <cstdlib>
00023
00024 int main()
00025 {
00026 cout << "This program tests the StFastCircleFitter class" << endl;
00027 cout << "-----------------------------------------------" << endl;
00028
00029 StFastCircleFitter fitter;
00030
00031 const unsigned int nPoints = 42;
00032 const double x0 = 10.23;
00033 const double y0 = 0.018;
00034 const double r = 19.91;
00035 double phi;
00036 int i;
00037
00038 cout << "Input: x0 = " << x0 << endl;
00039 cout << " y0 = " << y0 << endl;
00040 cout << " r = " << r << endl;
00041 cout << " n = " << nPoints << endl;
00042
00043 for (i=0; i<nPoints; i++) {
00044 phi = drand48();
00045 fitter.addPoint(r*cos(phi)+x0, r*sin(phi)+y0);
00046 }
00047
00048 fitter.fit();
00049 cout << "Fit 1: x0 = " << fitter.xcenter() << endl;
00050 cout << " y0 = " << fitter.ycenter() << endl;
00051 cout << " r = " << fitter.radius() << endl;
00052 cout << " n = " << fitter.numberOfPoints() << endl;
00053
00054 fitter.clear();
00055
00056 for (i=0; i<nPoints; i++) {
00057 phi = drand48();
00058 fitter.addPoint(r*cos(phi)+x0, r*sin(phi)+y0);
00059 }
00060
00061 fitter.fit();
00062 cout << "Fit 2: x0 = " << fitter.xcenter() << endl;
00063 cout << " y0 = " << fitter.ycenter() << endl;
00064 cout << " r = " << fitter.radius() << endl;
00065 cout << " n = " << fitter.numberOfPoints() << endl;
00066
00067 cout << "done\n" << endl;
00068 return 0;
00069 }