Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:25

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_MnMinimize
0011 #define ROOT_Minuit2_MnMinimize
0012 
0013 #include "Minuit2/MnApplication.h"
0014 #include "Minuit2/CombinedMinimizer.h"
0015 
0016 #include <vector>
0017 
0018 namespace ROOT {
0019 
0020 namespace Minuit2 {
0021 
0022 class FCNBase;
0023 
0024 /** API class for minimization using Variable Metric technology ("MIGRAD");
0025     allows for user interaction: set/change parameters, do minimization,
0026     change parameters, re-do minimization etc.;
0027     also used by MnMinos and MnContours;
0028  */
0029 
0030 class MnMinimize : public MnApplication {
0031 
0032 public:
0033    /// construct from FCNBase + std::vector for parameters and errors
0034    MnMinimize(const FCNBase &fcn, const std::vector<double> &par, const std::vector<double> &err, unsigned int stra = 1)
0035       : MnApplication(fcn, MnUserParameterState(par, err), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0036    {
0037    }
0038 
0039    /// construct from FCNBase + std::vector for parameters and covariance
0040    MnMinimize(const FCNBase &fcn, const std::vector<double> &par, unsigned int nrow, const std::vector<double> &cov,
0041               unsigned int stra = 1)
0042       : MnApplication(fcn, MnUserParameterState(par, cov, nrow), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0043    {
0044    }
0045 
0046    /// construct from FCNBase + std::vector for parameters and MnUserCovariance
0047    MnMinimize(const FCNBase &fcn, const std::vector<double> &par, const MnUserCovariance &cov, unsigned int stra = 1)
0048       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0049    {
0050    }
0051 
0052    /// construct from FCNBase + MnUserParameters
0053    MnMinimize(const FCNBase &fcn, const MnUserParameters &par, unsigned int stra = 1)
0054       : MnApplication(fcn, MnUserParameterState(par), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0055    {
0056    }
0057 
0058    /// construct from FCNBase + MnUserParameters + MnUserCovariance
0059    MnMinimize(const FCNBase &fcn, const MnUserParameters &par, const MnUserCovariance &cov, unsigned int stra = 1)
0060       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0061    {
0062    }
0063 
0064    /// construct from FCNBase + MnUserParameterState + MnStrategy
0065    MnMinimize(const FCNBase &fcn, const MnUserParameterState &par, const MnStrategy &str)
0066       : MnApplication(fcn, MnUserParameterState(par), str), fMinimizer(CombinedMinimizer())
0067    {
0068    }
0069 
0070    // interfaces using FCNGradientBase
0071 
0072    /// construct from FCNGradientBase + std::vector for parameters and errors
0073    MnMinimize(const FCNGradientBase &fcn, const std::vector<double> &par, const std::vector<double> &err,
0074               unsigned int stra = 1)
0075       : MnApplication(fcn, MnUserParameterState(par, err), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0076    {
0077    }
0078 
0079    /// construct from FCNGradientBase + std::vector for parameters and covariance
0080    MnMinimize(const FCNGradientBase &fcn, const std::vector<double> &par, unsigned int nrow,
0081               const std::vector<double> &cov, unsigned int stra = 1)
0082       : MnApplication(fcn, MnUserParameterState(par, cov, nrow), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0083    {
0084    }
0085 
0086    /// construct from FCNGradientBase + std::vector for parameters and MnUserCovariance
0087    MnMinimize(const FCNGradientBase &fcn, const std::vector<double> &par, const MnUserCovariance &cov,
0088               unsigned int stra = 1)
0089       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0090    {
0091    }
0092 
0093    /// construct from FCNGradientBase + MnUserParameters
0094    MnMinimize(const FCNGradientBase &fcn, const MnUserParameters &par, unsigned int stra = 1)
0095       : MnApplication(fcn, MnUserParameterState(par), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0096    {
0097    }
0098 
0099    /// construct from FCNGradientBase + MnUserParameters + MnUserCovariance
0100    MnMinimize(const FCNGradientBase &fcn, const MnUserParameters &par, const MnUserCovariance &cov,
0101               unsigned int stra = 1)
0102       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(CombinedMinimizer())
0103    {
0104    }
0105 
0106    /// construct from FCNGradientBase + MnUserParameterState + MnStrategy
0107    MnMinimize(const FCNGradientBase &fcn, const MnUserParameterState &par, const MnStrategy &str)
0108       : MnApplication(fcn, MnUserParameterState(par), str), fMinimizer(CombinedMinimizer())
0109    {
0110    }
0111 
0112    MnMinimize(const MnMinimize &migr)
0113       : MnApplication(migr.Fcnbase(), migr.State(), migr.Strategy(), migr.NumOfCalls()), fMinimizer(migr.fMinimizer)
0114    {
0115    }
0116 
0117    ~MnMinimize() override {}
0118 
0119    ModularFunctionMinimizer &Minimizer() override { return fMinimizer; }
0120    const ModularFunctionMinimizer &Minimizer() const override { return fMinimizer; }
0121 
0122 private:
0123    CombinedMinimizer fMinimizer;
0124 
0125 private:
0126    // forbidden assignment operator
0127    MnMinimize &operator=(const MnMinimize &) { return *this; }
0128 };
0129 
0130 } // namespace Minuit2
0131 
0132 } // namespace ROOT
0133 
0134 #endif // ROOT_Minuit2_MnMinimize