00001 /* -*- mode: c++ -*- */ 00002 00014 #ifndef _FunctionProjector_H_ 00015 #define _FunctionProjector_H_ 00016 00017 #include "ProjectorBase.h" 00018 00019 class BinsFunction; 00020 class Fitter; 00021 class FunctionBase; 00022 class TupleCut; 00023 00031 class MDL_HIPPOPLOT_API FunctionProjector : public ProjectorBase 00032 { 00033 00034 private: 00035 00038 mutable std::vector< std::vector < double > > m_covariance; 00039 00042 mutable std::vector< double > m_principleErrors; 00043 00050 std::list < std::vector < double > > m_values; 00051 00053 static std::string s_x_label; 00054 00057 std::vector< double > m_save_parms; 00058 00060 std::string m_z_label; 00061 00065 ProjectorBase * m_target; 00066 00068 FunctionBase * m_function; 00069 00074 Fitter * m_fitter; 00075 00077 BinsFunction * m_binner; 00078 00080 virtual void prepareValues (); 00081 00083 virtual void addPointReps (); 00084 00085 public: 00086 00091 FunctionProjector ( const std::string & name, 00092 ProjectorBase * targetProjector ); 00093 00096 FunctionProjector ( FunctionBase * function, 00097 ProjectorBase * targetProjector ); 00098 00100 FunctionProjector( const FunctionProjector & ); 00101 00104 virtual ~FunctionProjector(); 00105 00106 virtual ProjectorBase * clone(); 00107 00109 virtual bool isEmpty () const; 00110 00112 void setNumberOfBins( int nb ); 00113 00116 double objectiveValue () const; 00117 00120 const std::vector < std::vector < double > > & covariance ( ) const; 00121 00123 const std::vector< double > & principleErrors () const; 00124 00129 void setPrincipleErrors ( std::vector < double > ::const_iterator begin, 00130 std::vector < double > ::const_iterator end ); 00131 00134 void setFitter ( Fitter * fitter ); 00135 00138 Fitter * getFitter ( ) const; 00139 00141 int degreesOfFreedom () const; 00142 00144 FunctionBase * function () const; 00145 00147 bool hasSavedParameters () const; 00148 00150 void saveParameters (); 00151 00154 void restoreParameters (); 00155 00158 void initializeFunction ( ProjectorBase * projector ); 00159 00164 bool fitFunction ( ); 00165 00171 virtual void prepareAxis ( const Range & x_view, 00172 const Range & y_view ); 00173 00174 virtual Range valueRange() const; 00175 00176 virtual const std::string & getTitle() const; 00177 00178 virtual void setRange( hippodraw::Axes::Type, bool ); 00179 virtual double getPosOn ( hippodraw::Axes::Type ) const; 00180 00184 virtual const std::string & getXLabel() const; 00185 00191 virtual const std::string & getYLabel ( bool density = false ) const; 00192 00196 int getNumberOfEntries () const; 00197 00198 virtual Range dataRangeOn ( hippodraw::Axes::Type ) const; 00199 00201 virtual void setAxisModel ( hippodraw::Axes::Type axis, AxisModelBase * ); 00202 00204 const std::string & getZLabel() const; 00205 00206 virtual DataSource * createNTuple () const; 00207 00209 void setParameters( const std::vector<double> ¶ms ); 00210 00213 virtual void setFitCut ( TupleCut * cut ); 00214 00217 virtual void setFitRange ( bool yes = true ); 00218 00219 protected: 00220 00221 virtual void fillProjectedValues ( DataSource * ntuple, 00222 bool in_range = false ) const; 00223 virtual void fillDataSource ( DataSource * ntuple, 00224 bool in_range = false ) const; 00225 00226 }; 00227 00228 #endif // _FunctionProjector_H_