GooFit  v2.1.3
Public Member Functions | Protected Attributes | List of all members
GooFit::Indexable Class Reference

#include <Variable.h>

Inheritance diagram for GooFit::Indexable:
GooFit::Observable GooFit::Variable GooFit::EventNumber

Public Member Functions

 Indexable (std::string n, fptype val=0)
 
 Indexable (std::string n, fptype val, fptype lowerlimit, fptype upperlimit)
 
Indexableoperator= (const Indexable &)=delete
 
virtual ~Indexable ()
 
int getIndex () const
 Get the GooFit index. More...
 
void setIndex (int value)
 Set the GooFit index. More...
 
const std::string & getName () const
 Get the name. More...
 
fptype getValue () const
 Get the value. More...
 
void setValue (fptype val)
 Set the value. More...
 
fptype getUpperLimit () const
 Get the upper limit. More...
 
void setUpperLimit (fptype val)
 Set the upper limit. More...
 
fptype getLowerLimit () const
 Get the lower limit. More...
 
void setLowerLimit (fptype val)
 Set the lower limit. More...
 
const Indexableoperator= (const fptype &val)
 Support var = 3. More...
 
 operator fptype () const
 Support fptype val = var. More...
 
bool operator< (const Indexable &other) const
 Support for using as key in map - Notice this does NOT sort by index! More...
 
bool operator== (const Indexable &other) const
 Support for comparison - only if really the same object, not just the same value. More...
 
bool operator!= (const Indexable &other) const
 Support for comparison - only if really the same object, not just the same value. More...
 
 operator bool () const
 Check to see if in range. More...
 

Protected Attributes

std::string name
 The variable name. Should be unique. More...
 
std::shared_ptr< fptypevalue
 The value of the variable. More...
 
std::shared_ptr< fptypelowerlimit {std::make_shared<fptype>(0)}
 The lower limit. More...
 
std::shared_ptr< fptypeupperlimit {std::make_shared<fptype>(0)}
 The upper limit. More...
 
std::shared_ptr< int > index {std::make_shared<int>(-1)}
 The goofit index, -1 if unset. More...
 

Detailed Description

This class is specifically for any indexable quanity: Observables or Variables. It contains the idea of a limited quanity (min==max means no limit). It can also take a value.

Definition at line 22 of file Variable.h.

Constructor & Destructor Documentation

◆ Indexable() [1/2]

GooFit::Indexable::Indexable ( std::string  n,
fptype  val = 0 
)
inline

Definition at line 40 of file Variable.h.

41  : name(n)
42  , value(std::make_shared<fptype>(val)) {}
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28
std::string name
The variable name. Should be unique.
Definition: Variable.h:25

◆ Indexable() [2/2]

GooFit::Indexable::Indexable ( std::string  n,
fptype  val,
fptype  lowerlimit,
fptype  upperlimit 
)
inline

Definition at line 44 of file Variable.h.

References operator=().

45  : name(n)
46  , value(std::make_shared<fptype>(val))
47  , lowerlimit(std::make_shared<fptype>(lowerlimit))
48  , upperlimit(std::make_shared<fptype>(upperlimit)) {}
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28
std::shared_ptr< fptype > lowerlimit
The lower limit.
Definition: Variable.h:31
std::string name
The variable name. Should be unique.
Definition: Variable.h:25
std::shared_ptr< fptype > upperlimit
The upper limit.
Definition: Variable.h:34

◆ ~Indexable()

virtual GooFit::Indexable::~Indexable ( )
inlinevirtual

Definition at line 52 of file Variable.h.

References GOOFIT_DEBUG.

52  {
53  if(value.use_count() == 1)
54  GOOFIT_DEBUG("Destroying Indexable: {}", name);
55  }
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28
std::string name
The variable name. Should be unique.
Definition: Variable.h:25
#define GOOFIT_DEBUG(...)
Definition: Log.h:96

Member Function Documentation

◆ getIndex()

int GooFit::Indexable::getIndex ( ) const
inline

Get the GooFit index.

Definition at line 58 of file Variable.h.

References index.

Referenced by GooFit::max_index(), GooFit::operator<<(), and GooFit::PdfBase::registerParameter().

58 { return *index; }
std::shared_ptr< int > index
The goofit index, -1 if unset.
Definition: Variable.h:37

◆ getLowerLimit()

fptype GooFit::Indexable::getLowerLimit ( ) const
inline

◆ getName()

const std::string& GooFit::Indexable::getName ( ) const
inline

Get the name.

Definition at line 63 of file Variable.h.

References name.

Referenced by GooFit::UnbinnedDataSet::getValue(), GooFit::operator<<(), plotFit(), GooFit::PdfBase::registerObservable(), GooFit::PdfBase::registerParameter(), and GooFit::PdfBase::unregisterParameter().

