FunctionController Class Reference

#include <FunctionController.h>

Collaboration diagram for FunctionController:

Collaboration graph
PlotterBaseObserverObservableSizePointRect
[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.

Author:
Kaustuv <kaustuv@stanford.edu>

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

Sanket B. Malde <sanket@stanford.edu>

Definition at line 49 of file FunctionController.h.

Public Member Functions

void addDataRep (PlotterBase *plotter, DataRep *rep)
 Adds DataRep rep to the PlotterBase plotter.
void addFunction (PlotterBase *plotter, FunctionRep *func_rep)
 Adds the func_rep to the plotter.
FunctionRepaddFunction (PlotterBase *plotter, const std::string &name, FunctionRep *frep, DataRep *data_rep)
 Adds the function named by the string to the designated DataRep data_rep contained in the plotter.
FunctionBaseaddFunction (PlotterBase *plotter, const std::string &name)
 Adds a function to the first DataRep object of the plotter.
FunctionRepaddFunctionRep (PlotterBase *plotter, DataRep *, FunctionRep *frep, FunctionRep *func_rep)
 Adds the func_rep to the DataRep contained by the plotter.
bool changeFitter (const PlotterBase *plotter, const DataRep *datarep, const std::string &name)
 Changes the fitter.
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, FunctionRep *rep)
 Returns a new Ellipsoid display.
NTuplecreateNTuple (const PlotterBase *plotter, const FunctionRep *rep)
 Returns an NTuple from the FunctionRep and its target DataRep.
PlotterBasecreateResidualsDisplay (PlotterBase *plotter, const FunctionRep *)
 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, FunctionRep *, 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.
void fillTopLevelFunctionReps (std::vector< FunctionRep * > &reps, const PlotterBase *plotter, const DataRep *data_rep) const
 Clears and fills the vector with the top level FunctionRep objects that target data_rep and are contained in plotter.
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.
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, FunctionRep *rep)
 Returns the CompositeFunctionRep for which rep is a member if it is one, otherwise returns rep.
const std::vector< std::vector<
double > > & 
getCovarianceMatrix (const PlotterBase *)
 Returns the covariance matrix of the objective function.
const std::string & getDefaultFitter () const
 Returns the name of the default Fitter object.
int getDegreesOfFreedom (const PlotterBase *)
 Returns the degrees of freedom.
FittergetFitter (const PlotterBase *plotter)
 Returns the Fitter object used by the plotter.
