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)
40
41 /// construct from user parameters (before minimization)
42 MnUserParameterState(std::span<const double>, std::span<const double>);
43
45
46 /// construct from user parameters + covariance (before minimization)
47 MnUserParameterState(std::span<const double>, std::span<const double>, unsigned int);
48
49 MnUserParameterState(std::span<const double>, const MnUserCovariance &);
50
52
53 /// construct from internal parameters (after minimization)
55
56 // user external representation
57 const MnUserParameters &Parameters() const { return fParameters; }
58 const MnUserCovariance &Covariance() const { return fCovariance; }
60
61 // hessian (inverse of covariance matrix)
63
64 // Minuit internal representation
65 const std::vector<double> &IntParameters() const { return fIntParameters; }
67
68 // covariance matrix status (0 = not valid, 1 approximate, 2, full but made pos def, 3 accurate and not pos def
69 int CovarianceStatus() const { return fCovStatus; }
70
71 // transformation internal <-> external
72 const MnUserTransformation &Trafo() const { return fParameters.Trafo(); }
73
74 bool IsValid() const { return fValid; }
75 bool HasCovariance() const { return fCovarianceValid; }
76
77 double Fval() const { return fFVal; }
78 double Edm() const { return fEDM; }
79 unsigned int NFcn() const { return fNFcn; }
80
81public:
82 /** facade: forward interface of MnUserParameters and MnUserTransformation */
83
84 // access to parameters (row-wise)
85 const std::vector<ROOT::Minuit2::MinuitParameter> &MinuitParameters() const;
86 // access to parameters and errors in column-wise representation
87 std::vector<double> Params() const;
88 std::vector<double> Errors() const;
89
90 // access to single Parameter
91 const MinuitParameter &Parameter(unsigned int i) const;
92
93 // add free Parameter
94 void Add(const std::string &name, double val, double err);
95 // add limited Parameter
96 void Add(const std::string &name, double val, double err, double, double);
97 // add const Parameter
98 void Add(const std::string &, double);
99
100 // add covariance matrix
101 void AddCovariance(const MnUserCovariance &);
102
103 // interaction via external number of Parameter
104 void Fix(unsigned int);
105 void Release(unsigned int);
106 void RemoveLimits(unsigned int);
107 void SetValue(unsigned int, double);
108 void SetError(unsigned int, double);
109 void SetLimits(unsigned int, double, double);
110 void SetUpperLimit(unsigned int, double);
111 void SetLowerLimit(unsigned int, double);
112 void SetName(unsigned int iext, const std::string &name) { fParameters.SetName(iext, name); }
113
114 double Value(unsigned int) const;
115 double Error(unsigned int) const;
116
117 // interaction via Name of Parameter
118 void Fix(const std::string &);
119 void Release(const std::string &);
120 void SetValue(const std::string &, double);
121 void SetError(const std::string &, double);
122 void SetLimits(const std::string &, double, double);
123 void SetUpperLimit(const std::string &, double);
124 void SetLowerLimit(const std::string &, double);
125 void RemoveLimits(const std::string &);
126
127 double Value(const std::string &) const;
128 double Error(const std::string &) const;
129
130 // convert Name into external number of Parameter
131 unsigned int Index(const std::string &) const;
132 // convert external number into Name of Parameter
133 const std::string &GetName(unsigned int) const;
134 // maintain interface with const char * for backward compatibility
135 const char *Name(unsigned int) const;
136
137 // transformation internal <-> external
138 double Int2ext(unsigned int, double) const;
139 double Ext2int(unsigned int, double) const;
140 unsigned int IntOfExt(unsigned int) const;
141 unsigned int ExtOfInt(unsigned int) const;
142 unsigned int VariableParameters() const;
143 const MnMachinePrecision &Precision() const;
144 void SetPrecision(double eps);
145
146private:
147 bool fValid;
148 bool fCovarianceValid = false;
149 int fCovStatus; // covariance matrix status
150 double fFVal = 0.;
151 double fEDM = 0.;
152 unsigned int fNFcn = 0;
153
156
157 std::vector<double> fIntParameters;
159};
160
161} // namespace Minuit2
162
163} // namespace ROOT
164
165#endif // ROOT_Minuit2_MnUserParameterState
char name[80]
Definition TGX11.cxx:148
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