Logo ROOT   6.10/09
Reference Guide
MinimTransformVariable.h
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Author: L. Moneta 2009
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 // Header file for class MinimizerVariable
11 
12 #ifndef ROOT_Math_MinimizerVariable
13 #define ROOT_Math_MinimizerVariable
14 
16 
17 #include <memory>
18 
19 namespace ROOT {
20 
21  namespace Math {
22 
23  /**
24  Enumeration describing the status of the variable
25  The enumeration are used in the minimizer classes to categorize the variables
26  */
28  kDefault, // free variable (unlimited)
29  kFix, // fixed variable
30  kBounds, // variable has two bounds
31  kLowBound, // variable has a lower bound
32  kUpBound // variable has an upper bounds
33  };
34 
35 
36 
37 /**
38  MinimTransformVariable class
39  Contains meta information of the variables such as bounds, fix flags and
40  deals with transformation of the variable
41  The class does not contain the values and the step size (error) of the variable
42  This is an internal class used by the MinimTransformFunction class
43 
44  @ingroup MultiMin
45 */
46 
47 
49 
50 public:
51 
52  /**
53  Default Constructor for an unlimited variable
54  */
56  fFix(false), fLowBound(false), fUpBound(false), fBounds(false),
57  fLower(1), fUpper(0)
58  {}
59 
60  // constructor for fixed variable
61  MinimTransformVariable (double value) :
62  fFix(true), fLowBound(false), fUpBound(false), fBounds(false),
63  fLower(value), fUpper(value)
64  {}
65 
66  // constructor for double bound variable
67  MinimTransformVariable (double lower, double upper, SinVariableTransformation * trafo) :
68  fFix(false), fLowBound(false), fUpBound(false), fBounds(true),
69  fTransform(trafo),
70  fLower(lower), fUpper(upper)
71  { }
72 
73  // constructor for lower bound variable
75  fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
76  fTransform(trafo), fLower(lower), fUpper(lower)
77  {}
78 
79  // constructor for upper bound variable
81  fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
82  fTransform(trafo), fLower(upper), fUpper(upper)
83  {}
84 
85  // copy constructor
88  fLower(rhs.fLower), fUpper(rhs.fUpper)
89  {
90  // swap unique_ptr
91  fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
92  }
93 
94  // assignment
96  if (&rhs == this) return *this;
97  fFix = rhs.fFix;
98  fLowBound = rhs.fLowBound;
99  fUpBound = rhs.fUpBound;
100  fBounds = rhs.fBounds;
101  fLower = rhs.fLower; fUpper = rhs.fUpper;
102 
103  // swap unique_ptr
104  fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
105  return *this;
106  }
107 
108 
109  bool IsFixed() const { return fFix; }
110 
111  bool IsLimited() const { return fBounds || fLowBound || fUpBound; }
112 
113  bool HasLowerBound() const { return fLowBound || fBounds; }
114 
115  bool HasUpperBound() const { return fUpBound || fBounds; }
116 
117  double LowerBound() const { return fLower; }
118 
119  double UpperBound() const { return fUpper; }
120 
121  double FixValue() const { return fLower; }
122 
123  // internal to external transformation
124  double InternalToExternal( double x) const {
125  return (fTransform.get() ) ? fTransform->Int2ext(x, fLower, fUpper) : x;
126  }
127 
128  // derivative of the internal to external transformation ( d Int2Ext / d int )
129  double DerivativeIntToExt ( double x) const {
130  return (fTransform.get() ) ? fTransform->DInt2Ext( x, fLower, fUpper) : 1.0;
131  }
132 
133  // etxernal to internal transformation
134  double ExternalToInternal(double x) const {
135  return (fTransform.get() ) ? fTransform->Ext2int(x, fLower, fUpper) : x;
136  }
137 
138 private:
139 
140  bool fFix; // fix variable
141  bool fLowBound; // has lower bound
142  bool fUpBound; // has uppper bound param
143  bool fBounds; // has double bound
144  std::unique_ptr< MinimizerVariableTransformation> fTransform; // pointer to the minimizer transformation
145  double fLower; // lower parameter limit
146  double fUpper; // upper parameter limit
147 
148 };
149 
150  } // end namespace Math
151 
152 } // end namespace ROOT
153 
154 
155 #endif /* ROOT_Math_MinimTransformVariable */
156 
157 
MinimTransformVariable(double lower, double upper, SinVariableTransformation *trafo)
EMinimVariableType
Enumeration describing the status of the variable The enumeration are used in the minimizer classes t...
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
MinimTransformVariable()
Default Constructor for an unlimited variable.
Double_t x[n]
Definition: legend1.C:17
MinimTransformVariable(double upper, SqrtUpVariableTransformation *trafo)
Sqrt Transformation class for dealing with upper bounded variables.
MinimTransformVariable class Contains meta information of the variables such as bounds, fix flags and deals with transformation of the variable The class does not contain the values and the step size (error) of the variable This is an internal class used by the MinimTransformFunction class.
std::unique_ptr< MinimizerVariableTransformation > fTransform
MinimTransformVariable(const MinimTransformVariable &rhs)
MinimTransformVariable(double lower, SqrtLowVariableTransformation *trafo)
Namespace for new Math classes and functions.
MinimTransformVariable & operator=(const MinimTransformVariable &rhs)
Sin Transformation class for dealing with double bounded variables.
Sqrt Transformation class for dealing with lower bounded variables.