Logo ROOT  
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 #include "TAttLine.h"
16 #include "TNamed.h"
17 
18 class TTree;
19 class TPaveText;
20 class TEntryList;
22 class TParallelCoordVar;
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:
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);
76  Bool_t RemoveVariable(const char* var);
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);
86  Int_t GetDotsSpacing() const {return fDotsSpacing;}
94  Int_t GetNbins();
95  UInt_t GetNvar() {return fNvar;}
98  TParallelCoordSelect* GetSelection(const char* title);
99  TTree *GetTree();
100  Double_t *GetVariable(const char* var);
102  TList *GetVarList() {return fVarList;}
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;}
117  void SetCurrentN(Long64_t);
118  TParallelCoordSelect* SetCurrentSelection(const char* title);
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;}
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
TParallelCoord::fCurrentFirst
Long64_t fCurrentFirst
Definition: TParallelCoord.h:42
TParallelCoordVar
Definition: TParallelCoordVar.h:24
n
const Int_t n
Definition: legend1.C:16
TParallelCoord::kVertDisplay
@ kVertDisplay
Definition: TParallelCoord.h:31
TParallelCoord::GetGlobalScale
Bool_t GetGlobalScale()
Definition: TParallelCoord.h:90
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TParallelCoord::Draw
virtual void Draw(Option_t *options="")
Draw the parallel coordinates graph.
Definition: TParallelCoord.cxx:359
TParallelCoord::fLineColor
Color_t fLineColor
Definition: TParallelCoord.h:46
TParallelCoord::fInitEntries
TEntryList * fInitEntries
Definition: TParallelCoord.h:50
TParallelCoord::Init
void Init()
An axis used when displaying a candle chart.
Definition: TParallelCoord.cxx:585
tree
Definition: tree.py:1
TParallelCoord::SetCurrentFirst
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
Definition: TParallelCoord.cxx:1057
TNamed.h
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TParallelCoord::GetVarList
TList * GetVarList()
Definition: TParallelCoord.h:102
TParallelCoord::SetGlobalScale
void SetGlobalScale(Bool_t gl)
Constraint all axes to the same scale.
Definition: TParallelCoord.cxx:984
TTree
Definition: TTree.h:79
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
TParallelCoord::ApplySelectionToTree
void ApplySelectionToTree()
Apply the current selection to the tree.
Definition: TParallelCoord.cxx:252
TParallelCoord
Definition: TParallelCoord.h:28
Int_t
int Int_t
Definition: RtypesCore.h:45
TParallelCoord::SaveTree
void SaveTree(const char *filename="", Bool_t overwrite=kFALSE)
Save the tree in a file if fTreeFileName == "".
Definition: TParallelCoord.cxx:883
TParallelCoord::GetDotsSpacing
Int_t GetDotsSpacing() const
Definition: TParallelCoord.h:86
TParallelCoord::fCurrentSelection
TParallelCoordSelect * fCurrentSelection
Definition: TParallelCoord.h:56
TParallelCoord::SetNentries
void SetNentries(Long64_t n)
Definition: TParallelCoord.h:130
TParallelCoord::GetSelection
TParallelCoordSelect * GetSelection(const char *title)
Get a selection from its title.
Definition: TParallelCoord.cxx:510
nentries
int nentries
Definition: THbookFile.cxx:91
TParallelCoord::kGlobalScale
@ kGlobalScale
Definition: TParallelCoord.h:35
TParallelCoord::GetLineWidth
Width_t GetLineWidth()
Definition: TParallelCoord.h:93
TParallelCoord::GetEntryList
TEntryList * GetEntryList(Bool_t sel=kTRUE)
Get the whole entry list or one for a selection.
Definition: TParallelCoord.cxx:450
TParallelCoord::SetEntryList
static void SetEntryList(TParallelCoord *para, TEntryList *enlist)
Set the entry lists of "para".
Definition: TParallelCoord.cxx:1125
TParallelCoord::SetGlobalMax
void SetGlobalMax(Double_t max)
Force all variables to adopt the same max.
Definition: TParallelCoord.cxx:1134
TString
Definition: TString.h:136
TParallelCoord::SetGlobalLogScale
void SetGlobalLogScale(Bool_t)
All axes in log scale.
Definition: TParallelCoord.cxx:971
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TParallelCoord::fLineWidth
Width_t fLineWidth
Definition: TParallelCoord.h:47
TParallelCoord::fCandleAxis
TGaxis * fCandleAxis
Current Selection being edited.
Definition: TParallelCoord.h:57
Color_t
short Color_t
Definition: RtypesCore.h:83
TParallelCoord::SetLiveRangesUpdate
void SetLiveRangesUpdate(Bool_t)
If true, the pad is updated while the motion of a dragged range.
Definition: TParallelCoord.cxx:1158
TParallelCoord::GetGlobalMin
Double_t GetGlobalMin()
return the global minimum.
Definition: TParallelCoord.cxx:488
TParallelCoord::SetWeightCut
void SetWeightCut(Int_t w=0)
Definition: TParallelCoord.h:133
TParallelCoord::SetInitEntries
void SetInitEntries(TEntryList *entries)
Definition: TParallelCoord.h:126
bool
TParallelCoord::Paint
virtual void Paint(Option_t *options="")
Paint the parallel coordinates graph.
Definition: TParallelCoord.cxx:616
TParallelCoord::SetLineWidth
void SetLineWidth(Width_t wid)
Definition: TParallelCoord.h:128
TParallelCoord::SetCurrentEntries
void SetCurrentEntries(TEntryList *entries)
Definition: TParallelCoord.h:115
TParallelCoord::SetAxisHistogramBinning
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
Definition: TParallelCoord.cxx:951
TParallelCoord::GetNentries
Long64_t GetNentries()
Definition: TParallelCoord.h:96
TAttLine.h
TParallelCoord::GetLineColor
Color_t GetLineColor()
Definition: TParallelCoord.h:92
TParallelCoord::GetCurrentFirst
Long64_t GetCurrentFirst()
Definition: TParallelCoord.h:82
TParallelCoord::GetCurrentSelection
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
Definition: TParallelCoord.cxx:438
TParallelCoord::GetCurrentN
Long64_t GetCurrentN()
Definition: TParallelCoord.h:83
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TParallelCoord::GetNvar
UInt_t GetNvar()
Definition: TParallelCoord.h:95
TParallelCoordSelect
Definition: TParallelCoordRange.h:69
TParallelCoord::SetAxisHistogramHeight
void SetAxisHistogramHeight(Double_t h=0.5)
Set the same histogram axis height for all axis.
Definition: TParallelCoord.cxx:961
TParallelCoord::fDotsSpacing
Int_t fDotsSpacing
Definition: TParallelCoord.h:45
TParallelCoord::fCurrentEntries
TEntryList * fCurrentEntries
Definition: TParallelCoord.h:49
TParallelCoord::GetWeightCut
Int_t GetWeightCut() const
Definition: TParallelCoord.h:104
TParallelCoord::SetCurrentN
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
Definition: TParallelCoord.cxx:1074
TParallelCoord::ExecuteEvent
virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
Execute the corresponding entry.
Definition: TParallelCoord.cxx:429
h
#define h(i)
Definition: RSha256.hxx:124
TParallelCoord::GetVertDisplay
Bool_t GetVertDisplay() const
Definition: TParallelCoord.h:103
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TParallelCoord::GetCandleChart
Bool_t GetCandleChart()
Definition: TParallelCoord.h:81
TParallelCoord::DeleteSelection
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
Definition: TParallelCoord.cxx:325
TParallelCoord::GetCurveDisplay
Bool_t GetCurveDisplay() const
Definition: TParallelCoord.h:85
TNamed
Definition: TNamed.h:29
TParallelCoord::SetCandleChart
void SetCandleChart(Bool_t can)
Set a candle chart display.
Definition: TParallelCoord.cxx:1027
TParallelCoord::fCurrentN
Long64_t fCurrentN
Definition: TParallelCoord.h:43
Width_t
short Width_t
Definition: RtypesCore.h:82
TParallelCoord::GetSelectList
TList * GetSelectList()
Definition: TParallelCoord.h:97
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TParallelCoord::fNvar
UInt_t fNvar
Definition: TParallelCoord.h:41
TParallelCoord::RemoveVariable
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
Definition: TParallelCoord.cxx:729
TParallelCoord::SetCurveDisplay
virtual void SetCurveDisplay(Bool_t curve=1)
Definition: TParallelCoord.h:114
TParallelCoord::SetGlobalMin
void SetGlobalMin(Double_t min)
Force all variables to adopt the same min.
Definition: TParallelCoord.cxx:1146
BIT
#define BIT(n)
Definition: Rtypes.h:85
TParallelCoord::GetNbins
Int_t GetNbins()
get the binning of the histograms.
Definition: TParallelCoord.cxx:502
TParallelCoord::SetTree
void SetTree(TTree *tree)
Definition: TParallelCoord.h:131
TParallelCoord::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoord in a macro.
Definition: TParallelCoord.cxx:814
TParallelCoord::SetDotsSpacing
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
Definition: TParallelCoord.cxx:1114
TParallelCoord::SaveEntryLists
void SaveEntryLists(const char *filename="", Bool_t overwrite=kFALSE)
Save the entry lists in a root file "filename.root".
Definition: TParallelCoord.cxx:791
TParallelCoord::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from the TParallelCoord.
Definition: TParallelCoord.cxx:336
unsigned int
TEntryList
Definition: TEntryList.h:25
TParallelCoord::GetTree
TTree * GetTree()
return the tree if fTree is defined.
Definition: TParallelCoord.cxx:522
TParallelCoord::AddVariable
void AddVariable(Double_t *val, const char *title="")
Add a variable.
Definition: TParallelCoord.cxx:199
TParallelCoord::kCurveDisplay
@ kCurveDisplay
Definition: TParallelCoord.h:32
TParallelCoord::kPaintEntries
@ kPaintEntries
Definition: TParallelCoord.h:33
TParallelCoord::GetVariable
Double_t * GetVariable(const char *var)
Get the variables values from its title.
Definition: TParallelCoord.cxx:564
TParallelCoordRange
Definition: TParallelCoordRange.h:25
TParallelCoord::GetGlobalLogScale
Bool_t GetGlobalLogScale()
Definition: TParallelCoord.h:91
TParallelCoord::GetGlobalMax
Double_t GetGlobalMax()
return the global maximum.
Definition: TParallelCoord.cxx:474
Double_t
double Double_t
Definition: RtypesCore.h:59
TParallelCoord::fWeightCut
Int_t fWeightCut
Definition: TParallelCoord.h:48
TGaxis
Definition: TGaxis.h:23
TParallelCoord::UnzoomAll
void UnzoomAll()
Unzoom all variables.
Definition: TParallelCoord.cxx:1199
TParallelCoord::SetAxesPosition
void SetAxesPosition()
Update the position of the axes.
Definition: TParallelCoord.cxx:907
TParallelCoord::TParallelCoord
TParallelCoord()
Default constructor.
Definition: TParallelCoord.cxx:130
TParallelCoord::fSelectList
TList * fSelectList
Definition: TParallelCoord.h:55
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TParallelCoord::fNentries
Long64_t fNentries
Definition: TParallelCoord.h:44
TParallelCoord::fTreeFileName
TString fTreeFileName
Definition: TParallelCoord.h:53
TParallelCoord::PaintEntries
void PaintEntries(TParallelCoordSelect *sel=NULL)
Loop over the entries and paint them.
Definition: TParallelCoord.cxx:645
TParallelCoord::BuildParallelCoord
static void BuildParallelCoord(TSelectorDraw *selector, Bool_t candle)
Call constructor and add the variables.
Definition: TParallelCoord.cxx:288
TParallelCoord::fTree
TTree * fTree
Definition: TParallelCoord.h:51
TPaveText
Definition: TPaveText.h:21
TParallelCoord::ResetTree
void ResetTree()
Reset the tree entry list to the initial one..
Definition: TParallelCoord.cxx:759
TParallelCoord::AddSelection
void AddSelection(const char *title)
Add a selection.
Definition: TParallelCoord.cxx:242
TParallelCoord::fVarList
TList * fVarList
Definition: TParallelCoord.h:54
TParallelCoord::fTreeName
TString fTreeName
Pointer to the TTree.
Definition: TParallelCoord.h:52
TParallelCoord::SetAxisHistogramLineWidth
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
Definition: TParallelCoord.cxx:1017
TParallelCoord::CleanUpSelections
void CleanUpSelections(TParallelCoordRange *range)
Clean up the selections from the ranges which could have been deleted when a variable has been delete...
Definition: TParallelCoord.cxx:313
TParallelCoord::SetCurrentSelection
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
Definition: TParallelCoord.cxx:1091
TParallelCoord::kCandleChart
@ kCandleChart
Definition: TParallelCoord.h:36
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
TParallelCoord::kGlobalLogScale
@ kGlobalLogScale
Definition: TParallelCoord.h:37
TList
Definition: TList.h:44
TSelectorDraw
Definition: TSelectorDraw.h:33
TParallelCoord::~TParallelCoord
virtual ~TParallelCoord()
Destructor.
Definition: TParallelCoord.cxx:181
TParallelCoord::SetVertDisplay
void SetVertDisplay(Bool_t vert=kTRUE)
Set the vertical or horizontal display.
Definition: TParallelCoord.cxx:1169
int
TParallelCoord::kLiveUpdate
@ kLiveUpdate
Definition: TParallelCoord.h:34
TParallelCoord::SetLineColor
void SetLineColor(Color_t col)
Definition: TParallelCoord.h:127