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:
50
51 MnUserTransformation(std::span<const double>, std::span<const double>);
52
59
61 {
62 if (this != &trafo) {
63 fPrecision = trafo.fPrecision;
64 fParameters = trafo.fParameters;
65 fExtOfInt = trafo.fExtOfInt;
66 fDoubleLimTrafo = trafo.fDoubleLimTrafo;
67 fUpperLimTrafo = trafo.fUpperLimTrafo;
68 fLowerLimTrafo = trafo.fLowerLimTrafo;
69 fCache = trafo.fCache;
70 }
71 return *this;
72 }
73
74 //#ifdef MINUIT2_THREAD_SAFE
75 // thread-safe version (do not use cache)
76 std::vector<double> operator()(const MnAlgebraicVector &) const;
77 //#else // not thread safe
78 // const std::vector<double>& operator()(const MnAlgebraicVector&) const;
79 //#endif
80
81 // Index = internal Parameter
82 double Int2ext(unsigned int, double) const;
83
84 // Index = internal Parameter
85 double Int2extError(unsigned int, double, double) const;
86
89
90 // Index = external Parameter
91 double Ext2int(unsigned int, double) const;
92
93 // Index = internal Parameter
94 double DInt2Ext(unsigned int, double) const;
95 double D2Int2Ext(unsigned int, double) const;
96 double DExt2Int(unsigned int, double) const;
97
98 // // Index = external Parameter
99 // double dExt2Int(unsigned int, double) const;
100
101 // Index = external Parameter
102 unsigned int IntOfExt(unsigned int) const;
103
104 // Index = internal Parameter
105 unsigned int ExtOfInt(unsigned int internal) const
106 {
107 assert(internal < fExtOfInt.size());
108 return fExtOfInt[internal];
109 }
110
111 const std::vector<MinuitParameter> &Parameters() const { return fParameters; }
112
113 unsigned int VariableParameters() const { return static_cast<unsigned int>(fExtOfInt.size()); }
114
115 // return initial parameter values (useful especially to get fixed parameter values)
116 const std::vector<double> &InitialParValues() const { return fCache; }
117
118 /** forwarded interface */
119
120 const MnMachinePrecision &Precision() const { return fPrecision; }
121 void SetPrecision(double eps) { fPrecision.SetPrecision(eps); }
122
123 /// access to parameters and errors in column-wise representation
124
125 std::vector<double> Params() const;
126 std::vector<double> Errors() const;
127
128 // access to single Parameter
129 const MinuitParameter &Parameter(unsigned int) const;
130
131 // add free Parameter
132 bool Add(const std::string &, double, double);
133 // add limited Parameter
134 bool Add(const std::string &, double, double, double, double);
135 // add const Parameter
136 bool Add(const std::string &, double);
137
138 // interaction via external number of Parameter
139 void Fix(unsigned int);
140 void Release(unsigned int);
141 void RemoveLimits(unsigned int);
142 void SetValue(unsigned int, double);
143 void SetError(unsigned int, double);
144 void SetLimits(unsigned int, double, double);
145 void SetUpperLimit(unsigned int, double);
146 void SetLowerLimit(unsigned int, double);
147 void SetName(unsigned int, const std::string &);
148
149 double Value(unsigned int) const;
150 double Error(unsigned int) const;
151
152 // interaction via Name of Parameter
153 void Fix(const std::string &);
154 void Release(const std::string &);
155 void SetValue(const std::string &, double);
156 void SetError(const std::string &, double);
157 void SetLimits(const std::string &, double, double);
158 void SetUpperLimit(const std::string &, double);
159 void SetLowerLimit(const std::string &, double);
160 void RemoveLimits(const std::string &);
161
162 double Value(const std::string &) const;
163 double Error(const std::string &) const;
164
165 // convert Name into external number of Parameter (will assert if parameter is not found)
166 unsigned int Index(const std::string &) const;
167 // find parameter index given a name. If it is not found return a -1
168 int FindIndex(const std::string &) const;
169
170 // convert external number into Name of Parameter (will assert if index is out of range)
171 const std::string &GetName(unsigned int) const;
172 // maintain interface with const char * for backward compatibility
173 const char *Name(unsigned int) const;
174
175private:
177
178 std::vector<MinuitParameter> fParameters;
179 std::vector<unsigned int> fExtOfInt;
180
184
185 mutable std::vector<double> fCache;
186};
187
188} // namespace Minuit2
189
190} // namespace ROOT
191
192#endif // ROOT_Minuit2_MnUserTransformation
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Class describing a symmetric matrix of size n.
Definition MnMatrix.h:438
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
double D2Int2Ext(unsigned int, double) 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
unsigned int Index(const std::string &) 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...