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 namespace hippodraw {
00028
00029 class AxisModelBase;
00030 class BinsBase;
00031 class DataSource;
00032 class NTuple;
00033 class Range;
00034 class TupleCut;
00035 class TransformBase;
00036
00056 class MDL_HIPPOPLOT_API ProjectorBase
00057 : public Observable, public Observer
00058 {
00059
00060 private:
00061
00065 bool m_isDirty;
00066
00067 protected:
00068
00070 ProjectorBase ( const ProjectorBase & projector );
00071
00080 DataSource * m_proj_values;
00081
00088 AxisModelBase * m_x_axis;
00089
00092 AxisModelBase * m_y_axis;
00093
00096 AxisModelBase * m_z_axis;
00097
00101 std::string m_z_label;
00102
00104 std::vector < std::string > m_pointreps;
00105
00110 const ProjectorBase * m_target;
00111
00115 virtual void addPointReps () = 0;
00116
00119 mutable std::vector < double > m_zval;
00120
00121
00122 public:
00123
00125 ProjectorBase();
00126
00128 virtual ~ProjectorBase();
00129
00132 virtual ProjectorBase * clone() = 0;
00133
00140 virtual void setAxisBinding ( const std::string & axis,
00141 const std::string & label );
00142
00146 virtual void matrixTranspose ( bool yes );
00147
00154 virtual
00155 void setAxisBindings ( const std::vector < std::string > & bindings );
00156
00163 virtual const std::vector < std::string > & getAxisBindings () const;
00164
00171 virtual bool isEmpty () const = 0;
00172
00181 virtual void prepareValues ();
00182
00184 virtual Range dataRangeOn ( Axes::Type ) const = 0;
00185
00190 virtual Range preferredRange ( Axes::Type ) const;
00191
00195 bool isDirty () const;
00196
00198 virtual void setDirty ( bool value = true );
00199
00203 virtual int getNumberOfBins ( Axes::Type ) const;
00204
00206 virtual void setAxisModel ( Axes::Type axis, AxisModelBase * );
00207
00209 virtual AxisModelBase * getAxisModel ( Axes::Type axis )const;
00210
00214 virtual bool isAxisBinned ( const std::string & axis ) const;
00215
00220 virtual bool isValueBinned () const;
00221
00223 virtual const std::string & getTitle() const = 0;
00224
00231 virtual Range valueRange () const = 0;
00232
00238 virtual const Range & getRange ( Axes::Type ) const;
00239
00245 virtual void setRange ( Axes::Type axis,
00246 bool const_width = true );
00247
00251 virtual double getPosOn ( Axes::Type ) const = 0;
00252
00260 virtual void setNumberOfBins ( Axes::Type axis,
00261 unsigned int number );
00262
00270 virtual const Range & setBinWidth ( Axes::Type axis,
00271 double width );
00272
00282 virtual const Range & setBinWidth ( Axes::Type axis,
00283 int parm,
00284 bool dragging );
00285
00289 virtual void setOffset ( const std::string & axis,
00290 int parm,
00291 bool dragging );
00292
00300 virtual void setOffset ( Axes::Type axis, double offset );
00301
00302
00306 virtual void reset ();
00307
00308
00316 virtual double getOffset ( Axes::Type axis ) const;
00317
00324 virtual double getBinWidth ( Axes::Type axis ) const;
00325
00328 virtual const std::string & getXLabel() const = 0;
00329
00336 virtual const std::string & getYLabel ( bool flag = false ) const = 0;
00337
00340 virtual const std::string & getZLabel() const;
00341
00344 virtual int indexOf ( const std::string & label ) const;
00345
00346
00351 virtual int getNumberOfEntries () const = 0;
00352
00354 virtual int getUnderflow () const = 0;
00355
00357 virtual int getOverflow () const = 0;
00358
00359
00363 virtual double getAverage(Axes::Type axis) const;
00364
00368 virtual double getRMS ( Axes::Type axis );
00369
00371 virtual double getZValue ( double x, double y ) const;
00372
00377 virtual void addValues ( const std::vector < double > & v );
00378
00380 const std::vector < std::string > & getPointReps() const;
00381
00387 virtual DataSource * createNTuple () const = 0;
00388
00391 const DataSource * getProjectedValues () const;
00392
00393 virtual const DataSource * createOldStyleNTuple () const;
00394
00398 virtual NTuple * getNTupleAfterCuts () const;
00399
00403 virtual void fillColumnAfterCuts(const std::string & column,
00404 std::vector<double> & columnData) const;
00405
00410 virtual
00411 NTuple * createNTupleWith ( const std::vector< TupleCut > & cut_list ) const;
00412
00420 virtual bool wantsScaleFactor ( const std::string & axis ) const;
00421
00427 virtual void normalizeTo ( const ProjectorBase * target );
00428
00434 virtual void normalizeTo ( double norm );
00435
00439 virtual void setNormalizing ( bool on );
00440
00445 virtual void update ( const Observable * );
00446
00452 virtual void checkScaling ();
00453
00454
00457 const std::vector <double> & getZValues();
00458
00461 const std::vector <unsigned int> & getShape();
00462
00465 const std::vector <double> & getZAfterTransform(TransformBase * transform);
00466
00472 virtual bool hasDataSourceBindings () const;
00473
00476 virtual void setMinEntries( int entries );
00477
00480 virtual int getMinEntries ( );
00481
00488 virtual bool isImageConvertable () const;
00489
00490 };
00491
00492 }
00493
00494 #endif // _ProjectorBase_H_