Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LocalFit.h

Go to the documentation of this file.
00001 #ifndef ANP_LOCALFIT_H
00002 #define ANP_LOCALFIT_H
00003 
00004 // $Id: LocalFit.h,v 1.1 2007/11/30 16:03:57 rustem Exp $
00005 //
00006 // Implementation of robust locally weighted regression algorithm:
00007 // Cleveland, W.S., 1979, Journal of the American Statistical Association, 74, 829
00008 //
00009 
00010 // C++
00011 #include <list>
00012 #include <map>
00013 #include <string>
00014 #include <vector>
00015 
00016 // ROOT
00017 #include "Rtypes.h"
00018 
00019 // Local
00020 #include "PhysicsNtuple/Handle.h"
00021 
00022 // Local
00023 #include "FitPoint.h"
00024 
00025 class Registry;
00026 
00027 namespace Anp
00028 {
00029    class LocalFit: virtual public Base
00030    {
00031    public:
00032       
00033       LocalFit();
00034       virtual ~LocalFit();
00035       
00036       bool Add(int index, double x_, double y_);
00037       
00038       bool RunFit();
00039       
00040       void Clear();
00041       
00042       void Config(const Registry &reg);
00043       
00044       const std::vector<Anp::FitPoint>& GetFit() const;
00045       
00046       double FitY(double x) const;
00047 
00048       void SetWindow(int value);
00049       void SetIter(int value);
00050       void SetDegree(int value);
00051 
00052       unsigned int Window() const;
00053       unsigned int Iter() const;
00054       unsigned int Degree() const;
00055       
00056       void Print(std::ostream &os = std::cout) const;
00057 
00058    private:
00059       
00060       typedef std::list<std::pair<unsigned int,double> > List;
00061       
00062    private:
00063       
00064       bool RunLFit(FitPoint &point, const std::vector<FitPoint> &fvec) const;
00065       bool RunQFit(FitPoint &point, const std::vector<FitPoint> &fvec) const;
00066       
00067       bool SortCleanCheck(std::vector<Anp::FitPoint> &fvec) const;
00068       
00069       const List GetList(unsigned int pos) const;
00070       
00071       double BFunction(double value) const;
00072       double WFunction(double value) const;
00073       
00074    private:
00075 
00076       Bool_t fDebug;
00077       Bool_t fValid;
00078       
00079       UInt_t fDegree;
00080       UInt_t fIter;
00081       UInt_t fWindow;
00082       
00083       std::vector<Anp::FitPoint> fFitVec;
00084    };
00085    
00086    //
00087    // inlined member functions
00088    //
00089    inline const std::vector<Anp::FitPoint>& LocalFit::GetFit() const
00090    {
00091       return fFitVec;
00092    }
00093    inline unsigned int LocalFit::Window() const
00094    {
00095       return fWindow;
00096    }
00097    inline unsigned int LocalFit::Iter() const
00098    {
00099       return fIter;
00100    }
00101    inline unsigned int LocalFit::Degree() const
00102    {
00103       return fDegree;
00104    }   
00105 }
00106 
00107 #endif

Generated on Mon Feb 15 11:06:53 2010 for loon by  doxygen 1.3.9.1