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_MnScan
0011 #define ROOT_Minuit2_MnScan
0012 
0013 #include "Minuit2/MnApplication.h"
0014 #include "Minuit2/ScanMinimizer.h"
0015 
0016 #include <vector>
0017 #include <utility>
0018 
0019 namespace ROOT {
0020 
0021 namespace Minuit2 {
0022 
0023 class FCNBase;
0024 
0025 //_______________________________________________________________________
0026 /**
0027     API class for minimization using a scan method to find the minimum;
0028     allows for user interaction: set/change parameters, do minimization,
0029     change parameters, re-do minimization etc.;
0030 
0031  */
0032 
0033 class MnScan : public MnApplication {
0034 
0035 public:
0036    /// construct from FCNBase + std::vector for parameters and errors
0037    MnScan(const FCNBase &fcn, const std::vector<double> &par, const std::vector<double> &err, unsigned int stra = 1)
0038       : MnApplication(fcn, MnUserParameterState(par, err), MnStrategy(stra)), fMinimizer(ScanMinimizer())
0039    {
0040    }
0041 
0042    /// construct from FCNBase + std::vector for parameters and covariance
0043    MnScan(const FCNBase &fcn, const std::vector<double> &par, unsigned int nrow, const std::vector<double> &cov,
0044           unsigned int stra = 1)
0045       : MnApplication(fcn, MnUserParameterState(par, cov, nrow), MnStrategy(stra)), fMinimizer(ScanMinimizer())
0046    {
0047    }
0048 
0049    /// construct from FCNBase + std::vector for parameters and MnUserCovariance
0050    MnScan(const FCNBase &fcn, const std::vector<double> &par, const MnUserCovariance &cov, unsigned int stra = 1)
0051       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(ScanMinimizer())
0052    {
0053    }
0054 
0055    /// construct from FCNBase + MnUserParameters
0056    MnScan(const FCNBase &fcn, const MnUserParameters &par, unsigned int stra = 1)
0057       : MnApplication(fcn, MnUserParameterState(par), MnStrategy(stra)), fMinimizer(ScanMinimizer())
0058    {
0059    }
0060 
0061    /// construct from FCNBase + MnUserParameters + MnUserCovariance
0062    MnScan(const FCNBase &fcn, const MnUserParameters &par, const MnUserCovariance &cov, unsigned int stra = 1)
0063       : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(ScanMinimizer())
0064    {
0065    }
0066 
0067    /// construct from FCNBase + MnUserParameterState + MnStrategy
0068    MnScan(const FCNBase &fcn, const MnUserParameterState &par, const MnStrategy &str)
0069       : MnApplication(fcn, MnUserParameterState(par), str), fMinimizer(ScanMinimizer())
0070    {
0071    }
0072 
0073    MnScan(const MnScan &migr)
0074       : MnApplication(migr.Fcnbase(), migr.State(), migr.Strategy(), migr.NumOfCalls()), fMinimizer(migr.fMinimizer)
0075    {
0076    }
0077 
0078    ~MnScan() override {}
0079 
0080    ModularFunctionMinimizer &Minimizer() override { return fMinimizer; }
0081    const ModularFunctionMinimizer &Minimizer() const override { return fMinimizer; }
0082 
0083    std::vector<std::pair<double, double>>
0084    Scan(unsigned int par, unsigned int maxsteps = 41, double low = 0., double high = 0.);
0085 
0086 private:
0087    ScanMinimizer fMinimizer;
0088 
0089 private:
0090    /// forbidden assignment (const FCNBase& = )
0091    MnScan &operator=(const MnScan &) { return *this; }
0092 };
0093 
0094 } // namespace Minuit2
0095 
0096 } // namespace ROOT
0097 
0098 #endif // ROOT_Minuit2_MnScan