Logo ROOT  
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 <string>
23 #include <cassert>
24 
25 namespace ROOT {
26 
27  namespace Minuit2 {
28 
29 
30 class MnUserCovariance;
31 
32 // class MnMachinePrecision;
33 
34 /**
35  class dealing with the transformation between user specified parameters (external) and
36  internal parameters used for minimization
37  */
38 
39 class MnUserTransformation {
40 
41 public:
42 
43  MnUserTransformation() : fPrecision(MnMachinePrecision()),
44  fParameters(std::vector<MinuitParameter>()),
45  fExtOfInt(std::vector<unsigned int>()),
46  fDoubleLimTrafo(SinParameterTransformation()),
49  fCache(std::vector<double>()) {}
50 
51  MnUserTransformation(const std::vector<double>&, const std::vector<double>&);
52 
54 
56  fPrecision(trafo.fPrecision),
60  fLowerLimTrafo(trafo.fLowerLimTrafo), fCache(trafo.fCache) {}
61 
63  if(this != &trafo) {
64  fPrecision = trafo.fPrecision;
65  fParameters = trafo.fParameters;
66  fExtOfInt = trafo.fExtOfInt;
67  fDoubleLimTrafo = trafo.fDoubleLimTrafo;
68  fUpperLimTrafo = trafo.fUpperLimTrafo;
69  fLowerLimTrafo = trafo.fLowerLimTrafo;
70  fCache = trafo.fCache;
71  }
72  return *this;
73  }
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 
89  MnUserCovariance Int2extCovariance(const MnAlgebraicVector&, const MnAlgebraicSymMatrix&) const;
90 
91  // Index = external Parameter
92  double Ext2int(unsigned int, double) const;
93 
94  // Index = internal Parameter
95  double DInt2Ext(unsigned int, double) const;
96 
97 // // Index = external Parameter
98 // double dExt2Int(unsigned int, double) const;
99 
100  // Index = external Parameter
101  unsigned int IntOfExt(unsigned int) const;
102 
103  // Index = internal Parameter
104  unsigned int ExtOfInt(unsigned int internal) const {
105  assert(internal < fExtOfInt.size());
106  return fExtOfInt[internal];
107  }
108 
109  const std::vector<MinuitParameter>& Parameters() const {
110  return fParameters;
111  }
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 {
117  return fCache;
118  }
119 
120 
121  /** forwarded interface */
122 
123  const MnMachinePrecision& Precision() const {return fPrecision;}
124  void SetPrecision(double eps) {fPrecision.SetPrecision(eps);}
125 
126  /// access to parameters and errors in column-wise representation
127 
128  std::vector<double> Params() const;
129  std::vector<double> Errors() const;
130 
131  //access to single Parameter
132  const MinuitParameter& Parameter(unsigned int) const;
133 
134  //add free Parameter
135  bool Add(const std::string &, double, double);
136  //add limited Parameter
137  bool Add(const std::string &, double, double, double, double);
138  //add const Parameter
139  bool Add(const std::string &, double);
140 
141  //interaction via external number of Parameter
142  void Fix(unsigned int);
143  void Release(unsigned int);
144  void RemoveLimits(unsigned int);
145  void SetValue(unsigned int, double);
146  void SetError(unsigned int, double);
147  void SetLimits(unsigned int, double, double);
148  void SetUpperLimit(unsigned int, double);
149  void SetLowerLimit(unsigned int, double);
150  void SetName(unsigned int, const std::string &);
151 
152  double Value(unsigned int) const;
153  double Error(unsigned int) const;
154 
155  //interaction via Name of Parameter
156  void Fix(const std::string &);
157  void Release(const std::string &);
158  void SetValue(const std::string &, double);
159  void SetError(const std::string &, double);
160  void SetLimits(const std::string &, double, double);
161  void SetUpperLimit(const std::string &, double);
162  void SetLowerLimit(const std::string &, double);
163  void RemoveLimits(const std::string &);
164 
165  double Value(const std::string &) const;
166  double Error(const std::string &) const;
167 
168  //convert Name into external number of Parameter (will assert if parameter is not found)
169  unsigned int Index(const std::string &) const;
170  // find parameter index given a name. If it is not found return a -1
171  int FindIndex(const std::string & ) const;
172 
173  //convert external number into Name of Parameter (will assert if index is out of range)
174  const std::string & GetName(unsigned int) const;
175  // mantain interface with const char * for backward compatibility
176  const char* Name(unsigned int) const;
177 
178 private:
179 
181 
182  std::vector<MinuitParameter> fParameters;
183  std::vector<unsigned int> fExtOfInt;
184 
188 
189  mutable std::vector<double> fCache;
190 
191 
192 };
193 
194  } // namespace Minuit2
195 
196 } // namespace ROOT
197 
198 #endif // ROOT_Minuit2_MnUserTransformation
SqrtUpParameterTransformation.h
ROOT::Minuit2::MinuitParameter
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
Definition: MinuitParameter.h:41
SinParameterTransformation.h
ROOT::Minuit2::MnUserTransformation::Fix
void Fix(unsigned int)
Definition: MnUserTransformation.cxx:305
ROOT::Minuit2::MnUserTransformation::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserTransformation.cxx:103
ROOT::Minuit2::MnUserTransformation::FindIndex
int FindIndex(const std::string &) const
Definition: MnUserTransformation.cxx:443
MnMachinePrecision.h
ROOT::Minuit2::MnUserTransformation::SetPrecision
void SetPrecision(double eps)
Definition: MnUserTransformation.h:132
ROOT::Minuit2::MnUserTransformation::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnUserTransformation.cxx:357
ROOT::Minuit2::MnUserTransformation::Params
std::vector< double > Params() const
access to parameters and errors in column-wise representation
Definition: MnUserTransformation.cxx:232
ROOT::Minuit2::MnUserTransformation::SetUpperLimit
void SetUpperLimit(unsigned int, double)
Definition: MnUserTransformation.cxx:345
ROOT::Minuit2::MnUserTransformation::Parameters
const std::vector< MinuitParameter > & Parameters() const
Definition: MnUserTransformation.h:117
ROOT::Minuit2::MnUserTransformation::Precision
const MnMachinePrecision & Precision() const
forwarded interface
Definition: MnUserTransformation.h:131
ROOT::Minuit2::MnUserTransformation::Error
double Error(unsigned int) const
Definition: MnUserTransformation.cxx:376
ROOT::Minuit2::MnUserTransformation::Add
bool Add(const std::string &, double, double)
Definition: MnUserTransformation.cxx:272
ROOT::Minuit2::MnUserTransformation::fExtOfInt
std::vector< unsigned int > fExtOfInt
Definition: MnUserTransformation.h:191
ROOT::Minuit2::MnUserTransformation::SetValue
void SetValue(unsigned int, double)
Definition: MnUserTransformation.cxx:325
ROOT::Minuit2::MnUserTransformation::fUpperLimTrafo
SqrtUpParameterTransformation fUpperLimTrafo
Definition: MnUserTransformation.h:194
ROOT::Minuit2::MnAlgebraicSymMatrix
LASymMatrix MnAlgebraicSymMatrix
Definition: MnMatrix.h:36
MnMatrix.h
ROOT::Minuit2::MnUserTransformation::Errors
std::vector< double > Errors() const
Definition: MnUserTransformation.cxx:242
SqrtLowParameterTransformation.h
ROOT::Minuit2::SqrtLowParameterTransformation
Transformation from external to internal Parameter based on sqrt(1 + x**2)
Definition: SqrtLowParameterTransformation.h:40
ROOT::Minuit2::MnUserTransformation::~MnUserTransformation
~MnUserTransformation()
Definition: MnUserTransformation.h:61
ROOT::Minuit2::MnUserTransformation::Name
const char * Name(unsigned int) const
Definition: MnUserTransformation.cxx:458
ROOT::Minuit2::MnAlgebraicVector
LAVector MnAlgebraicVector
Definition: MnMatrix.h:37
ROOT::Minuit2::MnUserTransformation::Int2extCovariance
MnUserCovariance Int2extCovariance(const MnAlgebraicVector &, const MnAlgebraicSymMatrix &) const
Definition: MnUserTransformation.cxx:143
ROOT::Minuit2::MnUserTransformation::fPrecision
MnMachinePrecision fPrecision
Definition: MnUserTransformation.h:188
MinuitParameter.h
ROOT::Minuit2::MnUserTransformation::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserTransformation.h:121
ROOT::Minuit2::MnUserTransformation::Index
unsigned int Index(const std::string &) const
Definition: MnUserTransformation.cxx:434
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:41
double
double
Definition: Converters.cxx:921
ROOT::Minuit2::MnUserTransformation::Parameter
const MinuitParameter & Parameter(unsigned int) const
Definition: MnUserTransformation.cxx:252
ROOT::Minuit2::MnUserTransformation::InitialParValues
const std::vector< double > & InitialParValues() const
Definition: MnUserTransformation.h:124
ROOT::Minuit2::SinParameterTransformation
class for the transformation for double-limited parameter Using a sin function one goes from a double...
Definition: SinParameterTransformation.h:33
ROOT::Minuit2::MnUserTransformation::Value
double Value(unsigned int) const
Definition: MnUserTransformation.cxx:370
ROOT::Minuit2::MnUserTransformation::Int2extError
double Int2extError(unsigned int, double, double) const
Definition: MnUserTransformation.cxx:117
ROOT::Minuit2::MnUserTransformation::Ext2int
double Ext2int(unsigned int, double) const
Definition: MnUserTransformation.cxx:170
ROOT::Minuit2::MnUserTransformation
class dealing with the transformation between user specified parameters (external) and internal param...
Definition: MnUserTransformation.h:47
ROOT::Minuit2::MnUserTransformation::MnUserTransformation
MnUserTransformation()
Definition: MnUserTransformation.h:51
ROOT::Minuit2::MnUserTransformation::fLowerLimTrafo
SqrtLowParameterTransformation fLowerLimTrafo
Definition: MnUserTransformation.h:195
ROOT::Minuit2::MnUserTransformation::fDoubleLimTrafo
SinParameterTransformation fDoubleLimTrafo
Definition: MnUserTransformation.h:193
ROOT::Minuit2::MnUserTransformation::fParameters
std::vector< MinuitParameter > fParameters
Definition: MnUserTransformation.h:190
ROOT::Minuit2::MnUserTransformation::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnUserTransformation.cxx:338
ROOT::Minuit2::SqrtUpParameterTransformation
Transformation from external to internal Parameter based on sqrt(1 + x**2)
Definition: SqrtUpParameterTransformation.h:42
ROOT::Minuit2::MnUserTransformation::SetLowerLimit
void SetLowerLimit(unsigned int, double)
Definition: MnUserTransformation.cxx:351
ROOT::Minuit2::MnUserTransformation::SetName
void SetName(unsigned int, const std::string &)
Definition: MnUserTransformation.cxx:363
ROOT::Minuit2::MnUserTransformation::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnUserTransformation.cxx:221
ROOT::Minuit2::MnMachinePrecision::SetPrecision
void SetPrecision(double prec)
override Minuit's own determination
Definition: MnMachinePrecision.h:59
ROOT::Minuit2::MnUserTransformation::GetName
const std::string & GetName(unsigned int) const
Definition: MnUserTransformation.cxx:452
ROOT::Minuit2::MnUserTransformation::DInt2Ext
double DInt2Ext(unsigned int, double) const
Definition: MnUserTransformation.cxx:185
ROOT::Minuit2::MnUserTransformation::operator=
MnUserTransformation & operator=(const MnUserTransformation &trafo)
Definition: MnUserTransformation.h:70
ROOT::Minuit2::MnUserTransformation::ExtOfInt
unsigned int ExtOfInt(unsigned int internal) const
Definition: MnUserTransformation.h:112
ROOT::Minuit2::MnUserTransformation::operator()
std::vector< double > operator()(const MnAlgebraicVector &) const
Definition: MnUserTransformation.cxx:71
ROOT::Minuit2::MnUserTransformation::SetError
void SetError(unsigned int, double)
Definition: MnUserTransformation.cxx:332
ROOT::Minuit2::MnUserTransformation::Release
void Release(unsigned int)
Definition: MnUserTransformation.cxx:314
ROOT
VSD Structures.
Definition: StringConv.hxx:21
MnConfig.h
ROOT::Minuit2::MnUserTransformation::fCache
std::vector< double > fCache
Definition: MnUserTransformation.h:197
int