Logo ROOT   6.10/09
Reference Guide
FCNAdapter.h
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Author: L. Moneta 10/2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 ROOT Foundation, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef ROOT_Minuit2_FCNAdapter
11 #define ROOT_Minuit2_FCNAdapter
12 
13 #include "Minuit2/FCNBase.h"
14 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 /**
20 
21 
22 template wrapped class for adapting to FCNBase signature
23 
24 @author Lorenzo Moneta
25 
26 @ingroup Minuit
27 
28 */
29 
30 template< class Function>
31 class FCNAdapter : public FCNBase {
32 
33 public:
34 
35  FCNAdapter(const Function & f, double up = 1.) :
36  fFunc(f) ,
37  fUp (up)
38  {}
39 
41 
42 
43  double operator()(const std::vector<double>& v) const {
44  return fFunc.operator()(&v[0]);
45  }
46  double operator()(const double * v) const {
47  return fFunc.operator()(v);
48  }
49  double Up() const {return fUp;}
50 
51  void SetErrorDef(double up) { fUp = up; }
52 
53  //virtual std::vector<double> Gradient(const std::vector<double>&) const;
54 
55  // forward interface
56  //virtual double operator()(int npar, double* params,int iflag = 4) const;
57 
58 private:
59  const Function & fFunc;
60  double fUp;
61 };
62 
63  } // end namespace Minuit2
64 
65 } // end namespace ROOT
66 
67 
68 
69 #endif //ROOT_Minuit2_FCNAdapter
double Up() const
Error definition of the function.
Definition: FCNAdapter.h:49
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
FCNAdapter(const Function &f, double up=1.)
Definition: FCNAdapter.h:35
template wrapped class for adapting to FCNBase signature
Definition: FCNAdapter.h:31
double operator()(const double *v) const
Definition: FCNAdapter.h:46
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:47
Double_t(* Function)(Double_t)
Definition: Functor.C:4
SVector< double, 2 > v
Definition: Dict.h:5
double f(double x)
const Function & fFunc
Definition: FCNAdapter.h:59
double operator()(const std::vector< double > &v) const
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
Definition: FCNAdapter.h:43
void SetErrorDef(double up)
add interface to set dynamically a new error definition Re-implement this function if needed...
Definition: FCNAdapter.h:51