File indexing completed on 2025-01-18 10:10:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_Fit_ParameterSettings
0014 #define ROOT_Fit_ParameterSettings
0015
0016 #include <string>
0017
0018 namespace ROOT {
0019
0020 namespace Fit {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class ParameterSettings {
0034
0035 public:
0036
0037
0038
0039
0040 ParameterSettings () :
0041 fValue(0.), fStepSize(0.1), fFix(false),
0042 fLowerLimit(0.), fUpperLimit(0.), fHasLowerLimit(false), fHasUpperLimit(false),
0043 fName("")
0044 {}
0045
0046
0047
0048 ParameterSettings(const std::string & name, double val, double err) :
0049 fValue(val), fStepSize(err), fFix(false),
0050 fLowerLimit(0.), fUpperLimit(0.), fHasLowerLimit(false), fHasUpperLimit(false),
0051 fName(name)
0052 {}
0053
0054
0055 ParameterSettings(const std::string & name, double val, double err,
0056 double min, double max) :
0057 fValue(val), fStepSize(err), fFix(false),
0058 fLowerLimit(0.), fUpperLimit(0.), fHasLowerLimit(false), fHasUpperLimit(false),
0059 fName(name)
0060 {
0061 SetLimits(min,max);
0062 }
0063
0064
0065 ParameterSettings(const std::string & name, double val) :
0066 fValue(val), fStepSize(0), fFix(true),
0067 fLowerLimit(0.), fUpperLimit(0.), fHasLowerLimit(false), fHasUpperLimit(false),
0068 fName(name)
0069 {}
0070
0071
0072
0073
0074
0075 void Set(const std::string & name, double value, double step) {
0076 SetName(name);
0077 SetValue(value);
0078 SetStepSize(step);
0079 }
0080
0081
0082 void Set(const std::string & name, double value, double step, double lower, double upper ) {
0083 SetName(name);
0084 SetValue(value);
0085 SetStepSize(step);
0086 SetLimits(lower,upper);
0087 }
0088
0089
0090 void Set(const std::string & name, double value) {
0091 SetName(name);
0092 SetValue(value);
0093 Fix();
0094 }
0095
0096
0097
0098
0099
0100 ~ParameterSettings () {}
0101
0102
0103
0104 public:
0105
0106
0107 double Value() const { return fValue; }
0108
0109 double StepSize() const { return fStepSize; }
0110
0111 double LowerLimit() const {return fLowerLimit;}
0112
0113 double UpperLimit() const {return fUpperLimit;}
0114
0115 bool IsFixed() const { return fFix; }
0116
0117 bool HasLowerLimit() const {return fHasLowerLimit; }
0118
0119 bool HasUpperLimit() const {return fHasUpperLimit; }
0120
0121 bool IsBound() const { return fHasLowerLimit || fHasUpperLimit; }
0122
0123 bool IsDoubleBound() const { return fHasLowerLimit && fHasUpperLimit; }
0124
0125 const std::string & Name() const { return fName; }
0126
0127
0128
0129
0130 void SetName(const std::string & name ) { fName = name; }
0131
0132
0133 void Fix() {fFix = true;}
0134
0135 void Release() {fFix = false;}
0136
0137 void SetValue(double val) {fValue = val;}
0138
0139 void SetStepSize(double err) {fStepSize = err;}
0140 void SetLimits(double low, double up);
0141
0142 void SetUpperLimit(double up) {
0143 fLowerLimit = 0.;
0144 fUpperLimit = up;
0145 fHasLowerLimit = false;
0146 fHasUpperLimit = true;
0147 }
0148
0149 void SetLowerLimit(double low) {
0150 fLowerLimit = low;
0151 fUpperLimit = 0.;
0152 fHasLowerLimit = true;
0153 fHasUpperLimit = false;
0154 }
0155
0156
0157 void RemoveLimits() {
0158 fLowerLimit = 0.;
0159 fUpperLimit = 0.;
0160 fHasLowerLimit = false;
0161 fHasUpperLimit = false;
0162 }
0163
0164
0165
0166 protected:
0167
0168
0169 private:
0170
0171 double fValue;
0172 double fStepSize;
0173 bool fFix;
0174 double fLowerLimit;
0175 double fUpperLimit;
0176 bool fHasLowerLimit;
0177 bool fHasUpperLimit;
0178
0179 std::string fName;
0180
0181 };
0182
0183 }
0184
0185 }
0186
0187
0188 #endif