const std::string & getFitterName (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.
const std::vector< std::string > & getFunctionNames () const
 Returns the list of available functions.
FunctionRepgetFunctionRep (const PlotterBase *plotter, const DataRep *data) const
 Returns the FunctionRep.
FunctionRepgetFunctionRep (const PlotterBase *plotter) const
 Returns the FunctionRep.
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.
PlotterBaserefreshEllipsoidDisplay (PlotterBase *plotter, FunctionRep *)
 Returns a new Ellipsoid display.
void removeFunction (PlotterBase *plotter, FunctionRep *function)
 Removes the designated function from the plotter.
void removeTupleCut (const PlotterBase *plotter, DataRep *data_rep)
 Removes the region cut from both the target and function.
void restoreParameters (PlotterBase *plotter)
 Restores the parameters from previously stored values.
void saveParameters (PlotterBase *plotter)
 Saves the parameters so they can be restored.
void setDefaultFitter (const std::string &name)
 Sets the default Fitter object that will be used for newly created FunctionRep objects.
int setEllpsoidParamIndex (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, const std::string &name)
 Sets the Fitter.
bool setFitter (const PlotterBase *plotter, const std::string &name)
 Sets the Fitter.
void setTupleCut (const PlotterBase *plotter, DataRep *data_rep)
 Sets the TupleCut, if any for the FunctionRep contained by plotter whose target is data_rep.
void setTupleCut (FunctionRep *rep)
 Sets the function representation up to obey TupleCut on target, if any.
bool tryFitFunction (PlotterBase *plotter, FunctionRep *)
 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 fillFunctionReps (std::vector< FunctionRep * > &freps, const PlotterBase *plotter, const DataRep *data_rep) const
 Clears and fills the vector the FunctionRep objects contained by the plotter that target the data_rep.
void findFunctions (const PlotterBase *plotter) const
 Finds the FunctionRep objects contained by the plotter.
 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::string > m_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 (  )  [private]

A private default constructor for avoiding creation.

Definition at line 77 of file FunctionController.cxx.

References FunctionController::m_deltaXSq.

Referenced by FunctionController::instance().

FunctionController ( const FunctionController  )  [private]

A private copy constructor to avoid copying.

~FunctionController (  ) 

The destructor.

Definition at line 93 of file FunctionController.cxx.


Member Function Documentation

void 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 if it is not a composite function.

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

Definition at line 265 of file FunctionController.cxx.

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

Referenced by FunctionController::addFunctionRep(), and PlotterBaseXML::getObject().

void 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.

Definition at line 241 of file FunctionController.cxx.

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

FunctionRep * addFunction ( PlotterBase plotter,
const std::string &  name,
FunctionRep frep,
DataRep data_rep 
)

Adds the function named by the string to the designated DataRep data_rep contained in the plotter.

If frep is not a null pointer, then the newly created function and frep become part of the same CompositeFunctionRep, otherwise the newly created function is stand-a-lone. Returns either the CompositeFunctionRep or the stand-a-lone FunctionRep.

Definition at line 228 of file FunctionController.cxx.

References FunctionController::addFunctionRep(), and FunctionController::createFunctionRep().

FunctionBase * 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 212 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

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

FunctionRep * addFunctionRep ( PlotterBase plotter,
DataRep ,
FunctionRep frep,
FunctionRep func_rep 
)

Adds the func_rep to the DataRep contained by the plotter.

If frep is not a null pointer, then func_rep and frep become part of of a CompositeFunctionRep which is created if one doesn't already exist. Otherwise, func_rep because a standalone object.

Returns either the CompositeFunctionRep or the standalone FunctionRep.

Definition at line 311 of file FunctionController.cxx.

References FunctionController::addDataRep(), PlotterBase::addDataRep(), FunctionController::createFunctionRep(), FunctionController::fillFunctionReps(), FitterFactory::instance(), FunctionController::m_func_reps, Observable::notifyObservers(), FunctionController::setFitter(), and FunctionController::setTupleCut().

Referenced by FunctionController::addDataRep(), and FunctionController::addFunction().

bool changeFitter ( const PlotterBase plotter,
const DataRep datarep,
const std::string &  name 
)

Changes the fitter.

Definition at line 736 of file FunctionController.cxx.

References FunctionController::getFitter(), FunctionController::getFunctionRep(), FitterFactory::instance(), FunctionController::isCompatible(), and FunctionController::setFitter().

FunctionRep * createFunctionRep ( FunctionBase function,
DataRep rep 
)

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

Definition at line 176 of file FunctionController.cxx.

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

FunctionRep * createFunctionRep ( const std::string &  name,
DataRep rep 
)

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

Definition at line 159 of file FunctionController.cxx.

References FunctionFactory::instance().

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

ViewBase * createFuncView ( const ViewFactory factory,
PlotterBase plotter,
const std::string &  type 
)

Creates a textual view of function of type type.

Definition at line 669 of file FunctionController.cxx.

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

Referenced by CanvasView::addFuncDisplay().

PlotterBase * createNewEllipsoidDisplay ( PlotterBase plotter,
FunctionRep rep 
)

Returns a new Ellipsoid display.

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

Definition at line 864 of file FunctionController.cxx.

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

NTuple * createNTuple ( const PlotterBase plotter,
const FunctionRep rep 
)

Returns an NTuple from the FunctionRep and its target DataRep.

Definition at line 797 of file FunctionController.cxx.

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

Referenced by FunctionController::createResidualsDisplay().

PlotterBase * createResidualsDisplay ( PlotterBase plotter,
const FunctionRep  
)

Returns residuals display.

Creates and returns a PlotterBase object displaying the residuals of the function to its target.

Definition at line 839 of file FunctionController.cxx.

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

NTuple * 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 1029 of file FunctionController.cxx.

References num_util::size().

Referenced by FunctionController::ellipsoidNTuple().

void ellipsoidNTuple ( PlotterBase plotter,
FunctionRep ,
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.

Requests:
@@ Make sure they are being calculated correctly by hold one parameter constant and refitting.

Definition at line 906 of file FunctionController.cxx.

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

Referenced by FunctionController::createNewEllipsoidDisplay(), and FunctionController::refreshEllipsoidDisplay().

void fillFunctionReps ( std::vector< FunctionRep * > &  freps,
const PlotterBase plotter,
const DataRep data_rep 
) const [private]

Clears and fills the vector the FunctionRep objects contained by the plotter that target the data_rep.

If data_rep is a null pointer, then all FunctionRep objects are appended.

Definition at line 447 of file FunctionController.cxx.

Referenced by FunctionController::addFunction(), FunctionController::addFunctionRep(), FunctionController::fillTopLevelFunctionReps(), FunctionController::functionNames(), FunctionController::getComposite(), FunctionController::getFunctionRep(), FunctionController::hasFunction(), FunctionController::removeFunction(), and FunctionController::setErrorsFromComposite().

void fillTopLevelFunctionReps ( std::vector< FunctionRep * > &  reps,
const PlotterBase plotter,
const DataRep data_rep 
) const

Clears and fills the vector with the top level FunctionRep objects that target data_rep and are contained in plotter.

A top level FunctionRep object is one that is not a member of a CompositeFunctionRep.

Definition at line 471 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), FunctionController::m_func_reps, and num_util::size().

void 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 144 of file FunctionController.cxx.

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

Referenced by FunctionController::restoreParameters(), and FunctionController::saveParameters().

bool 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 513 of file FunctionController.cxx.

References FunctionController::fitFunction(), and FunctionController::getFunctionRep().

bool 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 544 of file FunctionController.cxx.

References FunctionController::getComposite(), and FunctionController::setErrorsFromComposite().

Referenced by FunctionController::fitFunction(), and FunctionController::tryFitFunction().

bool functionExists ( const std::string &  name  ) 

Returns true if function with name name is available.

Definition at line 1115 of file FunctionController.cxx.

References FunctionFactory::instance().

const vector< string > & 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 427 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), FunctionController::m_f_names, FunctionController::m_func_reps, and FunctionBase::name().

