Logo ROOT  
Reference Guide
TParallelCoordVar.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_TParallelCoordVar
13 #define ROOT_TParallelCoordVar
14 
15 #include "TNamed.h"
16 #include "TAttLine.h"
17 #include "TAttFill.h"
18 
19 class TParallelCoord;
22 class TH1F;
23 
24 class TParallelCoordVar : public TNamed, public TAttLine, public TAttFill {
25 public:
26  enum EStatusBits {
27  kLogScale = BIT(14),
28  kShowBox = BIT(15),
30  };
31 private:
32  Int_t fNbins; // Number of bins in fHistogram.
33  Int_t fHistoLW; // Line width used to draw the histogram line.
34  Int_t fId; // Id identifying the variable for the editor.
35  Long64_t fNentries; // Number of stored entries values.
36  Double_t fX1; // x1 coordinate of the axis.
37  Double_t fX2; // x2 coordinate of the axis.
38  Double_t fY1; // y1 coordinate of the axis.
39  Double_t fY2; // y2 coordinate of the axis.
40  Double_t fMinInit; // Memory of the minimum when first initialized.
41  Double_t fMaxInit; // Memory of the maximum when first initialized.
42  Double_t fMean; // Average.
43  Double_t fMinCurrent; // Current used minimum.
44  Double_t fMaxCurrent; // Current used maximum.
45  Double_t fMed; // Median value (Q2).
46  Double_t fQua1; // First quantile (Q1).
47  Double_t fQua3; // Third quantile (Q3).
48  Double_t fHistoHeight; // Histogram Height.
49  Double_t *fVal; //![fNentries] Entries values for the variable.
50  TList *fRanges; // List of the TParallelRange owned by TParallelCoordVar.
51  TParallelCoord *fParallel; // Pointer to the TParallelCoord which owns the TParallelCoordVar.
52  TH1F *fHistogram; //! Histogram holding the variable distribution.
53 
54 public:
56  TParallelCoordVar(Double_t *val, const char* title,Int_t id, TParallelCoord* gram);
57  virtual ~TParallelCoordVar();
58 
59  void AddRange(TParallelCoordRange* range);
60  void AddRange() {AddRange(NULL);} // *MENU*
61  void DeleteVariable(); // *MENU*
62  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
63  virtual void Draw(Option_t *option="");
64  Bool_t Eval(Long64_t evtidx, TParallelCoordSelect *select); // Check an entry is within its ranges owned by a given TParallelSelect.
65  virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py);
68  TH1F *GetHistogram();
69  Int_t GetId() {return fId;}
70  Bool_t GetLogScale() const {return TestBit (kLogScale);}
71  Int_t GetHistBinning() const {return fNbins;}
74  Double_t GetCurrentAverage() const {return fMean;}
75  void GetEntryXY(Long64_t n, Double_t & x, Double_t & y);
79  void GetMinMaxMean();
80  void GetQuantiles();
81  Double_t GetX() {return fX1;}
82  Double_t GetY() {return fY1;}
83  Int_t GetNbins() {return fNbins;}
84  Long64_t GetNentries() const {return fNentries;}
85  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
87  TList *GetRanges() {return fRanges;}
88  Double_t *GetValues() {return fVal;}
90  Bool_t GetVert() {return fX1 == fX2;} // Tells if the axis is vertical or not.
91  void GetXYfromValue(Double_t value, Double_t & x, Double_t & y);
92  void Init();
93  virtual void Paint(Option_t* option="");
94  void PaintBoxPlot();
95  void PaintHistogram();
96  void PaintLabels();
97  virtual void Print(Option_t* option="") const; // *MENU*
98  void SavePrimitive(std::ostream & out, Option_t *options);
99  void SetBoxPlot(Bool_t box); // *TOGGLE* *GETTER=GetBoxPlot
100  void SetBarHisto(Bool_t h) {SetBit(kShowBarHisto,h);} // *TOGGLE* *GETTER=GetBarHisto
101  void SetHistogramLineWidth(Int_t lw=2) {fHistoLW = lw;} // *MENU*
102  void SetHistogramHeight(Double_t h=0); // *MENU*
103  void SetHistogramBinning(Int_t n=100); // *MENU*
104  void SetCurrentLimits(Double_t min, Double_t max); // *MENU*
105  void SetCurrentMin(Double_t min);
106  void SetCurrentMax(Double_t max);
107  void SetInitMin(Double_t min) {fMinInit = min;}
108  void SetInitMax(Double_t max) {fMaxInit = max;}
109  void SetLiveRangesUpdate(Bool_t on);
110  void SetLogScale(Bool_t log); // *TOGGLE* *GETTER=GetLogScale
111  void SetTitle(const char* /*title*/) {} // To hide TNamed::SetTitle.
112  void SetValues(Long64_t length, Double_t* val);
113  void SetX(Double_t x, Bool_t gl); // Set a new x position in case of a vertical display.
114  void SetY(Double_t y, Bool_t gl); // Set a new y position in case of a horizontal display.
115  void Unzoom() {SetCurrentLimits(fMinInit,fMaxInit);} // *MENU* Reset fMin and fMax to their original value.
116 
117  ClassDef(TParallelCoordVar,1); // A Variable of a parallel coordinates plot.
118 };
119 
120 #endif
TParallelCoordVar::GetHistBinning
Int_t GetHistBinning() const
Definition: TParallelCoordVar.h:71
TParallelCoordVar::fRanges
TList * fRanges
[fNentries] Entries values for the variable.
Definition: TParallelCoordVar.h:50
TParallelCoordVar
Definition: TParallelCoordVar.h:24
n
const Int_t n
Definition: legend1.C:16
TParallelCoordVar::SetCurrentMax
void SetCurrentMax(Double_t max)
Set the current maximum of the axis.
Definition: TParallelCoordVar.cxx:912
TParallelCoordVar::fQua3
Double_t fQua3
Definition: TParallelCoordVar.h:47
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TParallelCoordVar::Eval
Bool_t Eval(Long64_t evtidx, TParallelCoordSelect *select)
Check if the entry is within the range(s) of "select".
Definition: TParallelCoordVar.cxx:160
TParallelCoordVar::fHistogram
TH1F * fHistogram
Definition: TParallelCoordVar.h:52
TParallelCoordVar::GetEntryXY
void GetEntryXY(Long64_t n, Double_t &x, Double_t &y)
Get the position of the variable on the graph for the n'th entry.
Definition: TParallelCoordVar.cxx:317
TParallelCoordVar::fMinCurrent
Double_t fMinCurrent
Definition: TParallelCoordVar.h:43
TParallelCoordVar::TParallelCoordVar
TParallelCoordVar()
Histogram holding the variable distribution.
Definition: TParallelCoordVar.cxx:54
TParallelCoordVar::GetCurrentMin
Double_t GetCurrentMin() const
Definition: TParallelCoordVar.h:72
TParallelCoordVar::SetX
void SetX(Double_t x, Bool_t gl)
Set the X position of the axis in the case of a vertical axis.
Definition: TParallelCoordVar.cxx:992
TNamed.h
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TParallelCoordVar::GetBoxPlot
Bool_t GetBoxPlot()
Definition: TParallelCoordVar.h:67
TParallelCoordVar::SetBoxPlot
void SetBoxPlot(Bool_t box)
Set the axis to display a candle.
Definition: TParallelCoordVar.cxx:869
TParallelCoordVar::SetLogScale
void SetLogScale(Bool_t log)
Set the axis in log scale.
Definition: TParallelCoordVar.cxx:955
TParallelCoordVar::fMaxInit
Double_t fMaxInit
Definition: TParallelCoordVar.h:41
TParallelCoordVar::GetValues
Double_t * GetValues()
Definition: TParallelCoordVar.h:88
log
double log(double)
TParallelCoordVar::DeleteVariable
void DeleteVariable()
Delete variables.
Definition: TParallelCoordVar.cxx:122
TParallelCoord
Definition: TParallelCoord.h:28
TParallelCoordVar::kShowBox
@ kShowBox
Definition: TParallelCoordVar.h:28
Int_t
int Int_t
Definition: RtypesCore.h:45
box
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
TParallelCoordVar::fId
Int_t fId
Definition: TParallelCoordVar.h:34
x
Double_t x[n]
Definition: legend1.C:17
TParallelCoordVar::SetValues
void SetValues(Long64_t length, Double_t *val)
Set the variable values.
Definition: TParallelCoordVar.cxx:977
TParallelCoordVar::SetInitMin
void SetInitMin(Double_t min)
Definition: TParallelCoordVar.h:107
TParallelCoordVar::GetVert
Bool_t GetVert()
Definition: TParallelCoordVar.h:90
TParallelCoordVar::GetValuefromXY
Double_t GetValuefromXY(Double_t x, Double_t y)
Get the value corresponding to the position.
Definition: TParallelCoordVar.cxx:469
TParallelCoordVar::GetHistHeight
Double_t GetHistHeight()
Definition: TParallelCoordVar.h:77
TParallelCoordVar::GetXYfromValue
void GetXYfromValue(Double_t value, Double_t &x, Double_t &y)
Get a position corresponding to the value on the axis.
Definition: TParallelCoordVar.cxx:488
TParallelCoordVar::fMean
Double_t fMean
Definition: TParallelCoordVar.h:42
TParallelCoordVar::SetY
void SetY(Double_t y, Bool_t gl)
Set the Y position of the axis in the case of a horizontal axis.
Definition: TParallelCoordVar.cxx:1011
TParallelCoordVar::SetCurrentMin
void SetCurrentMin(Double_t min)
Set the current minimum of the axis.
Definition: TParallelCoordVar.cxx:904
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TParallelCoordVar::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes the distance from the axis.
Definition: TParallelCoordVar.cxx:131
TParallelCoordVar::GetHistLineWidth
Int_t GetHistLineWidth()
Definition: TParallelCoordVar.h:78
TParallelCoordVar::SetLiveRangesUpdate
void SetLiveRangesUpdate(Bool_t on)
If true, the pad is updated while the motion of a dragged range.
Definition: TParallelCoordVar.cxx:945
bool
TParallelCoordVar::fHistoHeight
Double_t fHistoHeight
Definition: TParallelCoordVar.h:48
TParallelCoordVar::GetNbins
Int_t GetNbins()
Definition: TParallelCoordVar.h:83
TParallelCoordVar::GetObjectInfo
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns info about this axis.
Definition: TParallelCoordVar.cxx:394
TParallelCoordVar::GetHistogram
TH1F * GetHistogram()
Create or recreate the histogram.
Definition: TParallelCoordVar.cxx:355
TParallelCoordVar::fMaxCurrent
Double_t fMaxCurrent
Definition: TParallelCoordVar.h:44
TParallelCoordVar::fMed
Double_t fMed
Definition: TParallelCoordVar.h:45
TParallelCoordVar::fY2
Double_t fY2
Definition: TParallelCoordVar.h:39
TAttLine.h
TParallelCoordVar::~TParallelCoordVar
virtual ~TParallelCoordVar()
Destructor.
Definition: TParallelCoordVar.cxx:63
TParallelCoordVar::PaintLabels
void PaintLabels()
Paint the axis labels and titles.
Definition: TParallelCoordVar.cxx:768
TParallelCoordVar::fX2
Double_t fX2
Definition: TParallelCoordVar.h:37
TParallelCoordVar::fParallel
TParallelCoord * fParallel
Definition: TParallelCoordVar.h:51
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TParallelCoordVar::GetCurrentMax
Double_t GetCurrentMax() const
Definition: TParallelCoordVar.h:73
TAttFill.h
TParallelCoordSelect
Definition: TParallelCoordRange.h:69
TAttLine
Definition: TAttLine.h:18
TParallelCoordVar::SetInitMax
void SetInitMax(Double_t max)
Definition: TParallelCoordVar.h:108
TParallelCoordVar::Init
void Init()
Initialise the TParallelVar variables.
Definition: TParallelCoordVar.cxx:518
TParallelCoordVar::GetEntryWeight
Int_t GetEntryWeight(Long64_t evtidx)
Get the entry weight: The weight of an entry for a given variable is the bin content of the histogram...
Definition: TParallelCoordVar.cxx:346
h
#define h(i)
Definition: RSha256.hxx:124
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
TParallelCoordVar::fMinInit
Double_t fMinInit
Definition: TParallelCoordVar.h:40
TParallelCoordVar::GetQuantiles
void GetQuantiles()
Get the box plot values (quantiles).
Definition: TParallelCoordVar.cxx:429
TParallelCoordVar::SetCurrentLimits
void SetCurrentLimits(Double_t min, Double_t max)
Set the limits within which one the entries must be painted.
Definition: TParallelCoordVar.cxx:920
TNamed
Definition: TNamed.h:29
TGeant4Unit::gram
static constexpr double gram
Definition: TGeant4SystemOfUnits.h:204
TParallelCoordVar::Paint
virtual void Paint(Option_t *option="")
Paint the axis.
Definition: TParallelCoordVar.cxx:549
TParallelCoordVar::GetBarHisto
Bool_t GetBarHisto()
Definition: TParallelCoordVar.h:66
TParallelCoordVar::Draw
virtual void Draw(Option_t *option="")
Draw the axis.
Definition: TParallelCoordVar.cxx:150
TParallelCoordVar::GetMinMaxMean
void GetMinMaxMean()
Get mean, min and max of those variable.
Definition: TParallelCoordVar.cxx:372
TParallelCoordVar::PaintHistogram
void PaintHistogram()
Paint the histogram on the axis.
Definition: TParallelCoordVar.cxx:663
TParallelCoordVar::fNentries
Long64_t fNentries
Definition: TParallelCoordVar.h:35
BIT
#define BIT(n)
Definition: Rtypes.h:85
TParallelCoordVar::fVal
Double_t * fVal
Definition: TParallelCoordVar.h:49
y
Double_t y[n]
Definition: legend1.C:17
TParallelCoordVar::GetY
Double_t GetY()
Definition: TParallelCoordVar.h:82
TParallelCoordVar::SetHistogramBinning
void SetHistogramBinning(Int_t n=100)
Set the histogram binning.
Definition: TParallelCoordVar.cxx:882
TParallelCoordVar::fHistoLW
Int_t fHistoLW
Definition: TParallelCoordVar.h:33
TParallelCoordVar::kLogScale
@ kLogScale
Definition: TParallelCoordVar.h:27
TParallelCoordVar::GetLogScale
Bool_t GetLogScale() const
Definition: TParallelCoordVar.h:70
TParallelCoordVar::AddRange
void AddRange()
Definition: TParallelCoordVar.h:60
TParallelCoordVar::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoordVar as a macro.
Definition: TParallelCoordVar.cxx:831
TParallelCoordVar::Print
virtual void Print(Option_t *option="") const
Print the axis main data.
Definition: TParallelCoordVar.cxx:819
TParallelCoordVar::SetBarHisto
void SetBarHisto(Bool_t h)
Definition: TParallelCoordVar.h:100
TParallelCoordRange
Definition: TParallelCoordRange.h:25
Double_t
double Double_t
Definition: RtypesCore.h:59
TParallelCoordVar::SetHistogramHeight
void SetHistogramHeight(Double_t h=0)
Set the height of the bar histogram.
Definition: TParallelCoordVar.cxx:892
TParallelCoordVar::SetHistogramLineWidth
void SetHistogramLineWidth(Int_t lw=2)
Definition: TParallelCoordVar.h:101
TParallelCoordVar::GetNentries
Long64_t GetNentries() const
Definition: TParallelCoordVar.h:84
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:572
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TParallelCoordVar::GetCurrentAverage
Double_t GetCurrentAverage() const
Definition: TParallelCoordVar.h:74
TParallelCoordVar::Unzoom
void Unzoom()
Definition: TParallelCoordVar.h:115
TParallelCoordVar::fX1
Double_t fX1
Definition: TParallelCoordVar.h:36
TParallelCoordVar::SetTitle
void SetTitle(const char *)
Set the title of the TNamed.
Definition: TParallelCoordVar.h:111
TParallelCoordVar::fY1
Double_t fY1
Definition: TParallelCoordVar.h:38
TParallelCoordVar::GetX
Double_t GetX()
Definition: TParallelCoordVar.h:81
TAttFill
Definition: TAttFill.h:19
TParallelCoordVar::GetId
Int_t GetId()
Definition: TParallelCoordVar.h:69
TParallelCoordVar::ExecuteEvent
virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
Execute the corresponding entry.
Definition: TParallelCoordVar.cxx:182
TParallelCoordVar::fQua1
Double_t fQua1
Definition: TParallelCoordVar.h:46
TParallelCoordVar::GetParallel
TParallelCoord * GetParallel()
Definition: TParallelCoordVar.h:86
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
TParallelCoordVar::GetRanges
TList * GetRanges()
Definition: TParallelCoordVar.h:87
TList
Definition: TList.h:44
TParallelCoordVar::PaintBoxPlot
void PaintBoxPlot()
Paint the boxes in the case of a candle chart.
Definition: TParallelCoordVar.cxx:563
TParallelCoordVar::kShowBarHisto
@ kShowBarHisto
Definition: TParallelCoordVar.h:29
int
TParallelCoordVar::fNbins
Int_t fNbins
Definition: TParallelCoordVar.h:32