1 // @(#)root/minuit2:$Id$ 2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 3 4 /********************************************************************** 5 * * 6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * 7 * * 8 **********************************************************************/ 9 10 #ifndef ROOT_Minuit2_FCNBase 11 #define ROOT_Minuit2_FCNBase 12 13 #include "Minuit2/MnConfig.h" 14 15 #include <vector> 16 17 #include "Minuit2/GenericFunction.h" 18 19 namespace ROOT { 20 21 namespace Minuit2 { 22 23 /** 24 25 \defgroup Minuit Minuit2 Minimization Library 26 27 New Object-oriented implementation of the MINUIT minimization package. 28 More information is available at the home page of the \ref Minuit2Page "Minuit2" minimization package". 29 30 \ingroup Math 31 */ 32 33 //______________________________________________________________________________ 34 /** 35 36 37 Interface (abstract class) defining the function to be minimized, which has to be implemented by the user. 38 39 @author Fred James and Matthias Winkler; modified by Andras Zsenei and Lorenzo Moneta 40 41 \ingroup Minuit 42 43 */ 44 45 class FCNBase : public GenericFunction { 46 47 public: ~FCNBase()48 virtual ~FCNBase() {} 49 50 /** 51 52 The meaning of the vector of parameters is of course defined by the user, 53 who uses the values of those parameters to calculate their function Value. 54 The order and the position of these parameters is strictly the one specified 55 by the user when supplying the starting values for minimization. The starting 56 values must be specified by the user, either via an std::vector<double> or the 57 MnUserParameters supplied as input to the MINUIT minimizers such as 58 VariableMetricMinimizer or MnMigrad. Later values are determined by MINUIT 59 as it searches for the Minimum or performs whatever analysis is requested by 60 the user. 61 62 @param v function parameters as defined by the user. 63 64 @return the Value of the function. 65 66 @see MnUserParameters 67 @see VariableMetricMinimizer 68 @see MnMigrad 69 70 */ 71 72 virtual double operator()(const std::vector<double> &v) const = 0; 73 74 /** 75 76 Error definition of the function. MINUIT defines Parameter errors as the 77 change in Parameter Value required to change the function Value by up. Normally, 78 for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. 79 If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, 80 as Chi2(x+n*sigma) = Chi2(x) + n*n. 81 82 Comment a little bit better with links!!!!!!!!!!!!!!!!! 83 84 */ 85 ErrorDef()86 virtual double ErrorDef() const { return Up(); } 87 88 /** 89 90 Error definition of the function. MINUIT defines Parameter errors as the 91 change in Parameter Value required to change the function Value by up. Normally, 92 for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. 93 If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, 94 as Chi2(x+n*sigma) = Chi2(x) + n*n. 95 96 \todo Comment a little bit better with links!!!!!!!!!!!!!!!!! Idem for ErrorDef() 97 98 */ 99 100 virtual double Up() const = 0; 101 102 /** 103 add interface to set dynamically a new error definition 104 Re-implement this function if needed. 105 */ SetErrorDef(double)106 virtual void SetErrorDef(double){}; 107 }; 108 109 } // namespace Minuit2 110 111 } // namespace ROOT 112 113 #endif // ROOT_Minuit2_FCNBase 114