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 class MinimumState;
25 
26 //_____________________________________________________________________________
27 /**
28  class which holds the external user and/or internal Minuit representation
29  of the parameters and errors;
30  transformation internal <-> external on demand;
31  */
32 
34 
35 public:
36  /// default constructor (invalid state)
38  : fValid(false), fCovarianceValid(false), fGCCValid(false), fCovStatus(-1), fFVal(0), fEDM(0), fNFcn(0),
41  {
42  }
43 
44  /// construct from user parameters (before minimization)
45  MnUserParameterState(const std::vector<double> &, const std::vector<double> &);
46 
48 
49  /// construct from user parameters + covariance (before minimization)
50  MnUserParameterState(const std::vector<double> &, const std::vector<double> &, unsigned int);
51 
52  MnUserParameterState(const std::vector<double> &, const MnUserCovariance &);
53 
55 
56  /// construct from internal parameters (after minimization)
57  MnUserParameterState(const MinimumState &, double, const MnUserTransformation &);
58 
60 
63  fCovStatus(state.fCovStatus), fFVal(state.fFVal), fEDM(state.fEDM), fNFcn(state.fNFcn),
66  {
67  }
68 
70  {
71  if (this != &state) {
72  fValid = state.fValid;
74  fGCCValid = state.fGCCValid;
75  fCovStatus = state.fCovStatus;
76  fFVal = state.fFVal;
77  fEDM = state.fEDM;
78  fNFcn = state.fNFcn;
79  fParameters = state.fParameters;
80  fCovariance = state.fCovariance;
81  fGlobalCC = state.fGlobalCC;
84  }
85  return *this;
86  }
87 
88  // user external representation
89  const MnUserParameters &Parameters() const { return fParameters; }
90  const MnUserCovariance &Covariance() const { return fCovariance; }
91  const MnGlobalCorrelationCoeff &GlobalCC() const { return fGlobalCC; }
92 
93  // hessian (inverse of covariance matrix)
94  MnUserCovariance Hessian() const;
95 
96  // Minuit internal representation
97  const std::vector<double> &IntParameters() const { return fIntParameters; }
98  const MnUserCovariance &IntCovariance() const { return fIntCovariance; }
99 
100  // covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not pos def
101  int CovarianceStatus() const { return fCovStatus; }
102 
103  // transformation internal <-> external
104  const MnUserTransformation &Trafo() const { return fParameters.Trafo(); }
105 
106  bool IsValid() const { return fValid; }
107  bool HasCovariance() const { return fCovarianceValid; }
108  bool HasGlobalCC() const { return fGCCValid; }
109 
110  double Fval() const { return fFVal; }
111  double Edm() const { return fEDM; }
112  unsigned int NFcn() const { return fNFcn; }
113 
114 public:
115  /** facade: forward interface of MnUserParameters and MnUserTransformation */
116 
117  // access to parameters (row-wise)
118  const std::vector<ROOT::Minuit2::MinuitParameter> &MinuitParameters() const;
119  // access to parameters and errors in column-wise representation
120  std::vector<double> Params() const;
121  std::vector<double> Errors() const;
122 
123  // access to single Parameter
124  const MinuitParameter &Parameter(unsigned int i) const;
125 
126  // add free Parameter
127  void Add(const std::string &name, double val, double err);
128  // add limited Parameter
129  void Add(const std::string &name, double val, double err, double, double);
130  // add const Parameter
131  void Add(const std::string &, double);
132 
133  // interaction via external number of Parameter
134  void Fix(unsigned int);
135  void Release(unsigned int);
136  void RemoveLimits(unsigned int);
137  void SetValue(unsigned int, double);
138  void SetError(unsigned int, double);
139  void SetLimits(unsigned int, double, double);
140  void SetUpperLimit(unsigned int, double);
141  void SetLowerLimit(unsigned int, double);
142  void SetName(unsigned int iext, const std::string &name) { fParameters.SetName(iext, name); }
143 
144  double Value(unsigned int) const;
145  double Error(unsigned int) const;
146 
147  // interaction via Name of Parameter
148  void Fix(const std::string &);
149  void Release(const std::string &);
150  void SetValue(const std::string &, double);
151  void SetError(const std::string &, double);
152  void SetLimits(const std::string &, double, double);
153  void SetUpperLimit(const std::string &, double);
154  void SetLowerLimit(const std::string &, double);
155  void RemoveLimits(const std::string &);
156 
157  double Value(const std::string &) const;
158  double Error(const std::string &) const;
159 
160  // convert Name into external number of Parameter
161  unsigned int Index(const std::string &) const;
162  // convert external number into Name of Parameter
163  const std::string &GetName(unsigned int) const;
164  // mantain interface with const char * for backward compatibility
165  const char *Name(unsigned int) const;
166 
167  // transformation internal <-> external
168  double Int2ext(unsigned int, double) const;
169  double Ext2int(unsigned int, double) const;
170  unsigned int IntOfExt(unsigned int) const;
171  unsigned int ExtOfInt(unsigned int) const;
172  unsigned int VariableParameters() const;
173  const MnMachinePrecision &Precision() const;
174  void SetPrecision(double eps);
175 
176 private:
177  bool fValid;
179  bool fGCCValid;
180  int fCovStatus; // covariance matrix status
181  double fFVal;
182  double fEDM;
183  unsigned int fNFcn;
184 
188 
189  std::vector<double> fIntParameters;
191 };
192 
193 } // namespace Minuit2
194 
195 } // namespace ROOT
196 
197 #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:33
ROOT::Minuit2::MnUserParameterState::HasCovariance
bool HasCovariance() const
Definition: MnUserParameterState.h:107
ROOT::Minuit2::MnUserParameterState::Error
double Error(unsigned int) const
Definition: MnUserParameterState.cxx:409
ROOT::Minuit2::MnUserParameterState::fGCCValid
bool fGCCValid
Definition: MnUserParameterState.h:179
ROOT::Minuit2::MinimumState
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
ROOT::Minuit2::MnUserParameterState::MinuitParameters
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
facade: forward interface of MnUserParameters and MnUserTransformation
Definition: MnUserParameterState.cxx:213
ROOT::Minuit2::MnUserParameterState::~MnUserParameterState
~MnUserParameterState()
Definition: MnUserParameterState.h:59
ROOT::Minuit2::MnUserParameterState::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnUserParameterState.cxx:394
ROOT::Minuit2::MnUserParameterState::SetError
void SetError(unsigned int, double)
Definition: MnUserParameterState.cxx:341
ROOT::Minuit2::MnUserParameterState::NFcn
unsigned int NFcn() const
Definition: MnUserParameterState.h:112
ROOT::Minuit2::MnUserParameterState::Fval
double Fval() const
Definition: MnUserParameterState.h:110
ROOT::Minuit2::MnUserParameterState::fEDM
double fEDM
Definition: MnUserParameterState.h:182
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:26
ROOT::Minuit2::MnUserParameterState::CovarianceStatus
int CovarianceStatus() const
Definition: MnUserParameterState.h:101
ROOT::Minuit2::MnUserParameterState::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserParameterState.cxx:506
ROOT::Minuit2::MnUserParameterState::SetPrecision
void SetPrecision(double eps)
Definition: MnUserParameterState.cxx:517
ROOT::Minuit2::MnUserParameterState::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnUserParameterState.cxx:347
ROOT::Minuit2::MnUserParameterState::IsValid
bool IsValid() const
Definition: MnUserParameterState.h:106
ROOT::Minuit2::MnUserParameterState::Edm
double Edm() const
Definition: MnUserParameterState.h:111
MnUserParameters.h
ROOT::Minuit2::MnUserParameters::SetName
void SetName(unsigned int, const std::string &)
Definition: MnUserParameters.cxx:116
ROOT::Minuit2::MnUserParameterState::fGlobalCC
MnGlobalCorrelationCoeff fGlobalCC
Definition: MnUserParameterState.h:187
ROOT::Minuit2::MnUserParameterState::operator=
MnUserParameterState & operator=(const MnUserParameterState &state)
Definition: MnUserParameterState.h:69
ROOT::Minuit2::MnUserParameterState::GetName
const std::string & GetName(unsigned int) const
Definition: MnUserParameterState.cxx:478
ROOT::Minuit2::MnUserParameterState::fCovariance
MnUserCovariance fCovariance
Definition: MnUserParameterState.h:186
ROOT::Minuit2::MnGlobalCorrelationCoeff
class for global correlation coefficient
Definition: MnGlobalCorrelationCoeff.h:25
ROOT::Minuit2::MnUserParameterState::fCovarianceValid
bool fCovarianceValid
Definition: MnUserParameterState.h:178
ROOT::Minuit2::MnUserParameterState::Name
const char * Name(unsigned int) const
Definition: MnUserParameterState.cxx:473
ROOT::Minuit2::MnUserParameterState::Hessian
MnUserCovariance Hessian() const
Definition: MnUserParameterState.cxx:187
ROOT::Minuit2::MnUserParameterState::IntParameters
const std::vector< double > & IntParameters() const
Definition: MnUserParameterState.h:97
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:36
ROOT::Minuit2::MnUserParameterState::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameterState.h:104
ROOT::Minuit2::MnUserParameterState::Precision
const MnMachinePrecision & Precision() const
Definition: MnUserParameterState.cxx:511
ROOT::Minuit2::MnUserParameterState::SetValue
void SetValue(unsigned int, double)
Definition: MnUserParameterState.cxx:328
ROOT::Minuit2::MnUserParameterState::Params
std::vector< double > Params() const
Definition: MnUserParameterState.cxx:219
ROOT::Minuit2::MnUserParameterState::Errors
std::vector< double > Errors() const
Definition: MnUserParameterState.cxx:224
ROOT::Minuit2::MnUserParameterState::fValid
bool fValid
Definition: MnUserParameterState.h:177
ROOT::Minuit2::MnUserParameterState::HasGlobalCC
bool HasGlobalCC() const
Definition: MnUserParameterState.h:108
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
ROOT::Minuit2::MnUserParameterState::SetUpperLimit
void SetUpperLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:364
double
double
Definition: Converters.cxx:921
ROOT::Minuit2::MnUserParameterState::fIntParameters
std::vector< double > fIntParameters
Definition: MnUserParameterState.h:189
ROOT::Minuit2::MnUserParameters::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameters.h:53
ROOT::Minuit2::MnUserParameterState::MnUserParameterState
MnUserParameterState()
default constructor (invalid state)
Definition: MnUserParameterState.h:37
ROOT::Minuit2::MnUserParameterState::fNFcn
unsigned int fNFcn
Definition: MnUserParameterState.h:183
ROOT::Minuit2::MnUserParameterState::fCovStatus
int fCovStatus
Definition: MnUserParameterState.h:180
MnUserCovariance.h
ROOT::Minuit2::MnUserParameterState::ExtOfInt
unsigned int ExtOfInt(unsigned int) const
Definition: MnUserParameterState.cxx:501
ROOT::Minuit2::MnUserParameterState::Add
void Add(const std::string &name, double val, double err)
Definition: MnUserParameterState.cxx:236
ROOT::Minuit2::MnUserParameterState::SetName
void SetName(unsigned int iext, const std::string &name)
Definition: MnUserParameterState.h:142
ROOT::Minuit2::MnUserTransformation
class dealing with the transformation between user specified parameters (external) and internal param...
Definition: MnUserTransformation.h:38
ROOT::Minuit2::MnUserParameterState
class which holds the external user and/or internal Minuit representation of the parameters and error...
Definition: MnUserParameterState.h:33
ROOT::Minuit2::MnUserParameterState::Parameter
const MinuitParameter & Parameter(unsigned int i) const
Definition: MnUserParameterState.cxx:230
ROOT::Minuit2::MnUserParameterState::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnUserParameterState.cxx:496
ROOT::Minuit2::MnUserParameterState::Parameters
const MnUserParameters & Parameters() const
Definition: MnUserParameterState.h:89
ROOT::Minuit2::MnUserParameterState::GlobalCC
const MnGlobalCorrelationCoeff & GlobalCC() const
Definition: MnUserParameterState.h:91
ROOT::Minuit2::MnUserParameterState::Index
unsigned int Index(const std::string &) const
Definition: MnUserParameterState.cxx:467
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Minuit2::MnUserParameterState::Release
void Release(unsigned int)
Definition: MnUserParameterState.cxx:312
ROOT::Minuit2::MnUserParameterState::fFVal
double fFVal
Definition: MnUserParameterState.h:181
ROOT::Minuit2::MnUserParameterState::Ext2int
double Ext2int(unsigned int, double) const
Definition: MnUserParameterState.cxx:491
ROOT::Minuit2::MnUserParameterState::fIntCovariance
MnUserCovariance fIntCovariance
Definition: MnUserParameterState.h:190
ROOT::Minuit2::MnUserParameterState::SetLowerLimit
void SetLowerLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:379
ROOT::Minuit2::MnUserParameterState::Value
double Value(unsigned int) const
Definition: MnUserParameterState.cxx:404
ROOT::Minuit2::MnUserParameterState::Covariance
const MnUserCovariance & Covariance() const
Definition: MnUserParameterState.h:90
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Minuit2::MnUserParameterState::MnUserParameterState
MnUserParameterState(const MnUserParameterState &state)
Definition: MnUserParameterState.h:61
MnGlobalCorrelationCoeff.h
ROOT::Minuit2::MnUserParameterState::IntCovariance
const MnUserCovariance & IntCovariance() const
Definition: MnUserParameterState.h:98
ROOT::Minuit2::MnUserParameterState::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserParameterState.cxx:486
ROOT::Minuit2::MnUserParameterState::Fix
void Fix(unsigned int)
Definition: MnUserParameterState.cxx:297
ROOT::Minuit2::MnUserParameterState::fParameters
MnUserParameters fParameters
Definition: MnUserParameterState.h:185