Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StatedFCN Class Reference

#include <StatedFCN.h>

Inheritance diagram for StatedFCN:

Inheritance graph
[legend]
Collaboration diagram for StatedFCN:

Collaboration graph
[legend]
List of all members.

Detailed Description

A derived class for FCNBase class.

This class uses a stated function derived from FunctionBase. That is, it assumes the function maintains the state of all its parameters and maintains which parameters are free for minimization.

If HippoDraw is built with Minuit, then this class is derived from the Minuit's FCNBase class, otherwise it derives from HippoDraw's FCNBase.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 46 of file StatedFCN.h.

Public Member Functions

virtual void calcAlphaBeta (std::vector< std::vector< double > > &alpha, std::vector< double > &beta)=0
virtual StatedFCNclone () const =0
 Makes a copy of the derived class object.
virtual int degreesOfFreedom () const =0
 Returns the number of degrees of freedom.
virtual double errorDef () const
void fillFreeDerivatives (std::vector< double > &, double x)
 Clears and fills the vector with the derivatives of the function a coordinate value x.
void fillFreeParameters (std::vector< double > &free_parms) const
 Fills the vector with the values of the free parameters.
const std::vector< int > & getFixedFlags () const
 Returns the vector of which of the model function's parameters are considered fixed and not to be changed during minimization of this objective function.
unsigned int getNumberFreeParms () const
 Returns the number of free parameters.
const std::vector< double > & getParameters () const
 Returns the current state of the model function's parameters.
const std::vector< std::string > & getParmNames () const
 Returns the names of the model function's parameters.
bool hasFunction () const
 Returns true if model function has been set, otherwise returns false.
virtual bool needsIntegrated () const =0
 Returns true if data points were integrated.
virtual double objectiveValue () const =0
 Returns the value of the objective function.
virtual double operator() (const std::vector< double > &parms) const
 Sets the model function parameters to parms and returns the objective value.
virtual void setDataSource (const DataSource *source, int dimension, const std::vector< int > &)=0
 Sets the data source, dimension, and indices into the columns.
virtual void setDataSource (const DataSource *source)=0
 Sets the data source.
virtual void setFitCut (TupleCut *cut)=0
 Sets the cut to limit range of fitting.
virtual void setFitRange (bool yes=true)=0
 Sets use of a fitting range on or off.
virtual void setFixedFlags (const std::vector< int > &flags)
 Sets the parameters that are to be held fixed during minimization of this objective function.
virtual void setFreeParameters (const std::vector< double > &parms)
 Sets the free parameters from the vector parms.
void setFunction (FunctionBase *function)
 Sets the model function.
void setParameters (const std::vector< double > &parms)
 Sets the values of the model function's parameters.
virtual bool setUseErrors (bool yes=true)=0
 Sets the FCN to use errors on the data source values if it can.
 StatedFCN (FunctionBase *function)
 The constructor taking FunctionBase object as argument.
virtual double up () const =0

Protected Member Functions

 StatedFCN (const StatedFCN &)
 The copy constructor.
 StatedFCN ()
 The default constructor.

Protected Attributes

FunctionBasem_function
 A pointer to the model function to be used in fitting.
bool m_has_errors
 Error use flag.

Private Attributes

std::vector< int > m_fixed_flags
 The flags to indicated which parameters are to be held fixed during minimization of this objective function.


Constructor & Destructor Documentation

StatedFCN::StatedFCN  )  [protected]
 

The default constructor.

The default constructor initializes the pointer to the model function to the null pointer.

Definition at line 24 of file StatedFCN.cxx.

StatedFCN::StatedFCN const StatedFCN  )  [protected]
 

The copy constructor.

The copy constructor makes a copy of the pointer to the FunctionBase object it uses.

Definition at line 31 of file StatedFCN.cxx.

StatedFCN::StatedFCN FunctionBase function  ) 
 

The constructor taking FunctionBase object as argument.

Definition at line 39 of file StatedFCN.cxx.

References setFunction().


Member Function Documentation

virtual void StatedFCN::calcAlphaBeta std::vector< std::vector< double > > &  alpha,
std::vector< double > &  beta
[pure virtual]
 

Implemented in NTupleFCN.

virtual StatedFCN* StatedFCN::clone  )  const [pure virtual]
 

Makes a copy of the derived class object.

Implemented in NTupleChiSqFCN, NTupleLikeliHoodFCN, and NTuplePearsonFCN.

virtual int StatedFCN::degreesOfFreedom  )  const [pure virtual]
 

Returns the number of degrees of freedom.

Implemented in NTupleFCN.

void StatedFCN::fillFreeDerivatives std::vector< double > &  ,
double  x
 

Clears and fills the vector with the derivatives of the function a coordinate value x.

Definition at line 149 of file StatedFCN.cxx.

References getParameters(), m_fixed_flags, m_function, and num_util::size().

Referenced by NTupleFCN::calcAlphaBeta().

void StatedFCN::fillFreeParameters std::vector< double > &  free_parms  )  const
 

Fills the vector with the values of the free parameters.

Definition at line 89 of file StatedFCN.cxx.

References getParameters(), m_fixed_flags, m_function, and num_util::size().

const vector< int > & StatedFCN::getFixedFlags  )  const
 

Returns the vector of which of the model function's parameters are considered fixed and not to be changed during minimization of this objective function.

Definition at line 116 of file StatedFCN.cxx.

References m_fixed_flags.

unsigned int StatedFCN::getNumberFreeParms  )  const
 

Returns the number of free parameters.

Definition at line 103 of file StatedFCN.cxx.

References m_fixed_flags, and num_util::size().

Referenced by NTupleFCN::calcAlphaBeta(), and NTupleFCN::degreesOfFreedom().

const vector< double > & StatedFCN::getParameters  )  const
 

