ComPWA
Common Partial-Wave-Analysis Framework
ComPWA::FunctionTree::FitParameter Class Reference

#include <FitParameter.hpp>

Public Member Functions

 FitParameter (std::string inName="")
 Standard constructor with no information provided. More...
 
 FitParameter (const boost::property_tree::ptree &pt)
 Construct parameter from a property tree. More...
 
 FitParameter (std::string inName, const double value)
 Standard constructor with just a value provided. More...
 
 FitParameter (std::string inName, const double value, const double error)
 Standard constructor with value and error provided. More...
 
 FitParameter (std::string inName, const double value, const double min, const double max)
 Standard constructor with value and bounds provided. More...
 
 FitParameter (std::string inName, const double value, const double min, const double max, const double error)
 Standard constructor with value, bounds and error provided. More...
 
 FitParameter (ComPWA::FitParameter< double > par)
 
virtual bool isParameter () const
 
 operator double () const
 
virtual bool hasBounds () const
 
virtual bool isFixed () const
 
virtual void fixParameter (const bool fixed)
 
virtual void updateParameter (std::shared_ptr< FitParameter > newPar)
 Update member variables from other FitParameter. More...
 
virtual double value () const
 Getter for value of parameter. More...
 
virtual void setValue (const double inVal)
 Setter for value of parameter. More...
 
virtual std::pair< double, double > bounds () const
 Bounds of parameter. More...
 
virtual void setBounds (const double min, const double max)
 Bounds of parameter. More...
 
virtual void setBounds (const std::pair< double, double > r)
 Bounds of parameter. More...
 
virtual bool hasError () const
 Is an error set? More...
 
virtual ErrorType errorType () const
 
virtual std::pair< double, double > error () const
 Parameter error. More...
 
virtual double avgError () const
 Average parameter error (in case of asymmetric errors) or simply parameter error. More...
 
virtual void setError (double errLow, double errHigh)
 Set parameter error and assume that this parameter has asymmetric errors. More...
 
virtual void setError (std::pair< double, double > err)
 Set parameter error and assume that this parameter has asymmetric errors. More...
 
virtual void setError (double err)
 Setter parameter error and assume that this parameter has symmetric errors. More...
 
bool operator== (const FitParameter otherPar) const
 
void load (const boost::property_tree::ptree &pt)
 Load parameters from a ptree. More...
 
boost::property_tree::ptree save () const
 Save parameter to a ptree. More...
 
virtual std::string to_str () const
 String with detailed information about the parameter. More...
 
virtual std::string val_to_str () const
 String with detailed information about the parameter. More...
 
- Public Member Functions inherited from ComPWA::FunctionTree::Parameter
 Parameter (std::string name, ParType type=ParType::UNDEFINED)
 Constructor with name of parameter and optional type. More...
 
virtual ~Parameter ()=default
 
virtual std::string name () const
 Getter for name of object. More...
 
virtual void setName (std::string n)
 Getter for name of object. More...
 
virtual ParType type () const
 Getter for type of object. More...
 
void attach (std::weak_ptr< ParObserver > newObserver)
 Attaches a new TreeNode as Observer. More...
 
void detachExpired ()
 Removes TreeNodes not needed as Observer anymore. More...
 
void notify ()
 Notify all observing TreeNodes that parameter changed. More...
 

Protected Member Functions

virtual std::string className () const
 Getter for typename of object, to be defined by the actual implementation. More...
 
virtual void SetErrorType (ErrorType t)
 
bool check_bounds (const std::pair< double, double > bounds) const
 Check if min and max are valid bounds. More...
 

Protected Attributes

bool HasBounds
 Are valid bounds defined for this parameter? More...
 
bool IsFixed
 Do you want to keep parameter fixed? More...
 
double Value
 Parameter value. More...
 
std::pair< double, double > Bounds
 Parameter bounds. More...
 
ErrorType ErrType
 No error / symmetric error / asymmetric error. More...
 
std::pair< double, double > Error
 Lower parameter error. More...
 
- Protected Attributes inherited from ComPWA::FunctionTree::Parameter
std::string Name
 Name of parameter. More...
 
ParType Type
 Type of parameter (e.g. Double, Integer, ...) More...
 
std::vector< std::weak_ptr< ParObserver > > ObservingNodes
 List of observers, e.g. TreeNodes. More...
 

Private Member Functions

template<class archive >
void serialize (archive &ar, const unsigned int version)
 

Detailed Description

Definition at line 34 of file FitParameter.hpp.

