TParallelCoord.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TParallelCoord.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_TParallelCoord
00013 #define ROOT_TParallelCoord
00014 
00015 #ifndef ROOT_TAttLine
00016 #include "TAttLine.h"
00017 #endif
00018 #ifndef ROOT_TNamed
00019 #include "TNamed.h"
00020 #endif
00021 
00022 class TTree;
00023 class TPaveText;
00024 class TEntryList;
00025 class TParallelCoordSelect;
00026 class TParallelCoordVar;
00027 class TParallelCoordRange;
00028 class TList;
00029 class TGaxis;
00030 class TSelectorDraw;
00031 
00032 class TParallelCoord : public TNamed {
00033 public:
00034    enum {
00035       kVertDisplay      =BIT(14),      // If the axes are drawn vertically, false if horizontally.
00036       kCurveDisplay     =BIT(15),      // If the polylines are replaced by interpolated curves.
00037       kPaintEntries     =BIT(16),      // To prentry the TParallelCoord to paint all the entries.
00038       kLiveUpdate       =BIT(17),      // To paint the entries when being modified.
00039       kGlobalScale      =BIT(19),      // Every variable is on the same scale.
00040       kCandleChart      =BIT(20),      // To produce a candle chart.
00041       kGlobalLogScale   =BIT(21)       // Every variable in log scale.
00042    };
00043 
00044 private:
00045    UInt_t          fNvar;              // Number of variables.
00046    Long64_t        fCurrentFirst;      // First entry to display.
00047    Long64_t        fCurrentN;          // Number of entries to display.
00048    Long64_t        fNentries;          // Number of entries;
00049    Int_t           fDotsSpacing;       // Spacing between dots to draw the entries.
00050    Color_t         fLineColor;         // entries line color.
00051    Width_t         fLineWidth;         // entries line width.
00052    Int_t           fWeightCut;         // Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
00053    TEntryList     *fCurrentEntries;    //-> Current selected entries in the tree.
00054    TEntryList     *fInitEntries;       //-> Selected entries when TParallelCoord first initialized.
00055    TTree          *fTree;              //! Pointer to the TTree.
00056    TString         fTreeName;          // Name of the tree.
00057    TString         fTreeFileName;      // Name of the file containing the tree.
00058    TList          *fVarList;           // List of the variables.
00059    TList          *fSelectList;        // List of selections over the variables.
00060    TParallelCoordSelect* fCurrentSelection; //! Current Selection being edited.
00061    TGaxis         *fCandleAxis;        //! An axis used when displaying a candle chart.
00062 
00063    void            Init();
00064    void            PaintEntries(TParallelCoordSelect* sel=NULL);
00065    void            SetAxesPosition();
00066 
00067 public:
00068    TParallelCoord();
00069    TParallelCoord(Long64_t nentries);
00070    TParallelCoord(TTree* tree, Long64_t nentries);
00071    ~TParallelCoord();
00072 
00073    void           AddVariable(Double_t* val, const char* title="");
00074    void           AddVariable(const char* varexp);
00075    void           AddSelection(const char* title);
00076    void           ApplySelectionToTree(); // *MENU*
00077    static void    BuildParallelCoord(TSelectorDraw* selector, Bool_t candle);
00078    void           CleanUpSelections(TParallelCoordRange* range);
00079    void           RemoveVariable(TParallelCoordVar* var);
00080    TParallelCoordVar* RemoveVariable(const char* var);
00081    void           DeleteSelection(TParallelCoordSelect* sel);
00082    virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py);
00083    virtual void   Draw(Option_t* options="");
00084    virtual void   ExecuteEvent(Int_t entry, Int_t px, Int_t py);
00085    Bool_t         GetCandleChart() {return TestBit(kCandleChart);}
00086    Long64_t       GetCurrentFirst() {return fCurrentFirst;}
00087    Long64_t       GetCurrentN() {return fCurrentN;}
00088    TParallelCoordSelect* GetCurrentSelection();
00089    Bool_t         GetCurveDisplay() const {return TestBit(kCurveDisplay);}
00090    Int_t          GetDotsSpacing() const {return fDotsSpacing;}
00091    TEntryList    *GetEntryList(Bool_t sel=kTRUE);
00092    Double_t       GetGlobalMin();
00093    Double_t       GetGlobalMax();
00094    Bool_t         GetGlobalScale() {return TestBit(kGlobalScale);}
00095    Bool_t         GetGlobalLogScale() {return TestBit(kGlobalLogScale);}
00096    Color_t        GetLineColor() {return fLineColor;}
00097    Width_t        GetLineWidth() {return fLineWidth;}
00098    Int_t          GetNbins();
00099    UInt_t         GetNvar() {return fNvar;}
00100    Long64_t       GetNentries() {return fNentries;}
00101    TList         *GetSelectList() {return fSelectList;}
00102    TParallelCoordSelect* GetSelection(const char* title);
00103    TTree         *GetTree();
00104    Double_t      *GetVariable(const char* var);
00105    Double_t      *GetVariable(Int_t i);
00106    TList         *GetVarList() {return fVarList;}
00107    Bool_t         GetVertDisplay() const {return TestBit(kVertDisplay);}
00108    Int_t          GetWeightCut() const {return fWeightCut;};
00109    virtual void   Paint(Option_t* options="");
00110    void           ResetTree();
00111    void           SaveEntryLists(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
00112    void           SavePrimitive(ostream & out,Option_t *options);
00113    void           SaveTree(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
00114    void           SetAxisHistogramBinning(Int_t n=100); // *MENU*
00115    void           SetAxisHistogramHeight(Double_t h=0.5); // *MENU*
00116    void           SetAxisHistogramLineWidth(Int_t lw=2); // *MENU*
00117    void           SetCandleChart(Bool_t can); // *TOGGLE* *GETTER=GetCandleChart
00118    virtual void   SetCurveDisplay(Bool_t curve=1) {SetBit(kCurveDisplay,curve);} // *TOGGLE* *GETTER=GetCurveDisplay
00119    void           SetCurrentEntries(TEntryList* entries) {fCurrentEntries = entries;}
00120    void           SetCurrentFirst(Long64_t);
00121    void           SetCurrentN(Long64_t);
00122    TParallelCoordSelect* SetCurrentSelection(const char* title);
00123    void           SetCurrentSelection(TParallelCoordSelect* sel);
00124    void           SetDotsSpacing(Int_t s=0); // *MENU*
00125    static void    SetEntryList(TParallelCoord* para, TEntryList* enlist);
00126    void           SetGlobalScale(Bool_t gl); // *TOGGLE* *GETTER=GetGlobalScale
00127    void           SetGlobalLogScale(Bool_t); // *TOGGLE* *GETTER=GetGlobalLogScale
00128    void           SetGlobalMin(Double_t min);
00129    void           SetGlobalMax(Double_t max);
00130    void           SetInitEntries(TEntryList* entries) {fInitEntries = entries;}
00131    void           SetLineColor(Color_t col) {fLineColor = col;}
00132    void           SetLineWidth(Width_t wid) {fLineWidth = wid;}
00133    void           SetLiveRangesUpdate(Bool_t);
00134    void           SetNentries(Long64_t n) {fNentries = n;}
00135    void           SetTree(TTree* tree) {fTree = tree;}
00136    void           SetVertDisplay(Bool_t vert=kTRUE); // *TOGGLE* *GETTER=GetVertDisplay
00137    void           SetWeightCut(Int_t w=0) {fWeightCut = w;} // *MENU*
00138    void           UnzoomAll(); // *MENU*
00139 
00140    ClassDef(TParallelCoord,1); // To display parallel coordinates plots.
00141 };
00142 
00143 #endif

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