File indexing completed on 2025-01-30 10:22:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_Math_MinimizerVariable
0013 #define ROOT_Math_MinimizerVariable
0014
0015 #include "MinimizerVariableTransformation.h"
0016
0017 #include <memory>
0018
0019 namespace ROOT {
0020
0021 namespace Math {
0022
0023
0024
0025
0026
0027 enum EMinimVariableType {
0028 kDefault,
0029 kFix,
0030 kBounds,
0031 kLowBound,
0032 kUpBound
0033 };
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class MinimTransformVariable {
0049
0050 public:
0051
0052
0053
0054
0055 MinimTransformVariable () :
0056 fFix(false), fLowBound(false), fUpBound(false), fBounds(false),
0057 fLower(1), fUpper(0)
0058 {}
0059
0060
0061 MinimTransformVariable (double value) :
0062 fFix(true), fLowBound(false), fUpBound(false), fBounds(false),
0063 fLower(value), fUpper(value)
0064 {}
0065
0066
0067 MinimTransformVariable (double lower, double upper, SinVariableTransformation * trafo) :
0068 fFix(false), fLowBound(false), fUpBound(false), fBounds(true),
0069 fTransform(trafo),
0070 fLower(lower), fUpper(upper)
0071 { }
0072
0073
0074 MinimTransformVariable (double lower, SqrtLowVariableTransformation * trafo) :
0075 fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
0076 fTransform(trafo), fLower(lower), fUpper(lower)
0077 {}
0078
0079
0080 MinimTransformVariable (double upper, SqrtUpVariableTransformation * trafo) :
0081 fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
0082 fTransform(trafo), fLower(upper), fUpper(upper)
0083 {}
0084
0085
0086 MinimTransformVariable (const MinimTransformVariable & rhs) :
0087 fFix(rhs.fFix), fLowBound(rhs.fLowBound), fUpBound(rhs.fUpBound), fBounds(rhs.fBounds),
0088 fLower(rhs.fLower), fUpper(rhs.fUpper)
0089 {
0090
0091 fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
0092 }
0093
0094
0095 MinimTransformVariable & operator= (const MinimTransformVariable & rhs) {
0096 if (&rhs == this) return *this;
0097 fFix = rhs.fFix;
0098 fLowBound = rhs.fLowBound;
0099 fUpBound = rhs.fUpBound;
0100 fBounds = rhs.fBounds;
0101 fLower = rhs.fLower; fUpper = rhs.fUpper;
0102
0103
0104 fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
0105 return *this;
0106 }
0107
0108
0109 bool IsFixed() const { return fFix; }
0110
0111 bool IsLimited() const { return fBounds || fLowBound || fUpBound; }
0112
0113 bool HasLowerBound() const { return fLowBound || fBounds; }
0114
0115 bool HasUpperBound() const { return fUpBound || fBounds; }
0116
0117 double LowerBound() const { return fLower; }
0118
0119 double UpperBound() const { return fUpper; }
0120
0121 double FixValue() const { return fLower; }
0122
0123
0124 double InternalToExternal( double x) const {
0125 return (fTransform.get() ) ? fTransform->Int2ext(x, fLower, fUpper) : x;
0126 }
0127
0128
0129 double DerivativeIntToExt ( double x) const {
0130 return (fTransform.get() ) ? fTransform->DInt2Ext( x, fLower, fUpper) : 1.0;
0131 }
0132
0133
0134 double ExternalToInternal(double x) const {
0135 return (fTransform.get() ) ? fTransform->Ext2int(x, fLower, fUpper) : x;
0136 }
0137
0138 private:
0139
0140 bool fFix;
0141 bool fLowBound;
0142 bool fUpBound;
0143 bool fBounds;
0144 std::unique_ptr< MinimizerVariableTransformation> fTransform;
0145 double fLower;
0146 double fUpper;
0147
0148 };
0149
0150 }
0151
0152 }
0153
0154
0155 #endif
0156
0157