Skip to content

Commit e9ebabf

Browse files
committed
[minuit2] Truncate setting parameter values if over the limit
1 parent 669bcf0 commit e9ebabf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

math/minuit2/inc/Minuit2/MinuitParameter.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MinuitParameter {
9696
unsigned int Number() const { return fNum; }
9797
// new API returning a string
9898
const std::string &GetName() const { return fName; }
99-
// return const char * for maintaining backward compatibility
99+
// return const char * for mantaining backward compatibility
100100
const char *Name() const { return fName.c_str(); }
101101

102102
double Value() const { return fValue; }
@@ -105,7 +105,11 @@ class MinuitParameter {
105105
// interaction
106106
void SetName(const std::string &name) { fName = name; }
107107

108-
void SetValue(double val) { fValue = val; }
108+
void SetValue(double val) {
109+
fValue = val;
110+
if (fLoLimValid && val < fLoLimit) fValue = fLoLimit;
111+
if (fUpLimValid && val > fUpLimit) fValue = fUpLimit;
112+
}
109113
void SetError(double err) { fError = err; }
110114
void SetLimits(double low, double up)
111115
{

0 commit comments

Comments
 (0)