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"
18
19#include <ROOT/RSpan.hxx>
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:
42
43 MnUserTransformation(std::span<const double>, std::span<const double>);
44
46
48
49 //#ifdef MINUIT2_THREAD_SAFE
50 // thread-safe version (do not use cache)
51 std::vector<double> operator()(const MnAlgebraicVector &) const;
52 //#else // not thread safe
53 // const std::vector<double>& operator()(const MnAlgebraicVector&) const;
54 //#endif
55
56 // Index = internal Parameter
57 double Int2ext(unsigned int, double) const;
58
59 // Index = internal Parameter
60 double Int2extError(unsigned int, double, double) const;
61
64
65 // Index = external Parameter
66 double Ext2int(unsigned int, double) const;
67
68 // Index = internal Parameter
69 double DInt2Ext(unsigned int, double) const;
70 double D2Int2Ext(unsigned int, double) const;
71 double DExt2Int(unsigned int, double) const;
72
73 // // Index = external Parameter
74 // double dExt2Int(unsigned int, double) const;
75
76 // Index = external Parameter
77 unsigned int IntOfExt(unsigned int) const;
78
79 // Index = internal Parameter
80 unsigned int ExtOfInt(unsigned int internal) const
81 {
82 assert(internal < fExtOfInt.size());
83 return fExtOfInt[internal];
84 }
85
86 const std::vector<MinuitParameter> &Parameters() const { return fParameters; }
87
88 unsigned int VariableParameters() const { return static_cast<unsigned int>(fExtOfInt.size()); }
89
90 // return initial parameter values (useful especially to get fixed parameter values)
91 const std::vector<double> &InitialParValues() const { return fCache; }
92
93 /** forwarded interface */
94
95 const MnMachinePrecision &Precision() const { return fPrecision; }
96 void SetPrecision(double eps) { fPrecision.SetPrecision(eps); }
97
98 /// access to parameters and errors in column-wise representation
99
100 std::vector<double> Params() const;
101 std::vector<double> Errors() const;
102
103 // access to single Parameter
104 const MinuitParameter &Parameter(unsigned int) const;
105
106 // add free Parameter
107 bool Add(const std::string &, double, double);
108 // add limited Parameter
109 bool Add(const std::string &, double, double, double, double);
110 // add const Parameter
111 bool Add(const std::string &, double);
112
113 // interaction via external number of Parameter
114 void Fix(unsigned int);
115 void Release(unsigned int);
116 void RemoveLimits(unsigned int);
117 void SetValue(unsigned int, double);
118 void SetError(unsigned int, double);
119 void SetLimits(unsigned int, double, double);
120 void SetUpperLimit(unsigned int, double);
121 void SetLowerLimit(unsigned int, double);
122 void SetName(unsigned int, const std::string &);
123
124 double Value(unsigned int) const;
125 double Error(unsigned int) const;
126
127 // interaction via Name of Parameter
128 void Fix(const std::string &);
129 void Release(const std::string &);
130 void SetValue(const std::string &, double);
131 void SetError(const std::string &, double);
132 void SetLimits(const std::string &, double, double);
133 void SetUpperLimit(const std::string &, double);
134 void SetLowerLimit(const std::string &, double);
135 void RemoveLimits(const std::string &);
136
137 double Value(const std::string &) const;
138 double Error(const std::string &) const;
139
140 // convert Name into external number of Parameter (will assert if parameter is not found)
141 unsigned int Index(const std::string &) const;
142 // find parameter index given a name. If it is not found return a -1
143 int FindIndex(const std::string &) const;
144
145 // convert external number into Name of Parameter (will assert if index is out of range)
146 const std::string &GetName(unsigned int) const;
147 // maintain interface with const char * for backward compatibility
148 const char *Name(unsigned int) const;
149
150private:
152
153 std::vector<MinuitParameter> fParameters;
154 std::vector<unsigned int> fExtOfInt;
155
159
160 mutable std::vector<double> fCache;
161};
162
163} // namespace Minuit2
164
165} // namespace ROOT
166
167#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
MnUserTransformation(const MnUserTransformation &trafo)=default
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
void SetLimits(unsigned int, double, double)
double Int2extError(unsigned int, double, double) const
const MnMachinePrecision & Precision() const
forwarded interface
SqrtUpParameterTransformation fUpperLimTrafo
MnUserTransformation & operator=(const MnUserTransformation &trafo)=default
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