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_MnUserParameters
0011 #define ROOT_Minuit2_MnUserParameters
0012 
0013 #include "Minuit2/MnUserTransformation.h"
0014 
0015 #include <vector>
0016 #include <string>
0017 
0018 namespace ROOT {
0019 
0020 namespace Minuit2 {
0021 
0022 class MnMachinePrecision;
0023 
0024 /** API class for the user interaction with the parameters;
0025     serves as input to the minimizer as well as output from it;
0026     users can interact: Fix/release parameters, set values and errors, etc.;
0027     parameters can be accessed via their Parameter number (determined
0028     internally by Minuit and followed the order how the parameters are created)
0029     or via their user-specified Name (10 character string).
0030     Minuit has also an internal parameter number which is used during the minimization
0031     (the fix parameter are skipped). The parameter number used in this class is the external
0032     one. The class ROOT::Minuit2::MnUserTransformation is used to keep the
0033     internal <-> external transformation
0034  */
0035 
0036 class MnUserParameters {
0037 
0038 public:
0039    MnUserParameters() : fTransformation(MnUserTransformation()) {}
0040 
0041    MnUserParameters(const std::vector<double> &, const std::vector<double> &);
0042 
0043    ~MnUserParameters() {}
0044 
0045    MnUserParameters(const MnUserParameters &par) : fTransformation(par.fTransformation) {}
0046 
0047    MnUserParameters &operator=(const MnUserParameters &par)
0048    {
0049       fTransformation = par.fTransformation;
0050       return *this;
0051    }
0052 
0053    const MnUserTransformation &Trafo() const { return fTransformation; }
0054 
0055    unsigned int VariableParameters() const { return fTransformation.VariableParameters(); }
0056 
0057    /// access to parameters (row-wise)
0058    const std::vector<ROOT::Minuit2::MinuitParameter> &Parameters() const;
0059 
0060    /// access to parameters and errors in column-wise representation
0061    std::vector<double> Params() const;
0062    std::vector<double> Errors() const;
0063 
0064    /// access to single Parameter
0065    const MinuitParameter &Parameter(unsigned int) const;
0066 
0067    /// Add free Parameter Name, Value, Error
0068    bool Add(const std::string &, double, double);
0069    /// Add limited Parameter Name, Value, Lower bound, Upper bound
0070    bool Add(const std::string &, double, double, double, double);
0071    /// Add const Parameter Name, vale
0072    bool Add(const std::string &, double);
0073 
0074    /// interaction via external number of Parameter
0075    void Fix(unsigned int);
0076    void Release(unsigned int);
0077    void RemoveLimits(unsigned int);
0078    void SetValue(unsigned int, double);
0079    void SetError(unsigned int, double);
0080    void SetLimits(unsigned int, double, double);
0081    void SetUpperLimit(unsigned int, double);
0082    void SetLowerLimit(unsigned int, double);
0083    void SetName(unsigned int, const std::string &);
0084 
0085    double Value(unsigned int) const;
0086    double Error(unsigned int) const;
0087 
0088    /// interaction via Name of Parameter
0089    void Fix(const std::string &);
0090    void Release(const std::string &);
0091    void SetValue(const std::string &, double);
0092    void SetError(const std::string &, double);
0093    void SetLimits(const std::string &, double, double);
0094    void SetUpperLimit(const std::string &, double);
0095    void SetLowerLimit(const std::string &, double);
0096    void RemoveLimits(const std::string &);
0097 
0098    double Value(const std::string &) const;
0099    double Error(const std::string &) const;
0100 
0101    // convert Name into external number of Parameter
0102    unsigned int Index(const std::string &) const;
0103    // convert external number into Name of Parameter
0104    const std::string &GetName(unsigned int) const;
0105    // maintain interface with const char * for backward compatibility
0106    const char *Name(unsigned int) const;
0107 
0108    const MnMachinePrecision &Precision() const;
0109    void SetPrecision(double eps) { fTransformation.SetPrecision(eps); }
0110 
0111 private:
0112    MnUserTransformation fTransformation;
0113 };
0114 
0115 } // namespace Minuit2
0116 
0117 } // namespace ROOT
0118 
0119 #endif // ROOT_Minuit2_MnUserParameters