Logo ROOT  
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
15namespace ROOT {
16
17 namespace Minuit2 {
18
19/**
20
21
22template wrapped class for adapting to FCNBase signature
23
24@author Lorenzo Moneta
25
26@ingroup Minuit
27
28*/
29
30template< class Function>
31class FCNAdapter : public FCNBase {
32
33public:
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
58private:
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
#define f(i)
Definition: RSha256.hxx:104
Double_t(* Function)(Double_t)
Definition: Functor.C:4
template wrapped class for adapting to FCNBase signature
Definition: FCNAdapter.h:31
FCNAdapter(const Function &f, double up=1.)
Definition: FCNAdapter.h:35
const Function & fFunc
Definition: FCNAdapter.h:59
double Up() const
Error definition of the function.
Definition: FCNAdapter.h:49
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
double operator()(const double *v) const
Definition: FCNAdapter.h:46
void SetErrorDef(double up)
add interface to set dynamically a new error definition Re-implement this function if needed.
Definition: FCNAdapter.h:51
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:47
VSD Structures.
Definition: StringConv.hxx:21