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 namespace hippodraw {
00023
00024 class DataSource;
00025 class FunctionBase;
00026 class StatedFCN;
00027 class TupleCut;
00028
00033 class MDL_HIPPOPLOT_API Fitter
00034 {
00035
00036 private:
00037
00041 unsigned int getParameterIndex ( const std::string & name );
00042
00043 protected:
00044
00048 Fitter ( const Fitter & );
00049
00051 std::string m_name;
00052
00055 Fitter ( const char * name );
00056
00059 StatedFCN * m_fcn;
00060
00062 int m_max_iterations;
00063
00064 public:
00065
00067 virtual ~Fitter();
00068
00074 virtual Fitter * clone () const = 0;
00075
00078 virtual void copyFrom ( const Fitter * other );
00079
00082 const std::string & name () const;
00083
00093 virtual void setFCN ( StatedFCN * fcn );
00094
00097 StatedFCN * getFCN ( );
00098
00101 void setFunction ( FunctionBase * function );
00102
00105 bool isCompatible ( const FunctionBase * ) const;
00106
00109 void setDataSource ( const DataSource * source );
00110
00114 void setUseErrors ( bool yes = true );
00115
00119 bool getUseErrors () const;
00120
00123 bool needsIntegrated () const;
00124
00127 void fillFreeParameters ( std::vector < double > & ) const;
00128
00132 virtual void setFixedFlags ( const std::vector < int > & flags );
00133
00145 virtual const std::vector < int > & getFixedFlags () const;
00146
00152 virtual void setLimits ( unsigned int i, double lower, double upper );
00153
00157 void setLimits ( const std::string & name,
00158 double lower,
00159 double upper );
00160
00163 virtual bool calcBestFit () = 0;
00164
00170 virtual void setStepSize ( unsigned int i, double size );
00171
00174 void setStepSize ( const std::string & name, double size );
00175
00179 virtual double objectiveValue() const;
00180
00183 virtual int calcDegreesOfFreedom () const;
00184
00194 virtual
00195 int calcCovariance ( std::vector < std::vector < double > > & cov );
00196
00199 virtual void setFitCut ( TupleCut * cut );
00200
00203 virtual void setFitRange ( bool yes = true );
00204
00205 };
00206
00207 }
00208
00209 #endif // _Fitter_H_