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_

Generated for HippoDraw Class Library by doxygen