#ifndef ROOT_Minuit2_MinuitParameter
#define ROOT_Minuit2_MinuitParameter
#include <algorithm>
#include <memory>
#include <cassert>
#include <string>
namespace ROOT {
namespace Minuit2 {
class MinuitParameter {
public:
MinuitParameter(unsigned int num, const std::string & name, double val) :
fNum(num), fValue(val), fError(0.), fConst(true), fFix(false),
fLoLimit(0.), fUpLimit(0.), fLoLimValid(false), fUpLimValid(false),
fName(name)
{}
MinuitParameter(unsigned int num, const std::string & name, double val, double err) :
fNum(num), fValue(val), fError(err), fConst(false), fFix(false),
fLoLimit(0.), fUpLimit(0.), fLoLimValid(false), fUpLimValid(false),
fName(name)
{}
MinuitParameter(unsigned int num, const std::string & name, double val, double err,
double min, double max) :
fNum(num),fValue(val), fError(err), fConst(false), fFix(false),
fLoLimit(min), fUpLimit(max), fLoLimValid(true), fUpLimValid(true),
fName(name)
{
assert(min != max);
if(min > max) {
fLoLimit = max;
fUpLimit = min;
}
}
~MinuitParameter() {}
MinuitParameter(const MinuitParameter& par) :
fNum(par.fNum), fValue(par.fValue), fError(par.fError),
fConst(par.fConst), fFix(par.fFix), fLoLimit(par.fLoLimit),
fUpLimit(par.fUpLimit), fLoLimValid(par.fLoLimValid),
fUpLimValid(par.fUpLimValid),
fName(par.fName )
{}
MinuitParameter& operator=(const MinuitParameter& par) {
fNum = par.fNum;
fName = par.fName;
fValue = par.fValue;
fError = par.fError;
fConst = par.fConst;
fFix = par.fFix;
fLoLimit = par.fLoLimit;
fUpLimit = par.fUpLimit;
fLoLimValid = par.fLoLimValid;
fUpLimValid = par.fUpLimValid;
return *this;
}
unsigned int Number() const {return fNum;}
const std::string & GetName() const { return fName; }
const char * Name() const {return fName.c_str();}
double Value() const {return fValue;}
double Error() const {return fError;}
void SetValue(double val) {fValue = val;}
void SetError(double err) {fError = err;}
void SetLimits(double low, double up) {
assert(low != up);
fLoLimit = low;
fUpLimit = up;
fLoLimValid = true;
fUpLimValid = true;
if(low > up) {
fLoLimit = up;
fUpLimit = low;
}
}
void SetUpperLimit(double up) {
fLoLimit = 0.;
fUpLimit = up;
fLoLimValid = false;
fUpLimValid = true;
}
void SetLowerLimit(double low) {
fLoLimit = low;
fUpLimit = 0.;
fLoLimValid = true;
fUpLimValid = false;
}
void RemoveLimits() {
fLoLimit = 0.;
fUpLimit = 0.;
fLoLimValid = false;
fUpLimValid = false;
}
void Fix() {fFix = true;}
void Release() {fFix = false;}
bool IsConst() const {return fConst;}
bool IsFixed() const {return fFix;}
bool HasLimits() const {return fLoLimValid || fUpLimValid; }
bool HasLowerLimit() const {return fLoLimValid; }
bool HasUpperLimit() const {return fUpLimValid; }
double LowerLimit() const {return fLoLimit;}
double UpperLimit() const {return fUpLimit;}
private:
unsigned int fNum;
double fValue;
double fError;
bool fConst;
bool fFix;
double fLoLimit;
double fUpLimit;
bool fLoLimValid;
bool fUpLimValid;
std::string fName;
private:
};
}
}
#endif // ROOT_Minuit2_MinuitParameter
Last change: Wed Jun 25 08:30:37 2008
Last generated: 2008-06-25 08:30
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.