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

FunctionController Class Reference

#include <FunctionController.h>

Collaboration diagram for FunctionController:

Collaboration graph
[legend]
List of all members.

Detailed Description

A singleton class is the interface between an application and the list of FunctionRep objects contained in a PlotterBase.

Requests:
Be able to display function without attaching it to DataRep.

Author:
Kaustuv <kaustuv@stanford.edu>

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

Sanket B. Malde <sanket@stanford.edu>

Definition at line 52 of file FunctionController.h.

Public Member Functions

void addDataRep (PlotterBase *plotter, DataRep *rep)
 Adds DataRep rep to the PlotterBase plotter.
int addFunction (PlotterBase *plotter, FunctionRep *func_rep)
 Adds the func_rep to the plotter.
int addFunction (PlotterBase *plotter, const std::string &name, DataRep *rep)
 Adds the function named by the string to the designated plotter.
FunctionBaseaddFunction (PlotterBase *plotter, const std::string &name)
 Adds a function to the first DataRep object of the plotter.
int addFunctionRep (PlotterBase *plotter, DataRep *, FunctionRep *func_rep)
 Adds the func_rep to the DataRep contained by the plotter.
void buildComposite (const PlotterBase *plotter)
 Builds the composite function, if any, for the plotter.
FunctionRepcreateFunctionRep (FunctionBase *function, DataRep *rep)
 Returns a newly created FunctionRep object with FunctionBase pointer function and target rep.
FunctionRepcreateFunctionRep (const std::string &name, DataRep *rep)
 Returns a newly created FunctionRep object with function of type name and target rep.
ViewBasecreateFuncView (const ViewFactory *factory, PlotterBase *plotter, const std::string &type)
 Creates a textual view of function of type type.
PlotterBasecreateNewEllipsoidDisplay (PlotterBase *plotter)
 Returns a new Ellipsoid display.
NTuplecreateNTuple (PlotterBase *plotter)
 Returns an NTuple from the plotter.
PlotterBasecreateResidualsDisplay (PlotterBase *plotter)
 Returns residuals display.
NTupleellipse (const std::vector< double > &xbar, std::vector< std::vector< double > > &SigmaInv, double Csq)
 Given an @ SigmaInv this function returns the coordinates of an ellipse (in 2 dimension) centered at xbar.
void ellipsoidNTuple (PlotterBase *plotter, NTuple *nt, int n, double &xmin, double &xmax, double &ymin, double &ymax)
 This returns in nt the percentage distribution of the confidence in a rectangle bounded by xmin, ymin, xmax and ymax.
bool fitFunction (PlotterBase *plotter, unsigned int)
 Attempts to fit the function to the data in the DataRep of the plotter.
bool fitFunction (PlotterBase *plotter, FunctionRep *rep)
 Attempts to fit the function contained by the plotter.
void fitFunctions (PlotterBase *plotter)
 Fits the functions contained by the plotter.
bool functionExists (const std::string &name)
 Returns true if function with name name is available.
const std::vector< std::string > & functionNames (PlotterBase *, DataRep *rep)
 Returns function names on the plotter.
double getChiSquared (const PlotterBase *)
 Returns the Chi-Squared.
FunctionRepgetComposite (const PlotterBase *plotter) const
 Returns the composite function contained by the plotter.
FunctionBasegetCompositeFunction (PlotterBase *plotter) const
 Returns a pointer to the composite function on plotter plotter At the moment it is being assumed that there is only one composite function for associated plotter.
const std::vector< std::vector<
double > > & 
getCovarianceMatrix (const PlotterBase *)
 Returns the covariance matrix of the objective function.
int getDegreesOfFreedom (const PlotterBase *)
 Returns the degrees of freedom.
const std::vector< double > & getErrors (const PlotterBase *)
 Returns the errors on the fitted function.
FittergetFitter (const PlotterBase *plotter)
 Returns the Fitter object used by the plotter.
const std::stringgetFitterName (const PlotterBase *plotter)
 Returns the name of the Fitter object as known by the FitterFactory.
const std::vector< std::string > & getFitterNames () const
 Returns the list of Fitter names.
