ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
FcnAdapter.h
Go to the documentation of this file.
1
// @(#)root/mathcore:$Id$
2
// Author: L. Moneta 10/2005
3
4
/**********************************************************************
5
* *
6
* Copyright (c) 2005 ROOT Foundation, CERN/PH-SFT *
7
* *
8
**********************************************************************/
9
10
#ifndef ROOT_Fit_FcnAdapter_H_
11
#define ROOT_Fit_FcnAdapter_H_
12
13
#include "
Math/IFunction.h
"
14
15
16
//___________________________________________________________
17
//
18
// Adapt the interface used in TMinuit (and the TVirtualFitter) for
19
// passing the objective function in a IFunction interface
20
// (ROOT::Math::IMultiGenFunction)
21
//
22
23
namespace
ROOT {
24
25
namespace
Fit {
26
27
class
FcnAdapter :
public
ROOT::Math::IMultiGenFunction {
28
29
public
:
30
31
FcnAdapter(
void
(*fcn)(
int
&,
double
*,
double
&,
double
*,
int
),
int
dim = 0) :
32
fDim(dim),
33
fFCN(fcn)
34
{}
35
36
virtual
~FcnAdapter() {}
37
38
virtual
unsigned
int
NDim()
const
{
return
fDim; }
39
40
ROOT::Math::IMultiGenFunction * Clone()
const
{
41
return
new
FcnAdapter(fFCN,fDim);
42
}
43
44
void
SetDimension(
int
dim) { fDim = dim; }
45
46
private
:
47
48
virtual
double
DoEval(
const
double
* x)
const
{
49
double
fval = 0;
50
int
dim = fDim;
51
// call with flag 4
52
fFCN(dim, 0, fval, const_cast<double *>(x), 4);
53
return
fval;
54
}
55
56
private
:
57
58
unsigned
int
fDim;
59
void (*fFCN)(
int
&,
double
*,
double
&,
double
*, int);
60
61
62
};
63
64
}
// end namespace Fit
65
66
}
// end namespace ROOT
67
68
#endif //ROOT_Fit_FcnAdapter
IFunction.h
math
mathcore
inc
Fit
FcnAdapter.h
Generated on Tue May 5 2020 14:03:00 for ROOT by
1.8.5