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 <vector>
16
17namespace ROOT {
18
19namespace Minuit2 {
20
21/**
22
23
24template wrapped class for adapting to FCNBase signature
25
26@author Lorenzo Moneta
27
28@ingroup Minuit
29
30*/
31
32template <class Function>
33class FCNAdapter : public FCNBase {
34
35public:
36 FCNAdapter(const Function &f, double up = 1.) : fFunc(f), fUp(up) {}
37
38 ~FCNAdapter() override {}
39
40 double operator()(const std::vector<double> &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
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
51private:
53 double fUp;
54};
55
56} // end namespace Minuit2
57
58} // end namespace ROOT
59
60#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:33
FCNAdapter(const Function &f, double up=1.)
Definition FCNAdapter.h:36
const Function & fFunc
Definition FCNAdapter.h:52
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
double operator()(const std::vector< double > &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
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:45
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.