Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

FitFunction.h

Go to the documentation of this file.
00001  /**********************************************************************
00002   *                                                                    *
00003   * Copyright (c) 2002 Jakub MOSCICKI, CERN/IT                       *
00004   *                   <Jakub.MOSCICKI@cern.ch>                       *
00005   *                                                                    *
00006   * This library is free software; you can redistribute it and/or      *
00007   * modify it under the terms of the GNU Lesser General Public         *
00008   * License as published by the Free Software Foundation; either       *
00009   * version 2.1 of the License, or (at your option) any later version. *
00010   *                                                                    *
00011   * This library is distributed in the hope that it will be useful,    *
00012   * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00013   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014   * Lesser General Public License for more details.                    *
00015   *                                                                    *
00016   * You should have received a copy of the GNU Lesser General Public   *
00017   * License along with this library (see file COPYING); if not, write  *
00018   * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
00019   * 330, Boston, MA 02111-1307 USA, or contact the author at           *
00020   *  <Jakub.MOSCICKI@cern.ch>                                        *
00021   **********************************************************************/
00022 
00023 // Header file for class FitFunction 
00024 // 
00025 // Created by: Jakub MOSCICKI  at Tue Jan 15 13:05:34 2002
00026 // 
00027 // Last update: Tue Jan 15 13:05:34 2002
00028 // 
00029 #ifndef FITFUNCTION_H
00030 #define FITFUNCTION_H
00031 
00032 // let's use implementation of Function
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 // for more complex classes these two should probably be protected
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     // Methods needed by fitter, but not by user
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   // no default arguments here to avoid clashes with previous method 
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   // IFunction Interface
00163   //-----------------------------------------------------------------------
00164 
00165    virtual const std::string & label (  ) const;
00166     
00173    virtual double value ( const std::vector< double > & point ) const;
00174 
00175    //-FIXME: for 1-D:  operator () (double), similar for n-D
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 /* FITFUNCTION_H */ 


Anaphe documentation generated by Doxygen (www.doxygen.org)