FunctionRepgetFunctionRep (const PlotterBase *plotter, const DataRep *datarep) const
 Returns the FunctionRep.
FunctionRepgetFunctionRep (const PlotterBase *plotter) const
 Returns the FunctionRep.
const std::vector< FunctionRep * > & getFunctionReps (const PlotterBase *plotter) const
 Returns a vector of FunctionRep objects.
double getObjectiveValue (const PlotterBase *, const DataRep *)
 Returns the value of the objective function.
int getUniqueNonFunctionIndex (const PlotterBase *plotter) const
 Returns the index to an unique DataRep object that is not a FunctionRep.
bool hasFunction (const PlotterBase *plotter, const DataRep *rep)
 Returns true if rep contained by plotter has a function attached.
bool isCompatible (const std::string &function, const std::string &fitter)
 Returns true if the function is compatible with the fitter.
const std::vector< double > parameters (const PlotterBase *, unsigned int)
 Returns the parameters of the function in the plotter.
const std::vector< double > principleErrors (const PlotterBase *, unsigned int)
 Returns the errors on the parameters of the function in the plotter.
PlotterBaserefreshEllipsoidDisplay (PlotterBase *plotter)
 Returns a new Ellipsoid display.
void removeFunction (PlotterBase *plotter, unsigned int index)
 Removes the designated function from the plotter.
void restoreParameters (PlotterBase *plotter)
 Restores the parameters from previously stored values.
void saveParameters (PlotterBase *plotter)
 Saves the parameters so they can be restored.
int setEllpsoidParamIndex (hippodraw::Axes::Type axes, int index)
 Sets the which parameter shall be bound to which axes while plotting the error / confidence ellipsoids.
void setFitRange (PlotterBase *plotter, double low, double high)
 Sets the range used for fitting.
void setFitRange (PlotterBase *plotter, const Range &range)
 Sets the range used for fitting.
bool setFitter (FunctionRep *frep, Fitter *fitter)
 Sets the Fitter.
bool setFitter (FunctionRep *frep, const std::string &name)
 Sets the Fitter.
bool setFitter (const PlotterBase *plotter, const std::string &name)
 Sets the Fitter.
void tryFitFunction (PlotterBase *plotter, const DataRep *)
 Attempts to fit the function.
 ~FunctionController ()
 The destructor.

Static Public Member Functions

static FunctionControllerinstance ()
 Returns the pointer to the singleton instance.

Private Member Functions

void buildComposite (FunctionBase *composite)
 Builds a composite function.
void findFunctions (const PlotterBase *plotter) const
 Finds the FunctionRep objects contained by the plotter.
int findIndex (const FunctionRep *function)
 Returns the index of the specified Function, or returns -1 if the function is not in the list.
 FunctionController (const FunctionController &)
 A private copy constructor to avoid copying.
 FunctionController ()
 A private default constructor for avoiding creation.
void setErrorsFromComposite (const PlotterBase *plotter, const FunctionRep *composite)
 Sets the errors from the composite.

Private Attributes

unsigned int m_confid_count
 A count of number of confidence contour plots created.
std::vector< double > m_deltaXSq
 delta chi squared values for 99.99% confidence ellipsoids for mu = 1,2,3,4,5,6
std::vector< std::stringm_f_names
 The list of function names attached to the plotter.
std::vector< FunctionRep * > m_func_reps
 The list of FunctionRep objects for the current plotter.
PlotterBasem_plotter
 The current PlotterBase object.
int m_x
 Index of the parameter that shall be bound to X axes while plotting the error / confidence ellipsoids.
int m_y
 Index of the parameter that shall be bound to Y axes while plotting the error / confidence ellipsoids.

Static Private Attributes

static FunctionControllers_instance = 0
 A pointer to the singleton object.


Constructor & Destructor Documentation

FunctionController::FunctionController  )  [private]
 

A private default constructor for avoiding creation.

Definition at line 81 of file FunctionController.cxx.

References m_deltaXSq.

Referenced by instance().

FunctionController::FunctionController const FunctionController  )  [private]
 

A private copy constructor to avoid copying.

FunctionController::~FunctionController  ) 
 

The destructor.

