Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:19

0001 // @(#)root/treeviewer:$Id$
0002 // Author: Bastien Dalla Piazza  02/08/2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TParallelCoord
0013 #define ROOT_TParallelCoord
0014 
0015 #include "TAttLine.h"
0016 #include "TNamed.h"
0017 
0018 class TTree;
0019 class TPaveText;
0020 class TEntryList;
0021 class TParallelCoordSelect;
0022 class TParallelCoordVar;
0023 class TParallelCoordRange;
0024 class TList;
0025 class TGaxis;
0026 class TSelectorDraw;
0027 
0028 class TParallelCoord : public TNamed {
0029 public:
0030    enum EStatusBits {
0031       kVertDisplay     = BIT(14),      ///< If the axes are drawn vertically, false if horizontally.
0032       kCurveDisplay    = BIT(15),      ///< If the polylines are replaced by interpolated curves.
0033       kPaintEntries    = BIT(16),      ///< To paint all TParallelCoord entries.
0034       kLiveUpdate      = BIT(17),      ///< To paint the entries when being modified.
0035       kGlobalScale     = BIT(19),      ///< Every variable is on the same scale.
0036       kCandleChart     = BIT(20),      ///< To produce a candle chart.
0037       kGlobalLogScale  = BIT(21)       ///< Every variable in log scale.
0038    };
0039 
0040 private:
0041    UInt_t          fNvar;                   ///< Number of variables.
0042    Long64_t        fCurrentFirst;           ///< First entry to display.
0043    Long64_t        fCurrentN;               ///< Number of entries to display.
0044    Long64_t        fNentries;               ///< Number of entries;
0045    Int_t           fDotsSpacing;            ///< Spacing between dots to draw the entries.
0046    Color_t         fLineColor;              ///< entries line color.
0047    Width_t         fLineWidth;              ///< entries line width.
0048    Int_t           fWeightCut;              ///< Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
0049    TEntryList     *fCurrentEntries;         ///<-> Current selected entries in the tree.
0050    TEntryList     *fInitEntries;            ///<-> Selected entries when TParallelCoord first initialized.
0051    TTree          *fTree;                   ///<! Pointer to the TTree.
0052    TString         fTreeName;               ///< Name of the tree.
0053    TString         fTreeFileName;           ///< Name of the file containing the tree.
0054    TList          *fVarList;                ///< List of the variables.
0055    TList          *fSelectList;             ///< List of selections over the variables.
0056    TParallelCoordSelect* fCurrentSelection; ///<! Current Selection being edited.
0057    TGaxis         *fCandleAxis;             ///<! An axis used when displaying a candle chart.
0058 
0059    void            Init();
0060    void            PaintEntries(TParallelCoordSelect* sel=nullptr);
0061    void            SetAxesPosition();
0062 
0063 public:
0064    TParallelCoord();
0065    TParallelCoord(Long64_t nentries);
0066    TParallelCoord(TTree* tree, Long64_t nentries);
0067    ~TParallelCoord() override;
0068 
0069    void           AddVariable(Double_t* val, const char* title="");
0070    void           AddVariable(const char* varexp);
0071    void           AddSelection(const char* title);
0072    void           ApplySelectionToTree(); // *MENU*
0073    static void    BuildParallelCoord(TSelectorDraw* selector, bool candle);
0074    void           CleanUpSelections(TParallelCoordRange* range);
0075    void           RemoveVariable(TParallelCoordVar* var);
0076    bool           RemoveVariable(const char* var);
0077    void           DeleteSelection(TParallelCoordSelect* sel);
0078    Int_t          DistancetoPrimitive(Int_t px, Int_t py) override;
0079    void           Draw(Option_t* options="") override;
0080    void           ExecuteEvent(Int_t entry, Int_t px, Int_t py) override;
0081    bool           GetCandleChart() {return TestBit(kCandleChart);}
0082    Long64_t       GetCurrentFirst() {return fCurrentFirst;}
0083    Long64_t       GetCurrentN() {return fCurrentN;}
0084    TParallelCoordSelect* GetCurrentSelection();
0085    bool           GetCurveDisplay() const {return TestBit(kCurveDisplay);}
0086    Int_t          GetDotsSpacing() const {return fDotsSpacing;}
0087    TEntryList    *GetEntryList(bool sel=true);
0088    Double_t       GetGlobalMin();
0089    Double_t       GetGlobalMax();
0090    bool           GetGlobalScale() {return TestBit(kGlobalScale);}
0091    bool           GetGlobalLogScale() {return TestBit(kGlobalLogScale);}
0092    Color_t        GetLineColor() {return fLineColor;}
0093    Width_t        GetLineWidth() {return fLineWidth;}
0094    Int_t          GetNbins();
0095    UInt_t         GetNvar() {return fNvar;}
0096    Long64_t       GetNentries() {return fNentries;}
0097    TList         *GetSelectList() {return fSelectList;}
0098    TParallelCoordSelect* GetSelection(const char* title);
0099    TTree         *GetTree();
0100    Double_t      *GetVariable(const char* var);
0101    Double_t      *GetVariable(Int_t i);
0102    TList         *GetVarList() {return fVarList;}
0103    bool           GetVertDisplay() const {return TestBit(kVertDisplay);}
0104    Int_t          GetWeightCut() const {return fWeightCut;};
0105    void           Paint(Option_t* options="") override;
0106    void           ResetTree();
0107    void           SaveEntryLists(const char* filename="", bool overwrite=false); // *MENU*
0108    void           SavePrimitive(std::ostream & out,Option_t *options) override;
0109    void           SaveTree(const char* filename="", bool overwrite=false); // *MENU*
0110    void           SetAxisHistogramBinning(Int_t n=100); // *MENU*
0111    void           SetAxisHistogramHeight(Double_t h=0.5); // *MENU*
0112    void           SetAxisHistogramLineWidth(Int_t lw=2); // *MENU*
0113    void           SetCandleChart(bool can); // *TOGGLE* *GETTER=GetCandleChart
0114    virtual void   SetCurveDisplay(bool curve=true) {SetBit(kCurveDisplay,curve);} // *TOGGLE* *GETTER=GetCurveDisplay
0115    void           SetCurrentEntries(TEntryList* entries) {fCurrentEntries = entries;}
0116    void           SetCurrentFirst(Long64_t);
0117    void           SetCurrentN(Long64_t);
0118    TParallelCoordSelect* SetCurrentSelection(const char* title);
0119    void           SetCurrentSelection(TParallelCoordSelect* sel);
0120    void           SetDotsSpacing(Int_t s=0); // *MENU*
0121    static void    SetEntryList(TParallelCoord* para, TEntryList* enlist);
0122    void           SetGlobalScale(bool gl); // *TOGGLE* *GETTER=GetGlobalScale
0123    void           SetGlobalLogScale(bool); // *TOGGLE* *GETTER=GetGlobalLogScale
0124    void           SetGlobalMin(Double_t min);
0125    void           SetGlobalMax(Double_t max);
0126    void           SetInitEntries(TEntryList* entries) {fInitEntries = entries;}
0127    void           SetLineColor(Color_t col) {fLineColor = col;}
0128    void           SetLineWidth(Width_t wid) {fLineWidth = wid;}
0129    void           SetLiveRangesUpdate(bool);
0130    void           SetNentries(Long64_t n) {fNentries = n;}
0131    void           SetTree(TTree* tree) {fTree = tree;}
0132    void           SetVertDisplay(bool vert=true); // *TOGGLE* *GETTER=GetVertDisplay
0133    void           SetWeightCut(Int_t w=0) {fWeightCut = w;} // *MENU*
0134    void           UnzoomAll(); // *MENU*
0135 
0136    ClassDefOverride(TParallelCoord,1); // To display parallel coordinates plots.
0137 };
0138 
0139 #endif