Logo ROOT   6.08/07
Reference Guide
MnUserParameterState.h
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef ROOT_Minuit2_MnUserParameterState
11 #define ROOT_Minuit2_MnUserParameterState
12 
16 
17 namespace ROOT {
18 
19  namespace Minuit2 {
20 
21 
22 class MinimumState;
23 
24 //_____________________________________________________________________________
25 /**
26  class which holds the external user and/or internal Minuit representation
27  of the parameters and errors;
28  transformation internal <-> external on demand;
29  */
30 
32 
33 public:
34 
35  /// default constructor (invalid state)
36  MnUserParameterState() : fValid(false), fCovarianceValid(false), fGCCValid(false), fCovStatus(-1), fFVal(0), fEDM(0), fNFcn(0),
38  fIntParameters(std::vector<double>()), fIntCovariance(MnUserCovariance()) {}
39 
40  /// construct from user parameters (before minimization)
41  MnUserParameterState(const std::vector<double>&, const std::vector<double>&);
42 
44 
45  /// construct from user parameters + covariance (before minimization)
46  MnUserParameterState(const std::vector<double>&, const std::vector<double>&, unsigned int);
47 
48  MnUserParameterState(const std::vector<double>&, const MnUserCovariance&);
49 
51 
52  /// construct from internal parameters (after minimization)
54 
56 
59  fFVal(state.fFVal), fEDM(state.fEDM), fNFcn(state.fNFcn),
60  fParameters(state.fParameters),
61  fCovariance(state.fCovariance),
63 
65  if(this != &state) {
66  fValid = state.fValid;
68  fGCCValid = state.fGCCValid;
69  fCovStatus = state.fCovStatus;
70  fFVal = state.fFVal;
71  fEDM = state.fEDM;
72  fNFcn = state.fNFcn;
73  fParameters = state.fParameters;
74  fCovariance = state.fCovariance;
75  fGlobalCC = state.fGlobalCC;
78  }
79  return *this;
80  }
81 
82  //user external representation
83  const MnUserParameters& Parameters() const {return fParameters;}
84  const MnUserCovariance& Covariance() const {return fCovariance;}
85  const MnGlobalCorrelationCoeff& GlobalCC() const {return fGlobalCC;}
86 
87  // hessian (inverse of covariance matrix)
88  MnUserCovariance Hessian() const;
89 
90  //Minuit internal representation
91  const std::vector<double>& IntParameters() const {return fIntParameters;}
93 
94  // covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not pos def
95  int CovarianceStatus() const { return fCovStatus; }
96 
97  //transformation internal <-> external
98  const MnUserTransformation& Trafo() const {return fParameters.Trafo();}
99 
100  bool IsValid() const {return fValid;}
101  bool HasCovariance() const {return fCovarianceValid;}
102  bool HasGlobalCC() const {return fGCCValid;}
103 
104  double Fval() const {return fFVal;}
105  double Edm() const {return fEDM;}
106  unsigned int NFcn() const {return fNFcn;}
107 
108 
109 public:
110 
111  /** facade: forward interface of MnUserParameters and MnUserTransformation */
112 
113  //access to parameters (row-wise)
114  const std::vector<ROOT::Minuit2::MinuitParameter>& MinuitParameters() const;
115  //access to parameters and errors in column-wise representation
116  std::vector<double> Params() const;
117  std::vector<double> Errors() const;
118 
119  //access to single Parameter
120  const MinuitParameter& Parameter(unsigned int i) const;
121 
122  //add free Parameter
123  void Add(const std::string & name, double val, double err);
124  //add limited Parameter
125  void Add(const std::string & name, double val, double err, double , double);
126  //add const Parameter
127  void Add(const std::string &, double);
128 
129  //interaction via external number of Parameter
130  void Fix(unsigned int);
131  void Release(unsigned int);
132  void RemoveLimits(unsigned int);
133  void SetValue(unsigned int, double);
134  void SetError(unsigned int, double);
135  void SetLimits(unsigned int, double, double);
136  void SetUpperLimit(unsigned int, double);
137  void SetLowerLimit(unsigned int, double);
138  void SetName(unsigned int iext, const std::string &name) { fParameters.SetName(iext,name); }
139 
140  double Value(unsigned int) const;
141  double Error(unsigned int) const;
142 
143  //interaction via Name of Parameter
144  void Fix(const std::string &);
145  void Release(const std::string &);
146  void SetValue(const std::string &, double);
147  void SetError(const std::string &, double);
148  void SetLimits(const std::string &, double, double);
149  void SetUpperLimit(const std::string &, double);
150  void SetLowerLimit(const std::string &, double);
151  void RemoveLimits(const std::string &);
152 
153  double Value(const std::string &) const;
154  double Error(const std::string &) const;
155 
156  //convert Name into external number of Parameter
157  unsigned int Index(const std::string &) const;
158  //convert external number into Name of Parameter
159  const std::string & GetName(unsigned int) const;
160  // mantain interface with const char * for backward compatibility
161  const char* Name(unsigned int) const;
162 
163  // transformation internal <-> external
164  double Int2ext(unsigned int, double) const;
165  double Ext2int(unsigned int, double) const;
166  unsigned int IntOfExt(unsigned int) const;
167  unsigned int ExtOfInt(unsigned int) const;
168  unsigned int VariableParameters() const;
169  const MnMachinePrecision& Precision() const;
170  void SetPrecision(double eps);
171 
172 
173 private:
174 
175  bool fValid;
177  bool fGCCValid;
178  int fCovStatus; // covariance matrix status
179  double fFVal;
180  double fEDM;
181  unsigned int fNFcn;
182 
186 
187  std::vector<double> fIntParameters;
189 
190 };
191 
192  } // namespace Minuit2
193 
194 } // namespace ROOT
195 
196 #endif // ROOT_Minuit2_MnUserParameterState
const std::string & GetName(unsigned int) const
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
void SetName(unsigned int, const std::string &)
STL namespace.
void Add(const std::string &name, double val, double err)
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
const std::vector< double > & IntParameters() const
determines the relative floating point arithmetic precision.
const MinuitParameter & Parameter(unsigned int i) const
std::vector< double > Params() const
unsigned int ExtOfInt(unsigned int) const
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
facade: forward interface of MnUserParameters and MnUserTransformation
void SetLimits(unsigned int, double, double)
const MnMachinePrecision & Precision() const
void SetName(unsigned int iext, const std::string &name)
const MnUserTransformation & Trafo() const
unsigned int IntOfExt(unsigned int) const
void SetUpperLimit(unsigned int, double)
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MnGlobalCorrelationCoeff & GlobalCC() const
std::vector< double > Errors() const
void SetLowerLimit(unsigned int, double)
class dealing with the transformation between user specified parameters (external) and internal param...
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
const MnUserCovariance & Covariance() const
const MnUserTransformation & Trafo() const
MnUserParameterState()
default constructor (invalid state)
const MnUserParameters & Parameters() const
class for global correlation coefficient
const char * Name(unsigned int) const
const MnUserCovariance & IntCovariance() const
unsigned int Index(const std::string &) const
double Ext2int(unsigned int, double) const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
double Int2ext(unsigned int, double) const
MnUserParameterState & operator=(const MnUserParameterState &state)
MnUserParameterState(const MnUserParameterState &state)
char name[80]
Definition: TGX11.cxx:109
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...