Logo ROOT   6.16/01
Reference Guide
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 <cassert>
23
24namespace ROOT {
25
26 namespace Minuit2 {
27
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:
41
44 fExtOfInt(std::vector<unsigned int>()),
48 fCache(std::vector<double>()) {}
49
50 MnUserTransformation(const std::vector<double>&, const std::vector<double>&);
51
53
60
62 if(this != &trafo) {
63 fPrecision = trafo.fPrecision;
65 fExtOfInt = trafo.fExtOfInt;
69 fCache = trafo.fCache;
70 }
71 return *this;
72 }
73
74
75//#ifdef MINUIT2_THREAD_SAFE
76 // thread-safe version (do not use cache)
77 std::vector<double> operator()(const MnAlgebraicVector&) const;
78//#else // not thread safe
79// const std::vector<double>& operator()(const MnAlgebraicVector&) const;
80//#endif
81
82 // Index = internal Parameter
83 double Int2ext(unsigned int, double) const;
84
85 // Index = internal Parameter
86 double Int2extError(unsigned int, double, double) const;
87
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
96// // Index = external Parameter
97// double dExt2Int(unsigned int, double) const;
98
99 // Index = external Parameter
100 unsigned int IntOfExt(unsigned int) const;
101
102 // Index = internal Parameter
103 unsigned int ExtOfInt(unsigned int internal) const {
104 assert(internal < fExtOfInt.size());
105 return fExtOfInt[internal];
106 }
107
108 const std::vector<MinuitParameter>& Parameters() const {
109 return fParameters;
110 }
111
112 unsigned int VariableParameters() const {return static_cast<unsigned int> ( fExtOfInt.size() );}
113
114 // return initial parameter values (useful especially to get fixed parameter values)
115 const std::vector<double> & InitialParValues() const {
116 return fCache;
117 }
118
119
120 /** forwarded interface */
121
122 const MnMachinePrecision& Precision() const {return fPrecision;}
123 void SetPrecision(double eps) {fPrecision.SetPrecision(eps);}
124
125 /// access to parameters and errors in column-wise representation
126
127 std::vector<double> Params() const;
128 std::vector<double> Errors() const;
129
130 //access to single Parameter
131 const MinuitParameter& Parameter(unsigned int) const;
132
133 //add free Parameter
134 bool Add(const std::string &, double, double);
135 //add limited Parameter
136 bool Add(const std::string &, double, double, double, double);
137 //add const Parameter
138 bool Add(const std::string &, double);
139
140 //interaction via external number of Parameter
141 void Fix(unsigned int);
142 void Release(unsigned int);
143 void RemoveLimits(unsigned int);
144 void SetValue(unsigned int, double);
145 void SetError(unsigned int, double);
146 void SetLimits(unsigned int, double, double);
147 void SetUpperLimit(unsigned int, double);
148 void SetLowerLimit(unsigned int, double);
149 void SetName(unsigned int, const std::string &);
150
151 double Value(unsigned int) const;
152 double Error(unsigned int) const;
153
154 //interaction via Name of Parameter
155 void Fix(const std::string &);
156 void Release(const std::string &);
157 void SetValue(const std::string &, double);
158 void SetError(const std::string &, double);
159 void SetLimits(const std::string &, double, double);
160 void SetUpperLimit(const std::string &, double);
161 void SetLowerLimit(const std::string &, double);
162 void RemoveLimits(const std::string &);
163
164 double Value(const std::string &) const;
165 double Error(const std::string &) const;
166
167 //convert Name into external number of Parameter (will assert if parameter is not found)
168 unsigned int Index(const std::string &) const;
169 // find parameter index given a name. If it is not found return a -1
170 int FindIndex(const std::string & ) const;
171
172 //convert external number into Name of Parameter (will assert if index is out of range)
173 const std::string & GetName(unsigned int) const;
174 // mantain interface with const char * for backward compatibility
175 const char* Name(unsigned int) const;
176
177private:
178
180
181 std::vector<MinuitParameter> fParameters;
182 std::vector<unsigned int> fExtOfInt;
183
187
188 mutable std::vector<double> fCache;
189
190
191};
192
193 } // namespace Minuit2
194
195} // namespace ROOT
196
197#endif // ROOT_Minuit2_MnUserTransformation
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
determines the relative floating point 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
void SetUpperLimit(unsigned int, double)
bool Add(const std::string &, double, double)
double DInt2Ext(unsigned int, double) const
void SetLowerLimit(unsigned int, double)
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
std::vector< double > Errors() 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)
const MinuitParameter & Parameter(unsigned int) const
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)
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
STL namespace.