00001 /*************************************************************************** 00002 * 00003 * $Id: StFastCircleFitter.hh,v 1.1 1999/12/21 16:28:50 ullrich Exp $ 00004 * 00005 * Author: Thomas Ullrich, Dec 1999 00006 *************************************************************************** 00007 * 00008 * Description: 00009 * 00010 * Fast fitting routine using a iterational linear regression 00011 * method (ILRM). Reference: N.Chernov, G.A.Ososkov, Computer 00012 * Physics Communication 33 (1984) 329-333. 00013 * 00014 * Return codes: 0 fit ok 00015 * 1-4 error occured, no results 00016 * 00017 * StFastCircleFitter::fit() returns true only if rc = 0 00018 * 00019 *************************************************************************** 00020 * 00021 * $Log: StFastCircleFitter.hh,v $ 00022 * Revision 1.1 1999/12/21 16:28:50 ullrich 00023 * Initial Revision 00024 * 00025 **************************************************************************/ 00026 #ifndef ST_FAST_CIRCLE_FITTER_HH 00027 #define ST_FAST_CIRCLE_FITTER_HH 00028 00029 #include <vector> 00030 #if !defined(ST_NO_NAMESPACES) 00031 using std::vector; 00032 #endif 00033 00034 class StFastCircleFitter { 00035 public: 00036 StFastCircleFitter(); 00037 ~StFastCircleFitter(); 00038 00039 bool fit(); 00040 void clear(); // full reset 00041 00042 void addPoint(double x, double y); 00043 00044 double radius() const; // returns fitted radius 00045 double xcenter() const; // returns x of fitted center 00046 double ycenter() const; // returns y of fitted center 00047 double variance() const; // variance estimate 00048 int rc() const; // return code of fit 00049 unsigned int numberOfPoints() const; 00050 00051 private: 00052 #if defined(ST_NO_TEMPLATE_DEF_ARGS) 00053 vector<double, allocator<double> > mX; // x-coordinates of points 00054 vector<double, allocator<double> > mY; // y-coordinates of points 00055 #else 00056 vector<double> mX; // x-coordinates of points 00057 vector<double> mY; // y-coordinates of points 00058 #endif 00059 double mRadius; 00060 double mXCenter; 00061 double mYCenter; 00062 double mVariance; // the estimate of variance 00063 int mRC; 00064 }; 00065 00066 #endif
1.5.9