Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

SctData::FitObject Class Reference

FitObject is an abstract base class fit object to store the output to various types of fit. More...

#include <FitObject.h>

Inheritance diagram for SctData::FitObject:

Sct::Streamable SctData::ErfcFitObject SctData::ErfFitObject SctData::GausFitObject SctData::TopHatFitObject

Public Member Functions

virtual auto_ptr< FitObject > clone () const=0 throw ()
 Allows any sub-class of FitObject to be used as a prototype.

virtual auto_ptr< TF1 > makeRootTF1 () const throw (LogicError)
 Conversion utility functions;.

FitObject & operator= (const TF1 &) throw (LogicError)
 Set the values of this FitObject equal to those of a ROOT TF1 function to be implimented in sub-classes.

void print () const throw (LogicError)
 Print this to cout.

int getNDim () const throw ()
 Get the dimensionality.

int getNPar () const throw ()
 Get the number of parameters.

char * getParName (const int ipar) const throw (LogicError)
 Get name of parameter ipar.

int getParIndex (const string &name) const throw (LogicError)
 Return the parameter index corresponding to name.

double getParError (const string &name) const throw (LogicError)
 Get the error on parameter.

double getChiSquared () const throw ()
 Get the chisquared.

int getNDF () const throw ()
 Get the number of degrees of freedom.

double getVarMax (const int ivar) const throw (LogicError)
 Get the maximum value of the variable.

double getVarMin (const int ivar) const throw (LogicError)
 Get the minimum value of the variable.

void setVarMax (const int ivar, const double value) throw (LogicError)
 Set the maximum value of the variable:.

void setVarMin (const int ivar, const double value) throw (LogicError)
 Set the minimum value of the variable.

char * getFormula () const throw ()
 get the Formula from the m_type object

void fixParameter (int ipar, bool fix)
 Fixes or unfixes parameter ipar
Exceptions:
OutOfRangeError if ipar > NPar.


bool isFixed (int ipar) const
 Returns whether parameter ipar is fixed
Exceptions:
OutOfRangeError if ipar > NPar.


void setParameter (const int ipar, const double value) throw (LogicError)
 Set the value of parameter ipar.

void setParError (const int ipar, const double value) throw (LogicError)
 Set the error of parameter ipar.

void setParName (const int ipar, const char *name) throw (LogicError)
virtual ~FitObject () throw ()
 Destructor does nothing.

void reset () throw ()
 Sets parameters, errors, chisquared and NDF to zero.

double getParameter (const int ipar) const throw (LogicError)
 Get the value of parameter.

double getParameter (const string &name) const throw (LogicError)
 Get the value of parameter.

double getParError (const int ipar) const throw (LogicError)

Protected Member Functions

 FitObject () throw ()
 Create a default FitObject.

 FitObject (const TF1 &) throw (LogicError)
 Create a FitObject from a ROOT TF1 object.

void setNDim (unsigned int n) throw ()
 The following protected functions should only be used by the derived classes, or the fitting routines.

void setNPar (unsigned int npar) throw ()
 set the number of parameters

void setChiSquared (const double c) throw ()
 Set the chiSquared.

void setNDF (const int d) throw ()
 Set the number of degrees of freedom.

void setFormula (char const *f) throw ()
 set the character representation of the formula

virtual auto_ptr< TF1 > makeBasicRootTF1 () const=0 throw (LogicError)
 Make a TF1 using the appropriate constructor which can then be used in makeRootTF1().

virtual void init ()=0 throw (LogicError)
 Call to be made during constructor and after any equality operator, setting basic names and dimensions; to be implimented by derived classes.


Protected Attributes

vector< double > m_parameter
 values of parameters

vector< double > m_parError
 error on parameters

vector< string > m_parName
 names of parameters

vector< bool > m_parFixed
 true if parameter is fixed

vector< double > m_varMax
 maximum value of variables

vector< double > m_varMin
 minimum value of variables

double m_chiSquared
 chisquared parameter

int m_nDF
 degrees of freedom

string m_formula
 formula of type understood by root


Friends

class FitObjectIOHelper

Detailed Description

FitObject is an abstract base class fit object to store the output to various types of fit.

It can be published to and retrieved from IS. It can generate a ROOT TF1, or be created from one. Derived classes must implement a makeBasicRootTF1() method which use a suitable TF1 constructor.

So far I can't see any sensible use for `number of dimensions' != 1 but the class could be extensible to multi-dimensional functions.

The formula provided may be in a form comprehensible to ROOT e.g. "[0]*x*sin([1]*x)" for a 1-dimensional (x), 2-parameter ([0],[1]) function.

