Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TParallelCoord.h
Go to the documentation of this file.
1 // @(#)root/treeviewer:$Id$
2 // Author: Bastien Dalla Piazza 02/08/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TParallelCoord
13 #define ROOT_TParallelCoord
14 
15 #include "TAttLine.h"
16 #include "TNamed.h"
17 
18 class TTree;
19 class TPaveText;
20 class TEntryList;
21 class TParallelCoordSelect;
22 class TParallelCoordVar;
23 class TParallelCoordRange;
24 class TList;
25 class TGaxis;
26 class TSelectorDraw;
27 
28 class TParallelCoord : public TNamed {
29 public:
30  enum EStatusBits {
31  kVertDisplay = BIT(14), // If the axes are drawn vertically, false if horizontally.
32  kCurveDisplay = BIT(15), // If the polylines are replaced by interpolated curves.
33  kPaintEntries = BIT(16), // To prentry the TParallelCoord to paint all the entries.
34  kLiveUpdate = BIT(17), // To paint the entries when being modified.
35  kGlobalScale = BIT(19), // Every variable is on the same scale.
36  kCandleChart = BIT(20), // To produce a candle chart.
37  kGlobalLogScale = BIT(21) // Every variable in log scale.
38  };
39 
40 private:
41  UInt_t fNvar; // Number of variables.
42  Long64_t fCurrentFirst; // First entry to display.
43  Long64_t fCurrentN; // Number of entries to display.
44  Long64_t fNentries; // Number of entries;
45  Int_t fDotsSpacing; // Spacing between dots to draw the entries.
46  Color_t fLineColor; // entries line color.
47  Width_t fLineWidth; // entries line width.
48  Int_t fWeightCut; // Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
49  TEntryList *fCurrentEntries; //-> Current selected entries in the tree.
50  TEntryList *fInitEntries; //-> Selected entries when TParallelCoord first initialized.
51  TTree *fTree; //! Pointer to the TTree.
52  TString fTreeName; // Name of the tree.
53  TString fTreeFileName; // Name of the file containing the tree.
54  TList *fVarList; // List of the variables.
55  TList *fSelectList; // List of selections over the variables.
56  TParallelCoordSelect* fCurrentSelection; //! Current Selection being edited.
57  TGaxis *fCandleAxis; //! An axis used when displaying a candle chart.
58 
59  void Init();
60  void PaintEntries(TParallelCoordSelect* sel=NULL);
61  void SetAxesPosition();
62 
63 public:
64  TParallelCoord();
65  TParallelCoord(Long64_t nentries);
66  TParallelCoord(TTree* tree, Long64_t nentries);
67  virtual ~TParallelCoord();
68 
69  void AddVariable(Double_t* val, const char* title="");
70  void AddVariable(const char* varexp);
71  void AddSelection(const char* title);
72  void ApplySelectionToTree(); // *MENU*
73  static void BuildParallelCoord(TSelectorDraw* selector, Bool_t candle);
74  void CleanUpSelections(TParallelCoordRange* range);
75  void RemoveVariable(TParallelCoordVar* var);
76  Bool_t RemoveVariable(const char* var);
77  void DeleteSelection(TParallelCoordSelect* sel);
78  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
79  virtual void Draw(Option_t* options="");
80  virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py);
81  Bool_t GetCandleChart() {return TestBit(kCandleChart);}
82  Long64_t GetCurrentFirst() {return fCurrentFirst;}
83  Long64_t GetCurrentN() {return fCurrentN;}
84  TParallelCoordSelect* GetCurrentSelection();
85  Bool_t GetCurveDisplay() const {return TestBit(kCurveDisplay);}
86  Int_t GetDotsSpacing() const {return fDotsSpacing;}
87  TEntryList *GetEntryList(Bool_t sel=kTRUE);
88  Double_t GetGlobalMin();
89  Double_t GetGlobalMax();
90  Bool_t GetGlobalScale() {return TestBit(kGlobalScale);}
91  Bool_t GetGlobalLogScale() {return TestBit(kGlobalLogScale);}
92  Color_t GetLineColor() {return fLineColor;}
93  Width_t GetLineWidth() {return fLineWidth;}
94  Int_t GetNbins();
95  UInt_t GetNvar() {return fNvar;}
96  Long64_t GetNentries() {return fNentries;}
97  TList *GetSelectList() {return fSelectList;}
98  TParallelCoordSelect* GetSelection(const char* title);
99  TTree *GetTree();
100  Double_t *GetVariable(const char* var);
101  Double_t *GetVariable(Int_t i);
102  TList *GetVarList() {return fVarList;}
103  Bool_t GetVertDisplay() const {return TestBit(kVertDisplay);}
104  Int_t GetWeightCut() const {return fWeightCut;};
105  virtual void Paint(Option_t* options="");
106  void ResetTree();
107  void SaveEntryLists(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
108  void SavePrimitive(std::ostream & out,Option_t *options);
109  void SaveTree(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
110  void SetAxisHistogramBinning(Int_t n=100); // *MENU*
111  void SetAxisHistogramHeight(Double_t h=0.5); // *MENU*
112  void SetAxisHistogramLineWidth(Int_t lw=2); // *MENU*
113  void SetCandleChart(Bool_t can); // *TOGGLE* *GETTER=GetCandleChart
114  virtual void SetCurveDisplay(Bool_t curve=1) {SetBit(kCurveDisplay,curve);} // *TOGGLE* *GETTER=GetCurveDisplay
115  void SetCurrentEntries(TEntryList* entries) {fCurrentEntries = entries;}
116  void SetCurrentFirst(Long64_t);
117  void SetCurrentN(Long64_t);
118  TParallelCoordSelect* SetCurrentSelection(const char* title);
119  void SetCurrentSelection(TParallelCoordSelect* sel);
120  void SetDotsSpacing(Int_t s=0); // *MENU*
121  static void SetEntryList(TParallelCoord* para, TEntryList* enlist);
122  void SetGlobalScale(Bool_t gl); // *TOGGLE* *GETTER=GetGlobalScale
123  void SetGlobalLogScale(Bool_t); // *TOGGLE* *GETTER=GetGlobalLogScale
124  void SetGlobalMin(Double_t min);
125  void SetGlobalMax(Double_t max);
126  void SetInitEntries(TEntryList* entries) {fInitEntries = entries;}
127  void SetLineColor(Color_t col) {fLineColor = col;}
128  void SetLineWidth(Width_t wid) {fLineWidth = wid;}
129  void SetLiveRangesUpdate(Bool_t);
130  void SetNentries(Long64_t n) {fNentries = n;}
131  void SetTree(TTree* tree) {fTree = tree;}
132  void SetVertDisplay(Bool_t vert=kTRUE); // *TOGGLE* *GETTER=GetVertDisplay
133  void SetWeightCut(Int_t w=0) {fWeightCut = w;} // *MENU*
134  void UnzoomAll(); // *MENU*
135 
136  ClassDef(TParallelCoord,1); // To display parallel coordinates plots.
137 };
138 
139 #endif