ROOT  6.06/09
Reference Guide
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 #ifndef ROOT_TAttLine
16 #include "TAttLine.h"
17 #endif
18 #ifndef ROOT_TNamed
19 #include "TNamed.h"
20 #endif
21 
22 class TTree;
23 class TPaveText;
24 class TEntryList;
26 class TParallelCoordVar;
28 class TList;
29 class TGaxis;
30 class TSelectorDraw;
31 
32 class TParallelCoord : public TNamed {
33 public:
34  enum {
35  kVertDisplay =BIT(14), // If the axes are drawn vertically, false if horizontally.
36  kCurveDisplay =BIT(15), // If the polylines are replaced by interpolated curves.
37  kPaintEntries =BIT(16), // To prentry the TParallelCoord to paint all the entries.
38  kLiveUpdate =BIT(17), // To paint the entries when being modified.
39  kGlobalScale =BIT(19), // Every variable is on the same scale.
40  kCandleChart =BIT(20), // To produce a candle chart.
41  kGlobalLogScale =BIT(21) // Every variable in log scale.
42  };
43 
44 private:
45  UInt_t fNvar; // Number of variables.
46  Long64_t fCurrentFirst; // First entry to display.
47  Long64_t fCurrentN; // Number of entries to display.
48  Long64_t fNentries; // Number of entries;
49  Int_t fDotsSpacing; // Spacing between dots to draw the entries.
50  Color_t fLineColor; // entries line color.
51  Width_t fLineWidth; // entries line width.
52  Int_t fWeightCut; // Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
53  TEntryList *fCurrentEntries; //-> Current selected entries in the tree.
54  TEntryList *fInitEntries; //-> Selected entries when TParallelCoord first initialized.
55  TTree *fTree; //! Pointer to the TTree.
56  TString fTreeName; // Name of the tree.
57  TString fTreeFileName; // Name of the file containing the tree.
58  TList *fVarList; // List of the variables.
59  TList *fSelectList; // List of selections over the variables.
60  TParallelCoordSelect* fCurrentSelection; //! Current Selection being edited.
61  TGaxis *fCandleAxis; //! An axis used when displaying a candle chart.
62 
63  void Init();
65  void SetAxesPosition();
66 
67 public:
72 
73  void AddVariable(Double_t* val, const char* title="");
74  void AddVariable(const char* varexp);
75  void AddSelection(const char* title);
76  void ApplySelectionToTree(); // *MENU*
77  static void BuildParallelCoord(TSelectorDraw* selector, Bool_t candle);
80  TParallelCoordVar* RemoveVariable(const char* var);
82  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
83  virtual void Draw(Option_t* options="");
84  virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py);
90  Int_t GetDotsSpacing() const {return fDotsSpacing;}
98  Int_t GetNbins();
99  UInt_t GetNvar() {return fNvar;}
102  TParallelCoordSelect* GetSelection(const char* title);
103  TTree *GetTree();
104  Double_t *GetVariable(const char* var);
106  TList *GetVarList() {return fVarList;}
108  Int_t GetWeightCut() const {return fWeightCut;};
109  virtual void Paint(Option_t* options="");
110  void ResetTree();
111  void SaveEntryLists(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
112  void SavePrimitive(std::ostream & out,Option_t *options);
113  void SaveTree(const char* filename="", Bool_t overwrite=kFALSE); // *MENU*
114  void SetAxisHistogramBinning(Int_t n=100); // *MENU*
115  void SetAxisHistogramHeight(Double_t h=0.5); // *MENU*
116  void SetAxisHistogramLineWidth(Int_t lw=2); // *MENU*
117  void SetCandleChart(Bool_t can); // *TOGGLE* *GETTER=GetCandleChart
118  virtual void SetCurveDisplay(Bool_t curve=1) {SetBit(kCurveDisplay,curve);} // *TOGGLE* *GETTER=GetCurveDisplay
119  void SetCurrentEntries(TEntryList* entries) {fCurrentEntries = entries;}
121  void SetCurrentN(Long64_t);
122  TParallelCoordSelect* SetCurrentSelection(const char* title);
124  void SetDotsSpacing(Int_t s=0); // *MENU*
125  static void SetEntryList(TParallelCoord* para, TEntryList* enlist);
126  void SetGlobalScale(Bool_t gl); // *TOGGLE* *GETTER=GetGlobalScale
127  void SetGlobalLogScale(Bool_t); // *TOGGLE* *GETTER=GetGlobalLogScale
128  void SetGlobalMin(Double_t min);
129  void SetGlobalMax(Double_t max);
130  void SetInitEntries(TEntryList* entries) {fInitEntries = entries;}
131  void SetLineColor(Color_t col) {fLineColor = col;}
132  void SetLineWidth(Width_t wid) {fLineWidth = wid;}
134  void SetNentries(Long64_t n) {fNentries = n;}
135  void SetTree(TTree* tree) {fTree = tree;}
136  void SetVertDisplay(Bool_t vert=kTRUE); // *TOGGLE* *GETTER=GetVertDisplay
137  void SetWeightCut(Int_t w=0) {fWeightCut = w;} // *MENU*
138  void UnzoomAll(); // *MENU*
139 
140  ClassDef(TParallelCoord,1); // To display parallel coordinates plots.
141 };
142 
143 #endif
TEntryList * fInitEntries
void Init()
An axis used when displaying a candle chart.
Long64_t fNentries
void PaintEntries(TParallelCoordSelect *sel=NULL)
Loop over the entries and paint them.
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord...
void CleanUpSelections(TParallelCoordRange *range)
Clean up the selections from the ranges which could have been deleted when a variable has been delete...
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
void SetLineColor(Color_t col)
TString fTreeFileName
long long Long64_t
Definition: RtypesCore.h:69
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
static void BuildParallelCoord(TSelectorDraw *selector, Bool_t candle)
Call constructor and add the variables.
TParallelCoordSelect * GetSelection(const char *title)
Get a selection from its title.
Bool_t GetGlobalScale()
const char Option_t
Definition: RtypesCore.h:62
Long64_t fCurrentFirst
void SetAxisHistogramHeight(Double_t h=0.5)
Set the same histogram axis height for all axis.
#define BIT(n)
Definition: Rtypes.h:120
TH1 * h
Definition: legend2.C:5
void SetLineWidth(Width_t wid)
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
virtual void Draw(Option_t *options="")
Draw the parallel coordinates graph.
static const char * filename()
void SetLiveRangesUpdate(Bool_t)
If true, the pad is updated while the motion of a dragged range.
void SetWeightCut(Int_t w=0)
Basic string class.
Definition: TString.h:137
A TParallelCoordRange is a range used for parallel coordinates plots.
int Int_t
Definition: RtypesCore.h:41
void ResetTree()
Reset the tree entry list to the initial one..
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
void SetVertDisplay(Bool_t vert=kTRUE)
Set the vertical or horizontal display.
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
Color_t fLineColor
Double_t GetGlobalMin()
return the global minimum.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
TParallelCoordSelect * fCurrentSelection
TParallelCoord axes.
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
TEntryList * fCurrentEntries
Color_t GetLineColor()
TList * GetVarList()
Int_t GetNbins()
get the binning of the histograms.
void ApplySelectionToTree()
Apply the current selection to the tree.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
void SetInitEntries(TEntryList *entries)
void SetCurrentEntries(TEntryList *entries)
Long64_t GetCurrentN()
virtual void Paint(Option_t *options="")
Paint the parallel coordinates graph.
void SaveTree(const char *filename="", Bool_t overwrite=kFALSE)
Save the tree in a file if fTreeFileName == "".
char * out
Definition: TBase64.cxx:29
short Color_t
Definition: RtypesCore.h:79
void SetGlobalMax(Double_t max)
Force all variables to adopt the same max.
Bool_t GetVertDisplay() const
A doubly linked list.
Definition: TList.h:47
Long64_t fCurrentN
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
Long64_t GetCurrentFirst()
static void SetEntryList(TParallelCoord *para, TEntryList *enlist)
Set the entry lists of "para".
Double_t GetGlobalMax()
return the global maximum.
void SetCandleChart(Bool_t can)
Set a candle chart display.
void AddSelection(const char *title)
Add a selection.
Int_t GetWeightCut() const
void SetGlobalScale(Bool_t gl)
Constraint all axes to the same scale.
TString fTreeName
Pointer to the TTree.
virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
Execute the corresponding entry.
TList * GetSelectList()
void SetGlobalLogScale(Bool_t)
All axes in log scale.
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
TGaxis * fCandleAxis
Current Selection being edited.
TTree * GetTree()
return the tree if fTree is defined.
void SetGlobalMin(Double_t min)
Force all variables to adopt the same min.
The axis painter class.
Definition: TGaxis.h:39
~TParallelCoord()
Destructor.
void AddVariable(Double_t *val, const char *title="")
Add a variable.
Width_t GetLineWidth()
Long64_t entry
Long64_t GetNentries()
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
short Width_t
Definition: RtypesCore.h:78
void UnzoomAll()
Unzoom all variables.
Width_t fLineWidth
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:35
ClassDef(TParallelCoord, 1)
Bool_t GetCurveDisplay() const
double Double_t
Definition: RtypesCore.h:55
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
void SetTree(TTree *tree)
int nentries
Definition: THbookFile.cxx:89
virtual void SetCurveDisplay(Bool_t curve=1)
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
Bool_t GetCandleChart()
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
Bool_t GetGlobalLogScale()
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoord in a macro.
Parallel Coordinates class.
void SetAxesPosition()
Update the position of the axes.
UInt_t GetNvar()
Double_t * GetVariable(const char *var)
Get the variables values from its title.
#define NULL
Definition: Rtypes.h:82
TList * fSelectList
Int_t GetDotsSpacing() const
A TTree object has a header with a name and a title.
Definition: TTree.h:94
void SetNentries(Long64_t n)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the TParallelCoord.
const Bool_t kTRUE
Definition: Rtypes.h:91
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:27
TEntryList * GetEntryList(Bool_t sel=kTRUE)
Get the whole entry list or one for a selection.
const Int_t n
Definition: legend1.C:16
void SaveEntryLists(const char *filename="", Bool_t overwrite=kFALSE)
Save the entry lists in a root file "filename.root".