Logo ROOT   6.07/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 #ifndef ROOT_Minuit2_FCNBase
14 #include "Minuit2/FCNBase.h"
15 #endif
16 
17 namespace ROOT {
18 
19  namespace Minuit2 {
20 
21 /**
22 
23 
24 template wrapped class for adapting to FCNBase signature
25 
26 @author Lorenzo Moneta
27 
28 @ingroup Minuit
29 
30 */
31 
32 template< class Function>
33 class FCNAdapter : public FCNBase {
34 
35 public:
36 
37  FCNAdapter(const Function & f, double up = 1.) :
38  fFunc(f) ,
39  fUp (up)
40  {}
41 
43 
44 
45  double operator()(const std::vector<double>& v) const {
46  return fFunc.operator()(&v[0]);
47  }
48  double operator()(const double * v) const {
49  return fFunc.operator()(v);
50  }
51  double Up() const {return fUp;}
52 
53  void SetErrorDef(double up) { fUp = up; }
54 
55  //virtual std::vector<double> Gradient(const std::vector<double>&) const;
56 
57  // forward interface
58  //virtual double operator()(int npar, double* params,int iflag = 4) const;
59 
60 private:
61  const Function & fFunc;
62  double fUp;
63 };
64 
65  } // end namespace Minuit2
66 
67 } // end namespace ROOT
68 
69 
70 
71 #endif //ROOT_Minuit2_FCNAdapter
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
FCNAdapter(const Function &f, double up=1.)
Definition: FCNAdapter.h:37
template wrapped class for adapting to FCNBase signature
Definition: FCNAdapter.h:33
double operator()(const double *v) const
Definition: FCNAdapter.h:48
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:47
SVector< double, 2 > v
Definition: Dict.h:5
double f(double x)
double Up() const
Error definition of the function.
Definition: FCNAdapter.h:51
const Function & fFunc
Definition: FCNAdapter.h:61
void SetErrorDef(double up)
add interface to set dynamically a new error definition Re-implement this function if needed...
Definition: FCNAdapter.h:53
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:45