00001
00002
00014 #ifndef _FunctionProjector_H_
00015 #define _FunctionProjector_H_
00016
00017 #include "ProjectorBase.h"
00018
00019 namespace hippodraw {
00020
00021 class BinsFunction;
00022 class Fitter;
00023 class FunctionBase;
00024 class TupleCut;
00025
00033 class MDL_HIPPOPLOT_API FunctionProjector : public ProjectorBase
00034 {
00035
00036 private:
00037
00040 mutable std::vector< std::vector < double > > m_covariance;
00041
00044 mutable std::vector< double > m_principleErrors;
00045
00047 static std::string s_x_label;
00048
00053 std::vector< double > m_save_parms;
00054
00056 std::string m_z_label;
00057
00061 ProjectorBase * m_target;
00062
00064 FunctionBase * m_function;
00065
00070 Fitter * m_fitter;
00071
00073 virtual void addPointReps ();
00074
00075 public:
00076
00080 FunctionProjector ( FunctionBase * function,
00081 ProjectorBase * targetProjector );
00082
00084 FunctionProjector( const FunctionProjector & );
00085
00088 virtual ~FunctionProjector();
00089
00090 virtual ProjectorBase * clone();
00091
00093 virtual bool isEmpty () const;
00094
00097 double objectiveValue () const;
00098
00101 const std::vector < std::vector < double > > & covariance ( ) const;
00102
00105 void calcPrincipleErrors() const;
00106
00108 const std::vector< double > & principleErrors () const;
00109
00114 void setPrincipleErrors ( std::vector < double > ::const_iterator first,
00115 std::vector < double > ::const_iterator last );
00116
00119 void setFitter ( Fitter * fitter );
00120
00123 Fitter * getFitter ( ) const;
00124
00126 int degreesOfFreedom () const;
00127
00129 FunctionBase * function () const;
00130
00132 bool hasSavedParameters () const;
00133
00135 void saveParameters ();
00136
00139 void restoreParameters ();
00140
00143 void initializeFunction ( ProjectorBase * projector );
00144
00149 bool fitFunction ( );
00150
00151 virtual Range valueRange() const;
00152
00153 virtual const std::string & getTitle() const;
00154
00155 virtual void setRange( hippodraw::Axes::Type, bool );
00156 virtual double getPosOn ( hippodraw::Axes::Type ) const;
00157
00161 virtual const std::string & getXLabel() const;
00162
00168 virtual const std::string & getYLabel ( bool density = false ) const;
00169
00173 int getNumberOfEntries () const;
00174
00176 int getUnderflow () const;
00177
00179 int getOverflow () const;
00180
00181
00182 virtual Range dataRangeOn ( hippodraw::Axes::Type ) const;
00183
00185 const std::string & getZLabel() const;
00186
00189 virtual DataSource * createNTuple () const;
00190
00192 void setParameters( const std::vector<double> ¶ms );
00193
00196 virtual void setFitCut ( TupleCut * cut );
00197
00200 virtual void setFitRange ( bool yes = true );
00201
00202 protected:
00203
00206 virtual void fillProjectedValues ( DataSource * ntuple,
00207 bool in_range = false ) const;
00208
00209 };
00210
00211 }
00212
00213 #endif // _FunctionProjector_H_