00001
00002
00014 #ifndef _ProjectorBase_H_
00015 #define _ProjectorBase_H_
00016
00017 #include "axes/AxesType.h"
00018 #include "pattern/Observable.h"
00019 #include "pattern/Observer.h"
00020
00021 #ifdef _MSC_VER
00022 #include <msdevstudio/MSconfig.h>
00023 #endif
00024
00025 #include <vector>
00026
00027 class AxisModelBase;
00028 class BinsBase;
00029 class DataSource;
00030 class NTuple;
00031 class Range;
00032
00051 class MDL_HIPPOPLOT_API ProjectorBase : public Observable, public hippodraw::Observer
00052 {
00053
00054 private:
00055
00058 bool m_isDirty;
00059
00060 protected:
00061
00063 ProjectorBase ( const ProjectorBase & projector );
00064
00073 DataSource * m_proj_values;
00074
00082 AxisModelBase * m_x_axis;
00083
00086 AxisModelBase * m_y_axis;
00087
00090 AxisModelBase * m_z_axis;
00091
00095 std::string m_z_label;
00096
00098 std::vector < std::string > m_pointreps;
00099
00104 const ProjectorBase * m_target;
00105
00109 virtual void addPointReps () = 0;
00110
00111 public:
00112
00114 ProjectorBase();
00115
00117 virtual ~ProjectorBase();
00118
00121 virtual ProjectorBase * clone() = 0;
00122
00129 virtual void setAxisBinding ( const std::string & axis,
00130 const std::string & label );
00131
00135 virtual void matrixTranspose ( bool yes );
00136
00143 virtual
00144 void setAxisBindings ( const std::vector < std::string > & bindings );
00145
00152 virtual const std::vector < std::string > & getAxisBindings () const;
00153
00160 virtual bool isEmpty () const = 0;
00161
00170 virtual void prepareValues ();
00171
00173 virtual Range dataRangeOn ( hippodraw::Axes::Type ) const = 0;
00174
00179 virtual Range preferredRange ( hippodraw::Axes::Type ) const;
00180
00184 bool isDirty () const;
00185
00187 virtual void setDirty ( bool value = true );
00188
00192 virtual int getNumberOfBins ( hippodraw::Axes::Type ) const;
00193
00195 virtual void setAxisModel ( hippodraw::Axes::Type axis, AxisModelBase * );
00196
00198 virtual AxisModelBase * getAxisModel ( hippodraw::Axes::Type axis )const;
00199
00203 virtual bool isAxisBinned ( const std::string & axis ) const;
00204
00209 virtual bool isValueBinned () const;
00210
00212 virtual const std::string & getTitle() const = 0;
00213
00220 virtual Range valueRange () const = 0;
00221
00227 virtual const Range & getRange ( hippodraw::Axes::Type ) const;
00228
00234 virtual void setRange ( hippodraw::Axes::Type axis,
00235 bool const_width = true );
00236
00240 virtual double getPosOn ( hippodraw::Axes::Type ) const = 0;
00241
00249 virtual void setNumberOfBins ( hippodraw::Axes::Type axis,
00250 unsigned int number );
00251
00259 virtual void setBinWidth ( hippodraw::Axes::Type axis, double width );
00260
00270 virtual void setBinWidth ( const std::string & axis,
00271 int parm,
00272 bool dragging );
00273
00277 virtual void setOffset ( const std::string & axis,
00278 int parm,
00279 bool dragging );
00280
00288 virtual void setOffset ( hippodraw::Axes::Type axis, double offset );
00289
00290
00294 virtual void reset ();
00295
00296
00304 virtual double getOffset ( hippodraw::Axes::Type axis ) const;
00305
00312 virtual double getBinWidth ( hippodraw::Axes::Type axis ) const;
00313
00316 virtual const std::string & getXLabel() const = 0;
00317
00324 virtual const std::string & getYLabel ( bool flag = false ) const = 0;
00325
00328 virtual const std::string & getZLabel() const;
00329
00334 virtual int getNumberOfEntries () const = 0;
00335
00339 virtual double getAverage(hippodraw::Axes::Type axis) const;
00340
00344 virtual double getRMS ( hippodraw::Axes::Type axis );
00345
00347 virtual double getZValue ( double x, double y ) const;
00348
00353 virtual void addValues ( const std::vector < double > & v );
00354
00356 const std::vector < std::string > & getPointReps() const;
00357
00363 virtual DataSource * createNTuple () const = 0;
00364
00367 const DataSource * getProjectedValues () const;
00368
00369 virtual const DataSource * createOldStyleNTuple () const;
00370
00374 virtual NTuple * getNTupleAfterCuts () const;
00375
00383 virtual bool wantsScaleFactor ( const std::string & axis ) const;
00384
00390 virtual void normalizeTo ( const ProjectorBase * target );
00391
00397 virtual void normalizeTo ( double norm );
00398
00402 virtual void setNormalizing ( bool on );
00403
00408 virtual void update ( const Observable * );
00409
00410 protected:
00411
00423 virtual void fillProjectedValues ( DataSource * ntuple,
00424 bool in_range = false) const = 0;
00425
00437 virtual void fillDataSource ( DataSource * source,
00438 bool in_range = false) const = 0;
00439
00440 };
00441
00442 #endif // _ProjectorBase_H_