Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
MnFcn.h
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#ifndef ROOT_Minuit2_MnFcn
11#define ROOT_Minuit2_MnFcn
12
13#include "Minuit2/FCNBase.h"
14#include "Minuit2/MnMatrix.h"
15
16#include <vector>
17
18namespace ROOT {
19
20namespace Minuit2 {
21
22class MnUserTransformation;
23
24class FCNBase;
25/**
26 Wrapper class to FCNBase interface used internally by Minuit.
27 Apply conversion from calling the function from a Minuit Vector (MnAlgebraicVector) to a std::vector for
28 the function coordinates.
29 The class counts also the number of function calls. By default counter start from zero, but a different value
30 might be given if the class is instantiated later on, for example for a set of different minimizaitons
31 Normally the derived class MnUserFCN should be instantiated with performs in addition the transformatiopn
32 internal-> external parameters
33 */
34class MnFcn {
35
36public:
37 explicit MnFcn(const FCNBase &fcn, int ncall = 0) : fFCN(fcn), fNumCall(ncall) {}
38 explicit MnFcn(const FCNBase &fcn, const MnUserTransformation &trafo, int ncall = 0)
40 {
41 }
42
43 unsigned int NumOfCalls() const { return fNumCall; }
44
45 double ErrorDef() const
46 {
47 return fFCN.Up();
48 }
49
50 double Up() const
51 {
52 return fFCN.Up();
53 }
54
55 const FCNBase &Fcn() const { return fFCN; }
56
57 // Access the parameter transformations.
58 // For internal use in the Minuit2 implementation.
59 const MnUserTransformation *Trafo() const { return fTransform; }
60
61 double CallWithTransformedParams(std::vector<double> const &vpar) const;
62 double CallWithoutDoingTrafo(const MnAlgebraicVector &) const;
63
64private:
65 const FCNBase &fFCN;
66 mutable int fNumCall;
68};
69
70// Helper class to call the MnFcn, caching the transformed parameters if necessary.
72public:
73 MnFcnCaller(const MnFcn &mfcn);
74
75 double operator()(const MnAlgebraicVector &v);
76
77private:
78 MnFcn const &fMfcn;
79 bool fDoInt2ext = false;
80 std::vector<double> fLastInput;
81 std::vector<double> fVpar;
82};
83
84} // namespace Minuit2
85
86} // namespace ROOT
87
88#endif // ROOT_Minuit2_MnFcn
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:49
std::vector< double > fVpar
Definition MnFcn.h:81
std::vector< double > fLastInput
Definition MnFcn.h:80
double operator()(const MnAlgebraicVector &v)
Definition MnFcn.cxx:45
MnFcnCaller(const MnFcn &mfcn)
Definition MnFcn.cxx:34
MnFcn const & fMfcn
Definition MnFcn.h:78
Wrapper class to FCNBase interface used internally by Minuit.
Definition MnFcn.h:34
const FCNBase & fFCN
Definition MnFcn.h:65
double Up() const
Definition MnFcn.h:50
MnFcn(const FCNBase &fcn, const MnUserTransformation &trafo, int ncall=0)
Definition MnFcn.h:38
const MnUserTransformation * fTransform
Definition MnFcn.h:67
double CallWithoutDoingTrafo(const MnAlgebraicVector &) const
Definition MnFcn.cxx:17
MnFcn(const FCNBase &fcn, int ncall=0)
Definition MnFcn.h:37
const FCNBase & Fcn() const
Definition MnFcn.h:55
double ErrorDef() const
Definition MnFcn.h:45
double CallWithTransformedParams(std::vector< double > const &vpar) const
Definition MnFcn.cxx:26
unsigned int NumOfCalls() const
Definition MnFcn.h:43
const MnUserTransformation * Trafo() const
Definition MnFcn.h:59
class dealing with the transformation between user specified parameters (external) and internal param...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...