FunctionController.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _FunctionController_H_
15 #define _FunctionController_H_
16 
17 #include "axes/AxesType.h"
18 
19 // for incomplete type warning
20 #ifdef _MSC_VER
21 #include "functions/FunctionBase.h"
22 #endif
23 
24 #include <list>
25 #include <vector>
26 
27 namespace hippodraw {
28 
29 class DataRep;
30 class Fitter;
31 class FunctionBase;
32 class FunctionParameter;
33 class FunctionRep;
34 class NTuple;
35 class PlotterBase;
36 class ProjectorBase;
37 class Range;
38 class TupleCut;
39 class ViewBase;
40 class ViewFactory;
41 
50 {
51 
52 private:
53 
56  mutable std::vector < FunctionRep * > m_func_reps;
57 
59  std::vector < std::string > m_f_names;
60 
63  std::vector < double > m_deltaXSq;
64 
67 
70 
74  mutable int m_x;
75 
79  mutable int m_y;
80 
83  unsigned int m_confid_count;
84 
87 
90 
96  void findFunctions ( const PlotterBase * plotter ) const;
97 
101  void setErrorsFromComposite ( const PlotterBase * plotter,
102  const FunctionRep * composite );
103 
108  void fillFunctionReps ( std::vector < FunctionRep * > & freps,
109  const PlotterBase * plotter,
110  const DataRep * data_rep ) const;
111 
112 public:
113 
115  static FunctionController * instance ();
116 
119 
122  const std::vector < std::string > & getFitterNames () const;
123 
126  const std::string & getDefaultFitter () const;
127 
130  FunctionRep * createFunctionRep ( const std::string & name,
131  DataRep * rep );
132 
135  FunctionRep * createFunctionRep ( FunctionBase * function,
136  DataRep * rep );
137 
149  FunctionRep * getFunctionRep ( const PlotterBase * plotter ) const;
150 
156  FunctionRep * getFunctionRep ( const PlotterBase * plotter,
157  const DataRep * data ) const;
158 
159 
165  void fillTopLevelFunctionReps ( std::vector < FunctionRep * > & reps,
166  const PlotterBase * plotter,
167  const DataRep * data_rep ) const;
168 
171  FunctionRep * getComposite ( const PlotterBase * plotter,
172  FunctionRep * rep );
173 
176  FunctionBase * addFunction ( PlotterBase * plotter,
177  const std::string & name );
178 
186  FunctionRep * addFunction ( PlotterBase * plotter,
187  const std::string & name,
188  FunctionRep * frep,
189  DataRep * data_rep );
190 
194  void addFunction ( PlotterBase * plotter, FunctionRep * func_rep );
195 
204  void addDataRep ( PlotterBase * plotter, DataRep * rep );
205 
215  FunctionRep * addFunctionRep ( PlotterBase * plotter,
216  DataRep *,
217  FunctionRep * frep,
218  FunctionRep * func_rep );
219 
222  void removeFunction ( PlotterBase * plotter, FunctionRep * function );
223 
231  bool hasFunction ( const PlotterBase * plotter,
232  const DataRep * rep );
233 
237  int getUniqueNonFunctionIndex ( const PlotterBase * plotter ) const;
238 
245  const std::vector < std::string > &
246  functionNames ( PlotterBase *, DataRep * rep );
247 
250  const std::vector < std::string > &
251  getFunctionNames () const;
252 
255  Fitter * getFitter ( const PlotterBase * plotter );
256 
260  const std::string & getFitterName ( const PlotterBase * plotter );
261 
268  bool setFitter ( const PlotterBase * plotter, const std::string & name );
269 
272  bool changeFitter ( const PlotterBase * plotter,
273  const DataRep * datarep,
274  const std::string & name );
275 
283  bool setFitter ( FunctionRep * frep, const std::string & name );
284 
288  void setDefaultFitter ( const std::string & name );
289 
296  bool fitFunction ( PlotterBase * plotter, FunctionRep * rep );
297 
305  bool tryFitFunction ( PlotterBase * plotter, FunctionRep * );
306 
313  bool fitFunction ( PlotterBase * plotter, unsigned int );
314 
322  void saveParameters ( PlotterBase * plotter );
323 
328  void restoreParameters ( PlotterBase * plotter );
329 
330 
335  double getObjectiveValue ( const PlotterBase *, const DataRep * );
336 
339  const std::vector < std::vector < double > > &
340  getCovarianceMatrix ( const PlotterBase * );
341 
346  double getChiSquared ( const PlotterBase * );
347 
352  int getDegreesOfFreedom ( const PlotterBase * );
353 
356  ViewBase * createFuncView ( const ViewFactory * factory,
357  PlotterBase * plotter,
358  const std::string & type );
359 
362  NTuple * createNTuple ( const PlotterBase * plotter,
363  const FunctionRep * rep );
364 
371  PlotterBase * createResidualsDisplay ( PlotterBase * plotter,
372  const FunctionRep * );
373 
384  void ellipsoidNTuple ( PlotterBase * plotter, FunctionRep * ,
385  NTuple* nt, int n,
386  double & xmin, double & xmax,
387  double & ymin, double & ymax );
388 
393  PlotterBase * createNewEllipsoidDisplay ( PlotterBase * plotter,
394  FunctionRep * rep );
395 
400  PlotterBase * refreshEllipsoidDisplay ( PlotterBase * plotter,
401  FunctionRep * );
402 
407  NTuple * ellipse( const std::vector< double > & xbar,
408  std::vector< std::vector < double > > & SigmaInv,
409  double Csq );
410 
413  int setEllpsoidParamIndex ( Axes::Type axes, int index );
414 
422  bool isCompatible ( const std::string & function,
423  const std::string & fitter );
424 
427  bool functionExists ( const std::string & name );
428 
430  void setFitRange ( PlotterBase * plotter, const Range & range );
431 
433  void setFitRange ( PlotterBase * plotter, double low, double high );
434 
438  void setTupleCut ( FunctionRep * rep );
439 
443  void setTupleCut ( const PlotterBase * plotter,
444  DataRep * data_rep );
445 
448  void removeTupleCut ( const PlotterBase * plotter,
449  DataRep * data_rep );
450 
451 };
452 
453 } // namespace hippodraw
454 
455 #endif // _FunctionController_H_
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
std::vector< FunctionRep * > m_func_reps
The list of FunctionRep objects for the current plotter.
int m_y
Index of the parameter that shall be bound to Y axes while plotting the error / confidence ellipsoids...
std::vector< std::string > m_f_names
The list of function names attached to the plotter.
void * data(numeric::array arr)
Definition: num_util.cpp:389
A singleton class is the interface between an application and the list of FunctionRep objects contain...
A derived class of DataRep which is a base class for displaying a function.
Definition: FunctionRep.h:34
return rep
Definition: Inspector.cxx:3843
int m_x
Index of the parameter that shall be bound to X axes while plotting the error / confidence ellipsoids...
The base class for fitters.
Definition: Fitter.h:33
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
The base class for data representations.
Definition: DataRep.h:68
The namespace for axes.
The abstract base class for a factory that creates objects closely related to the graphics subsystem ...
Definition: ViewFactory.h:35
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The abstract base class for views.
Definition: ViewBase.h:62
A function that can be added to a DataRep and used in a fitter.
Definition: FunctionBase.h:90
PlotterBase * m_plotter
The current PlotterBase object.
static FunctionController * s_instance
A pointer to the singleton object.
Expresses a range of values.
Definition: Range.h:33
return index
Definition: PickTable.cxx:182
unsigned int m_confid_count
A count of number of confidence contour plots created.
hippodraw::FunctionBase class interface
std::vector< double > m_deltaXSq
delta chi squared values for 99.99% confidence ellipsoids for mu = 1,2,3,4,5,6
Type
Axes constants.
Definition: AxesType.h:31

Generated for HippoDraw Class Library by doxygen