00001 // @(#)root/minuit2:$Id: FCNBase.h 30749 2009-10-15 16:33:04Z brun $ 00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * 00007 * * 00008 **********************************************************************/ 00009 00010 #ifndef ROOT_Minuit2_FCNBase 00011 #define ROOT_Minuit2_FCNBase 00012 00013 #include "Minuit2/MnConfig.h" 00014 00015 #include <vector> 00016 00017 #include "Minuit2/GenericFunction.h" 00018 00019 namespace ROOT { 00020 00021 namespace Minuit2 { 00022 00023 00024 /** 00025 00026 @defgroup Minuit Minuit2 Minimization Library 00027 00028 Object-oriented implementation of the MINUIT minimization package. 00029 More information is available at the home page of the \ref Minuit2 package. 00030 */ 00031 00032 00033 //______________________________________________________________________________ 00034 /** 00035 00036 00037 Interface (abstract class) defining the function to be minimized, which has to be implemented by the user. 00038 00039 @author Fred James and Matthias Winkler; modified by Andras Zsenei and Lorenzo Moneta 00040 00041 @ingroup Minuit 00042 00043 */ 00044 00045 class FCNBase : public GenericFunction { 00046 00047 public: 00048 00049 00050 virtual ~FCNBase() {} 00051 00052 00053 00054 /** 00055 00056 The meaning of the vector of parameters is of course defined by the user, 00057 who uses the values of those parameters to calculate his function Value. 00058 The order and the position of these parameters is strictly the one specified 00059 by the user when supplying the starting values for minimization. The starting 00060 values must be specified by the user, either via an std::vector<double> or the 00061 MnUserParameters supplied as input to the MINUIT minimizers such as 00062 VariableMetricMinimizer or MnMigrad. Later values are determined by MINUIT 00063 as it searches for the Minimum or performs whatever analysis is requested by 00064 the user. 00065 00066 @param par function parameters as defined by the user. 00067 00068 @return the Value of the function. 00069 00070 @see MnUserParameters 00071 @see VariableMetricMinimizer 00072 @see MnMigrad 00073 00074 */ 00075 00076 virtual double operator()(const std::vector<double>& x) const = 0; 00077 00078 00079 /** 00080 00081 Error definition of the function. MINUIT defines Parameter errors as the 00082 change in Parameter Value required to change the function Value by up. Normally, 00083 for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. 00084 If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, 00085 as Chi2(x+n*sigma) = Chi2(x) + n*n. 00086 00087 Comment a little bit better with links!!!!!!!!!!!!!!!!! 00088 00089 */ 00090 00091 virtual double ErrorDef() const {return Up();} 00092 00093 00094 /** 00095 00096 Error definition of the function. MINUIT defines Parameter errors as the 00097 change in Parameter Value required to change the function Value by up. Normally, 00098 for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. 00099 If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, 00100 as Chi2(x+n*sigma) = Chi2(x) + n*n. 00101 00102 \todo Comment a little bit better with links!!!!!!!!!!!!!!!!! Idem for ErrorDef() 00103 00104 */ 00105 00106 virtual double Up() const = 0; 00107 00108 /** 00109 add interface to set dynamically a new error definition 00110 Re-implement this function if needed. 00111 */ 00112 virtual void SetErrorDef(double ) {}; 00113 00114 }; 00115 00116 } // namespace Minuit2 00117 00118 } // namespace ROOT 00119 00120 #endif // ROOT_Minuit2_FCNBase