+ Inheritance diagram for ComPWA::FunctionTree::FitParameter:
+ Collaboration diagram for ComPWA::FunctionTree::FitParameter:

Constructor & Destructor Documentation

◆ FitParameter() [1/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( std::string  inName = "")

Standard constructor with no information provided.

Creates parameter with value 0 but without bounds or an error.

Parameters
inNameinternal string identifier of this parameter

Definition at line 14 of file FitParameter.cpp.

◆ FitParameter() [2/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( const boost::property_tree::ptree &  pt)

Construct parameter from a property tree.

The expected tree layout is described in load().

Definition at line 19 of file FitParameter.cpp.

◆ FitParameter() [3/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( std::string  inName,
const double  value 
)

Standard constructor with just a value provided.

Creates parameter with given value but without bounds or an error.

Definition at line 26 of file FitParameter.cpp.

◆ FitParameter() [4/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( std::string  inName,
const double  value,
const double  error 
)

Standard constructor with value and error provided.

Creates parameter with given value and error but without bounds.

Definition at line 31 of file FitParameter.cpp.

◆ FitParameter() [5/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( std::string  inName,
const double  value,
const double  min,
const double  max 
)

Standard constructor with value and bounds provided.

Creates parameter with given value and bounds but without error. If a check for valid bounds fails, just the value is used.

Definition at line 37 of file FitParameter.cpp.

◆ FitParameter() [6/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( std::string  inName,
const double  value,
const double  min,
const double  max,
const double  error 
)

Standard constructor with value, bounds and error provided.

Creates parameter with the given information. If a check for valid bounds fails, just value and error are used.

Definition at line 45 of file FitParameter.cpp.

◆ FitParameter() [7/7]

ComPWA::FunctionTree::FitParameter::FitParameter ( ComPWA::FitParameter< double >  par)

Definition at line 55 of file FitParameter.cpp.

Member Function Documentation

◆ avgError()

virtual double ComPWA::FunctionTree::FitParameter::avgError ( ) const
inlinevirtual

Average parameter error (in case of asymmetric errors) or simply parameter error.

Definition at line 111 of file FitParameter.hpp.

◆ bounds()

std::pair< double, double > ComPWA::FunctionTree::FitParameter::bounds ( ) const
virtual

Bounds of parameter.

Definition at line 113 of file FitParameter.cpp.

◆ check_bounds()

bool ComPWA::FunctionTree::FitParameter::check_bounds ( const std::pair< double, double >  bounds) const
protected

Check if min and max are valid bounds.

Definition at line 213 of file FitParameter.cpp.

◆ className()

virtual std::string ComPWA::FunctionTree::FitParameter::className ( ) const
inlineprotectedvirtual

Getter for typename of object, to be defined by the actual implementation.

Implements ComPWA::FunctionTree::Parameter.

Definition at line 144 of file FitParameter.hpp.

◆ error()

std::pair< double, double > ComPWA::FunctionTree::FitParameter::error ( ) const
virtual

Parameter error.

Definition at line 139 of file FitParameter.cpp.

◆ errorType()

virtual ErrorType ComPWA::FunctionTree::FitParameter::errorType ( ) const
inlinevirtual

Definition at line 104 of file FitParameter.hpp.

◆ fixParameter()

virtual void ComPWA::FunctionTree::FitParameter::fixParameter ( const bool  fixed)
inlinevirtual

Definition at line 76 of file FitParameter.hpp.

◆ hasBounds()

virtual bool ComPWA::FunctionTree::FitParameter::hasBounds ( ) const
inlinevirtual

Definition at line 72 of file FitParameter.hpp.

◆ hasError()

bool ComPWA::FunctionTree::FitParameter::hasError ( ) const
virtual

Is an error set?

Definition at line 133 of file FitParameter.cpp.

◆ isFixed()

virtual bool ComPWA::FunctionTree::FitParameter::isFixed ( ) const
inlinevirtual

Definition at line 74 of file FitParameter.hpp.

◆ isParameter()

virtual bool ComPWA::FunctionTree::FitParameter::isParameter ( ) const
inlinevirtual

Reimplemented from ComPWA::FunctionTree::Parameter.

Definition at line 68 of file FitParameter.hpp.

◆ load()

void ComPWA::FunctionTree::FitParameter::load ( const boost::property_tree::ptree &  pt)

Load parameters from a ptree.

This approach is more or less equivalent to the serialization of a parameter but provides a better readable format.

Definition at line 243 of file FitParameter.cpp.

◆ operator double()

ComPWA::FunctionTree::FitParameter::operator double ( ) const
inline

Definition at line 70 of file FitParameter.hpp.

◆ operator==()

bool ComPWA::FunctionTree::FitParameter::operator== ( const FitParameter  otherPar) const

Definition at line 173 of file FitParameter.cpp.

◆ save()

boost::property_tree::ptree ComPWA::FunctionTree::FitParameter::save ( ) const

Save parameter to a ptree.

This approach is more or less equivalent to the serialization of a parameter but provides a better readable format.

Definition at line 290 of file FitParameter.cpp.

◆ serialize()

template<class archive >
void ComPWA::FunctionTree::FitParameter::serialize ( archive &  ar,
const unsigned int  version 
)
inlineprivate

Definition at line 172 of file FitParameter.hpp.

◆ setBounds() [1/2]

void ComPWA::FunctionTree::FitParameter::setBounds ( const double  min,
const double  max 
)
virtual

Bounds of parameter.

Definition at line 115 of file FitParameter.cpp.

◆ setBounds() [2/2]

void ComPWA::FunctionTree::FitParameter::setBounds ( const std::pair< double, double >  r)
virtual

Bounds of parameter.

Definition at line 124 of file FitParameter.cpp.

◆ setError() [1/3]

void ComPWA::FunctionTree::FitParameter::setError ( double  errLow,
double  errHigh 
)
virtual

Set parameter error and assume that this parameter has asymmetric errors.

Definition at line 147 of file FitParameter.cpp.

◆ setError() [2/3]

void ComPWA::FunctionTree::FitParameter::setError ( std::pair< double, double >  err)
virtual

Set parameter error and assume that this parameter has asymmetric errors.

Definition at line 156 of file FitParameter.cpp.

◆ setError() [3/3]

void ComPWA::FunctionTree::FitParameter::setError ( double  err)
virtual

Setter parameter error and assume that this parameter has symmetric errors.

Definition at line 164 of file FitParameter.cpp.

◆ SetErrorType()

virtual void ComPWA::FunctionTree::FitParameter::SetErrorType ( ErrorType  t)
inlineprotectedvirtual

Definition at line 164 of file FitParameter.hpp.

◆ setValue()

void ComPWA::FunctionTree::FitParameter::setValue ( const double  inVal)
virtual

Setter for value of parameter.

Definition at line 93 of file FitParameter.cpp.

◆ to_str()

std::string ComPWA::FunctionTree::FitParameter::to_str ( ) const
virtual

String with detailed information about the parameter.

Used in operator<<().

Implements ComPWA::FunctionTree::Parameter.

Definition at line 220 of file FitParameter.cpp.

◆ updateParameter()

void ComPWA::FunctionTree::FitParameter::updateParameter ( std::shared_ptr< FitParameter newPar)
virtual

Update member variables from other FitParameter.

Do to the Observer pattern we can't use a copy constructor. Therefore we use this workaround. The function ignores if parameter is fixed!

Definition at line 65 of file FitParameter.cpp.

◆ val_to_str()

std::string ComPWA::FunctionTree::FitParameter::val_to_str ( ) const
virtual

String with detailed information about the parameter.

Used in operator<<().

Implements ComPWA::FunctionTree::Parameter.

Definition at line 237 of file FitParameter.cpp.

◆ value()

virtual double ComPWA::FunctionTree::FitParameter::value ( ) const
inlinevirtual

Getter for value of parameter.

Definition at line 86 of file FitParameter.hpp.

Member Data Documentation

◆ Bounds

std::pair<double, double> ComPWA::FunctionTree::FitParameter::Bounds
protected

Parameter bounds.

Definition at line 156 of file FitParameter.hpp.

◆ Error

std::pair<double, double> ComPWA::FunctionTree::FitParameter::Error
protected

Lower parameter error.

Definition at line 162 of file FitParameter.hpp.

◆ ErrType

ErrorType ComPWA::FunctionTree::FitParameter::ErrType
protected

No error / symmetric error / asymmetric error.

Definition at line 159 of file FitParameter.hpp.

◆ HasBounds

bool ComPWA::FunctionTree::FitParameter::HasBounds
protected

Are valid bounds defined for this parameter?

Definition at line 147 of file FitParameter.hpp.

◆ IsFixed

bool ComPWA::FunctionTree::FitParameter::IsFixed
protected

Do you want to keep parameter fixed?

Definition at line 150 of file FitParameter.hpp.

◆ Value

double ComPWA::FunctionTree::FitParameter::Value
protected

Parameter value.

Definition at line 153 of file FitParameter.hpp.


The documentation for this class was generated from the following files: