StatedFCN.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00002 
00014 #ifndef _StatedFCN_H_
00015 #define _StatedFCN_H_
00016 
00017 #ifdef _MSC_VER
00018 #pragma warning(disable:4275) // non dll 9nterface coming from Minuit's FCNBase
00019 #endif
00020 
00021 // for have minuit
00022 #ifdef HAVE_CONFIG_H
00023 #include "config.h"
00024 #endif
00025 
00026 #ifdef HAVE_MINUIT
00027 #include "pattern/libhippo.h"
00028 #include "Minuit/FCNBase.h"
00029 #else
00030 
00031 #ifdef HAVE_MINUIT2
00032 #include "pattern/libhippo.h"
00033 #include "Minuit2/FCNBase.h"
00034 #else
00035 #include "FCNBase.h"
00036 #endif
00037 
00038 #endif
00039 
00040 #include <string>
00041 #include <vector>
00042 
00043 namespace hippodraw {
00044 
00045 class DataSource;
00046 class FunctionBase;
00047 class TupleCut;
00048 
00067 #ifdef HAVE_MINUIT2
00068 class MDL_HIPPOPLOT_API StatedFCN : public ROOT::Minuit2::FCNBase 
00069 #else
00070 class MDL_HIPPOPLOT_API StatedFCN : public FCNBase 
00071 #endif
00072 
00073 {
00074 
00075 // private:
00076 
00077 //   /** The flags to indicated which parameters are to be held fixed
00078 //       during minimization of this objective function.
00079 
00080 //       @note The flags are held as int because it is more space and
00081 //       time efficient for the expected number of parameters.
00082 //   */
00083 //   std::vector < int > m_fixed_flags;
00084 
00085 protected:
00086 
00090   FunctionBase * m_function;
00091 
00095   bool m_needs_derivs;
00096 
00100   StatedFCN ();
00101 
00105   StatedFCN ( const StatedFCN & );
00106 
00107  public:
00108 
00111   virtual StatedFCN * clone ( ) const = 0;
00112 
00117   virtual void copyFrom ( const StatedFCN * other );
00118 
00122   bool hasFunction () const;
00123 
00127   void setFunction ( FunctionBase * function );
00128 
00132   virtual void setDataSource ( const DataSource * source ) = 0;
00133 
00142   virtual void setDataSource ( const DataSource * source,
00143                                int dimension,
00144                                const std::vector < int > & ) = 0;
00145 
00149   virtual bool setUseErrors ( bool yes = true ) = 0;
00150 
00153   virtual bool getUseErrors () const = 0;
00154 
00157   const std::vector < std::string > & getParmNames () const;
00158 
00161   const std::vector < double > & getParameters () const;
00162 
00165   void setParameters ( const std::vector < double > & parms );
00166 
00169   void fillFreeParameters ( std::vector < double > & free_parms ) const;
00170 
00173   unsigned int getNumberFreeParms () const;
00174 
00179 //   const std::vector < int > & getFixedFlags () const;
00180 
00184   virtual void setFixedFlags ( const std::vector < int > & flags );
00185 
00188   virtual void setFreeParameters ( const std::vector < double > & parms );
00189 
00193   void fillFreeDerivatives ( std::vector < double > &, double x );
00194 
00198   virtual double operator () ( const std::vector < double > & parms ) const;
00199 
00206   virtual double objectiveValue () const = 0;
00207 
00211   virtual int degreesOfFreedom() const = 0;
00212 
00213   virtual void calcAlphaBeta ( std::vector < std::vector < double > > & alpha,
00214                                std::vector < double > & beta ) = 0;
00215 
00220   virtual bool needsIntegrated () const = 0;
00221 
00224   virtual void setFitCut ( TupleCut * cut ) = 0;
00225 
00228   virtual void setFitRange ( bool yes = true ) = 0;
00229 
00234   void setNeedsDerivatives ( bool yes );
00235 
00242   bool isCompatible ( const FunctionBase * ) const;
00243 
00246   const std::vector < int > & getFixedFlags() const;
00247 
00248 };
00249 
00250 } // namespace hippodraw
00251 
00252 #endif // _StatedFCN_H_

Generated for HippoDraw Class Library by doxygen