63 { return name; }
std::string name
The variable name. Should be unique.
Definition: Variable.h:25

◆ getUpperLimit()

fptype GooFit::Indexable::getUpperLimit ( ) const
inline

◆ getValue()

fptype GooFit::Indexable::getValue ( ) const
inline

◆ operator bool()

GooFit::Indexable::operator bool ( ) const
inline

Check to see if in range.

Definition at line 103 of file Variable.h.

References getLowerLimit(), getUpperLimit(), and getValue().

103  {
104  return getUpperLimit() == getLowerLimit() || (getValue() <= getUpperLimit() && getValue() >= getLowerLimit());
105  }
fptype getLowerLimit() const
Get the lower limit.
Definition: Variable.h:78
fptype getValue() const
Get the value.
Definition: Variable.h:68
fptype getUpperLimit() const
Get the upper limit.
Definition: Variable.h:73

◆ operator fptype()

GooFit::Indexable::operator fptype ( ) const
inline

Support fptype val = var.

Definition at line 91 of file Variable.h.

References getValue().

91 { return getValue(); }
fptype getValue() const
Get the value.
Definition: Variable.h:68

◆ operator!=()

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

Support for comparison - only if really the same object, not just the same value.

Definition at line 100 of file Variable.h.

References value.

100 { return value.get() != other.value.get(); }
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28

◆ operator<()

bool GooFit::Indexable::operator< ( const Indexable other) const
inline

Support for using as key in map - Notice this does NOT sort by index!

Definition at line 94 of file Variable.h.

References value.

94 { return value.get() < other.value.get(); }
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28

◆ operator=() [1/2]

Indexable& GooFit::Indexable::operator= ( const Indexable )
delete

◆ operator=() [2/2]

const Indexable& GooFit::Indexable::operator= ( const fptype val)
inline

Support var = 3.

Definition at line 83 of file Variable.h.

References setValue().

83  {
84  setValue(val);
85  return *this;
86  }
void setValue(fptype val)
Set the value.
Definition: Variable.h:70

◆ operator==()

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

Support for comparison - only if really the same object, not just the same value.

Definition at line 97 of file Variable.h.

References value.

97 { return value.get() == other.value.get(); }
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28

◆ setIndex()

void GooFit::Indexable::setIndex ( int  value)
inline

Set the GooFit index.

Definition at line 60 of file Variable.h.

References index, and value.

Referenced by GooFit::PdfBase::registerParameter(), and GooFit::PdfBase::unregisterParameter().

60 { *index = value; }
std::shared_ptr< fptype > value
The value of the variable.
Definition: Variable.h:28
std::shared_ptr< int > index
The goofit index, -1 if unset.
Definition: Variable.h:37

◆ setLowerLimit()

void GooFit::Indexable::setLowerLimit ( fptype  val)
inline

Set the lower limit.

Definition at line 80 of file Variable.h.

References lowerlimit.

Referenced by GooFit::readFromFile(), and runGeneratedMCFit().

80 { *lowerlimit = val; }
std::shared_ptr< fptype > lowerlimit
The lower limit.
Definition: Variable.h:31

◆ setUpperLimit()

void GooFit::Indexable::setUpperLimit ( fptype  val)
inline

Set the upper limit.

Definition at line 75 of file Variable.h.

References upperlimit.

Referenced by makeSignalJSU_gg(), GooFit::readFromFile(), and runGeneratedMCFit().

75 { *upperlimit = val; }
std::shared_ptr< fptype > upperlimit
The upper limit.
Definition: Variable.h:34

◆ setValue()

void GooFit::Indexable::setValue ( fptype  val)
inline

Member Data Documentation

◆ index

std::shared_ptr<int> GooFit::Indexable::index {std::make_shared<int>(-1)}
protected

The goofit index, -1 if unset.

Definition at line 37 of file Variable.h.

Referenced by getIndex(), and setIndex().

◆ lowerlimit

std::shared_ptr<fptype> GooFit::Indexable::lowerlimit {std::make_shared<fptype>(0)}
protected

The lower limit.

Definition at line 31 of file Variable.h.

Referenced by getLowerLimit(), and setLowerLimit().

◆ name

std::string GooFit::Indexable::name
protected

The variable name. Should be unique.

Definition at line 25 of file Variable.h.

Referenced by getName().

◆ upperlimit

std::shared_ptr<fptype> GooFit::Indexable::upperlimit {std::make_shared<fptype>(0)}
protected

The upper limit.

Definition at line 34 of file Variable.h.

Referenced by getUpperLimit(), and setUpperLimit().

◆ value

std::shared_ptr<fptype> GooFit::Indexable::value
protected

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