double 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 779 of file FunctionController.cxx.

References FunctionController::getObjectiveValue().

FunctionRep * getComposite ( const PlotterBase plotter,
FunctionRep rep 
)

Returns the CompositeFunctionRep for which rep is a member if it is one, otherwise returns rep.

Definition at line 522 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), and FunctionController::m_func_reps.

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

const vector< vector< double > > & getCovarianceMatrix ( const PlotterBase  ) 

Returns the covariance matrix of the objective function.

Definition at line 766 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

const std::string & getDefaultFitter (  )  const

Returns the name of the default Fitter object.

Definition at line 116 of file FunctionController.cxx.

References FitterFactory::instance().

int 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 788 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

Referenced by PyFunctionRep::degreesOfFreedom().

Fitter * getFitter ( const PlotterBase plotter  ) 

Returns the Fitter object used by the plotter.

Definition at line 707 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

Referenced by FunctionController::changeFitter(), FunctionController::ellipsoidNTuple(), and FunctionController::getFitterName().

const string & getFitterName ( const PlotterBase plotter  ) 

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

Definition at line 697 of file FunctionController.cxx.

References FunctionController::getFitter(), and FunctionController::getFunctionRep().

const vector< string > & getFitterNames (  )  const

Returns the list of Fitter names.

Definition at line 107 of file FunctionController.cxx.

