Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:31:45

0001 // @(#)root/minuit2:$Id$
0002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
0007  *                                                                    *
0008  **********************************************************************/
0009 
0010 #ifndef ROOT_Minuit2_MnHesse
0011 #define ROOT_Minuit2_MnHesse
0012 
0013 #include "Minuit2/MnConfig.h"
0014 #include "Minuit2/MnStrategy.h"
0015 
0016 #include <ROOT/RSpan.hxx>
0017 
0018 #include <vector>
0019 
0020 namespace ROOT {
0021 
0022 namespace Minuit2 {
0023 
0024 class FCNBase;
0025 class MnUserParameterState;
0026 class MnUserParameters;
0027 class MnUserCovariance;
0028 class MnUserTransformation;
0029 class MinimumState;
0030 class MnMachinePrecision;
0031 class MnFcn;
0032 class FunctionMinimum;
0033 
0034 //_______________________________________________________________________
0035 /**
0036     API class for calculating the numerical covariance matrix
0037     (== 2x Inverse Hessian == 2x Inverse 2nd derivative); can be used by the
0038     user or Minuit itself
0039  */
0040 
0041 class MnHesse {
0042 
0043 public:
0044    /// default constructor with default strategy
0045    MnHesse() : fStrategy(MnStrategy(1)) {}
0046 
0047    /// constructor with user-defined strategy level
0048    MnHesse(unsigned int stra) : fStrategy(MnStrategy(stra)) {}
0049 
0050    /// conctructor with specific strategy
0051    MnHesse(const MnStrategy &stra) : fStrategy(stra) {}
0052 
0053    /// FCN + MnUserParameterState
0054    MnUserParameterState operator()(const FCNBase &, const MnUserParameterState &, unsigned int maxcalls = 0) const;
0055    ///
0056    /// API to use MnHesse after minimization when function minimum is avalilable, otherwise information on the last
0057    /// state will be lost. (It would be needed to re-call the gradient and spend extra useless function calls) The
0058    /// Function Minimum is updated (modified) by adding the Hesse results as last state of minimization
0059    ///
0060    void operator()(const FCNBase &, FunctionMinimum &, unsigned int maxcalls = 0) const;
0061 
0062    /// internal interface
0063    ///
0064    MinimumState
0065    operator()(const MnFcn &, const MinimumState &, const MnUserTransformation &, unsigned int maxcalls = 0) const;
0066 
0067    /// forward interface of MnStrategy
0068    unsigned int Ncycles() const { return fStrategy.HessianNCycles(); }
0069    double Tolerstp() const { return fStrategy.HessianStepTolerance(); }
0070    double TolerG2() const { return fStrategy.HessianG2Tolerance(); }
0071 
0072 private:
0073    MnStrategy fStrategy;
0074 };
0075 
0076 } // namespace Minuit2
0077 
0078 } // namespace ROOT
0079 
0080 #endif // ROOT_Minuit2_MnHesse