Definition at line 97 of file FunctionController.cxx.


Member Function Documentation

void FunctionController::addDataRep PlotterBase plotter,
DataRep rep
 

Adds DataRep rep to the PlotterBase plotter.

If rep is not a FunctionRep, then just add the rep to the plotter. If rep is a FunctionRep object, then add it to the plotter and if it is not a composite function.

Note:
This function is intended to be use as part of the document reading.

Definition at line 213 of file FunctionController.cxx.

References addFunctionRep(), and DisplayController::instance().

Referenced by PlotterBaseXML::getObject().

int FunctionController::addFunction PlotterBase plotter,
FunctionRep func_rep
 

Adds the func_rep to the plotter.

Find the applicable DataRep in the plotter, then adds the function using it. Returns the index of the newly added function if successful, otherwise returns -1.

Definition at line 195 of file FunctionController.cxx.

References PlotterBase::activePlotIndex(), addFunctionRep(), PlotterBase::getDataRep(), getUniqueNonFunctionIndex(), and PlotterBase::setActivePlot().

int FunctionController::addFunction PlotterBase plotter,
const std::string name,
DataRep rep
 

Adds the function named by the string to the designated plotter.

The target is rep. Returns the index of the add function if successful; otherwise, it returns -1.

Definition at line 186 of file FunctionController.cxx.

References addFunctionRep(), and createFunctionRep().

FunctionBase * FunctionController::addFunction PlotterBase plotter,
const std::string name
 

Adds a function to the first DataRep object of the plotter.

Deprecated:
This function is here to maintain compatibility with Python programs using the SIP interface.

Definition at line 177 of file FunctionController.cxx.

References getFunctionRep().

Referenced by addFunctionRep(), PyFunctionRep::addTo(), and Inspector::functionAdd().

int FunctionController::addFunctionRep PlotterBase plotter,
DataRep ,
FunctionRep func_rep
 

Adds the func_rep to the DataRep contained by the plotter.

Returns the index of the newly added function if successful, otherwise returns -1.

Definition at line 230 of file FunctionController.cxx.

References PlotterBase::addDataRep(), addFunction(), FunctionBase::addToComposite(), buildComposite(), std::count(), findFunctions(), findIndex(), getFitterNames(), FunctionRep::getFunction(), FunctionBase::isComposite(), m_func_reps, FunctionBase::name(), Observable::notifyObservers(), and setFitter().

Referenced by addDataRep(), and addFunction().

void FunctionController::buildComposite const PlotterBase plotter  ) 
 

Builds the composite function, if any, for the plotter.

Definition at line 284 of file FunctionController.cxx.

References buildComposite(), getComposite(), and FunctionRep::getFunction().

void FunctionController::buildComposite FunctionBase composite  )  [private]
 

Builds a composite function.

Adds all previously added functions to the composite.

Definition at line 293 of file FunctionController.cxx.

References FunctionBase::addToComposite(), and m_func_reps.

Referenced by addFunctionRep(), buildComposite(), and fitFunctions().

FunctionRep * FunctionController::createFunctionRep FunctionBase function,
DataRep rep
 

Returns a newly created FunctionRep object with FunctionBase pointer function and target rep.

Definition at line 164 of file FunctionController.cxx.

References getFitterNames(), and setFitter().

FunctionRep * FunctionController::createFunctionRep const std::string name,
DataRep rep
 

Returns a newly created FunctionRep object with function of type name and target rep.

Definition at line 154 of file FunctionController.cxx.

Referenced by QtDisplay::addFunction(), addFunction(), and FunctionProjectorXML::createFunctionRep().

ViewBase * FunctionController::createFuncView const ViewFactory factory,
PlotterBase plotter,
const std::string type
 

Creates a textual view of function of type type.

Definition at line 649 of file FunctionController.cxx.

References DisplayController::createTextView(), getFunctionRep(), and DisplayController::instance().

Referenced by CanvasView::addFuncDisplay().

PlotterBase * FunctionController::createNewEllipsoidDisplay PlotterBase plotter  ) 
 

Returns a new Ellipsoid display.

Creates and returns a PlotterBase object displaying the ellipsoids of the function parameters in plotter.

