Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
MnHesse.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_MnHesse
11 #define ROOT_Minuit2_MnHesse
12 
13 #include "Minuit2/MnConfig.h"
14 #include "Minuit2/MnStrategy.h"
15 
16 #include <vector>
17 
18 namespace ROOT {
19 
20  namespace Minuit2 {
21 
22 
23 class FCNBase;
24 class MnUserParameterState;
25 class MnUserParameters;
26 class MnUserCovariance;
27 class MnUserTransformation;
28 class MinimumState;
29 class MnMachinePrecision;
30 class MnFcn;
31 class FunctionMinimum;
32 
33 //_______________________________________________________________________
34 /**
35  API class for calculating the numerical covariance matrix
36  (== 2x Inverse Hessian == 2x Inverse 2nd derivative); can be used by the
37  user or Minuit itself
38  */
39 
40 class MnHesse {
41 
42 public:
43 
44  /// default constructor with default strategy
45  MnHesse() : fStrategy(MnStrategy(1)) {}
46 
47  /// constructor with user-defined strategy level
48  MnHesse(unsigned int stra) : fStrategy(MnStrategy(stra)) {}
49 
50  /// conctructor with specific strategy
51  MnHesse(const MnStrategy& stra) : fStrategy(stra) {}
52 
53  ~MnHesse() {}
54 
55  ///
56  /// low-level API
57  ///
58  /// FCN + parameters + errors
59  MnUserParameterState operator()(const FCNBase&, const std::vector<double>&, const std::vector<double>&, unsigned int maxcalls=0) const;
60  /// FCN + parameters + covariance
61  MnUserParameterState operator()(const FCNBase&, const std::vector<double>&, unsigned int nrow, const std::vector<double>&, unsigned int maxcalls = 0) const;
62  /// FCN + parameters + MnUserCovariance
63  MnUserParameterState operator()(const FCNBase&, const std::vector<double>&, const MnUserCovariance&, unsigned int maxcalls=0) const;
64  ///
65  /// high-level API
66  ///
67  /// FCN + MnUserParameters
68  MnUserParameterState operator()(const FCNBase&, const MnUserParameters&, unsigned int maxcalls=0) const;
69  /// FCN + MnUserParameters + MnUserCovariance
70  MnUserParameterState operator()(const FCNBase&, const MnUserParameters&, const MnUserCovariance&, unsigned int maxcalls=0) const;
71  /// FCN + MnUserParameterState
72  MnUserParameterState operator()(const FCNBase&, const MnUserParameterState&, unsigned int maxcalls=0) const;
73  ///
74  /// API to use MnHesse after minimization when function mimimum is avalilable, otherwise information on the last state will be
75  /// lost. (It would be needed to re-call the gradient and spend extra useless function calls)
76  /// The Function Minimum is updated (modified) by adding the Hesse results as last state of minimization
77  ///
78  void operator()(const FCNBase&, FunctionMinimum&, unsigned int maxcalls=0) const;
79 
80 
81  /// internal interface
82  ///
83  MinimumState operator()(const MnFcn&, const MinimumState&, const MnUserTransformation&, unsigned int maxcalls=0) const;
84 
85  /// forward interface of MnStrategy
86  unsigned int Ncycles() const {return fStrategy.HessianNCycles();}
87  double Tolerstp() const {return fStrategy.HessianStepTolerance();}
88  double TolerG2() const {return fStrategy.HessianG2Tolerance();}
89 
90 private:
91 
92  MnStrategy fStrategy;
93 };
94 
95  } // namespace Minuit2
96 
97 } // namespace ROOT
98 
99 #endif // ROOT_Minuit2_MnHesse