Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MnUserTransformation.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_MnUserTransformation
11#define ROOT_Minuit2_MnUserTransformation
12
13#include "Minuit2/MnConfig.h"
14#include "Minuit2/MnMatrix.h"
20
21#include <ROOT/RSpan.hxx>
22
23#include <vector>
24#include <string>
25#include <cassert>
26
27namespace ROOT {
28
29namespace Minuit2 {
30
31class MnUserCovariance;
32
33// class MnMachinePrecision;
34
35/**
36 class dealing with the transformation between user specified parameters (external) and
37 internal parameters used for minimization
38 */
39
41
42public:
45 fExtOfInt(std::vector<unsigned int>()), fDoubleLimTrafo(SinParameterTransformation()),
47 fCache(std::vector<double>())
48 {
49 }
50
51 MnUserTransformation(std::span<const double>, std::span<const double>);
52
54
59 {
60 }
61
63 {
64 if (this != &trafo) {
65 fPrecision = trafo.fPrecision;
67 fExtOfInt = trafo.fExtOfInt;
71 fCache = trafo.fCache;
72 }
73 return *this;
74 }
75
76 //#ifdef MINUIT2_THREAD_SAFE
77 // thread-safe version (do not use cache)
78 std::vector<double> operator()(const MnAlgebraicVector &) const;
79 //#else // not thread safe
80 // const std::vector<double>& operator()(const MnAlgebraicVector&) const;
81 //#endif
82
83 // Index = internal Parameter
84 double Int2ext(unsigned int, double) const;
85
86 // Index = internal Parameter
87 double Int2extError(unsigned int, double, double) const;
88
91
92 // Index = external Parameter
93 double Ext2int(unsigned int, double) const;
94
95 // Index = internal Parameter
96 double DInt2Ext(unsigned int, double) const;
97 double DExt2Int(unsigned int, double) const;
98
99 // // Index = external Parameter
100 // double dExt2Int(unsigned int, double) const;
101
102 // Index = external Parameter
103 unsigned int IntOfExt(unsigned int) const;
104
105 // Index = internal Parameter
106 unsigned int ExtOfInt(unsigned int internal) const
107 {
108 assert(internal < fExtOfInt.size());
109 return fExtOfInt[internal];
110 }
111
112 const std::vector<MinuitParameter> &Parameters() const { return fParameters; }
113
114 unsigned int VariableParameters() const { return static_cast<unsigned int>(fExtOfInt.size()); }
115
116 // return initial parameter values (useful especially to get fixed parameter values)
117 const std::vector<double> &InitialParValues() const { return fCache; }
118
119 /** forwarded interface */
120
121 const MnMachinePrecision &Precision() const { return fPrecision; }
122 void SetPrecision(double eps) { fPrecision.SetPrecision(eps); }
123
124 /// access to parameters and errors in column-wise representation
125
126 std::vector<double> Params() const;
127 std::vector<double> Errors() const;
128
129 // access to single Parameter
130 const MinuitParameter &Parameter(unsigned int) const;
131
132 // add free Parameter
133 bool Add(const std::string &, double, double);
134 // add limited Parameter
135 bool Add(const std::string &, double, double, double, double);
136 // add const Parameter
137 bool Add(const std::string &, double);
138
139 // interaction via external number of Parameter
140 void Fix(unsigned int);
141 void Release(unsigned int);
142 void RemoveLimits(unsigned int);
143 void SetValue(unsigned int, double);
144 void SetError(unsigned int, double);
145 void SetLimits(unsigned int, double, double);
146 void SetUpperLimit(unsigned int, double);
147 void SetLowerLimit(unsigned int, double);
148 void SetName(unsigned int, const std::string &);
149
150 double Value(unsigned int) const;
151 double Error(unsigned int) const;
152
153 // interaction via Name of Parameter
154 void Fix(const std::string &);
155 void Release(const std::string &);
156 void SetValue(const std::string &, double);
157 void SetError(const std::string &, double);
158 void SetLimits(const std::string &, double, double);
159 void SetUpperLimit(const std::string &, double);
160 void SetLowerLimit(const std::string &, double);
161 void RemoveLimits(const std::string &);
162
163 double Value(const std::string &) const;
164 double Error(const std::string &) const;
165
166 // convert Name into external number of Parameter (will assert if parameter is not found)
167 unsigned int Index(const std::string &) const;
168 // find parameter index given a name. If it is not found return a -1
169 int FindIndex(const std::string &) const;
170
171 // convert external number into Name of Parameter (will assert if index is out of range)
172 const std::string &GetName(unsigned int) const;
173 // maintain interface with const char * for backward compatibility
174 const char *Name(unsigned int) const;
175
176private:
178
179 std::vector<MinuitParameter> fParameters;
180 std::vector<unsigned int> fExtOfInt;
181
185
186 mutable std::vector<double> fCache;
187};
188
189} // namespace Minuit2
190
191} // namespace ROOT
192
193#endif // ROOT_Minuit2_MnUserTransformation
Class describing a symmetric matrix of size n.
Definition LASymMatrix.h:45
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
Sets the relative floating point (double) arithmetic precision.
void SetPrecision(double prec)
override Minuit's own determination
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
class dealing with the transformation between user specified parameters (external) and internal param...
double Ext2int(unsigned int, double) const
MnUserCovariance Int2extCovariance(const MnAlgebraicVector &, const MnAlgebraicSymMatrix &) const
unsigned int ExtOfInt(unsigned int internal) const
double DExt2Int(unsigned int, double) const
bool Add(const std::string &, double, double)
double DInt2Ext(unsigned int, double) const
void SetName(unsigned int, const std::string &)
std::vector< MinuitParameter > fParameters
std::vector< double > operator()(const MnAlgebraicVector &) const
const std::vector< MinuitParameter > & Parameters() const
unsigned int IntOfExt(unsigned int) const
MnUserCovariance Ext2intCovariance(const MnAlgebraicVector &, const MnAlgebraicSymMatrix &) const
const char * Name(unsigned int) const
std::vector< unsigned int > fExtOfInt
std::vector< double > Params() const
access to parameters and errors in column-wise representation
SqrtLowParameterTransformation fLowerLimTrafo
int FindIndex(const std::string &) const
double Int2ext(unsigned int, double) const
SinParameterTransformation fDoubleLimTrafo
const std::vector< double > & InitialParValues() const
const std::string & GetName(unsigned int) const
MnUserTransformation & operator=(const MnUserTransformation &trafo)
void SetLimits(unsigned int, double, double)
double Int2extError(unsigned int, double, double) const
const MnMachinePrecision & Precision() const
forwarded interface
SqrtUpParameterTransformation fUpperLimTrafo
MnUserTransformation(const MnUserTransformation &trafo)
class for the transformation for double-limited parameter Using a sin function one goes from a double...
Transformation from external to internal Parameter based on sqrt(1 + x**2)
Transformation from external to internal Parameter based on sqrt(1 + x**2)
CPyCppyy::Parameter Parameter
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...