Definition at line 853 of file FunctionController.cxx.

References ellipsoidNTuple(), and DisplayController::instance().

NTuple * FunctionController::createNTuple PlotterBase plotter  ) 
 

Returns an NTuple from the plotter.

Returns an NTuple from the active DataRep. If function is attached, add columns corresponding to the function value and residual.

Definition at line 787 of file FunctionController.cxx.

References getFunctionRep(), DataRep::getProjector(), getUniqueNonFunctionIndex(), FunctionBase::name(), and num_util::size().

Referenced by createResidualsDisplay().

PlotterBase * FunctionController::createResidualsDisplay PlotterBase plotter  ) 
 

Returns residuals display.

Creates and returns a PlotterBase object displaying the residuals of the function in plotter.

Definition at line 828 of file FunctionController.cxx.

References createNTuple(), DisplayController::instance(), DataSourceController::instance(), and DisplayController::setLog().

NTuple * FunctionController::ellipse const std::vector< double > &  xbar,
std::vector< std::vector< double > > &  SigmaInv,
double  Csq
 

Given an @ SigmaInv this function returns the coordinates of an ellipse (in 2 dimension) centered at xbar.

Equation of ellipse is (x-xbar)' * SigmaInv * (x-xbar) = Csquare

Definition at line 1032 of file FunctionController.cxx.

References std::cos(), M_PI, std::sin(), num_util::size(), and std::sqrt().

Referenced by ellipsoidNTuple().

void FunctionController::ellipsoidNTuple PlotterBase plotter,
NTuple nt,
int  n,
double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax
 

This returns in nt the percentage distribution of the confidence in a rectangle bounded by xmin, ymin, xmax and ymax.

This bounding rectangle is just large enough that is captures 99.9% confidence ellipsoid between the two selected parameters (whose indexes are given by m_x and m_y

Definition at line 896 of file FunctionController.cxx.

References ellipse(), hippodraw::Numeric::gammq(), getFitter(), getFunctionRep(), DataSourceController::instance(), hippodraw::Numeric::invertMatrix(), m_confid_count, m_deltaXSq, m_x, m_y, and hippodraw::Numeric::quadraticProduct().

Referenced by createNewEllipsoidDisplay(), and refreshEllipsoidDisplay().

void FunctionController::findFunctions const PlotterBase plotter  )  const [private]
 

Finds the FunctionRep objects contained by the plotter.

Finds the FunctionRep objects contained by the plotter and inserts the list m_functions. If there are no functions contained, then the list will be empty.

Definition at line 139 of file FunctionController.cxx.

References PlotterBase::getDataRep(), PlotterBase::getNumDataReps(), and m_func_reps.

Referenced by addFunctionRep(), functionNames(), getComposite(), getFunctionRep(), getFunctionReps(), hasFunction(), removeFunction(), restoreParameters(), and saveParameters().

int FunctionController::findIndex const FunctionRep function  )  [private]
 

Returns the index of the specified Function, or returns -1 if the function is not in the list.

Definition at line 352 of file FunctionController.cxx.

References std::find(), and m_func_reps.

Referenced by addFunctionRep().

bool FunctionController::fitFunction PlotterBase plotter,
unsigned  int
 

Attempts to fit the function to the data in the DataRep of the plotter.

The int parameter is not used.

Deprecated:
This member function is maintained only for existing programs written in Python and using the SIP interface.

Definition at line 487 of file FunctionController.cxx.

References fitFunction(), and getFunctionRep().

bool FunctionController::fitFunction PlotterBase plotter,
FunctionRep rep
 

Attempts to fit the function contained by the plotter.

If a composite function exists, the fit is done to the composite. Otherwise, the fit is done the function contained by rep.

Note:
This is the member function that implements the application logic.

Definition at line 496 of file FunctionController.cxx.

References getComposite(), and setErrorsFromComposite().

Referenced by fitFunction(), fitFunctions(), and tryFitFunction().

void FunctionController::fitFunctions PlotterBase plotter  ) 
 

Fits the functions contained by the plotter.

Bug:
Probably doesn't work correctly if multiple Functions on multiple data reps.

