Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16#include <vector>
17
18namespace ROOT {
19
20namespace Minuit2 {
21
22class FunctionMinimum;
23class MinuitParameter;
24class MnMachinePrecision;
25class ModularFunctionMinimizer;
26class FCNBase;
27
28//___________________________________________________________________________
29/**
30 application interface class for minimizers (migrad, simplex, Minimize,
31 Scan)
32 User normally instantiates the derived class like ROOT::Minuit2::MnMigrad
33 for using Migrad for minimization
34 */
35
37
38public:
39 /// constructor from non-gradient functions
40 MnApplication(const FCNBase &fcn, const MnUserParameterState &state, const MnStrategy &stra, unsigned int nfcn = 0);
41
42 virtual ~MnApplication() {}
43
44 /**
45 Minimize the function
46 @param maxfcn : max number of function calls (if = 0) default is used which is set to
47 200 + 100 * npar + 5 * npar**2
48 @param tolerance : value used for terminating iteration procedure.
49 For example, MIGRAD will stop iterating when edm (expected distance from minimum) will be:
50 edm < tolerance * 10**-3
51 Default value of tolerance used is 0.1
52 */
53 virtual FunctionMinimum operator()(unsigned int maxfcn = 0, double tolerance = 0.1);
54
56 virtual const ModularFunctionMinimizer &Minimizer() const = 0;
57
58 const MnMachinePrecision &Precision() const { return fState.Precision(); }
59 const MnUserParameterState &State() const { return fState; }
60 const MnUserParameters &Parameters() const { return fState.Parameters(); }
61 const MnUserCovariance &Covariance() const { return fState.Covariance(); }
62 virtual const FCNBase &Fcnbase() const { return fFCN; }
63 const MnStrategy &Strategy() const { return fStrategy; }
64 unsigned int NumOfCalls() const { return fNumCall; }
65
66protected:
67 const FCNBase &fFCN;
70 unsigned int fNumCall;
71
72public:
73 // facade: forward interface of MnUserParameters and MnUserTransformation
74 // via MnUserParameterState
75
76 // access to parameters (row-wise)
77 const std::vector<ROOT::Minuit2::MinuitParameter> &MinuitParameters() const;
78 // access to parameters and errors in column-wise representation
79 std::vector<double> Params() const;
80 std::vector<double> Errors() const;
81
82 // access to single Parameter
83 const MinuitParameter &Parameter(unsigned int i) const;
84
85 // add free Parameter
86 void Add(const char *Name, double val, double err);
87 // add limited Parameter
88 void Add(const char *Name, double val, double err, double, double);
89 // add const Parameter
90 void Add(const char *, double);
91
92 // interaction via external number of Parameter
93 void Fix(unsigned int);
94 void Release(unsigned int);
95 void SetValue(unsigned int, double);
96 void SetError(unsigned int, double);
97 void SetLimits(unsigned int, double, double);
98 void RemoveLimits(unsigned int);
99
100 double Value(unsigned int) const;
101 double Error(unsigned int) const;
102
103 // interaction via Name of Parameter
104 void Fix(const char *);
105 void Release(const char *);
106 void SetValue(const char *, double);
107 void SetError(const char *, double);
108 void SetLimits(const char *, double, double);
109 void RemoveLimits(const char *);
110 void SetPrecision(double);
111
112 double Value(const char *) const;
113 double Error(const char *) const;
114
115 // convert Name into external number of Parameter
116 unsigned int Index(const char *) const;
117 // convert external number into Name of Parameter
118 const char *Name(unsigned int) const;
119
120 // transformation internal <-> external
121 double Int2ext(unsigned int, double) const;
122 double Ext2int(unsigned int, double) const;
123 unsigned int IntOfExt(unsigned int) const;
124 unsigned int ExtOfInt(unsigned int) const;
125 unsigned int VariableParameters() const;
126};
127
128} // namespace Minuit2
129
130} // namespace ROOT
131
132#endif // ROOT_Minuit2_MnApplication
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:51
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...
void SetError(unsigned int, double)
const MnUserParameters & Parameters() const
unsigned int NumOfCalls() const
MnUserParameterState fState
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
const MnUserParameterState & State() const
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
double Ext2int(unsigned int, double) const
const MnMachinePrecision & Precision() const
virtual const ModularFunctionMinimizer & Minimizer() const =0
const MnUserCovariance & Covariance() const
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
Sets the relative floating point (double) arithmetic precision.
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
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...
CPyCppyy::Parameter Parameter
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...