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 class 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 
40 public:
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;
64  fParameters = trafo.fParameters;
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 
172 private:
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
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:33
SinParameterTransformation.h
ROOT::Minuit2::MnUserTransformation::Fix
void Fix(unsigned int)
Definition: MnUserTransformation.cxx:317
ROOT::Minuit2::MnUserTransformation::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserTransformation.cxx:99
ROOT::Minuit2::MnUserTransformation::FindIndex
int FindIndex(const std::string &) const
Definition: MnUserTransformation.cxx:476
MnMachinePrecision.h
ROOT::Minuit2::MnUserTransformation::SetPrecision
void SetPrecision(double eps)
Definition: MnUserTransformation.h:118
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
ROOT::Minuit2::MnUserTransformation::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnUserTransformation.cxx:376
ROOT::Minuit2::MnUserTransformation::Params
std::vector< double > Params() const
access to parameters and errors in column-wise representation
Definition: MnUserTransformation.cxx:241
ROOT::Minuit2::MnUserTransformation::SetUpperLimit
void SetUpperLimit(unsigned int, double)
Definition: MnUserTransformation.cxx:362
ROOT::Minuit2::MnUserTransformation::Parameters
const std::vector< MinuitParameter > & Parameters() const
Definition: MnUserTransformation.h:108
ROOT::Minuit2::MnUserTransformation::Precision
const MnMachinePrecision & Precision() const
forwarded interface
Definition: MnUserTransformation.h:117
ROOT::Minuit2::MnUserTransformation::Error
double Error(unsigned int) const
Definition: MnUserTransformation.cxx:397
ROOT::Minuit2::MnUserTransformation::Add
bool Add(const std::string &, double, double)
Definition: MnUserTransformation.cxx:281
ROOT::Minuit2::MnUserTransformation::fExtOfInt
std::vector< unsigned int > fExtOfInt
Definition: MnUserTransformation.h:176
ROOT::Minuit2::LASymMatrix
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:45
ROOT::Minuit2::MnUserTransformation::SetValue
void SetValue(unsigned int, double)
Definition: MnUserTransformation.cxx:339
ROOT::Minuit2::MnUserTransformation::fUpperLimTrafo
SqrtUpParameterTransformation fUpperLimTrafo
Definition: MnUserTransformation.h:179
MnMatrix.h
ROOT::Minuit2::MnUserTransformation::Errors
std::vector< double > Errors() const
Definition: MnUserTransformation.cxx:252
ROOT::Minuit2::MnUserCovariance
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
Definition: MnUserCovariance.h:26
SqrtLowParameterTransformation.h
ROOT::Minuit2::SqrtLowParameterTransformation
Transformation from external to internal Parameter based on sqrt(1 + x**2)
Definition: SqrtLowParameterTransformation.h:30
ROOT::Minuit2::MnUserTransformation::~MnUserTransformation
~MnUserTransformation()
Definition: MnUserTransformation.h:51
ROOT::Minuit2::MnUserTransformation::Name
const char * Name(unsigned int) const
Definition: MnUserTransformation.cxx:493
ROOT::Minuit2::MnUserTransformation::Int2extCovariance
MnUserCovariance Int2extCovariance(const MnAlgebraicVector &, const MnAlgebraicSymMatrix &) const
Definition: MnUserTransformation.cxx:144
ROOT::Minuit2::MnUserTransformation::fPrecision
MnMachinePrecision fPrecision
Definition: MnUserTransformation.h:173
MinuitParameter.h
ROOT::Minuit2::MnUserTransformation::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserTransformation.h:110
ROOT::Minuit2::MnUserTransformation::Index
unsigned int Index(const std::string &) const
Definition: MnUserTransformation.cxx:466
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
double
double
Definition: Converters.cxx:921
ROOT::Minuit2::MnUserTransformation::Parameter
const MinuitParameter & Parameter(unsigned int) const
Definition: MnUserTransformation.cxx:263
ROOT::Minuit2::MnUserTransformation::MnUserTransformation
MnUserTransformation(const MnUserTransformation &trafo)
Definition: MnUserTransformation.h:53
ROOT::Minuit2::MnUserTransformation::InitialParValues
const std::vector< double > & InitialParValues() const
Definition: MnUserTransformation.h:113
ROOT::Minuit2::SinParameterTransformation
class for the transformation for double-limited parameter Using a sin function one goes from a double...
Definition: SinParameterTransformation.h:24
ROOT::Minuit2::MnUserTransformation::Value
double Value(unsigned int) const
Definition: MnUserTransformation.cxx:390
ROOT::Minuit2::MnUserTransformation::Int2extError
double Int2extError(unsigned int, double, double) const
Definition: MnUserTransformation.cxx:115
ROOT::Minuit2::MnUserTransformation::Ext2int
double Ext2int(unsigned int, double) const
Definition: MnUserTransformation.cxx:174
ROOT::Minuit2::MnUserTransformation
class dealing with the transformation between user specified parameters (external) and internal param...
Definition: MnUserTransformation.h:38
ROOT::Minuit2::MnUserTransformation::MnUserTransformation
MnUserTransformation()
Definition: MnUserTransformation.h:41
ROOT::Minuit2::MnUserTransformation::fLowerLimTrafo
SqrtLowParameterTransformation fLowerLimTrafo
Definition: MnUserTransformation.h:180
ROOT::Minuit2::MnUserTransformation::fDoubleLimTrafo
SinParameterTransformation fDoubleLimTrafo
Definition: MnUserTransformation.h:178
ROOT::Minuit2::MnUserTransformation::fParameters
std::vector< MinuitParameter > fParameters
Definition: MnUserTransformation.h:175
ROOT::Minuit2::MnUserTransformation::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnUserTransformation.cxx:354
ROOT::Minuit2::SqrtUpParameterTransformation
Transformation from external to internal Parameter based on sqrt(1 + x**2)
Definition: SqrtUpParameterTransformation.h:30
ROOT::Minuit2::MnUserTransformation::SetLowerLimit
void SetLowerLimit(unsigned int, double)
Definition: MnUserTransformation.cxx:369
ROOT::Minuit2::MnUserTransformation::SetName
void SetName(unsigned int, const std::string &)
Definition: MnUserTransformation.cxx:383
ROOT::Minuit2::MnUserTransformation::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnUserTransformation.cxx:229
ROOT::Minuit2::MnMachinePrecision::SetPrecision
void SetPrecision(double prec)
override Minuit's own determination
Definition: MnMachinePrecision.h:44
ROOT::Minuit2::MnUserTransformation::GetName
const std::string & GetName(unsigned int) const
Definition: MnUserTransformation.cxx:486
ROOT::Minuit2::MnUserTransformation::DInt2Ext
double DInt2Ext(unsigned int, double) const
Definition: MnUserTransformation.cxx:190
ROOT::Minuit2::MnUserTransformation::operator=
MnUserTransformation & operator=(const MnUserTransformation &trafo)
Definition: MnUserTransformation.h:60
ROOT::Minuit2::MnUserTransformation::ExtOfInt
unsigned int ExtOfInt(unsigned int internal) const
Definition: MnUserTransformation.h:102
ROOT::Minuit2::MnUserTransformation::operator()
std::vector< double > operator()(const MnAlgebraicVector &) const
Definition: MnUserTransformation.cxx:66
ROOT::Minuit2::MnUserTransformation::SetError
void SetError(unsigned int, double)
Definition: MnUserTransformation.cxx:347
ROOT::Minuit2::MnUserTransformation::Release
void Release(unsigned int)
Definition: MnUserTransformation.cxx:327
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
MnConfig.h
ROOT::Minuit2::MnUserTransformation::fCache
std::vector< double > fCache
Definition: MnUserTransformation.h:182
int