Logo ROOT   6.16/01
Reference Guide
MnApplication.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_MnApplication
11#define ROOT_Minuit2_MnApplication
12
14#include "Minuit2/MnStrategy.h"
15
16namespace ROOT {
17
18 namespace Minuit2 {
19
20
21
22class FunctionMinimum;
23class MinuitParameter;
24class MnMachinePrecision;
25class ModularFunctionMinimizer;
26class FCNBase;
27class FCNGradientBase;
28
29//___________________________________________________________________________
30/**
31 application interface class for minimizers (migrad, simplex, Minimize,
32 Scan)
33 User normally instantiates the derived class like ROOT::Minuit2::MnMigrad
34 for using Migrad for minimization
35 */
36
38
39public:
40
41
42 /// constructor from non-gradient functions
43 MnApplication(const FCNBase& fcn, const MnUserParameterState& state, const MnStrategy& stra, unsigned int nfcn = 0);
44
45 /// constructor from gradient function
46 MnApplication(const FCNGradientBase& fcn, const MnUserParameterState& state, const MnStrategy& stra, unsigned int nfcn = 0);
47
48 virtual ~MnApplication() { }
49
50 /**
51 Minimize the function
52 @param maxfcn : max number of function calls (if = 0) default is used which is set to
53 200 + 100 * npar + 5 * npar**2
54 @param tolerance : value used for terminating iteration procedure.
55 For example, MIGRAD will stop iterating when edm (expected distance from minimum) will be:
56 edm < tolerance * 10**-3
57 Default value of tolerance used is 0.1
58 */
59 virtual FunctionMinimum operator()(unsigned int maxfcn = 0, double tolerance = 0.1);
60
62 virtual const ModularFunctionMinimizer& Minimizer() const = 0;
63
64 const MnMachinePrecision& Precision() const {return fState.Precision();}
65 const MnUserParameterState& State() const {return fState;}
66 const MnUserParameters& Parameters() const {return fState.Parameters();}
67 const MnUserCovariance& Covariance() const {return fState.Covariance();}
68 virtual const FCNBase& Fcnbase() const {return fFCN;}
69 const MnStrategy& Strategy() const {return fStrategy;}
70 unsigned int NumOfCalls() const {return fNumCall;}
71
72protected:
73
74 const FCNBase& fFCN;
77 unsigned int fNumCall;
79
80public:
81
82// facade: forward interface of MnUserParameters and MnUserTransformation
83// via MnUserParameterState
84
85 //access to parameters (row-wise)
86 const std::vector<ROOT::Minuit2::MinuitParameter>& MinuitParameters() const;
87 //access to parameters and errors in column-wise representation
88 std::vector<double> Params() const;
89 std::vector<double> Errors() const;
90
91 //access to single Parameter
92 const MinuitParameter& Parameter(unsigned int i) const;
93
94 //add free Parameter
95 void Add(const char* Name, double val, double err);
96 //add limited Parameter
97 void Add(const char* Name, double val, double err, double , double);
98 //add const Parameter
99 void Add(const char*, double);
100
101 //interaction via external number of Parameter
102 void Fix(unsigned int);
103 void Release(unsigned int);
104 void SetValue(unsigned int, double);
105 void SetError(unsigned int, double);
106 void SetLimits(unsigned int, double, double);
107 void RemoveLimits(unsigned int);
108
109 double Value(unsigned int) const;
110 double Error(unsigned int) const;
111
112 //interaction via Name of Parameter
113 void Fix(const char*);
114 void Release(const char*);
115 void SetValue(const char*, double);
116 void SetError(const char*, double);
117 void SetLimits(const char*, double, double);
118 void RemoveLimits(const char*);
119 void SetPrecision(double);
120
121 double Value(const char*) const;
122 double Error(const char*) const;
123
124 //convert Name into external number of Parameter
125 unsigned int Index(const char*) const;
126 //convert external number into Name of Parameter
127 const char* Name(unsigned int) const;
128
129 // transformation internal <-> external
130 double Int2ext(unsigned int, double) const;
131 double Ext2int(unsigned int, double) const;
132 unsigned int IntOfExt(unsigned int) const;
133 unsigned int ExtOfInt(unsigned int) const;
134 unsigned int VariableParameters() const;
135
136};
137
138 } // namespace Minuit2
139
140} // namespace ROOT
141
142#endif // ROOT_Minuit2_MnApplication
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:47
Extension of the FCNBase for providing the analytical Gradient of the function.
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
application interface class for minimizers (migrad, simplex, Minimize, Scan) User normally instantiat...
Definition: MnApplication.h:37
void SetError(unsigned int, double)
const MnUserParameters & Parameters() const
Definition: MnApplication.h:66
unsigned int NumOfCalls() const
Definition: MnApplication.h:70
MnUserParameterState fState
Definition: MnApplication.h:75
double Int2ext(unsigned int, double) const
void Add(const char *Name, double val, double err)
std::vector< double > Errors() const
void RemoveLimits(unsigned int)
const MnStrategy & Strategy() const
Definition: MnApplication.h:69
double Value(unsigned int) const
const MnUserParameterState & State() const
Definition: MnApplication.h:65
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
virtual ModularFunctionMinimizer & Minimizer()=0
unsigned int ExtOfInt(unsigned int) const
unsigned int Index(const char *) const
unsigned int IntOfExt(unsigned int) const
virtual FunctionMinimum operator()(unsigned int maxfcn=0, double tolerance=0.1)
Minimize the function.
virtual const FCNBase & Fcnbase() const
Definition: MnApplication.h:68
double Ext2int(unsigned int, double) const
const MinuitParameter & Parameter(unsigned int i) const
const MnMachinePrecision & Precision() const
Definition: MnApplication.h:64
virtual const ModularFunctionMinimizer & Minimizer() const =0
const MnUserCovariance & Covariance() const
Definition: MnApplication.h:67
MnApplication(const FCNBase &fcn, const MnUserParameterState &state, const MnStrategy &stra, unsigned int nfcn=0)
constructor from non-gradient functions
const char * Name(unsigned int) const
std::vector< double > Params() const
void SetLimits(unsigned int, double, double)
double Error(unsigned int) const
void SetValue(unsigned int, double)
unsigned int VariableParameters() const
determines the relative floating point arithmetic precision.
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MnMachinePrecision & Precision() const
const MnUserParameters & Parameters() const
const MnUserCovariance & Covariance() const
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
Base common class providing the API for all the minimizer Various Minimize methods are provided varyi...
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21