Logo ROOT  
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
17namespace ROOT {
18
19 namespace Minuit2 {
20
21
22class 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
33public:
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),
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;
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;}
86
87 // hessian (inverse of covariance matrix)
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
109public:
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
173private:
174
175 bool fValid;
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
char name[80]
Definition: TGX11.cxx:109
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
class for global correlation coefficient
determines the relative floating point arithmetic precision.
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MnMachinePrecision & Precision() const
void SetLimits(unsigned int, double, double)
const MnUserParameters & Parameters() const
unsigned int Index(const std::string &) const
const std::string & GetName(unsigned int) const
double Int2ext(unsigned int, double) const
void SetName(unsigned int iext, const std::string &name)
const MnGlobalCorrelationCoeff & GlobalCC() const
MnUserParameterState & operator=(const MnUserParameterState &state)
const MinuitParameter & Parameter(unsigned int i) const
double Ext2int(unsigned int, double) const
const std::vector< double > & IntParameters() const
void Add(const std::string &name, double val, double err)
unsigned int ExtOfInt(unsigned int) const
const char * Name(unsigned int) const
MnUserParameterState()
default constructor (invalid state)
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
facade: forward interface of MnUserParameters and MnUserTransformation
unsigned int IntOfExt(unsigned int) const
const MnUserTransformation & Trafo() const
void SetUpperLimit(unsigned int, double)
const MnUserCovariance & IntCovariance() const
const MnUserCovariance & Covariance() const
std::vector< double > Errors() const
void SetLowerLimit(unsigned int, double)
MnUserParameterState(const MnUserParameterState &state)
std::vector< double > Params() const
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
void SetName(unsigned int, const std::string &)
const MnUserTransformation & Trafo() const
class dealing with the transformation between user specified parameters (external) and internal param...
VSD Structures.
Definition: StringConv.hxx:21