Definition at line 531 of file FunctionController.cxx.

References buildComposite(), fitFunction(), getFunctionRep(), and hasFunction().

bool FunctionController::functionExists const std::string name  ) 
 

Returns true if function with name name is available.

Definition at line 1118 of file FunctionController.cxx.

References FunctionFactory::instance().

const vector< string > & FunctionController::functionNames PlotterBase ,
DataRep rep
 

Returns function names on the plotter.

Returns a reference to a vector of function names on the designated plotter that are applied to the DataRep rep. If rep is a null pointer, returns all functions, otherwise returns only those whose target is rep.

Definition at line 397 of file FunctionController.cxx.

References findFunctions(), FunctionRep::getFunction(), FunctionRep::getTarget(), m_f_names, m_func_reps, and FunctionBase::name().

double FunctionController::getChiSquared const PlotterBase  ) 
 

Returns the Chi-Squared.

Uses getObjectiveValue to return the Chi-Squared. This is only meaningful if the objective function, class derived from FCNBase, is a Chi-Squared calculator.

Definition at line 765 of file FunctionController.cxx.

References getObjectiveValue().

FunctionRep * FunctionController::getComposite const PlotterBase plotter  )  const
 

Returns the composite function contained by the plotter.

Returns the first composite function, if found, contained by the plotter. If no composite is found, then returns a null pointer.

Todo:
What if there are multiple composites?

Definition at line 427 of file FunctionController.cxx.

References std::find_if(), findFunctions(), FunctionRep::isComposite(), m_func_reps, and std::mem_fun().

Referenced by buildComposite(), fitFunction(), and PyFunctionRep::operator()().

FunctionBase* FunctionController::getCompositeFunction PlotterBase plotter  )  const
 

Returns a pointer to the composite function on plotter plotter At the moment it is being assumed that there is only one composite function for associated plotter.

const vector< vector< double > > & FunctionController::getCovarianceMatrix const PlotterBase  ) 
 

Returns the covariance matrix of the objective function.

Definition at line 748 of file FunctionController.cxx.

References getFunctionRep(), and DataRep::getProjector().

int FunctionController::getDegreesOfFreedom const PlotterBase  ) 
 

Returns the degrees of freedom.

Returns the degrees of freedom of the function with the DataRep using the current function parameters.

Definition at line 774 of file FunctionController.cxx.

References getFunctionRep(), and DataRep::getProjector().

Referenced by PyFunctionRep::degreesOfFreedom().

const vector< double > & FunctionController::getErrors const PlotterBase  ) 
 

Returns the errors on the fitted function.

Definition at line 451 of file FunctionController.cxx.

References getFunctionRep(), and principleErrors().

Fitter * FunctionController::getFitter const PlotterBase plotter  ) 
 

Returns the Fitter object used by the plotter.

Definition at line 687 of file FunctionController.cxx.

References getFunctionRep().

Referenced by ellipsoidNTuple(), and getFitterName().

const string & FunctionController::getFitterName const PlotterBase plotter  ) 
 

Returns the name of the Fitter object as known by the FitterFactory.

Definition at line 677 of file FunctionController.cxx.

References getFitter(), and getFunctionRep().

const vector< string > & FunctionController::getFitterNames  )  const
 

Returns the list of Fitter names.

Definition at line 111 of file FunctionController.cxx.

References FitterFactory::instance().

Referenced by addFunctionRep(), and createFunctionRep().

FunctionRep * FunctionController::getFunctionRep const PlotterBase plotter,
const DataRep datarep
const
 

Returns the FunctionRep.

Returns the FunctionRep object contained by the plotter whose target is datarep. If more than one FunctionRep object has datarep as target, then return the one which holds the composite function, or if no composite is found, then return the last FunctionRep object.

Definition at line 631 of file FunctionController.cxx.

References findFunctions(), and m_func_reps.

FunctionRep * FunctionController::getFunctionRep const PlotterBase plotter  )  const
 

Returns the FunctionRep.

Returns a FunctionRep object contained by the plotter. If more than one exists, returns the FunctionRep corresponding the the composite function. If none exists, return a null pointer.

