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;
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 /// constructor from non-gradient functions
41 MnApplication(const FCNBase &fcn, const MnUserParameterState &state, const MnStrategy &stra, unsigned int nfcn = 0);
42
43 /// constructor from gradient function
44 MnApplication(const FCNGradientBase &fcn, const MnUserParameterState &state, const MnStrategy &stra,
45 unsigned int nfcn = 0);
46
47 virtual ~MnApplication() {}
48
49 /**
50 Minimize the function
51 @param maxfcn : max number of function calls (if = 0) default is used which is set to
52 200 + 100 * npar + 5 * npar**2
53 @param tolerance : value used for terminating iteration procedure.
54 For example, MIGRAD will stop iterating when edm (expected distance from minimum) will be:
55 edm < tolerance * 10**-3
56 Default value of tolerance used is 0.1
57 */
58 virtual FunctionMinimum operator()(unsigned int maxfcn = 0, double tolerance = 0.1);
59
61 virtual const ModularFunctionMinimizer &Minimizer() const = 0;
62
63 const MnMachinePrecision &Precision() const { return fState.Precision(); }
64 const MnUserParameterState &State() const { return fState; }
65 const MnUserParameters &Parameters() const { return fState.Parameters(); }
66 const MnUserCovariance &Covariance() const { return fState.Covariance(); }
67 virtual const FCNBase &Fcnbase() const { return fFCN; }
68 const MnStrategy &Strategy() const { return fStrategy; }
69 unsigned int NumOfCalls() const { return fNumCall; }
70
71protected:
72 const FCNBase &fFCN;
75 unsigned int fNumCall;
77
78public:
79 // facade: forward interface of MnUserParameters and MnUserTransformation
80 // via MnUserParameterState
81
82 // access to parameters (row-wise)
83 const std::vector<ROOT::Minuit2::MinuitParameter> &MinuitParameters() const;
84 // access to parameters and errors in column-wise representation
85 std::vector<double> Params() const;
86 std::vector<double> Errors() const;
87
88 // access to single Parameter
89 const MinuitParameter &Parameter(unsigned int i) const;
90
91 // add free Parameter
92 void Add(const char *Name, double val, double err);
93 // add limited Parameter
94 void Add(const char *Name, double val, double err, double, double);
95 // add const Parameter
96 void Add(const char *, double);
97
98 // interaction via external number of Parameter
99 void Fix(unsigned int);
100 void Release(unsigned int);
101 void SetValue(unsigned int, double);
102 void SetError(unsigned int, double);
103 void SetLimits(unsigned int, double, double);
104 void RemoveLimits(unsigned int);
105
106 double Value(unsigned int) const;
107 double Error(unsigned int) const;
108
109 // interaction via Name of Parameter
110 void Fix(const char *);
111 void Release(const char *);
112 void SetValue(const char *, double);
113 void SetError(const char *, double);
114 void SetLimits(const char *, double, double);
115 void RemoveLimits(const char *);
116 void SetPrecision(double);
117
118 double Value(const char *) const;
119 double Error(const char *) const;
120
121 // convert Name into external number of Parameter
122 unsigned int Index(const char *) const;
123 // convert external number into Name of Parameter
124 const char *Name(unsigned int) const;
125
126 // transformation internal <-> external
127 double Int2ext(unsigned int, double) const;
128 double Ext2int(unsigned int, double) const;
129 unsigned int IntOfExt(unsigned int) const;
130 unsigned int ExtOfInt(unsigned int) const;
131 unsigned int VariableParameters() const;
132};
133
134} // namespace Minuit2
135
136} // namespace ROOT
137
138#endif // ROOT_Minuit2_MnApplication
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:45
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
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.