StatedFCN.h
Go to the documentation of this file.00001
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
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
00042 namespace hippodraw {
00043
00044 class DataSource;
00045 class FunctionBase;
00046 class TupleCut;
00047
00066 #ifdef HAVE_MINUIT2
00067 class MDL_HIPPOPLOT_API StatedFCN : public ROOT::Minuit2::FCNBase
00068 #else
00069 class MDL_HIPPOPLOT_API StatedFCN : public FCNBase
00070 #endif
00071
00072 {
00073
00074 private:
00075
00082 std::vector < int > m_fixed_flags;
00083
00084 protected:
00085
00089 FunctionBase * m_function;
00090
00094 bool m_needs_derivs;
00095
00099 StatedFCN ();
00100
00104 StatedFCN ( const StatedFCN & );
00105
00106 public:
00107
00110 virtual StatedFCN * clone ( ) const = 0;
00111
00116 virtual void copyFrom ( const StatedFCN * other );
00117
00121 bool hasFunction () const;
00122
00126 void setFunction ( FunctionBase * function );
00127
00131 virtual void setDataSource ( const DataSource * source ) = 0;
00132
00141 virtual void setDataSource ( const DataSource * source,
00142 int dimension,
00143 const std::vector < int > & ) = 0;
00144
00148 virtual bool setUseErrors ( bool yes = true ) = 0;
00149
00152 virtual bool getUseErrors () const = 0;
00153
00156 const std::vector < std::string > & getParmNames () const;
00157
00160 const std::vector < double > & getParameters () const;
00161
00164 void setParameters ( const std::vector < double > & parms );
00165
00168 void fillFreeParameters ( std::vector < double > & free_parms ) const;
00169
00172 unsigned int getNumberFreeParms () const;
00173
00178 const std::vector < int > & getFixedFlags () const;
00179
00183 virtual void setFixedFlags ( const std::vector < int > & flags );
00184
00187 virtual void setFreeParameters ( const std::vector < double > & parms );
00188
00192 void fillFreeDerivatives ( std::vector < double > &, double x );
00193
00197 virtual double operator () ( const std::vector < double > & parms ) const;
00198
00205 virtual double objectiveValue () const = 0;
00206
00209 virtual int degreesOfFreedom() const = 0;
00210
00211 virtual void calcAlphaBeta ( std::vector < std::vector < double > > & alpha,
00212 std::vector < double > & beta ) = 0;
00213
00218 virtual bool needsIntegrated () const = 0;
00219
00222 virtual void setFitCut ( TupleCut * cut ) = 0;
00223
00226 virtual void setFitRange ( bool yes = true ) = 0;
00227
00232 void setNeedsDerivatives ( bool yes );
00233
00240 bool isCompatible ( const FunctionBase * ) const;
00241
00242 };
00243
00244 }
00245
00246 #endif // _StatedFCN_H_