Bug:
If multiple DataRep exists, each with its own functions, then this function will probably not return the right one.
Use datareps.py to demonstrate this. The only use of this function is Inspector itself, thus should be possible to remove this function altogether.

Definition at line 605 of file FunctionController.cxx.

References PlotterBase::activePlotIndex().

Referenced by addFunction(), createFuncView(), createNTuple(), ellipsoidNTuple(), fitFunction(), fitFunctions(), Inspector::functionsFitToDataButton_clicked(), getCovarianceMatrix(), getDegreesOfFreedom(), getErrors(), getFitter(), getFitterName(), getObjectiveValue(), parameters(), principleErrors(), setFitRange(), setFitter(), and tryFitFunction().

const std::vector< FunctionRep * > & FunctionController::getFunctionReps const PlotterBase plotter  )  const
 

Returns a vector of FunctionRep objects.

Returns a reference to a vector of FunctionRep objects contained by the plotter. If none exists, the vector will be empty.

Definition at line 417 of file FunctionController.cxx.

References findFunctions(), and m_func_reps.

Referenced by setErrorsFromComposite().

double FunctionController::getObjectiveValue const PlotterBase ,
const DataRep
 

Returns the value of the objective function.

Returns the value of the objective function, one derived from FCNBase, for the function whose target is the DataRep.

Definition at line 735 of file FunctionController.cxx.

References getFunctionRep(), and DataRep::getProjector().

Referenced by getChiSquared(), PyFunctionRep::objectiveValue(), and tryFitFunction().

int FunctionController::getUniqueNonFunctionIndex const PlotterBase plotter  )  const
 

Returns the index to an unique DataRep object that is not a FunctionRep.

Returns the index to the DataRep object contained by the plotter if only one is not a FunctionRep, otherwise returns -1

Definition at line 119 of file FunctionController.cxx.

References std::count(), PlotterBase::getDataRep(), and PlotterBase::getNumDataReps().

Referenced by DisplayController::activeDataRepIndex(), CutController::addCut(), addFunction(), createNTuple(), and DisplayController::isAxisBinned().

bool FunctionController::hasFunction const PlotterBase plotter,
const DataRep rep
 

Returns true if rep contained by plotter has a function attached.

If rep is non-zero, returns true if the rep contained by plotter is a target of a function, otherwise returns false. If rep is a null pointer, returns true, if plotter contains at least one DataRep object that is a target of a function, otherwise returns false.

Definition at line 368 of file FunctionController.cxx.

References findFunctions(), FunctionRep::getTarget(), and m_func_reps.

Referenced by fitFunctions(), setFitRange(), and Inspector::updateSummaryTab().

FunctionController * FunctionController::instance  )  [static]
 

Returns the pointer to the singleton instance.

Definition at line 101 of file FunctionController.cxx.

References FunctionController(), and s_instance.

Referenced by DisplayController::activeDataRepIndex(), CutController::addCut(), CanvasView::addFuncDisplay(), QtDisplay::addFunction(), PyCanvas::addTextRep(), PyFunctionRep::addTo(), Inspector::comboBoxEllipsoidParamXHighlighted(), Inspector::comboBoxEllipsoidParamYHighlighted(), PyFunctionRep::covarianceMatrix(), QtDisplay::createDataArray(), FunctionProjectorXML::createFunctionRep(), QtDisplay::createNTuple(), Inspector::createResiduals(), PyFunctionRep::createResidualsDisplay(), Inspector::cutNew(), PyFunctionRep::degreesOfFreedom(), PyFunctionRep::fitFunction(), Inspector::fitterNamesActivated(), Inspector::functionAdd(), Inspector::functionParamsCheckBoxToggled(), Inspector::functionParamsLineEditReturnPressed(), Inspector::functionParamsSliderSliderMoved(), Inspector::functionParamsSliderSliderPressed(), Inspector::functionsFitToDataButton_clicked(), Inspector::functionsRemoveButton_clicked(), Inspector::functionsResetButton_clicked(), PlotterBaseXML::getObject(), Inspector::getSelectedCut(), Inspector::Inspector(), DisplayController::isAxisBinned(), PyFunctionRep::objectiveValue(), PyFunctionRep::operator()(), Inspector::pushButtonNewErrorPlotClicked(), PyFunctionRep::PyFunctionRep(), Inspector::selectedCutsRadioButton_toggled(), PyFunctionRep::setFitter(), Inspector::setParameters(), Inspector::summaryNew(), Inspector::updateCutsTab(), Inspector::updateErrorEllipseTab(), Inspector::updateFunctionsTab(), and Inspector::updateSummaryTab().

