Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:13

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_MnSimplex
0011 #define ROOT_Minuit2_MnSimplex
0012 
0013 #include "Minuit2/MnApplication.h"
0014 #include "Minuit2/SimplexMinimizer.h"
0015 
0016 #include <vector>
0017 
0018 namespace ROOT {
0019 
0020 namespace Minuit2 {
0021 
0022 class FCNBase;
0023 
0024 //_________________________________________________________________________
0025 /**
0026     API class for minimization using the Simplex method, which does not need and use
0027     the derivatives of the function, but only function values.
0028     More information on the minimization method is available
0029     <A HREF="http://seal.web.cern.ch/mathlibs/documents/minuit/mntutorial.pdf">here</A>.
0030 
0031     It allows for user interaction: set/change parameters, do minimization,
0032     change parameters, re-do minimization etc.;
0033  */
0034 
0035 class MnSimplex : public MnApplication {
0036 
0037 public:
0038    /// construct from FCNBase + std::vector for parameters and errors
0039    MnSimplex(const FCNBase &fcn, const std::vector<double> &par, const std::vector<double> &err, unsigned int stra = 1)
0040       : MnApplication(fcn, MnUserParameterState(par, err), MnStrategy(stra)), fMinimizer(SimplexMinimizer())
0041    {
0042    }
0043 
0044    /// construct from FCNBase + std::vector for parameters and covariance
0045    MnSimplex(const FCNBase &fcn, const std::vector<double> &par, unsigned int nrow, const std::vector<double> &cov,
0046              unsigned int stra = 1)
0047       : MnApplication(fcn, MnUserParameterState(par, cov, nrow), MnStrategy(stra)), fMinimizer(SimplexMinimizer())
0048    {
0049    }
0050 
0051    /// construct from FCNBase + std::vector for parameters and MnUserCovariance
0052    MnSimplex(const FCNBase &fcn, const std::vector<double> &par, const MnUserCovariance &cov, unsigned int stra = 1)
0053       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(SimplexMinimizer())
0054    {
0055    }
0056 
0057    /// construct from FCNBase + MnUserParameters
0058    MnSimplex(const FCNBase &fcn, const MnUserParameters &par, unsigned int stra = 1)
0059       : MnApplication(fcn, MnUserParameterState(par), MnStrategy(stra)), fMinimizer(SimplexMinimizer())
0060    {
0061    }
0062 
0063    /// construct from FCNBase + MnUserParameters + MnUserCovariance
0064    MnSimplex(const FCNBase &fcn, const MnUserParameters &par, const MnUserCovariance &cov, unsigned int stra = 1)
0065       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(SimplexMinimizer())
0066    {
0067    }
0068 
0069    /// construct from FCNBase + MnUserParameterState + MnStrategy
0070    MnSimplex(const FCNBase &fcn, const MnUserParameterState &par, const MnStrategy &str)
0071       : MnApplication(fcn, MnUserParameterState(par), str), fMinimizer(SimplexMinimizer())
0072    {
0073    }
0074 
0075    MnSimplex(const MnSimplex &migr)
0076       : MnApplication(migr.Fcnbase(), migr.State(), migr.Strategy(), migr.NumOfCalls()), fMinimizer(migr.fMinimizer)
0077    {
0078    }
0079 
0080    ~MnSimplex() override {}
0081 
0082    ModularFunctionMinimizer &Minimizer() override { return fMinimizer; }
0083    const ModularFunctionMinimizer &Minimizer() const override { return fMinimizer; }
0084 
0085 private:
0086    SimplexMinimizer fMinimizer;
0087 
0088 private:
0089    // forbidden assignment of migrad (const FCNBase& = )
0090    MnSimplex &operator=(const MnSimplex &) { return *this; }
0091 };
0092 
0093 } // namespace Minuit2
0094 
0095 } // namespace ROOT
0096 
0097 #endif // ROOT_Minuit2_MnSimplex