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 <vector>
22#include <string>
23#include <cassert>
24
25namespace ROOT {
26
27namespace Minuit2 {
28
29class MnUserCovariance;
30
31// class MnMachinePrecision;
32
33/**
34 class dealing with the transformation between user specified parameters (external) and
35 internal parameters used for minimization
36 */
37
39
40public:
43 fExtOfInt(std::vector<unsigned int>()), fDoubleLimTrafo(SinParameterTransformation()),
45 fCache(std::vector<double>())
46 {
47 }
48
49 MnUserTransformation(const std::vector<double> &, const std::vector<double> &);
50
52
57 {
58 }
59
61 {
62 if (this != &trafo) {
63 fPrecision = trafo.fPrecision;
65 fExtOfInt = trafo.fExtOfInt;
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
88
89 // Index = external Parameter
90 double Ext2int(unsigned int, double) const;
91
92 // Index = internal Parameter
93 double DInt2Ext(unsigned int, double) const;
94
95 // // Index = external Parameter
96 // double dExt2Int(unsigned int, double) const;
97
98 // Index = external Parameter
99 unsigned int IntOfExt(unsigned int) const;
100
101 // Index = internal Parameter
102 unsigned int ExtOfInt(unsigned int internal) const
103 {
104 assert(internal < fExtOfInt.size());
105 return fExtOfInt[internal];
106 }
107
108 const std::vector<MinuitParameter> &Parameters() const { return fParameters; }
109
110 unsigned int VariableParameters() const { return static_cast<unsigned int>(fExtOfInt.size()); }
111
112 // return initial parameter values (useful especially to get fixed parameter values)
113 const std::vector<double> &InitialParValues() const { return fCache; }
114
115 /** forwarded interface */
116
117 const MnMachinePrecision &Precision() const { return fPrecision; }
118 void SetPrecision(double eps) { fPrecision.SetPrecision(eps); }
119
120 /// access to parameters and errors in column-wise representation
121
122 std::vector<double> Params() const;
123 std::vector<double> Errors() const;
124
125 // access to single Parameter
126 const MinuitParameter &Parameter(unsigned int) const;
127
128 // add free Parameter
129 bool Add(const std::string &, double, double);
130 // add limited Parameter
131 bool Add(const std::string &, double, double, double, double);
132 // add const Parameter
133 bool Add(const std::string &, double);
134
135 // interaction via external number of Parameter
136 void Fix(unsigned int);
137 void Release(unsigned int);
138 void RemoveLimits(unsigned int);
139 void SetValue(unsigned int, double);
140 void SetError(unsigned int, double);
141 void SetLimits(unsigned int, double, double);
142 void SetUpperLimit(unsigned int, double);
143 void SetLowerLimit(unsigned int, double);
144 void SetName(unsigned int, const std::string &);
145
146 double Value(unsigned int) const;
147 double Error(unsigned int) const;
148
149 // interaction via Name of Parameter
150 void Fix(const std::string &);
151 void Release(const std::string &);
152 void SetValue(const std::string &, double);
153 void SetError(const std::string &, double);
154 void SetLimits(const std::string &, double, double);
155 void SetUpperLimit(const std::string &, double);
156 void SetLowerLimit(const std::string &, double);
157 void RemoveLimits(const std::string &);
158
159 double Value(const std::string &) const;
160 double Error(const std::string &) const;
161
162 // convert Name into external number of Parameter (will assert if parameter is not found)
163 unsigned int Index(const std::string &) const;
164 // find parameter index given a name. If it is not found return a -1
165 int FindIndex(const std::string &) const;
166
167 // convert external number into Name of Parameter (will assert if index is out of range)
168 const std::string &GetName(unsigned int) const;
169 // mantain interface with const char * for backward compatibility
170 const char *Name(unsigned int) const;
171
172private:
174
175 std::vector<MinuitParameter> fParameters;
176 std::vector<unsigned int> fExtOfInt;
177
181
182 mutable std::vector<double> fCache;
183};
184
185} // namespace Minuit2
186
187} // namespace ROOT
188
189#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
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
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
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.