00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FITFUNCTION_H
00030 #define FITFUNCTION_H
00031
00032
00033 # include "AIDA/IFitFunction.h"
00034
00035 # include "Function.h"
00036
00037 # include "AIDA_FML/IFitter_impl.h"
00038
00039 namespace Anaphe
00040 {
00041 class IVector;
00042 };
00043
00044 class ICloud;
00045
00046 class FitFunction : virtual public IFitFunction
00047 {
00048
00049 public:
00050
00053 FitFunction(const std::string & label, const std::string & type, const std::string & options);
00054
00056 virtual ~FitFunction();
00057
00058 private:
00059
00060 FitFunction(const FitFunction &);
00061 FitFunction & operator = (const FitFunction &);
00062
00063 public:
00064
00068 virtual bool setFixed ( const std::string & name, bool state );
00069
00073 virtual bool setBounds ( const std::string & name, double lower, double upper );
00074
00078 virtual bool setStart ( const std::string & name, double start );
00079
00083 virtual bool clearBounds ( const std::string & name );
00084
00088 virtual bool setStepSize ( const std::string & name, double step );
00089
00093 virtual double error ( const std::string & name );
00094
00098 virtual const std::vector< double > & errors ( );
00099
00103 virtual double chiSquare ( );
00104
00108 virtual double degreeOfFreedom ( );
00109
00110
00111
00112
00113
00117 virtual bool setErrors ( const std::vector< double > & errors );
00118
00122 virtual bool setChiSquare ( double chiSquare );
00123
00127 virtual bool setDegreeOfFreedom ( double degreeOfFreedom );
00128
00132 virtual bool hasGradient ( ) const;
00133
00137 virtual const std::vector< double > & getGradient ( const std::vector< double > & one, const std::vector< double > & orTwo );
00138
00143 virtual bool fit(const IHistogram & histogram);
00144
00150
00151 virtual bool fit(const IHistogram & histogram, int imin , int imax );
00152
00159 virtual bool fit(const ICloud & cloud, int imin = 0, int imax = 0);
00160
00161
00162
00163
00164
00165 virtual const std::string & label ( ) const;
00166
00173 virtual double value ( const std::vector< double > & point ) const;
00174
00175
00176
00180 virtual int dimension ( ) const;
00181
00185 virtual const std::vector< std::string > & parameterNames ( ) const;
00186
00190 virtual const std::vector< double > & parameterValues ( ) const;
00191
00195 virtual bool setParameterValue ( const std::string & name, double value );
00196
00197 virtual const string & version() const;
00198
00199 protected:
00200
00201 bool m_fit( int imin, int imax);
00202 void nyi() const;
00203
00204 private:
00205
00206 mutable std::auto_ptr<Function_plain_wrapper> m_model;
00207 mutable std::auto_ptr<FML::IFitter_impl> m_fitter;
00208 mutable std::auto_ptr<Anaphe::IVector> m_source_data;
00209 mutable std::string m_version;
00210 std::vector<double> m_errors_ret;
00211 std::string m_method;
00212 };
00213
00214 #endif