Logo ROOT  
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 
16 #include <vector>
17 
18 namespace ROOT {
19 
20 namespace Minuit2 {
21 
22 class FunctionMinimum;
23 class MinuitParameter;
24 class MnMachinePrecision;
25 class ModularFunctionMinimizer;
26 class FCNBase;
27 class 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 
39 public:
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 
71 protected:
72  const FCNBase &fFCN;
75  unsigned int fNumCall;
76  bool fUseGrad;
77 
78 public:
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
ROOT::Minuit2::MinuitParameter
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
Definition: MinuitParameter.h:33
ROOT::Minuit2::MnApplication::Fix
void Fix(unsigned int)
Definition: MnApplication.cxx:118
ROOT::Minuit2::MnApplication::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnApplication.cxx:141
ROOT::Minuit2::MnApplication::SetError
void SetError(unsigned int, double)
Definition: MnApplication.cxx:131
ROOT::Minuit2::MnApplication::Add
void Add(const char *Name, double val, double err)
Definition: MnApplication.cxx:99
ROOT::Minuit2::MnApplication::fFCN
const FCNBase & fFCN
Definition: MnApplication.h:72
ROOT::Minuit2::MnApplication::fUseGrad
bool fUseGrad
Definition: MnApplication.h:76
ROOT::Minuit2::MnApplication::~MnApplication
virtual ~MnApplication()
Definition: MnApplication.h:47
MnStrategy.h
ROOT::Minuit2::MnApplication::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnApplication.cxx:136
ROOT::Minuit2::MnApplication
application interface class for minimizers (migrad, simplex, Minimize, Scan) User normally instantiat...
Definition: MnApplication.h:37
ROOT::Minuit2::FCNBase
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:45
ROOT::Minuit2::MnApplication::Ext2int
double Ext2int(unsigned int, double) const
Definition: MnApplication.cxx:211
ROOT::Minuit2::MnApplication::Minimizer
virtual const ModularFunctionMinimizer & Minimizer() const =0
ROOT::Minuit2::MnApplication::Error
double Error(unsigned int) const
Definition: MnApplication.cxx:150
MnUserParameterState.h
ROOT::Minuit2::MnApplication::Release
void Release(unsigned int)
Definition: MnApplication.cxx:122
ROOT::Minuit2::MnApplication::MinuitParameters
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
Definition: MnApplication.cxx:78
ROOT::Minuit2::MnApplication::Fcnbase
virtual const FCNBase & Fcnbase() const
Definition: MnApplication.h:67
ROOT::Minuit2::MnApplication::Value
double Value(unsigned int) const
Definition: MnApplication.cxx:146
ROOT::Minuit2::MnUserCovariance
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
Definition: MnUserCovariance.h:26
ROOT::Minuit2::MnApplication::SetPrecision
void SetPrecision(double)
Definition: MnApplication.cxx:180
ROOT::Minuit2::MnApplication::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnApplication.cxx:216
ROOT::Minuit2::MnApplication::Precision
const MnMachinePrecision & Precision() const
Definition: MnApplication.h:63
ROOT::Minuit2::MnApplication::State
const MnUserParameterState & State() const
Definition: MnApplication.h:64
ROOT::Minuit2::MnApplication::NumOfCalls
unsigned int NumOfCalls() const
Definition: MnApplication.h:69
ROOT::Minuit2::MnApplication::Parameters
const MnUserParameters & Parameters() const
Definition: MnApplication.h:65
ROOT::Minuit2::MnApplication::operator()
virtual FunctionMinimum operator()(unsigned int maxfcn=0, double tolerance=0.1)
Minimize the function.
Definition: MnApplication.cxx:34
ROOT::Minuit2::MnApplication::Params
std::vector< double > Params() const
Definition: MnApplication.cxx:84
ROOT::Minuit2::MnApplication::ExtOfInt
unsigned int ExtOfInt(unsigned int) const
Definition: MnApplication.cxx:221
ROOT::Minuit2::MnUserParameters
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
Definition: MnUserParameters.h:36
ROOT::Minuit2::MnApplication::fStrategy
MnStrategy fStrategy
Definition: MnApplication.h:74
ROOT::Minuit2::MnApplication::VariableParameters
unsigned int VariableParameters() const
Definition: MnApplication.cxx:226
ROOT::Minuit2::MnUserParameterState::Precision
const MnMachinePrecision & Precision() const
Definition: MnUserParameterState.cxx:511
ROOT::Minuit2::MnApplication::Index
unsigned int Index(const char *) const
Definition: MnApplication.cxx:194
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
ROOT::Minuit2::MnApplication::Minimizer
virtual ModularFunctionMinimizer & Minimizer()=0
ROOT::Minuit2::ModularFunctionMinimizer
Base common class providing the API for all the minimizer Various Minimize methods are provided varyi...
Definition: ModularFunctionMinimizer.h:40
ROOT::Minuit2::MnApplication::SetValue
void SetValue(unsigned int, double)
Definition: MnApplication.cxx:126
ROOT::Minuit2::MnApplication::fState
MnUserParameterState fState
Definition: MnApplication.h:73
ROOT::Minuit2::FunctionMinimum
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
Definition: FunctionMinimum.h:33
ROOT::Minuit2::FCNGradientBase
Extension of the FCNBase for providing the analytical Gradient of the function.
Definition: FCNGradientBase.h:34
ROOT::Minuit2::MnUserParameterState
class which holds the external user and/or internal Minuit representation of the parameters and error...
Definition: MnUserParameterState.h:33
ROOT::Minuit2::MnUserParameterState::Parameters
const MnUserParameters & Parameters() const
Definition: MnUserParameterState.h:89
ROOT::Minuit2::MnApplication::Errors
std::vector< double > Errors() const
Definition: MnApplication.cxx:88
ROOT::Minuit2::MnApplication::Covariance
const MnUserCovariance & Covariance() const
Definition: MnApplication.h:66
ROOT::Minuit2::MnStrategy
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
ROOT::Minuit2::MnApplication::fNumCall
unsigned int fNumCall
Definition: MnApplication.h:75
ROOT::Minuit2::MnUserParameterState::Covariance
const MnUserCovariance & Covariance() const
Definition: MnUserParameterState.h:90
ROOT::Minuit2::MnApplication::Parameter
const MinuitParameter & Parameter(unsigned int i) const
Definition: MnApplication.cxx:93
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Minuit2::MnApplication::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnApplication.cxx:206
ROOT::Minuit2::MnApplication::Name
const char * Name(unsigned int) const
Definition: MnApplication.cxx:200
ROOT::Minuit2::MnApplication::Strategy
const MnStrategy & Strategy() const
Definition: MnApplication.h:68
ROOT::Minuit2::MnApplication::MnApplication
MnApplication(const FCNBase &fcn, const MnUserParameterState &state, const MnStrategy &stra, unsigned int nfcn=0)
constructor from non-gradient functions
Definition: MnApplication.cxx:21