Returns the current state of the model function's parameters.

Definition at line 75 of file StatedFCN.cxx.

References m_function.

Referenced by fillFreeDerivatives(), fillFreeParameters(), and setFreeParameters().

const vector< string > & StatedFCN::getParmNames  )  const
 

Returns the names of the model function's parameters.

Definition at line 68 of file StatedFCN.cxx.

References m_function.

bool StatedFCN::hasFunction  )  const
 

Returns true if model function has been set, otherwise returns false.

Definition at line 48 of file StatedFCN.cxx.

References m_function.

virtual bool StatedFCN::needsIntegrated  )  const [pure virtual]
 

Returns true if data points were integrated.

Return true if the FCN function needs data points were integrated over a range. An example would be a histogram. Returns false if the integrated data points are not needed.

Implemented in NTupleChiSqFCN, NTupleLikeliHoodFCN, and NTuplePearsonFCN.

virtual double StatedFCN::objectiveValue  )  const [pure virtual]
 

Returns the value of the objective function.

Returns the value of the objective function for the current state of the function. The state of the function's parameters is set by operator(). Other states the function may have is set by calling member functions of the function directly.

Implemented in NTupleChiSqFCN, NTupleLikeliHoodFCN, and NTuplePearsonFCN.

Referenced by hippodraw::Python::export_StatedFCN(), and operator()().

double StatedFCN::operator() const std::vector< double > &  parms  )  const [virtual]
 

Sets the model function parameters to parms and returns the objective value.

Implements FCNBase.

Definition at line 165 of file StatedFCN.cxx.

References m_function, objectiveValue(), and setParameters().

Referenced by NTupleFCN::calcAlphaBeta(), NTuplePearsonFCN::objectiveValue(), and NTupleChiSqFCN::objectiveValue().

virtual void StatedFCN::setDataSource const DataSource source,
int  dimension,
const std::vector< int > & 
[pure virtual]
 

Sets the data source, dimension, and indices into the columns.

Sets the data source, dimension and indices into the column. For one dimensional data source, the order of the indices are as in The hippodraw::DataPoint2DTuple enumeration. For two dimensional data source as with hippodraw::DataPoint3DTuple enumeration. For higher dimensions, the pattern should repeat. A negative index value indicates that the variable is not used.

Implemented in NTupleFCN.

virtual void StatedFCN::setDataSource const DataSource source  )  [pure virtual]
 

Sets the data source.

Sets the data source and uses indices from hippodraw::DataPoint2DTuple.

Implemented in NTupleFCN.

Referenced by hippodraw::Python::export_StatedFCN().

virtual void StatedFCN::setFitCut TupleCut cut  )  [pure virtual]
 

Sets the cut to limit range of fitting.

Implemented in NTupleFCN.

virtual void StatedFCN::setFitRange bool  yes = true  )  [pure virtual]
 

Sets use of a fitting range on or off.

Implemented in NTupleFCN.

void StatedFCN::setFixedFlags const std::vector< int > &  flags  )  [virtual]
 

Sets the parameters that are to be held fixed during minimization of this objective function.

Definition at line 124 of file StatedFCN.cxx.

References m_fixed_flags.

void StatedFCN::setFreeParameters const std::vector< double > &  parms  )  [virtual]
 

Sets the free parameters from the vector parms.

Definition at line 131 of file StatedFCN.cxx.

References getParameters(), m_fixed_flags, m_function, setParameters(), and num_util::size().

void StatedFCN::setFunction FunctionBase function  ) 
 

Sets the model function.

Sets the model function object to function.

Definition at line 55 of file StatedFCN.cxx.

References m_fixed_flags, m_function, and num_util::size().

Referenced by hippodraw::Python::export_StatedFCN(), and StatedFCN().

void StatedFCN::setParameters const std::vector< double > &  parms  ) 
 

Sets the values of the model function's parameters.

Definition at line 82 of file StatedFCN.cxx.

References m_function.

Referenced by operator()(), and setFreeParameters().

virtual bool StatedFCN::setUseErrors bool  yes = true  )  [pure virtual]
 

Sets the FCN to use errors on the data source values if it can.

Implemented in NTupleFCN.

Referenced by hippodraw::Python::export_StatedFCN().


Member Data Documentation

std::vector< int > StatedFCN::m_fixed_flags [private]
 

The flags to indicated which parameters are to be held fixed during minimization of this objective function.

Note:
The flags are held as int because it is more space and time efficient for the expected number of parameters.

Definition at line 57 of file StatedFCN.h.

Referenced by fillFreeDerivatives(), fillFreeParameters(), getFixedFlags(), getNumberFreeParms(), setFixedFlags(), setFreeParameters(), and setFunction().

FunctionBase* StatedFCN::m_function [protected]
 

A pointer to the model function to be used in fitting.

This object does not own the function.

Definition at line 64 of file StatedFCN.h.

Referenced by NTupleFCN::calcAlphaBeta(), fillFreeDerivatives(), fillFreeParameters(), getParameters(), getParmNames(), hasFunction(), NTuplePearsonFCN::objectiveValue(), NTupleLikeliHoodFCN::objectiveValue(), NTupleChiSqFCN::objectiveValue(), operator()(), setFreeParameters(), setFunction(), and setParameters().

bool StatedFCN::m_has_errors [protected]
 

Error use flag.

A flag set to true, if errors on measured points are to be used. When set true, only data points with non-zero errors are used. When set false, all error on data points is set to 1.0

Definition at line 71 of file StatedFCN.h.

Referenced by NTupleFCN::calcAlphaBeta(), NTupleFCN::degreesOfFreedom(), NTuplePearsonFCN::objectiveValue(), NTupleChiSqFCN::objectiveValue(), and NTupleFCN::setUseErrors().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3