The analytical form of the functions themselves are in `FitFunctions.cpp'.

Author:
Alan Barr
Date:
6 December 2002

Definition at line 38 of file FitObject.h.


Constructor & Destructor Documentation

virtual SctData::FitObject::~FitObject   throw () [inline, virtual]
 

Destructor does nothing.

Definition at line 144 of file FitObject.h.

SctData::FitObject::FitObject   throw () [protected]
 

Create a default FitObject.

Definition at line 13 of file FitObject.cpp.

SctData::FitObject::FitObject const TF1 &    throw (LogicError) [protected]
 

Create a FitObject from a ROOT TF1 object.

Definition at line 17 of file FitObject.cpp.


Member Function Documentation

virtual auto_ptr<FitObject> SctData::FitObject::clone   const throw () [pure virtual]
 

Allows any sub-class of FitObject to be used as a prototype.

Returns:
a new FitObject of the appropriate type which is a copy of this.

Implemented in SctData::ErfcFitObject, SctData::ErfFitObject, SctData::GausFitObject, and SctData::TopHatFitObject.

void SctData::FitObject::fixParameter int    ipar,
bool    fix
 

Fixes or unfixes parameter ipar

Exceptions:
OutOfRangeError if ipar > NPar.

Definition at line 146 of file FitObject.cpp.

References getNPar(), and m_parFixed.

Referenced by SctData::IO::FitObjectStreamer::read().

double SctData::FitObject::getChiSquared   const throw () [inline]
 

Get the chisquared.

Definition at line 103 of file FitObject.h.

References m_chiSquared.

Referenced by SctData::IO::FitObjectStreamer::write().

char* SctData::FitObject::getFormula   const throw () [inline]
 

get the Formula from the m_type object

Definition at line 121 of file FitObject.h.

References m_formula.

int SctData::FitObject::getNDF   const throw () [inline]
 

Get the number of degrees of freedom.

Definition at line 106 of file FitObject.h.

References m_nDF.

Referenced by SctData::IO::FitObjectStreamer::write().

int SctData::FitObject::getNDim   const throw () [inline]
 

Get the dimensionality.

Definition at line 69 of file FitObject.h.

References m_varMax.

Referenced by SctData::IO::FitObjectStreamer::read(), and SctData::IO::FitObjectStreamer::write().

int SctData::FitObject::getNPar   const throw () [inline]
 

Get the number of parameters.

Definition at line 72 of file FitObject.h.

References m_parameter.

Referenced by fixParameter(), isFixed(), SctData::IO::FitObjectStreamer::read(), and SctData::IO::FitObjectStreamer::write().

double SctData::FitObject::getParameter const string &    name const throw (LogicError) [inline]
 

Get the value of parameter.

Parameters:
the parameter name

Definition at line 201 of file FitObject.h.

double SctData::FitObject::getParameter const int    ipar const throw (LogicError)
 

Get the value of parameter.

Parameters:
the parameter number

Definition at line 50 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::write().

double SctData::FitObject::getParError const string &    name const throw (LogicError) [inline]
 

Get the error on parameter.

Parameters:
the parameter name

Definition at line 205 of file FitObject.h.

double SctData::FitObject::getParError const int    ipar const throw (LogicError)
 

Get the error on parameter

Parameters:
the parameter number

Definition at line 59 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::write().

int SctData::FitObject::getParIndex const string &    name const throw (LogicError)
 

Return the parameter index corresponding to name.

The index can be used in the other functions.

Definition at line 41 of file FitObject.cpp.

char * SctData::FitObject::getParName const int    ipar const throw (LogicError)
 

Get name of parameter ipar.

Definition at line 32 of file FitObject.cpp.

double SctData::FitObject::getVarMax const int    ivar const throw (LogicError)
 

Get the maximum value of the variable.

Definition at line 110 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::write().

double SctData::FitObject::getVarMin const int    ivar const throw (LogicError)
 

Get the minimum value of the variable.

Definition at line 119 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::write().

virtual void SctData::FitObject::init   throw (LogicError) [protected, pure virtual]
 

Call to be made during constructor and after any equality operator, setting basic names and dimensions; to be implimented by derived classes.

Implemented in SctData::ErfcFitObject, SctData::ErfFitObject, SctData::GausFitObject, and SctData::TopHatFitObject.

bool SctData::FitObject::isFixed int    ipar const
 

Returns whether parameter ipar is fixed

Exceptions:
OutOfRangeError if ipar > NPar.

Definition at line 155 of file FitObject.cpp.

References getNPar(), and m_parFixed.

Referenced by SctData::IO::FitObjectStreamer::write().

virtual auto_ptr<TF1> SctData::FitObject::makeBasicRootTF1   const throw (LogicError) [protected, pure virtual]
 

Make a TF1 using the appropriate constructor which can then be used in makeRootTF1().

To be implimented by derived classes.

Implemented in SctData::ErfcFitObject, SctData::ErfFitObject, SctData::GausFitObject, and SctData::TopHatFitObject.

auto_ptr< TF1 > SctData::FitObject::makeRootTF1   const throw (LogicError) [virtual]
 

Conversion utility functions;.

Make a new ROOT TF1 from this object. Calls the virtual function makeBasicRootTF1()

Definition at line 165 of file FitObject.cpp.

FitObject & SctData::FitObject::operator= const TF1 &    throw (LogicError)
 

Set the values of this FitObject equal to those of a ROOT TF1 function to be implimented in sub-classes.

Reimplemented in SctData::ErfcFitObject, SctData::ErfFitObject, SctData::GausFitObject, and SctData::TopHatFitObject.

Definition at line 212 of file FitObject.cpp.

void SctData::FitObject::print   const throw (LogicError)
 

Print this to cout.

Definition at line 238 of file FitObject.cpp.

void SctData::FitObject::reset   throw ()
 

Sets parameters, errors, chisquared and NDF to zero.

Definition at line 21 of file FitObject.cpp.

void SctData::FitObject::setChiSquared const double    c throw () [inline, protected]
 

Set the chiSquared.

Definition at line 177 of file FitObject.h.

void SctData::FitObject::setFormula char const *    f throw () [inline, protected]
 

set the character representation of the formula

Definition at line 183 of file FitObject.h.

void SctData::FitObject::setNDF const int    d throw () [inline, protected]
 

Set the number of degrees of freedom.

Definition at line 180 of file FitObject.h.

void SctData::FitObject::setNDim unsigned int    n throw () [protected]
 

The following protected functions should only be used by the derived classes, or the fitting routines.

set the number of dimensions

Definition at line 105 of file FitObject.cpp.

void SctData::FitObject::setNPar unsigned int    npar throw () [protected]
 

set the number of parameters

Definition at line 68 of file FitObject.cpp.

void SctData::FitObject::setParameter const int    ipar,
const double    value
throw (LogicError)
 

Set the value of parameter ipar.

Definition at line 76 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::read().

void SctData::FitObject::setParError const int    ipar,
const double    value
throw (LogicError)
 

Set the error of parameter ipar.

Definition at line 86 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::read().

void SctData::FitObject::setParName const int    ipar,
const char *    name
throw (LogicError)
 

Definition at line 96 of file FitObject.cpp.

void SctData::FitObject::setVarMax const int    ivar,
const double    value
throw (LogicError)
 

Set the maximum value of the variable:.

Definition at line 128 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::read().

void SctData::FitObject::setVarMin const int    ivar,
const double    value
throw (LogicError)
 

Set the minimum value of the variable.

Definition at line 137 of file FitObject.cpp.

Referenced by SctData::IO::FitObjectStreamer::read().


Friends And Related Function Documentation

friend class FitObjectIOHelper [friend]
 

Definition at line 197 of file FitObject.h.


Field Documentation

double SctData::FitObject::m_chiSquared [protected]
 

chisquared parameter

Definition at line 156 of file FitObject.h.

Referenced by getChiSquared().

string SctData::FitObject::m_formula [protected]
 

formula of type understood by root

Definition at line 158 of file FitObject.h.

Referenced by getFormula().

int SctData::FitObject::m_nDF [protected]
 

degrees of freedom

Definition at line 157 of file FitObject.h.

Referenced by getNDF().

vector<double> SctData::FitObject::m_parameter [protected]
 

values of parameters

Definition at line 150 of file FitObject.h.

Referenced by getNPar().

vector<double> SctData::FitObject::m_parError [protected]
 

error on parameters

Definition at line 151 of file FitObject.h.

vector<bool> SctData::FitObject::m_parFixed [protected]
 

true if parameter is fixed

Definition at line 153 of file FitObject.h.

Referenced by fixParameter(), and isFixed().

vector<string> SctData::FitObject::m_parName [protected]
 

names of parameters

Definition at line 152 of file FitObject.h.

vector<double> SctData::FitObject::m_varMax [protected]
 

maximum value of variables

Definition at line 154 of file FitObject.h.

Referenced by getNDim().

vector<double> SctData::FitObject::m_varMin [protected]
 

minimum value of variables

Definition at line 155 of file FitObject.h.


The documentation for this class was generated from the following files:
Generated on Mon Dec 15 19:37:44 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3