References FitterFactory::instance().

const vector< string > & getFunctionNames (  )  const

Returns the list of available functions.

Definition at line 1142 of file FunctionController.cxx.

References FunctionFactory::instance().

FunctionRep * getFunctionRep ( const PlotterBase plotter,
const DataRep data 
) const

Returns the FunctionRep.

Returns the FunctionRep object contained by the plotter whose target is data. If more than one FunctionRep object has data 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 651 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), and FunctionController::m_func_reps.

FunctionRep * 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 622 of file FunctionController.cxx.

References PlotterBase::activePlotIndex().

Referenced by FunctionController::addFunction(), FunctionController::changeFitter(), FunctionController::createFuncView(), FunctionController::createNTuple(), FunctionController::fitFunction(), FunctionController::getCovarianceMatrix(), FunctionController::getDegreesOfFreedom(), FunctionController::getFitter(), FunctionController::getFitterName(), FunctionController::getObjectiveValue(), FunctionController::removeTupleCut(), FunctionController::setFitRange(), FunctionController::setFitter(), and FunctionController::setTupleCut().

double 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 757 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

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

int 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 124 of file FunctionController.cxx.

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

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

bool 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 414 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), and FunctionController::m_func_reps.

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

FunctionController * instance (  )  [static]

Returns the pointer to the singleton instance.

Definition at line 97 of file FunctionController.cxx.

References FunctionController::FunctionController(), and FunctionController::s_instance.

Referenced by DisplayController::activeDataRepIndex(), CanvasView::addFuncDisplay(), QtDisplay::addFunction(), PyCanvas::addTextRep(), PyFunctionRep::addTo(), PyFunctionRep::covarianceMatrix(), QtDisplay::createDataArray(), FunctionProjectorXML::createFunctionRep(), QtDisplay::createNTuple(), Inspector::createResiduals(), PyFunctionRep::createResidualsDisplay(), Inspector::cutNew(), Inspector::cutRemovePushButton_clicked(), Inspector::dataCreateNTuple(), 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::ignoreErrorCheckBoxToggled(), CanvasView::initFitterMenu(), Inspector::Inspector(), DisplayController::isAxisBinned(), PyFunctionRep::objectiveValue(), PyFunctionRep::operator()(), Inspector::pushButtonNewErrorPlotClicked(), PyFunctionRep::PyFunctionRep(), PyFunctionRep::setFitter(), CanvasView::setFitterDefault(), Inspector::setParameters(), Inspector::setSelectedFitter(), Inspector::summaryNew(), Inspector::updateFunctionsTab(), and Inspector::updateSummaryTab().

bool 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 1124 of file FunctionController.cxx.

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

Referenced by FunctionController::changeFitter().

PlotterBase * refreshEllipsoidDisplay ( PlotterBase plotter,
FunctionRep  
)

Returns a new Ellipsoid display.

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

Definition at line 990 of file FunctionController.cxx.

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

void removeFunction ( PlotterBase plotter,
FunctionRep function 
)

Removes the designated function from the plotter.

Definition at line 350 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), FunctionController::m_func_reps, PlotterBase::removeDataRep(), and num_util::size().

void removeTupleCut ( const PlotterBase plotter,
DataRep data_rep 
)

Removes the region cut from both the target and function.

Definition at line 301 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

void 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 606 of file FunctionController.cxx.

References FunctionController::findFunctions(), FunctionBase::isComposite(), and FunctionController::m_func_reps.

Referenced by FunctionController::tryFitFunction().

void 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 593 of file FunctionController.cxx.

References FunctionController::findFunctions(), FunctionBase::isComposite(), and FunctionController::m_func_reps.

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

