GooFit  v2.1.3
Public Member Functions | List of all members
GooFit::Uncertain Class Reference

#include <Uncertain.h>

Public Member Functions

 Uncertain (fptype value, fptype uncertainty=0)
 
 Uncertain (const Variable &val)
 
fptype get_value () const
 
fptype get_uncertainty () const
 
fptype get_relative_uncertainty () const
 
bool operator== (const Uncertain &other) const
 
bool operator!= (const Uncertain &other) const
 
Uncertain operator+ (const Uncertain &other) const
 
Uncertain operator- (const Uncertain &other) const
 
Uncertain operator* (const Uncertain &other) const
 
Uncertain operator* (fptype other) const
 Allow int and float multiplies. More...
 
Uncertain operator/ (const Uncertain &other) const
 
Uncertain operator/ (const fptype &other) const
 

Detailed Description

Definition at line 36 of file Uncertain.h.

Constructor & Destructor Documentation

◆ Uncertain() [1/2]

GooFit::Uncertain::Uncertain ( fptype  value,
fptype  uncertainty = 0 
)
inline

Definition at line 43 of file Uncertain.h.

Referenced by operator*(), GooFit::operator*(), operator+(), operator-(), and operator/().

44  : m_value(value)
45  , m_uncertainty(uncertainty) {
46  if(m_uncertainty < 0)
47  throw std::invalid_argument("Uncertainty can not be negative.");
48  }

◆ Uncertain() [2/2]

GooFit::Uncertain::Uncertain ( const Variable val)
inline

Definition at line 50 of file Uncertain.h.

51  : Uncertain(val.getValue(), val.getError()) {}
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

Member Function Documentation

◆ get_relative_uncertainty()

fptype GooFit::Uncertain::get_relative_uncertainty ( ) const
inline

Definition at line 58 of file Uncertain.h.

Referenced by operator*(), and operator/().

58 { return m_uncertainty / m_value; }

◆ get_uncertainty()

fptype GooFit::Uncertain::get_uncertainty ( ) const
inline

Definition at line 56 of file Uncertain.h.

Referenced by GooFit::format_arg(), GooFit::operator*(), and GooFit::operator<<().

56 { return m_uncertainty; }

◆ get_value()

fptype GooFit::Uncertain::get_value ( ) const
inline

Definition at line 54 of file Uncertain.h.

Referenced by GooFit::format_arg(), GooFit::operator*(), and GooFit::operator<<().

54 { return m_value; }

◆ operator!=()

bool GooFit::Uncertain::operator!= ( const Uncertain other) const
inline

Definition at line 65 of file Uncertain.h.

References operator==().

65 { return !operator==(other); }
bool operator==(const Uncertain &other) const
Definition: Uncertain.h:61

◆ operator*() [1/2]

Uncertain GooFit::Uncertain::operator* ( const Uncertain other) const
inline

Definition at line 76 of file Uncertain.h.

References get_relative_uncertainty(), and Uncertain().

76  {
77  return Uncertain(m_value * other.m_value, get_relative_uncertainty() + other.get_relative_uncertainty());
78  }
fptype get_relative_uncertainty() const
Definition: Uncertain.h:58
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator*() [2/2]

Uncertain GooFit::Uncertain::operator* ( fptype  other) const
inline

Allow int and float multiplies.

Definition at line 81 of file Uncertain.h.

References Uncertain().

81 { return Uncertain(m_value * other, m_uncertainty * other); }
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator+()

Uncertain GooFit::Uncertain::operator+ ( const Uncertain other) const
inline

Definition at line 68 of file Uncertain.h.

References Uncertain().

68  {
69  return Uncertain(m_value + other.m_value, m_uncertainty + other.m_uncertainty);
70  }
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator-()

Uncertain GooFit::Uncertain::operator- ( const Uncertain other) const
inline

Definition at line 72 of file Uncertain.h.

References Uncertain().

72  {
73  return Uncertain(m_value - other.m_value, m_uncertainty + other.m_uncertainty);
74  }
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator/() [1/2]

Uncertain GooFit::Uncertain::operator/ ( const Uncertain other) const
inline

Definition at line 83 of file Uncertain.h.

References get_relative_uncertainty(), and Uncertain().

83  {
84  return Uncertain(m_value / other.m_value, get_relative_uncertainty() + other.get_relative_uncertainty());
85  }
fptype get_relative_uncertainty() const
Definition: Uncertain.h:58
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator/() [2/2]

Uncertain GooFit::Uncertain::operator/ ( const fptype other) const
inline

Definition at line 87 of file Uncertain.h.

References Uncertain().

87 { return Uncertain(m_value / other, m_uncertainty / other); }
Uncertain(fptype value, fptype uncertainty=0)
Definition: Uncertain.h:43

◆ operator==()

bool GooFit::Uncertain::operator== ( const Uncertain other) const
inline

Definition at line 61 of file Uncertain.h.

Referenced by operator!=().

61  {
62  return (m_value == other.m_value) && (m_uncertainty == other.m_uncertainty);
63  }

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