Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <ROOT/RSpan.hxx>
16
17#include <vector>
18
19namespace ROOT {
20
21namespace Minuit2 {
22
23/**
24
25
26template wrapped class for adapting to FCNBase signature
27
28@author Lorenzo Moneta
29
30@ingroup Minuit
31
32*/
33
34template <class Function>
35class FCNAdapter : public FCNBase {
36
37public:
38 FCNAdapter(const Function &f, double up = 1.) : fFunc(f), fUp(up) {}
39
40 double operator()(std::vector<double> const& v) const override { return fFunc.operator()(&v[0]); }
41 double operator()(const double *v) const { return fFunc.operator()(v); }
42 double Up() const override { return fUp; }
43
44 void SetErrorDef(double up) override { fUp = up; }
45
46private:
48 double fUp;
49};
50
51} // end namespace Minuit2
52
53} // end namespace ROOT
54
55#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:35
FCNAdapter(const Function &f, double up=1.)
Definition FCNAdapter.h:38
double operator()(std::vector< double > const &v) const override
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
Definition FCNAdapter.h:40
const Function & fFunc
Definition FCNAdapter.h:47
void SetErrorDef(double up) override
add interface to set dynamically a new error definition Re-implement this function if needed.
Definition FCNAdapter.h:44
double Up() const override
Error definition of the function.
Definition FCNAdapter.h:42
double operator()(const double *v) const
Definition FCNAdapter.h:41
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:51
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...