void setDefaultFitter ( const std::string &  name  ) 

Sets the default Fitter object that will be used for newly created FunctionRep objects.

Definition at line 728 of file FunctionController.cxx.

References FitterFactory::instance().

int setEllpsoidParamIndex ( Axes::Type  axes,
int  index 
)

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

Definition at line 1099 of file FunctionController.cxx.

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

void 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 488 of file FunctionController.cxx.

References FunctionController::fillFunctionReps(), and FunctionController::m_func_reps.

Referenced by FunctionController::fitFunction().

void setFitRange ( PlotterBase plotter,
double  low,
double  high 
)

Sets the range used for fitting.

Definition at line 587 of file FunctionController.cxx.

References FunctionController::setFitRange().

void setFitRange ( PlotterBase plotter,
const Range range 
)

Sets the range used for fitting.

Definition at line 576 of file FunctionController.cxx.

References FunctionController::getFunctionRep(), and FunctionController::hasFunction().

Referenced by FunctionController::setFitRange().

bool 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 718 of file FunctionController.cxx.

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

bool 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 684 of file FunctionController.cxx.

References FunctionController::getFunctionRep().

Referenced by FunctionController::addFunctionRep(), FunctionController::changeFitter(), FunctionController::createFunctionRep(), and FunctionController::setFitter().

void setTupleCut ( const PlotterBase plotter,
DataRep data_rep 
)

Sets the TupleCut, if any for the FunctionRep contained by plotter whose target is data_rep.

Definition at line 290 of file FunctionController.cxx.

References FunctionController::getFunctionRep(), and FunctionController::setTupleCut().

void setTupleCut ( FunctionRep rep  ) 

Sets the function representation up to obey TupleCut on target, if any.

Definition at line 282 of file FunctionController.cxx.

Referenced by FunctionController::addFunctionRep(), and FunctionController::setTupleCut().

bool tryFitFunction ( PlotterBase plotter,
FunctionRep  
)

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. Returns true if the function converged, otherwise returns false.

Definition at line 557 of file FunctionController.cxx.

References FunctionController::fitFunction(), FunctionController::restoreParameters(), and FunctionController::saveParameters().


Member Data Documentation

unsigned int m_confid_count [private]

A count of number of confidence contour plots created.

Definition at line 83 of file FunctionController.h.

Referenced by FunctionController::ellipsoidNTuple().

std::vector< double > m_deltaXSq [private]

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

Definition at line 63 of file FunctionController.h.

Referenced by FunctionController::ellipsoidNTuple(), and FunctionController::FunctionController().

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

The list of function names attached to the plotter.

Definition at line 59 of file FunctionController.h.

Referenced by FunctionController::functionNames().

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

The list of FunctionRep objects for the current plotter.

Definition at line 56 of file FunctionController.h.

Referenced by FunctionController::addFunction(), FunctionController::addFunctionRep(), FunctionController::fillTopLevelFunctionReps(), FunctionController::findFunctions(), FunctionController::functionNames(), FunctionController::getComposite(), FunctionController::getFunctionRep(), FunctionController::hasFunction(), FunctionController::removeFunction(), FunctionController::restoreParameters(), FunctionController::saveParameters(), and FunctionController::setErrorsFromComposite().

PlotterBase* m_plotter [private]

The current PlotterBase object.

Definition at line 69 of file FunctionController.h.

int 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 74 of file FunctionController.h.

Referenced by FunctionController::ellipsoidNTuple(), and FunctionController::setEllpsoidParamIndex().

int 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 79 of file FunctionController.h.

Referenced by FunctionController::ellipsoidNTuple(), and FunctionController::setEllpsoidParamIndex().

FunctionController * s_instance = 0 [static, private]

A pointer to the singleton object.

Definition at line 66 of file FunctionController.h.

Referenced by FunctionController::instance().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen