#include <FunctionController.h>
Collaboration diagram for FunctionController:
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. | |
FunctionBase * | addFunction (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. | |
FunctionRep * | createFunctionRep (FunctionBase *function, DataRep *rep) |
Returns a newly created FunctionRep object with FunctionBase pointer function and target rep. | |
FunctionRep * | createFunctionRep (const std::string &name, DataRep *rep) |
Returns a newly created FunctionRep object with function of type name and target rep. | |
ViewBase * | createFuncView (const ViewFactory *factory, PlotterBase *plotter, const std::string &type) |
Creates a textual view of function of type type. | |
PlotterBase * | createNewEllipsoidDisplay (PlotterBase *plotter) |
Returns a new Ellipsoid display. | |
NTuple * | createNTuple (PlotterBase *plotter) |
Returns an NTuple from the plotter. | |
PlotterBase * | createResidualsDisplay (PlotterBase *plotter) |
Returns residuals display. | |
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. | |
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. | |
FunctionRep * | getComposite (const PlotterBase *plotter) const |
Returns the composite function contained by the plotter. | |
FunctionBase * | 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 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. | |
Fitter * | getFitter (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. | |
FunctionRep * | getFunctionRep (const PlotterBase *plotter, const DataRep *datarep) const |
Returns the FunctionRep. | |
FunctionRep * | getFunctionRep (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. | |
PlotterBase * | refreshEllipsoidDisplay (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 FunctionController * | instance () |
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::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. | |
PlotterBase * | m_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 FunctionController * | s_instance = 0 |
A pointer to the singleton object. |
|
A private default constructor for avoiding creation.
Definition at line 81 of file FunctionController.cxx. References m_deltaXSq. Referenced by instance(). |
|
A private copy constructor to avoid copying.
|
|
The destructor.
Definition at line 97 of file FunctionController.cxx. |
|
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.
Definition at line 213 of file FunctionController.cxx. References addFunctionRep(), and DisplayController::instance(). Referenced by PlotterBaseXML::getObject(). |
|
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(). |
|
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(). |
|
Adds a function to the first DataRep object of the plotter.
Definition at line 177 of file FunctionController.cxx. References getFunctionRep(). Referenced by addFunctionRep(), PyFunctionRep::addTo(), and Inspector::functionAdd(). |
|
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(). |
|
Builds the composite function, if any, for the plotter.
Definition at line 284 of file FunctionController.cxx. References buildComposite(), getComposite(), and FunctionRep::getFunction(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Attempts to fit the function to the data in the DataRep of the plotter. The int parameter is not used.
Definition at line 487 of file FunctionController.cxx. References fitFunction(), and getFunctionRep(). |
|
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.
Definition at line 496 of file FunctionController.cxx. References getComposite(), and setErrorsFromComposite(). Referenced by fitFunction(), fitFunctions(), and tryFitFunction(). |
|
Fits the functions contained by the plotter.
Definition at line 531 of file FunctionController.cxx. References buildComposite(), fitFunction(), getFunctionRep(), and hasFunction(). |
|
Returns
Definition at line 1118 of file FunctionController.cxx. References FunctionFactory::instance(). |
|
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(). |
|
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(). |
|
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
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()(). |
|
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.
|
|
Returns the covariance matrix of the objective function.
Definition at line 748 of file FunctionController.cxx. References getFunctionRep(), and DataRep::getProjector(). |
|
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(). |
|
Returns the errors on the fitted function.
Definition at line 451 of file FunctionController.cxx. References getFunctionRep(), and principleErrors(). |
|
Returns the Fitter object used by the plotter.
Definition at line 687 of file FunctionController.cxx. References getFunctionRep(). Referenced by ellipsoidNTuple(), and getFitterName(). |
|
Returns the name of the Fitter object as known by the FitterFactory.
Definition at line 677 of file FunctionController.cxx. References getFitter(), and getFunctionRep(). |
|
Returns the list of Fitter names.
Definition at line 111 of file FunctionController.cxx. References FitterFactory::instance(). Referenced by addFunctionRep(), and createFunctionRep(). |
|
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. |
|
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.
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Returns true if rep contained by plotter has a function attached.
If rep is non-zero, returns Definition at line 368 of file FunctionController.cxx. References findFunctions(), FunctionRep::getTarget(), and m_func_reps. Referenced by fitFunctions(), setFitRange(), and Inspector::updateSummaryTab(). |
|
|
Returns
Checks if the function is compatible with the fitter and return Definition at line 1127 of file FunctionController.cxx. References FitterFactory::instance(), and FunctionFactory::instance(). |
|
Returns the parameters of the function in the plotter. The int parameter is not used.
Definition at line 560 of file FunctionController.cxx. References getFunctionRep(). |
|
Returns the errors on the parameters of the function in the plotter. The int parameter is not used.
Definition at line 569 of file FunctionController.cxx. References getFunctionRep(). Referenced by getErrors(), and setErrorsFromComposite(). |
|
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(). |
|
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(). |
|
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(). |
|
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.
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(). |
|
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. |
|
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(). |
|
Sets the range used for fitting.
Definition at line 552 of file FunctionController.cxx. References setFitRange(). |
|
Sets the range used for fitting.
Definition at line 541 of file FunctionController.cxx. References getFunctionRep(), and hasFunction(). Referenced by setFitRange(). |
|
Sets the Fitter.
Sets the Fitter for FunctionRep frep to fitter. Returns Definition at line 708 of file FunctionController.cxx. References setFitter(), and hippodraw::Axes::X. |
|
Sets the Fitter.
Sets the Fitter for FunctionRep frep to a fitter in the FitterFactory with name name. Returns
Definition at line 698 of file FunctionController.cxx. References FitterFactory::instance(), and setFitter(). |
|
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 Definition at line 664 of file FunctionController.cxx. References getFunctionRep(). Referenced by addFunctionRep(), createFunctionRep(), and setFitter(). |
|
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(). |
|
A count of number of confidence contour plots created.
Definition at line 86 of file FunctionController.h. Referenced by ellipsoidNTuple(). |
|
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(). |
|
The list of function names attached to the plotter.
Definition at line 62 of file FunctionController.h. Referenced by functionNames(). |
|
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(). |
|
The current PlotterBase object.
Definition at line 72 of file FunctionController.h. |
|
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(). |
|
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(). |
|
A pointer to the singleton object.
Definition at line 79 of file FunctionController.cxx. Referenced by instance(). |