bool FunctionController::isCompatible const std::string function,
const std::string fitter
 

Returns true if the function is compatible with the fitter.

Checks if the function is compatible with the fitter and return true if so, otherwise returns false. A function maybe incompatible with the fitter, for example, if the fitter needs the partial derivatives from the function, but the function is not capable of supplying them.

Definition at line 1127 of file FunctionController.cxx.

References FitterFactory::instance(), and FunctionFactory::instance().

const std::vector< double > FunctionController::parameters const PlotterBase ,
unsigned  int
 

Returns the parameters of the function in the plotter.

The int parameter is not used.

Deprecated:
This member function is maintained only for existing programs written in Python and using the SIP interface.

Definition at line 560 of file FunctionController.cxx.

References getFunctionRep().

const std::vector< double > FunctionController::principleErrors const PlotterBase ,
unsigned  int
 

Returns the errors on the parameters of the function in the plotter.

The int parameter is not used.

Deprecated:
This member function is maintained only for existing programs written in Python and using the SIP interface.

Definition at line 569 of file FunctionController.cxx.

References getFunctionRep().

Referenced by getErrors(), and setErrorsFromComposite().

PlotterBase * FunctionController::refreshEllipsoidDisplay PlotterBase plotter  ) 
 

Returns a new Ellipsoid display.

Creates and returns a PlotterBase object displaying the ellipsoids of the function parameters in plotter.

Definition at line 993 of file FunctionController.cxx.

References ellipsoidNTuple(), and PlotterBase::getParentPlotter().

void FunctionController::removeFunction PlotterBase plotter,
unsigned int  index
 

Removes the designated function from the plotter.

Definition at line 305 of file FunctionController.cxx.

References FunctionBase::count(), findFunctions(), FunctionBase::isComposite(), m_func_reps, PlotterBase::removeDataRep(), and FunctionBase::removeFromComposite().

void FunctionController::restoreParameters PlotterBase plotter  ) 
 

Restores the parameters from previously stored values.

With the exception of cases in which they contain a composite function, the message is forwarded to all FunctionProjector objects.

Definition at line 589 of file FunctionController.cxx.

References findFunctions(), FunctionRep::getFunction(), FunctionBase::isComposite(), m_func_reps, and FunctionRep::restoreParameters().

Referenced by tryFitFunction().

void FunctionController::saveParameters PlotterBase plotter  ) 
 

Saves the parameters so they can be restored.

With the exception of cases in which they contain a composite function, the message is forwarded to all FunctionProjector objects.

Requests:
Should save parameters in a stack, so that more than one set can be saved and restored.

Definition at line 576 of file FunctionController.cxx.

References findFunctions(), FunctionRep::getFunction(), FunctionBase::isComposite(), m_func_reps, and FunctionRep::saveParameters().

Referenced by Inspector::functionAdd(), and tryFitFunction().

int FunctionController::setEllpsoidParamIndex hippodraw::Axes::Type  axes,
int  index
 

Sets the which parameter shall be bound to which axes while plotting the error / confidence ellipsoids.

Definition at line 1102 of file FunctionController.cxx.

References m_x, m_y, hippodraw::Axes::X, and hippodraw::Axes::Y.

void FunctionController::setErrorsFromComposite const PlotterBase plotter,
const FunctionRep composite
[private]
 

Sets the errors from the composite.

Sets the errors or each of the contained functions in the composite.

Definition at line 460 of file FunctionController.cxx.

References getFunctionReps(), m_func_reps, principleErrors(), and FunctionProjector::setPrincipleErrors().

Referenced by fitFunction().

void FunctionController::setFitRange PlotterBase plotter,
double  low,
double  high
 

