10 #ifndef _FITPARAMETER_HPP_ 11 #define _FITPARAMETER_HPP_ 20 #include <boost/property_tree/ptree_fwd.hpp> 21 #include <boost/serialization/utility.hpp> 30 namespace FunctionTree {
57 FitParameter(std::string inName,
const double value,
const double min,
63 FitParameter(std::string inName,
const double value,
const double min,
64 const double max,
const double error);
70 operator double()
const {
return Value; };
89 virtual void setValue(
const double inVal);
92 virtual std::pair<double, double>
bounds()
const;
95 virtual void setBounds(
const double min,
const double max);
98 virtual void setBounds(
const std::pair<double, double> r);
107 virtual std::pair<double, double>
error()
const;
114 virtual void setError(
double errLow,
double errHigh);
117 virtual void setError(std::pair<double, double> err);
128 void load(
const boost::property_tree::ptree &pt);
133 boost::property_tree::ptree
save()
const;
137 virtual std::string
to_str()
const;
144 virtual std::string
className()
const {
return "Double"; }
167 bool check_bounds(
const std::pair<double, double> bounds)
const;
170 friend class boost::serialization::access;
171 template <
class archive>
172 void serialize(archive &ar,
const unsigned int version) {
176 ar &make_nvp(
"Name",
Name);
177 ar &make_nvp(
"Bounds", Bounds);
178 ar &make_nvp(
"Fix", IsFixed);
179 ar &make_nvp(
"Value", Value);
180 ar &make_nvp(
"Bounds", Bounds);
182 ar &make_nvp(
"ErrorType", ErrType);
183 ar &make_nvp(
"Error", Error);
185 Error = std::pair<double, double>(0, 0);
virtual void setValue(const double inVal)
Setter for value of parameter.
void serialize(archive &ar, const unsigned int version)
virtual ErrorType errorType() const
virtual std::pair< double, double > error() const
Parameter error.
boost::property_tree::ptree save() const
Save parameter to a ptree.
bool operator==(const FitParameter otherPar) const
Base class for internal parameter.
virtual void SetErrorType(ErrorType t)
virtual void updateParameter(std::shared_ptr< FitParameter > newPar)
Update member variables from other FitParameter.
virtual bool hasBounds() const
std::pair< double, double > Bounds
Parameter bounds.
virtual std::pair< double, double > bounds() const
Bounds of parameter.
bool HasBounds
Are valid bounds defined for this parameter?
void load(const boost::property_tree::ptree &pt)
Load parameters from a ptree.
std::string Name
Name of parameter.
virtual std::string className() const
Getter for typename of object, to be defined by the actual implementation.
virtual std::string val_to_str() const
String with detailed information about the parameter.
bool IsFixed
Do you want to keep parameter fixed?
ErrorType ErrType
No error / symmetric error / asymmetric error.
FitParameter(std::string inName="")
Standard constructor with no information provided.
virtual bool isParameter() const
virtual void fixParameter(const bool fixed)
virtual double value() const
Getter for value of parameter.
virtual double avgError() const
Average parameter error (in case of asymmetric errors) or simply parameter error. ...
virtual void setError(double errLow, double errHigh)
Set parameter error and assume that this parameter has asymmetric errors.
virtual bool isFixed() const
double Value
Parameter value.
virtual std::string to_str() const
String with detailed information about the parameter.
virtual void setBounds(const double min, const double max)
Bounds of parameter.
virtual bool hasError() const
Is an error set?
std::pair< double, double > Error
Lower parameter error.
bool check_bounds(const std::pair< double, double > bounds) const
Check if min and max are valid bounds.