Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <ROOT/RSpan.hxx>
18
19#include <vector>
20#include <string>
21
22namespace ROOT {
23
24namespace Minuit2 {
25
26class MinimumState;
27
28//_____________________________________________________________________________
29/**
30 class which holds the external user and/or internal Minuit representation
31 of the parameters and errors;
32 transformation internal <-> external on demand;
33 */
34
36
37public:
38 /// default constructor (invalid state)
48
49 /// construct from user parameters (before minimization)
50 MnUserParameterState(std::span<const double>, std::span<const double>);
51
53
54 /// construct from user parameters + covariance (before minimization)
55 MnUserParameterState(std::span<const double>, std::span<const double>, unsigned int);
56
57 MnUserParameterState(std::span<const double>, const MnUserCovariance &);
58
60
61 /// construct from internal parameters (after minimization)
63
64 // user external representation
65 const MnUserParameters &Parameters() const { return fParameters; }
66 const MnUserCovariance &Covariance() const { return fCovariance; }
68
69 // hessian (inverse of covariance matrix)
71
72 // Minuit internal representation
73 const std::vector<double> &IntParameters() const { return fIntParameters; }
75
76 // covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not pos def
77 int CovarianceStatus() const { return fCovStatus; }
78
79 // transformation internal <-> external
80 const MnUserTransformation &Trafo() const { return fParameters.Trafo(); }
81
82 bool IsValid() const { return fValid; }
83 bool HasCovariance() const { return fCovarianceValid; }
84
85 double Fval() const { return fFVal; }
86 double Edm() const { return fEDM; }
87 unsigned int NFcn() const { return fNFcn; }
88
89public:
90 /** facade: forward interface of MnUserParameters and MnUserTransformation */
91
92 // access to parameters (row-wise)
93 const std::vector<ROOT::Minuit2::MinuitParameter> &MinuitParameters() const;
94 // access to parameters and errors in column-wise representation
95 std::vector<double> Params() const;
96 std::vector<double> Errors() const;
97
98 // access to single Parameter
99 const MinuitParameter &Parameter(unsigned int i) const;
100
101 // add free Parameter
102 void Add(const std::string &name, double val, double err);
103 // add limited Parameter
104 void Add(const std::string &name, double val, double err, double, double);
105 // add const Parameter
106 void Add(const std::string &, double);
107
108 // add covariance matrix
109 void AddCovariance(const MnUserCovariance &);
110
111 // interaction via external number of Parameter
112 void Fix(unsigned int);
113 void Release(unsigned int);
114 void RemoveLimits(unsigned int);
115 void SetValue(unsigned int, double);
116 void SetError(unsigned int, double);
117 void SetLimits(unsigned int, double, double);
118 void SetUpperLimit(unsigned int, double);
119 void SetLowerLimit(unsigned int, double);
120 void SetName(unsigned int iext, const std::string &name) { fParameters.SetName(iext, name); }
121
122 double Value(unsigned int) const;
123 double Error(unsigned int) const;
124
125 // interaction via Name of Parameter
126 void Fix(const std::string &);
127 void Release(const std::string &);
128 void SetValue(const std::string &, double);
129 void SetError(const std::string &, double);
130 void SetLimits(const std::string &, double, double);
131 void SetUpperLimit(const std::string &, double);
132 void SetLowerLimit(const std::string &, double);
133 void RemoveLimits(const std::string &);
134
135 double Value(const std::string &) const;
136 double Error(const std::string &) const;
137
138 // convert Name into external number of Parameter
139 unsigned int Index(const std::string &) const;
140 // convert external number into Name of Parameter
141 const std::string &GetName(unsigned int) const;
142 // maintain interface with const char * for backward compatibility
143 const char *Name(unsigned int) const;
144
145 // transformation internal <-> external
146 double Int2ext(unsigned int, double) const;
147 double Ext2int(unsigned int, double) const;
148 unsigned int IntOfExt(unsigned int) const;
149 unsigned int ExtOfInt(unsigned int) const;
150 unsigned int VariableParameters() const;
151 const MnMachinePrecision &Precision() const;
152 void SetPrecision(double eps);
153
154private:
155 bool fValid;
156 bool fCovarianceValid = false;
157 int fCovStatus; // covariance matrix status
158 double fFVal = 0.;
159 double fEDM = 0.;
160 unsigned int fNFcn = 0;
161
164
165 std::vector<double> fIntParameters;
167};
168
169} // namespace Minuit2
170
171} // namespace ROOT
172
173#endif // ROOT_Minuit2_MnUserParameterState
char name[80]
Definition TGX11.cxx:110
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
class for global correlation coefficient
Sets the relative floating point (double) 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)
MnGlobalCorrelationCoeff GlobalCC() 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
void AddCovariance(const MnUserCovariance &)
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
const MnUserCovariance & IntCovariance() const
const MnUserCovariance & Covariance() 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...
CPyCppyy::Parameter Parameter