Sets the range used for fitting.

Definition at line 552 of file FunctionController.cxx.

References setFitRange().

void FunctionController::setFitRange PlotterBase plotter,
const Range range
 

Sets the range used for fitting.

Definition at line 541 of file FunctionController.cxx.

References getFunctionRep(), and hasFunction().

Referenced by setFitRange().

bool FunctionController::setFitter FunctionRep frep,
Fitter fitter
 

Sets the Fitter.

Sets the Fitter for FunctionRep frep to fitter. Returns true if the fitter is compatible with the target of the frep, otherwise return false.

Definition at line 708 of file FunctionController.cxx.

References setFitter(), and hippodraw::Axes::X.

bool FunctionController::setFitter FunctionRep frep,
const std::string name
 

Sets the Fitter.

Sets the Fitter for FunctionRep frep to a fitter in the FitterFactory with name name. Returns true if the fitter is compatible with the target of the FunctionRep, otherwise returns false.

See also:
setFitter ( FunctionRep *, Fitter * )

Definition at line 698 of file FunctionController.cxx.

References FitterFactory::instance(), and setFitter().

bool FunctionController::setFitter const PlotterBase plotter,
const std::string name
 

Sets the Fitter.

Sets the Fitter object for the function contained by the plotter. The fitter is created from the FitterFactory using the name name. Returns true if the fitter is compatible with the target plotter, otherwise returns false.

Definition at line 664 of file FunctionController.cxx.

References getFunctionRep().

Referenced by addFunctionRep(), createFunctionRep(), and setFitter().

void FunctionController::tryFitFunction PlotterBase plotter,
const DataRep
 

Attempts to fit the function.

If function converges and the resulting chi squared is smaller than that of the starting point, keeps the functions parameters at the fitted value. Otherwise, restore the function parameters to their initial value.

Definition at line 513 of file FunctionController.cxx.

References fitFunction(), getFunctionRep(), getObjectiveValue(), restoreParameters(), and saveParameters().


Member Data Documentation

unsigned int FunctionController::m_confid_count [private]
 

A count of number of confidence contour plots created.

Definition at line 86 of file FunctionController.h.

Referenced by ellipsoidNTuple().

std::vector< double > FunctionController::m_deltaXSq [private]
 

delta chi squared values for 99.99% confidence ellipsoids for mu = 1,2,3,4,5,6

Definition at line 66 of file FunctionController.h.

Referenced by ellipsoidNTuple(), and FunctionController().

std::vector< std::string > FunctionController::m_f_names [private]
 

The list of function names attached to the plotter.

Definition at line 62 of file FunctionController.h.

Referenced by functionNames().

std::vector< FunctionRep * > FunctionController::m_func_reps [mutable, private]
 

The list of FunctionRep objects for the current plotter.

Definition at line 59 of file FunctionController.h.

Referenced by addFunctionRep(), buildComposite(), findFunctions(), findIndex(), functionNames(), getComposite(), getFunctionRep(), getFunctionReps(), hasFunction(), removeFunction(), restoreParameters(), saveParameters(), and setErrorsFromComposite().

PlotterBase* FunctionController::m_plotter [private]
 

The current PlotterBase object.

Definition at line 72 of file FunctionController.h.

int FunctionController::m_x [mutable, private]
 

Index of the parameter that shall be bound to X axes while plotting the error / confidence ellipsoids.

NOTE: m_x = n is the index of nth FREE parameter and NOT of nth parameter.

Definition at line 77 of file FunctionController.h.

Referenced by ellipsoidNTuple(), and setEllpsoidParamIndex().

int FunctionController::m_y [mutable, private]
 

Index of the parameter that shall be bound to Y axes while plotting the error / confidence ellipsoids.

NOTE: m_y = n is the index of nth FREE parameter and NOT of nth parameter.

Definition at line 82 of file FunctionController.h.

Referenced by ellipsoidNTuple(), and setEllpsoidParamIndex().

FunctionController * FunctionController::s_instance = 0 [static, private]
 

A pointer to the singleton object.

Definition at line 79 of file FunctionController.cxx.

Referenced by instance().


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