Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
18class TTree;
19class TPaveText;
20class TEntryList;
24class TList;
25class TGaxis;
26class TSelectorDraw;
27
28class TParallelCoord : public TNamed {
29public:
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 paint all TParallelCoord 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
40private:
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();
61 void SetAxesPosition();
62
63public:
67 ~TParallelCoord() override;
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 candle);
76 bool RemoveVariable(const char* var);
78 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
79 void Draw(Option_t* options="") override;
80 void ExecuteEvent(Int_t entry, Int_t px, Int_t py) override;
85 bool GetCurveDisplay() const {return TestBit(kCurveDisplay);}
87 TEntryList *GetEntryList(bool sel=true);
95 UInt_t GetNvar() {return fNvar;}
98 TParallelCoordSelect* GetSelection(const char* title);
99 TTree *GetTree();
100 Double_t *GetVariable(const char* var);
103 bool GetVertDisplay() const {return TestBit(kVertDisplay);}
104 Int_t GetWeightCut() const {return fWeightCut;};
105 void Paint(Option_t* options="") override;
106 void ResetTree();
107 void SaveEntryLists(const char* filename="", bool overwrite=false); // *MENU*
108 void SavePrimitive(std::ostream & out,Option_t *options) override;
109 void SaveTree(const char* filename="", bool overwrite=false); // *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 can); // *TOGGLE* *GETTER=GetCandleChart
114 virtual void SetCurveDisplay(bool curve=true) {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 gl); // *TOGGLE* *GETTER=GetGlobalScale
123 void SetGlobalLogScale(bool); // *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;}
129 void SetLiveRangesUpdate(bool);
131 void SetTree(TTree* tree) {fTree = tree;}
132 void SetVertDisplay(bool vert=true); // *TOGGLE* *GETTER=GetVertDisplay
133 void SetWeightCut(Int_t w=0) {fWeightCut = w;} // *MENU*
134 void UnzoomAll(); // *MENU*
135
136 ClassDefOverride(TParallelCoord,1); // To display parallel coordinates plots.
137};
138
139#endif
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:85
short Width_t
Definition RtypesCore.h:84
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:69
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
int nentries
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
The axis painter class.
Definition TGaxis.h:24
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:786
A TParallelCoordRange is a range used for parallel coordinates plots.
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord.
TParallelCoord axes.
Parallel Coordinates class.
void AddSelection(const char *title)
Add a selection.
Int_t GetWeightCut() const
void SetCurrentEntries(TEntryList *entries)
void ExecuteEvent(Int_t entry, Int_t px, Int_t py) override
Execute the corresponding entry.
bool GetVertDisplay() const
void SetTree(TTree *tree)
void SetGlobalScale(bool gl)
Constraint all axes to the same scale.
void UnzoomAll()
Unzoom all variables.
TEntryList * fInitEntries
-> Selected entries when TParallelCoord first initialized.
TList * GetSelectList()
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
bool GetGlobalLogScale()
void SetLineColor(Color_t col)
void SetLineWidth(Width_t wid)
TTree * GetTree()
return the tree if fTree is defined.
TEntryList * fCurrentEntries
-> Current selected entries in the tree.
~TParallelCoord() override
Destructor.
TParallelCoordSelect * fCurrentSelection
! Current Selection being edited.
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
static void BuildParallelCoord(TSelectorDraw *selector, bool candle)
Call constructor and add the variables.
Double_t GetGlobalMin()
return the global minimum.
void Init()
Initialise the data members of TParallelCoord.
void SetLiveRangesUpdate(bool)
If true, the pad is updated while the motion of a dragged range.
void PaintEntries(TParallelCoordSelect *sel=nullptr)
Loop over the entries and paint them.
Int_t fDotsSpacing
Spacing between dots to draw the entries.
Int_t GetDotsSpacing() const
Int_t fWeightCut
Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
void SetAxisHistogramHeight(Double_t h=0.5)
Set the same histogram axis height for all axis.
TParallelCoordSelect * GetSelection(const char *title)
Get a selection from its title.
void SetNentries(Long64_t n)
TList * fSelectList
List of selections over the variables.
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute the distance from the TParallelCoord.
void SaveEntryLists(const char *filename="", bool overwrite=false)
Save the entry lists in a root file "filename.root".
Int_t GetNbins()
get the binning of the histograms.
TString fTreeName
Name of the tree.
Long64_t GetNentries()
void SaveTree(const char *filename="", bool overwrite=false)
Save the tree in a file if fTreeFileName == "".
void ResetTree()
Reset the tree entry list to the initial one..
void SetCandleChart(bool can)
Set a candle chart display.
void Paint(Option_t *options="") override
Paint the parallel coordinates graph.
void SetVertDisplay(bool vert=true)
Set the vertical or horizontal display.
TParallelCoord()
Default constructor.
TTree * fTree
! Pointer to the TTree.
Long64_t GetCurrentFirst()
Width_t fLineWidth
entries line width.
TString fTreeFileName
Name of the file containing the tree.
Long64_t GetCurrentN()
void AddVariable(Double_t *val, const char *title="")
Add a variable.
TList * GetVarList()
Long64_t fCurrentFirst
First entry to display.
Color_t GetLineColor()
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
Double_t GetGlobalMax()
return the global maximum.
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
void SetGlobalMax(Double_t max)
Force all variables to adopt the same max.
void SetGlobalMin(Double_t min)
Force all variables to adopt the same min.
Long64_t fCurrentN
Number of entries to display.
Long64_t fNentries
Number of entries;.
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
void ApplySelectionToTree()
Apply the current selection to the tree.
void SetAxesPosition()
Update the position of the axes.
UInt_t fNvar
Number of variables.
Color_t fLineColor
entries line color.
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
void SavePrimitive(std::ostream &out, Option_t *options) override
Save the TParallelCoord in a macro.
void CleanUpSelections(TParallelCoordRange *range)
Clean up the selections from the ranges which could have been deleted when a variable has been delete...
void SetInitEntries(TEntryList *entries)
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
virtual void SetCurveDisplay(bool curve=true)
static void SetEntryList(TParallelCoord *para, TEntryList *enlist)
Set the entry lists of "para".
@ kCurveDisplay
If the polylines are replaced by interpolated curves.
@ kGlobalScale
Every variable is on the same scale.
@ kVertDisplay
If the axes are drawn vertically, false if horizontally.
@ kGlobalLogScale
Every variable in log scale.
@ kPaintEntries
To paint all TParallelCoord entries.
@ kLiveUpdate
To paint the entries when being modified.
@ kCandleChart
To produce a candle chart.
void SetGlobalLogScale(bool)
All axes in log scale.
TEntryList * GetEntryList(bool sel=true)
Get the whole entry list or one for a selection.
Double_t * GetVariable(const char *var)
Get the variables values from its title.
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
void SetWeightCut(Int_t w=0)
TGaxis * fCandleAxis
! An axis used when displaying a candle chart.
TList * fVarList
List of the variables.
bool GetCurveDisplay() const
Width_t GetLineWidth()
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
A specialized TSelector for TTree::Draw.
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79
const Int_t n
Definition legend1.C:16
th1 Draw()