// @(#)root/minuit2:$Id$
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
 *                                                                    *
 **********************************************************************/

#ifndef ROOT_Minuit2_FCNBase
#define ROOT_Minuit2_FCNBase

#include "Minuit2/MnConfig.h"

#include <vector>

#include "Minuit2/GenericFunction.h"

namespace ROOT {

   namespace Minuit2 {


/**

@defgroup Minuit Minuit2 Minimization Library

  Object-oriented implementation of the MINUIT minimization package.
  More information is available at the home page of the \ref Minuit2 package.
*/


//______________________________________________________________________________
/**


Interface (abstract class) defining the function to be minimized, which has to be implemented by the user.

@author Fred James and Matthias Winkler; modified by Andras Zsenei and Lorenzo Moneta

@ingroup Minuit

 */

class FCNBase : public GenericFunction {

public:


   virtual ~FCNBase() {}



   /**

      The meaning of the vector of parameters is of course defined by the user,
      who uses the values of those parameters to calculate their function Value.
      The order and the position of these parameters is strictly the one specified
      by the user when supplying the starting values for minimization. The starting
      values must be specified by the user, either via an std::vector<double> or the
      MnUserParameters supplied as input to the MINUIT minimizers such as
      VariableMetricMinimizer or MnMigrad. Later values are determined by MINUIT
      as it searches for the Minimum or performs whatever analysis is requested by
      the user.

      @param par function parameters as defined by the user.

      @return the Value of the function.

      @see MnUserParameters
      @see VariableMetricMinimizer
      @see MnMigrad

   */

   virtual double operator()(const std::vector<double>& x) const = 0;


   /**

      Error definition of the function. MINUIT defines Parameter errors as the
      change in Parameter Value required to change the function Value by up. Normally,
      for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5.
      If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4,
      as Chi2(x+n*sigma) = Chi2(x) + n*n.

      Comment a little bit better with links!!!!!!!!!!!!!!!!!

   */

   virtual double ErrorDef() const {return Up();}


   /**

      Error definition of the function. MINUIT defines Parameter errors as the
      change in Parameter Value required to change the function Value by up. Normally,
      for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5.
      If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4,
      as Chi2(x+n*sigma) = Chi2(x) + n*n.

      \todo Comment a little bit better with links!!!!!!!!!!!!!!!!! Idem for ErrorDef()

   */

   virtual double Up() const = 0;

   /**
       add interface to set dynamically a new error definition
       Re-implement this function if needed.
   */
   virtual void SetErrorDef(double ) {};

};

  }  // namespace Minuit2

}  // namespace ROOT

#endif  // ROOT_Minuit2_FCNBase
 FCNBase.h:1
 FCNBase.h:2
 FCNBase.h:3
 FCNBase.h:4
 FCNBase.h:5
 FCNBase.h:6
 FCNBase.h:7
 FCNBase.h:8
 FCNBase.h:9
 FCNBase.h:10
 FCNBase.h:11
 FCNBase.h:12
 FCNBase.h:13
 FCNBase.h:14
 FCNBase.h:15
 FCNBase.h:16
 FCNBase.h:17
 FCNBase.h:18
 FCNBase.h:19
 FCNBase.h:20
 FCNBase.h:21
 FCNBase.h:22
 FCNBase.h:23
 FCNBase.h:24
 FCNBase.h:25
 FCNBase.h:26
 FCNBase.h:27
 FCNBase.h:28
 FCNBase.h:29
 FCNBase.h:30
 FCNBase.h:31
 FCNBase.h:32
 FCNBase.h:33
 FCNBase.h:34
 FCNBase.h:35
 FCNBase.h:36
 FCNBase.h:37
 FCNBase.h:38
 FCNBase.h:39
 FCNBase.h:40
 FCNBase.h:41
 FCNBase.h:42
 FCNBase.h:43
 FCNBase.h:44
 FCNBase.h:45
 FCNBase.h:46
 FCNBase.h:47
 FCNBase.h:48
 FCNBase.h:49
 FCNBase.h:50
 FCNBase.h:51
 FCNBase.h:52
 FCNBase.h:53
 FCNBase.h:54
 FCNBase.h:55
 FCNBase.h:56
 FCNBase.h:57
 FCNBase.h:58
 FCNBase.h:59
 FCNBase.h:60
 FCNBase.h:61
 FCNBase.h:62
 FCNBase.h:63
 FCNBase.h:64
 FCNBase.h:65
 FCNBase.h:66
 FCNBase.h:67
 FCNBase.h:68
 FCNBase.h:69
 FCNBase.h:70
 FCNBase.h:71
 FCNBase.h:72
 FCNBase.h:73
 FCNBase.h:74
 FCNBase.h:75
 FCNBase.h:76
 FCNBase.h:77
 FCNBase.h:78
 FCNBase.h:79
 FCNBase.h:80
 FCNBase.h:81
 FCNBase.h:82
 FCNBase.h:83
 FCNBase.h:84
 FCNBase.h:85
 FCNBase.h:86
 FCNBase.h:87
 FCNBase.h:88
 FCNBase.h:89
 FCNBase.h:90
 FCNBase.h:91
 FCNBase.h:92
 FCNBase.h:93
 FCNBase.h:94
 FCNBase.h:95
 FCNBase.h:96
 FCNBase.h:97
 FCNBase.h:98
 FCNBase.h:99
 FCNBase.h:100
 FCNBase.h:101
 FCNBase.h:102
 FCNBase.h:103
 FCNBase.h:104
 FCNBase.h:105
 FCNBase.h:106
 FCNBase.h:107
 FCNBase.h:108
 FCNBase.h:109
 FCNBase.h:110
 FCNBase.h:111
 FCNBase.h:112
 FCNBase.h:113
 FCNBase.h:114
 FCNBase.h:115
 FCNBase.h:116
 FCNBase.h:117
 FCNBase.h:118
 FCNBase.h:119
 FCNBase.h:120