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 
15 #include <vector>
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  FCNAdapter(const Function &f, double up = 1.) : fFunc(f), fUp(up) {}
37 
39 
40  double operator()(const std::vector<double> &v) const { return fFunc.operator()(&v[0]); }
41  double operator()(const double *v) const { return fFunc.operator()(v); }
42  double Up() const { return fUp; }
43 
44  void SetErrorDef(double up) { fUp = up; }
45 
46  // virtual std::vector<double> Gradient(const std::vector<double>&) const;
47 
48  // forward interface
49  // virtual double operator()(int npar, double* params,int iflag = 4) const;
50 
51 private:
52  const Function &fFunc;
53  double fUp;
54 };
55 
56 } // end namespace Minuit2
57 
58 } // end namespace ROOT
59 
60 #endif // ROOT_Minuit2_FCNAdapter
ROOT::Minuit2::FCNAdapter::~FCNAdapter
~FCNAdapter()
Definition: FCNAdapter.h:38
f
#define f(i)
Definition: RSha256.hxx:104
ROOT::Minuit2::FCNAdapter::Up
double Up() const
Error definition of the function.
Definition: FCNAdapter.h:42
ROOT::Minuit2::FCNAdapter::fUp
double fUp
Definition: FCNAdapter.h:53
ROOT::Minuit2::FCNBase
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:45
ROOT::Minuit2::FCNAdapter::operator()
double operator()(const double *v) const
Definition: FCNAdapter.h:41
ROOT::Minuit2::FCNAdapter::FCNAdapter
FCNAdapter(const Function &f, double up=1.)
Definition: FCNAdapter.h:36
ROOT::Minuit2::FCNAdapter
template wrapped class for adapting to FCNBase signature
Definition: FCNAdapter.h:33
Function
Double_t(* Function)(Double_t)
Definition: Functor.C:4
v
@ v
Definition: rootcling_impl.cxx:3664
ROOT::Minuit2::FCNAdapter::SetErrorDef
void SetErrorDef(double up)
add interface to set dynamically a new error definition Re-implement this function if needed.
Definition: FCNAdapter.h:44
FCNBase.h
ROOT::Minuit2::FCNAdapter::fFunc
const Function & fFunc
Definition: FCNAdapter.h:52
ROOT::Minuit2::FCNAdapter::operator()
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:40
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4