00001
00002
00014 #ifndef _Fitter_H_
00015 #define _Fitter_H_
00016
00017 #include "pattern/libhippo.h"
00018
00019 #include <string>
00020 #include <vector>
00021
00022 class StatedFCN;
00023 class TupleCut;
00024
00029 class MDL_HIPPOPLOT_API Fitter
00030 {
00031
00032 private:
00033
00037 unsigned int getParameterIndex ( const std::string & name );
00038
00039 protected:
00040
00044 Fitter ( const Fitter & );
00045
00047 std::string m_name;
00048
00051 Fitter ( const char * name );
00052
00055 StatedFCN * m_fcn;
00056
00058 int m_max_iterations;
00059
00060 public:
00061
00063 virtual ~Fitter();
00064
00070 virtual Fitter * clone () const = 0;
00071
00074 const std::string & name () const;
00075
00079 virtual bool needsDerivatives () const = 0;
00080
00086 void setFCN ( StatedFCN * fcn );
00087
00090 StatedFCN * getFCN ( );
00091
00094 void fillFreeParameters ( std::vector < double > & ) const;
00095
00099 virtual void setFixedFlags ( const std::vector < int > & flags );
00100
00112 virtual const std::vector < int > & getFixedFlags () const;
00113
00117 virtual void setLimits ( unsigned int i, double lower, double upper );
00118
00122 void setLimits ( const std::string & name,
00123 double lower,
00124 double upper );
00125
00128 virtual bool calcBestFit () = 0;
00129
00135 virtual void setStepSize ( unsigned int i, double size );
00136
00139 void setStepSize ( const std::string & name, double size );
00140
00144 virtual double objectiveValue() const;
00145
00148 virtual int calcDegreesOfFreedom () const;
00149
00159 virtual
00160 int calcCovariance ( std::vector < std::vector < double > > & cov );
00161
00164 virtual void setFitCut ( TupleCut * cut );
00165
00168 virtual void setFitRange ( bool yes = true );
00169
00170 };
00171
00172 #endif // _Fitter_H_