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 
17 #include <vector>
18 #include <string>
19 
20 namespace ROOT {
21 
22  namespace Minuit2 {
23 
24 
25 class MinimumState;
26 
27 //_____________________________________________________________________________
28 /**
29  class which holds the external user and/or internal Minuit representation
30  of the parameters and errors;
31  transformation internal <-> external on demand;
32  */
33 
34 class MnUserParameterState {
35 
36 public:
37 
38  /// default constructor (invalid state)
39  MnUserParameterState() : fValid(false), fCovarianceValid(false), fGCCValid(false), fCovStatus(-1), fFVal(0), fEDM(0), fNFcn(0),
40  fParameters(MnUserParameters()), fCovariance(MnUserCovariance()),
41  fIntParameters(std::vector<double>()), fIntCovariance(MnUserCovariance()) {}
42 
43  /// construct from user parameters (before minimization)
44  MnUserParameterState(const std::vector<double>&, const std::vector<double>&);
45 
47 
48  /// construct from user parameters + covariance (before minimization)
49  MnUserParameterState(const std::vector<double>&, const std::vector<double>&, unsigned int);
50 
51  MnUserParameterState(const std::vector<double>&, const MnUserCovariance&);
52 
54 
55  /// construct from internal parameters (after minimization)
57 
59 
62  fFVal(state.fFVal), fEDM(state.fEDM), fNFcn(state.fNFcn),
63  fParameters(state.fParameters),
64  fCovariance(state.fCovariance),
66 
68  if(this != &state) {
69  fValid = state.fValid;
70  fCovarianceValid = state.fCovarianceValid;
71  fGCCValid = state.fGCCValid;
72  fCovStatus = state.fCovStatus;
73  fFVal = state.fFVal;
74  fEDM = state.fEDM;
75  fNFcn = state.fNFcn;
76  fParameters = state.fParameters;
77  fCovariance = state.fCovariance;
78  fGlobalCC = state.fGlobalCC;
79  fIntParameters = state.fIntParameters;
80  fIntCovariance = state.fIntCovariance;
81  }
82  return *this;
83  }
84 
85  //user external representation
86  const MnUserParameters& Parameters() const {return fParameters;}
87  const MnUserCovariance& Covariance() const {return fCovariance;}
88  const MnGlobalCorrelationCoeff& GlobalCC() const {return fGlobalCC;}
89 
90  // hessian (inverse of covariance matrix)
91  MnUserCovariance Hessian() const;
92 
93  //Minuit internal representation
94  const std::vector<double>& IntParameters() const {return fIntParameters;}
96 
97  // covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not pos def
98  int CovarianceStatus() const { return fCovStatus; }
99 
100  //transformation internal <-> external
101  const MnUserTransformation& Trafo() const {return fParameters.Trafo();}
102 
103  bool IsValid() const {return fValid;}
104  bool HasCovariance() const {return fCovarianceValid;}
105  bool HasGlobalCC() const {return fGCCValid;}
106 
107  double Fval() const {return fFVal;}
108  double Edm() const {return fEDM;}
109  unsigned int NFcn() const {return fNFcn;}
110 
111 
112 public:
113 
114  /** facade: forward interface of MnUserParameters and MnUserTransformation */
115 
116  //access to parameters (row-wise)
117  const std::vector<ROOT::Minuit2::MinuitParameter>& MinuitParameters() const;
118  //access to parameters and errors in column-wise representation
119  std::vector<double> Params() const;
120  std::vector<double> Errors() const;
121 
122  //access to single Parameter
123  const MinuitParameter& Parameter(unsigned int i) const;
124 
125  //add free Parameter
126  void Add(const std::string & name, double val, double err);
127  //add limited Parameter
128  void Add(const std::string & name, double val, double err, double , double);
129  //add const Parameter
130  void Add(const std::string &, double);
131 
132  //interaction via external number of Parameter
133  void Fix(unsigned int);
134  void Release(unsigned int);
135  void RemoveLimits(unsigned int);
136  void SetValue(unsigned int, double);
137  void SetError(unsigned int, double);
138  void SetLimits(unsigned int, double, double);
139  void SetUpperLimit(unsigned int, double);
140  void SetLowerLimit(unsigned int, double);
141  void SetName(unsigned int iext, const std::string &name) { fParameters.SetName(iext,name); }
142 
143  double Value(unsigned int) const;
144  double Error(unsigned int) const;
145 
146  //interaction via Name of Parameter
147  void Fix(const std::string &);
148  void Release(const std::string &);
149  void SetValue(const std::string &, double);
150  void SetError(const std::string &, double);
151  void SetLimits(const std::string &, double, double);
152  void SetUpperLimit(const std::string &, double);
153  void SetLowerLimit(const std::string &, double);
154  void RemoveLimits(const std::string &);
155 
156  double Value(const std::string &) const;
157  double Error(const std::string &) const;
158 
159  //convert Name into external number of Parameter
160  unsigned int Index(const std::string &) const;
161  //convert external number into Name of Parameter
162  const std::string & GetName(unsigned int) const;
163  // mantain interface with const char * for backward compatibility
164  const char* Name(unsigned int) const;
165 
166  // transformation internal <-> external
167  double Int2ext(unsigned int, double) const;
168  double Ext2int(unsigned int, double) const;
169  unsigned int IntOfExt(unsigned int) const;
170  unsigned int ExtOfInt(unsigned int) const;
171  unsigned int VariableParameters() const;
172  const MnMachinePrecision& Precision() const;
173  void SetPrecision(double eps);
174 
175 
176 private:
177 
178  bool fValid;
179  bool fCovarianceValid;
180  bool fGCCValid;
181  int fCovStatus; // covariance matrix status
182  double fFVal;
183  double fEDM;
184  unsigned int fNFcn;
185 
189 
190  std::vector<double> fIntParameters;
192 
193 };
194 
195  } // namespace Minuit2
196 
197 } // namespace ROOT
198 
199 #endif // ROOT_Minuit2_MnUserParameterState
ROOT::Minuit2::MinuitParameter
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
Definition: MinuitParameter.h:41
ROOT::Minuit2::MnUserParameterState::HasCovariance
bool HasCovariance() const
Definition: MnUserParameterState.h:112
ROOT::Minuit2::MnUserParameterState::Error
double Error(unsigned int) const
Definition: MnUserParameterState.cxx:373
ROOT::Minuit2::MnUserParameterState::fGCCValid
bool fGCCValid
Definition: MnUserParameterState.h:188
ROOT::Minuit2::MinimumState
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:37
ROOT::Minuit2::MnUserParameterState::MinuitParameters
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
facade: forward interface of MnUserParameters and MnUserTransformation
Definition: MnUserParameterState.cxx:193
ROOT::Minuit2::MnUserParameterState::~MnUserParameterState
~MnUserParameterState()
Definition: MnUserParameterState.h:66
ROOT::Minuit2::MnUserParameterState::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnUserParameterState.cxx:360
ROOT::Minuit2::MnUserParameterState::SetError
void SetError(unsigned int, double)
Definition: MnUserParameterState.cxx:311
ROOT::Minuit2::MnUserParameterState::NFcn
unsigned int NFcn() const
Definition: MnUserParameterState.h:117
ROOT::Minuit2::MnUserParameterState::Fval
double Fval() const
Definition: MnUserParameterState.h:115
ROOT::Minuit2::MnUserParameterState::fEDM
double fEDM
Definition: MnUserParameterState.h:191
ROOT::Minuit2::MnUserCovariance
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
Definition: MnUserCovariance.h:35
ROOT::Minuit2::MnUserParameterState::CovarianceStatus
int CovarianceStatus() const
Definition: MnUserParameterState.h:106
ROOT::Minuit2::MnUserParameterState::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserParameterState.cxx:433
ROOT::Minuit2::MnUserParameterState::SetPrecision
void SetPrecision(double eps)
Definition: MnUserParameterState.cxx:442
ROOT::Minuit2::MnUserParameterState::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnUserParameterState.cxx:316
ROOT::Minuit2::MnUserParameterState::IsValid
bool IsValid() const
Definition: MnUserParameterState.h:111
ROOT::Minuit2::MnUserParameterState::Edm
double Edm() const
Definition: MnUserParameterState.h:116
MnUserParameters.h
ROOT::Minuit2::MnUserParameters::SetName
void SetName(unsigned int, const std::string &)
Definition: MnUserParameters.cxx:107
ROOT::Minuit2::MnUserParameterState::fGlobalCC
MnGlobalCorrelationCoeff fGlobalCC
Definition: MnUserParameterState.h:196
ROOT::Minuit2::MnUserParameterState::operator=
MnUserParameterState & operator=(const MnUserParameterState &state)
Definition: MnUserParameterState.h:75
ROOT::Minuit2::MnUserParameterState::GetName
const std::string & GetName(unsigned int) const
Definition: MnUserParameterState.cxx:410
ROOT::Minuit2::MnUserParameterState::fCovariance
MnUserCovariance fCovariance
Definition: MnUserParameterState.h:195
ROOT::Minuit2::MnGlobalCorrelationCoeff
class for global correlation coefficient
Definition: MnGlobalCorrelationCoeff.h:34
ROOT::Minuit2::MnUserParameterState::fCovarianceValid
bool fCovarianceValid
Definition: MnUserParameterState.h:187
ROOT::Minuit2::MnUserParameterState::Name
const char * Name(unsigned int) const
Definition: MnUserParameterState.cxx:406
ROOT::Minuit2::MnUserParameterState::Hessian
MnUserCovariance Hessian() const
Definition: MnUserParameterState.cxx:168
ROOT::Minuit2::MnUserParameterState::IntParameters
const std::vector< double > & IntParameters() const
Definition: MnUserParameterState.h:102
ROOT::Minuit2::MnUserParameters
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
Definition: MnUserParameters.h:45
ROOT::Minuit2::MnUserParameterState::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameterState.h:109
ROOT::Minuit2::MnUserParameterState::Precision
const MnMachinePrecision & Precision() const
Definition: MnUserParameterState.cxx:437
ROOT::Minuit2::MnUserParameterState::SetValue
void SetValue(unsigned int, double)
Definition: MnUserParameterState.cxx:299
ROOT::Minuit2::MnUserParameterState::Params
std::vector< double > Params() const
Definition: MnUserParameterState.cxx:198
ROOT::Minuit2::MnUserParameterState::Errors
std::vector< double > Errors() const
Definition: MnUserParameterState.cxx:202
ROOT::Minuit2::MnUserParameterState::fValid
bool fValid
Definition: MnUserParameterState.h:186
ROOT::Minuit2::MnUserParameterState::HasGlobalCC
bool HasGlobalCC() const
Definition: MnUserParameterState.h:113
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:41
ROOT::Minuit2::MnUserParameterState::SetUpperLimit
void SetUpperLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:332
double
double
Definition: Converters.cxx:921
ROOT::Minuit2::MnUserParameterState::fIntParameters
std::vector< double > fIntParameters
Definition: MnUserParameterState.h:198
ROOT::Minuit2::MnUserParameters::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameters.h:63
ROOT::Minuit2::MnUserParameterState::MnUserParameterState
MnUserParameterState()
default constructor (invalid state)
Definition: MnUserParameterState.h:47
ROOT::Minuit2::MnUserParameterState::fNFcn
unsigned int fNFcn
Definition: MnUserParameterState.h:192
ROOT::Minuit2::MnUserParameterState::fCovStatus
int fCovStatus
Definition: MnUserParameterState.h:189
MnUserCovariance.h
ROOT::Minuit2::MnUserParameterState::ExtOfInt
unsigned int ExtOfInt(unsigned int) const
Definition: MnUserParameterState.cxx:429
ROOT::Minuit2::MnUserParameterState::Add
void Add(const std::string &name, double val, double err)
Definition: MnUserParameterState.cxx:212
ROOT::Minuit2::MnUserParameterState::SetName
void SetName(unsigned int iext, const std::string &name)
Definition: MnUserParameterState.h:149
ROOT::Minuit2::MnUserTransformation
class dealing with the transformation between user specified parameters (external) and internal param...
Definition: MnUserTransformation.h:47
ROOT::Minuit2::MnUserParameterState
class which holds the external user and/or internal Minuit representation of the parameters and error...
Definition: MnUserParameterState.h:42
ROOT::Minuit2::MnUserParameterState::Parameter
const MinuitParameter & Parameter(unsigned int i) const
Definition: MnUserParameterState.cxx:207
ROOT::Minuit2::MnUserParameterState::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnUserParameterState.cxx:425
ROOT::Minuit2::MnUserParameterState::Parameters
const MnUserParameters & Parameters() const
Definition: MnUserParameterState.h:94
ROOT::Minuit2::MnUserParameterState::GlobalCC
const MnGlobalCorrelationCoeff & GlobalCC() const
Definition: MnUserParameterState.h:96
ROOT::Minuit2::MnUserParameterState::Index
unsigned int Index(const std::string &) const
Definition: MnUserParameterState.cxx:401
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Minuit2::MnUserParameterState::Release
void Release(unsigned int)
Definition: MnUserParameterState.cxx:285
ROOT::Minuit2::MnUserParameterState::fFVal
double fFVal
Definition: MnUserParameterState.h:190
ROOT::Minuit2::MnUserParameterState::Ext2int
double Ext2int(unsigned int, double) const
Definition: MnUserParameterState.cxx:421
ROOT::Minuit2::MnUserParameterState::fIntCovariance
MnUserCovariance fIntCovariance
Definition: MnUserParameterState.h:199
ROOT::Minuit2::MnUserParameterState::SetLowerLimit
void SetLowerLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:346
ROOT::Minuit2::MnUserParameterState::Value
double Value(unsigned int) const
Definition: MnUserParameterState.cxx:369
ROOT::Minuit2::MnUserParameterState::Covariance
const MnUserCovariance & Covariance() const
Definition: MnUserParameterState.h:95
ROOT
VSD Structures.
Definition: StringConv.hxx:21
MnGlobalCorrelationCoeff.h
ROOT::Minuit2::MnUserParameterState::IntCovariance
const MnUserCovariance & IntCovariance() const
Definition: MnUserParameterState.h:103
ROOT::Minuit2::MnUserParameterState::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserParameterState.cxx:417
ROOT::Minuit2::MnUserParameterState::Fix
void Fix(unsigned int)
Definition: MnUserParameterState.cxx:271
ROOT::Minuit2::MnUserParameterState::fParameters
MnUserParameters fParameters
Definition: MnUserParameterState.h:194