TParallelCoordVar.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TParallelCoordVar.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Bastien Dalla Piazza  02/08/2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TParallelCoordVar
00013 #define ROOT_TParallelCoordVar
00014 
00015 #ifndef ROOT_TAttLine
00016 #include "TAttLine.h"
00017 #endif
00018 #ifndef ROOT_TNamed
00019 #include "TNamed.h"
00020 #endif
00021 #ifndef ROOT_TAttFill
00022 #include "TAttFill.h"
00023 #endif
00024 
00025 class TParallelCoord;
00026 class TParallelCoordSelect;
00027 class TParallelCoordRange;
00028 class TH1F;
00029 
00030 class TParallelCoordVar : public TNamed, public TAttLine, public TAttFill {
00031 public:
00032    enum {
00033       kLogScale      =BIT(14),
00034       kShowBox       =BIT(15),
00035       kShowBarHisto  =BIT(16)
00036    };
00037 private:
00038    Int_t             fNbins;        // Number of bins in fHistogram.
00039    Int_t             fHistoLW;      // Line width used to draw the histogram line.
00040    Int_t             fId;           // Id identifying the variable for the editor.
00041    Long64_t          fNentries;      // Number of stored entries values.
00042    Double_t          fX1;           // x1 coordinate of the axis.
00043    Double_t          fX2;           // x2 coordinate of the axis.
00044    Double_t          fY1;           // y1 coordinate of the axis.
00045    Double_t          fY2;           // y2 coordinate of the axis.
00046    Double_t          fMinInit;      // Memory of the minimum when first initialized.
00047    Double_t          fMaxInit;      // Memory of the maximum when first initialized.
00048    Double_t          fMean;         // Average.
00049    Double_t          fMinCurrent;   // Current used minimum.
00050    Double_t          fMaxCurrent;   // Current used maximum.
00051    Double_t          fMed;          // Median value (Q2).
00052    Double_t          fQua1;         // First quantile (Q1).
00053    Double_t          fQua3;         // Third quantile (Q3).
00054    Double_t          fHistoHeight;  // Histogram Height.
00055    Double_t         *fVal;          //![fNentries] Entries values for the variable.
00056    TList            *fRanges;       // List of the TParallelRange owned by TParallelCoordVar.
00057    TParallelCoord   *fParallel;     // Pointer to the TParallelCoord which owns the TParallelCoordVar.
00058    TH1F             *fHistogram;    //! Histogram holding the variable distribution.
00059 
00060 public:
00061    TParallelCoordVar();
00062    TParallelCoordVar(Double_t *val, const char* title,Int_t id, TParallelCoord* gram);
00063    ~TParallelCoordVar();
00064 
00065    void           AddRange(TParallelCoordRange* range);
00066    void           AddRange() {AddRange(NULL);} // *MENU*
00067    void           DeleteVariable(); // *MENU*
00068    virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py);
00069    virtual void   Draw(Option_t *option="");
00070    Bool_t         Eval(Long64_t evtidx, TParallelCoordSelect *select); // Check an entry is within its ranges owned by a given TParallelSelect.
00071    virtual void   ExecuteEvent(Int_t entry, Int_t px, Int_t py);
00072    Bool_t         GetBarHisto() {return TestBit(kShowBarHisto);}
00073    Bool_t         GetBoxPlot() {return TestBit(kShowBox);}
00074    TH1F          *GetHistogram();
00075    Int_t          GetId() {return fId;}
00076    Bool_t         GetLogScale() const {return TestBit (kLogScale);}
00077    Int_t          GetHistBinning() const {return fNbins;}
00078    Double_t       GetCurrentMin() const {return fMinCurrent;}
00079    Double_t       GetCurrentMax() const {return fMaxCurrent;}
00080    Double_t       GetCurrentAverage() const {return fMean;}
00081    void           GetEntryXY(Long64_t n, Double_t & x, Double_t & y);
00082    Int_t          GetEntryWeight(Long64_t evtidx);
00083    Double_t       GetHistHeight() {return fHistoHeight;}
00084    Int_t          GetHistLineWidth() {return fHistoLW;}
00085    void           GetMinMaxMean();
00086    void           GetQuantiles();
00087    Double_t       GetX() {return fX1;}
00088    Double_t       GetY() {return fY1;}
00089    Int_t          GetNbins() {return fNbins;}
00090    Long64_t       GetNentries() const {return fNentries;}
00091    virtual char  *GetObjectInfo(Int_t px, Int_t py) const;
00092    TParallelCoord* GetParallel() {return fParallel;}
00093    TList         *GetRanges() {return fRanges;}
00094    Double_t      *GetValues() {return fVal;}
00095    Double_t       GetValuefromXY(Double_t x,Double_t y);
00096    Bool_t         GetVert() {return fX1 == fX2;} // Tells if the axis is vertical or not.
00097    void           GetXYfromValue(Double_t value, Double_t & x, Double_t & y);
00098    void           Init();
00099    virtual void   Paint(Option_t* option="");
00100    void           PaintBoxPlot();
00101    void           PaintHistogram();
00102    void           PaintLabels();
00103    virtual void   Print(Option_t* option="") const; // *MENU*
00104    void           SavePrimitive(ostream & out, Option_t *options);
00105    void           SetBoxPlot(Bool_t box); // *TOGGLE* *GETTER=GetBoxPlot
00106    void           SetBarHisto(Bool_t h) {SetBit(kShowBarHisto,h);} // *TOGGLE* *GETTER=GetBarHisto
00107    void           SetHistogramLineWidth(Int_t lw=2) {fHistoLW = lw;} // *MENU*
00108    void           SetHistogramHeight(Double_t h=0); // *MENU*
00109    void           SetHistogramBinning(Int_t n=100); // *MENU*
00110    void           SetCurrentLimits(Double_t min, Double_t max); // *MENU*
00111    void           SetCurrentMin(Double_t min);
00112    void           SetCurrentMax(Double_t max);
00113    void           SetInitMin(Double_t min) {fMinInit = min;}
00114    void           SetInitMax(Double_t max) {fMaxInit = max;}
00115    void           SetLiveRangesUpdate(Bool_t on);
00116    void           SetLogScale(Bool_t log); // *TOGGLE* *GETTER=GetLogScale
00117    void           SetTitle(const char* /*title*/) {} // To hide TNamed::SetTitle.
00118    void           SetValues(Long64_t length, Double_t* val);
00119    void           SetX(Double_t x, Bool_t gl);    // Set a new x position in case of a vertical display.
00120    void           SetY(Double_t y, Bool_t gl);    // Set a new y position in case of a horizontal display.
00121    void           Unzoom() {SetCurrentLimits(fMinInit,fMaxInit);} // *MENU* Reset fMin and fMax to their original value.
00122 
00123    ClassDef(TParallelCoordVar,1); // A Variable of a parallel coordinates plot.
00124 };
00125 
00126 #endif

Generated on Tue Jul 5 14:27:54 2011 for ROOT_528-00b_version by  doxygen 1.5.1