MnUserParameters.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: MnUserParameters.h 24400 2008-06-20 07:28:49Z moneta $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #ifndef ROOT_Minuit2_MnUserParameters
00011 #define ROOT_Minuit2_MnUserParameters
00012 
00013 #include "Minuit2/MnUserTransformation.h"
00014 
00015 
00016 #include <vector>
00017 
00018 namespace ROOT {
00019 
00020    namespace Minuit2 {
00021 
00022 
00023 class MnMachinePrecision;
00024 
00025 /** API class for the user interaction with the parameters;
00026     serves as input to the minimizer as well as output from it;
00027     users can interact: Fix/release parameters, set values and errors, etc.;
00028     parameters can be accessed via their Parameter number (determined 
00029     internally by Minuit and followed the order how the parameters are created) 
00030     or via their user-specified Name (10 character string). 
00031     Minuit has also an internal parameter number which is used during the minimization
00032     (the fix parameter are skipped). The parameter number used in this class is the external 
00033     one. The class ROOT::Minuit2::MnUserTransformation is used to keep the 
00034     internal <-> external transformation
00035  */
00036 
00037 class MnUserParameters {
00038 
00039 public:
00040 
00041    MnUserParameters() : fTransformation(MnUserTransformation()) {}
00042 
00043    MnUserParameters(const std::vector<double>&, const std::vector<double>&);
00044 
00045    ~MnUserParameters() {}
00046 
00047    MnUserParameters(const MnUserParameters& par) : 
00048       fTransformation(par.fTransformation) {}
00049 
00050    MnUserParameters& operator=(const MnUserParameters& par) {
00051       fTransformation = par.fTransformation;
00052       return *this;
00053    }
00054 
00055    const MnUserTransformation& Trafo() const {return fTransformation;}
00056 
00057    unsigned int VariableParameters() const {
00058       return fTransformation.VariableParameters();
00059    }
00060 
00061    /// access to parameters (row-wise)
00062    const std::vector<ROOT::Minuit2::MinuitParameter>& Parameters() const;
00063 
00064    /// access to parameters and errors in column-wise representation 
00065    std::vector<double> Params() const;
00066    std::vector<double> Errors() const;
00067 
00068    /// access to single Parameter
00069    const MinuitParameter& Parameter(unsigned int) const;
00070 
00071    /// Add free Parameter Name, Value, Error
00072    bool Add(const std::string &, double, double);
00073    /// Add limited Parameter Name, Value, Lower bound, Upper bound
00074    bool Add(const std::string &, double, double, double, double);
00075    /// Add const Parameter Name, vale
00076    bool Add(const std::string &, double);
00077 
00078    /// interaction via external number of Parameter
00079    void Fix(unsigned int);
00080    void Release(unsigned int);
00081    void SetValue(unsigned int, double);
00082    void SetError(unsigned int, double);
00083    void SetLimits(unsigned int, double, double);
00084    void SetUpperLimit(unsigned int, double);
00085    void SetLowerLimit(unsigned int, double);
00086    void RemoveLimits(unsigned int);
00087 
00088    double Value(unsigned int) const;
00089    double Error(unsigned int) const;
00090   
00091    /// interaction via Name of Parameter
00092    void Fix(const std::string &);
00093    void Release(const std::string &);
00094    void SetValue(const std::string &, double);
00095    void SetError(const std::string &, double);
00096    void SetLimits(const std::string &, double, double);
00097    void SetUpperLimit(const std::string &, double);
00098    void SetLowerLimit(const std::string &, double);
00099    void RemoveLimits(const std::string &);
00100 
00101    double Value(const std::string &) const;
00102    double Error(const std::string &) const;
00103   
00104    //convert Name into external number of Parameter
00105    unsigned int Index(const std::string &) const;
00106    //convert external number into Name of Parameter
00107    const std::string & GetName(unsigned int) const;
00108    // mantain interface with const char * for backward compatibility
00109    const char* Name(unsigned int) const;
00110 
00111    const MnMachinePrecision& Precision() const;
00112    void SetPrecision(double eps) {fTransformation.SetPrecision(eps);}
00113 
00114 private:
00115 
00116    MnUserTransformation fTransformation;
00117 };
00118 
00119   }  // namespace Minuit2
00120 
00121 }  // namespace ROOT
00122 
00123 #endif  // ROOT_Minuit2_MnUserParameters

Generated on Tue Jul 5 14:25:45 2011 for ROOT_528-00b_version by  doxygen 1.5.1