Logo ROOT   6.07/09
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 #ifndef ROOT_TAttLine
16 #include "TAttLine.h"
17 #endif
18 #ifndef ROOT_TNamed
19 #include "TNamed.h"
20 #endif
21 #ifndef ROOT_TAttFill
22 #include "TAttFill.h"
23 #endif
24 
25 class TParallelCoord;
28 class TH1F;
29 
30 class TParallelCoordVar : public TNamed, public TAttLine, public TAttFill {
31 public:
32  enum {
33  kLogScale =BIT(14),
34  kShowBox =BIT(15),
36  };
37 private:
38  Int_t fNbins; // Number of bins in fHistogram.
39  Int_t fHistoLW; // Line width used to draw the histogram line.
40  Int_t fId; // Id identifying the variable for the editor.
41  Long64_t fNentries; // Number of stored entries values.
42  Double_t fX1; // x1 coordinate of the axis.
43  Double_t fX2; // x2 coordinate of the axis.
44  Double_t fY1; // y1 coordinate of the axis.
45  Double_t fY2; // y2 coordinate of the axis.
46  Double_t fMinInit; // Memory of the minimum when first initialized.
47  Double_t fMaxInit; // Memory of the maximum when first initialized.
48  Double_t fMean; // Average.
49  Double_t fMinCurrent; // Current used minimum.
50  Double_t fMaxCurrent; // Current used maximum.
51  Double_t fMed; // Median value (Q2).
52  Double_t fQua1; // First quantile (Q1).
53  Double_t fQua3; // Third quantile (Q3).
54  Double_t fHistoHeight; // Histogram Height.
55  Double_t *fVal; //![fNentries] Entries values for the variable.
56  TList *fRanges; // List of the TParallelRange owned by TParallelCoordVar.
57  TParallelCoord *fParallel; // Pointer to the TParallelCoord which owns the TParallelCoordVar.
58  TH1F *fHistogram; //! Histogram holding the variable distribution.
59 
60 public:
62  TParallelCoordVar(Double_t *val, const char* title,Int_t id, TParallelCoord* gram);
64 
65  void AddRange(TParallelCoordRange* range);
66  void AddRange() {AddRange(NULL);} // *MENU*
67  void DeleteVariable(); // *MENU*
68  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
69  virtual void Draw(Option_t *option="");
70  Bool_t Eval(Long64_t evtidx, TParallelCoordSelect *select); // Check an entry is within its ranges owned by a given TParallelSelect.
71  virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py);
74  TH1F *GetHistogram();
75  Int_t GetId() {return fId;}
76  Bool_t GetLogScale() const {return TestBit (kLogScale);}
77  Int_t GetHistBinning() const {return fNbins;}
80  Double_t GetCurrentAverage() const {return fMean;}
81  void GetEntryXY(Long64_t n, Double_t & x, Double_t & y);
85  void GetMinMaxMean();
86  void GetQuantiles();
87  Double_t GetX() {return fX1;}
88  Double_t GetY() {return fY1;}
89  Int_t GetNbins() {return fNbins;}
90  Long64_t GetNentries() const {return fNentries;}
91  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
93  TList *GetRanges() {return fRanges;}
94  Double_t *GetValues() {return fVal;}
96  Bool_t GetVert() {return fX1 == fX2;} // Tells if the axis is vertical or not.
97  void GetXYfromValue(Double_t value, Double_t & x, Double_t & y);
98  void Init();
99  virtual void Paint(Option_t* option="");
100  void PaintBoxPlot();
101  void PaintHistogram();
102  void PaintLabels();
103  virtual void Print(Option_t* option="") const; // *MENU*
104  void SavePrimitive(std::ostream & out, Option_t *options);
105  void SetBoxPlot(Bool_t box); // *TOGGLE* *GETTER=GetBoxPlot
106  void SetBarHisto(Bool_t h) {SetBit(kShowBarHisto,h);} // *TOGGLE* *GETTER=GetBarHisto
107  void SetHistogramLineWidth(Int_t lw=2) {fHistoLW = lw;} // *MENU*
108  void SetHistogramHeight(Double_t h=0); // *MENU*
109  void SetHistogramBinning(Int_t n=100); // *MENU*
110  void SetCurrentLimits(Double_t min, Double_t max); // *MENU*
111  void SetCurrentMin(Double_t min);
112  void SetCurrentMax(Double_t max);
113  void SetInitMin(Double_t min) {fMinInit = min;}
114  void SetInitMax(Double_t max) {fMaxInit = max;}
115  void SetLiveRangesUpdate(Bool_t on);
116  void SetLogScale(Bool_t log); // *TOGGLE* *GETTER=GetLogScale
117  void SetTitle(const char* /*title*/) {} // To hide TNamed::SetTitle.
118  void SetValues(Long64_t length, Double_t* val);
119  void SetX(Double_t x, Bool_t gl); // Set a new x position in case of a vertical display.
120  void SetY(Double_t y, Bool_t gl); // Set a new y position in case of a horizontal display.
121  void Unzoom() {SetCurrentLimits(fMinInit,fMaxInit);} // *MENU* Reset fMin and fMax to their original value.
122 
123  ClassDef(TParallelCoordVar,1); // A Variable of a parallel coordinates plot.
124 };
125 
126 #endif
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord...
virtual void ExecuteEvent(Int_t entry, Int_t px, Int_t py)
Execute the corresponding entry.
Double_t * GetValues()
long long Long64_t
Definition: RtypesCore.h:69
void SetCurrentMax(Double_t max)
Set the current maximum of the axis.
const char Option_t
Definition: RtypesCore.h:62
void SetInitMin(Double_t min)
void PaintBoxPlot()
Paint the boxes in the case of a candle chart.
Double_t GetValuefromXY(Double_t x, Double_t y)
Get the value corresponding to the position.
TH1 * h
Definition: legend2.C:5
void SetLogScale(Bool_t log)
Set the axis in log scale.
void SetCurrentMin(Double_t min)
Set the current minimum of the axis.
Long64_t GetNentries() const
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes the distance from the axis.
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
A TParallelCoordRange is a range used for parallel coordinates plots.
void SetValues(Long64_t length, Double_t *val)
Set the variable values.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TH1F * GetHistogram()
Create or recreate the histogram.
void GetXYfromValue(Double_t value, Double_t &x, Double_t &y)
Get a position corresponding to the value on the axis.
Double_t GetCurrentMin() const
void SetBoxPlot(Bool_t box)
Set the axis to display a candle.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
~TParallelCoordVar()
Destructor.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:739
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns info about this axis.
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.
TParallelCoord axes.
TParallelCoordVar()
Histogram holding the variable distribution.
void SetX(Double_t x, Bool_t gl)
Set the X position of the axis in the case of a vertical axis.
Bool_t GetLogScale() const
Fill Area Attributes class.
Definition: TAttFill.h:24
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
void SetY(Double_t y, Bool_t gl)
Set the Y position of the axis in the case of a horizontal axis.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
void SetCurrentLimits(Double_t min, Double_t max)
Set the limits within which one the entries must be painted.
void DeleteVariable()
Delete variables.
void SetLiveRangesUpdate(Bool_t on)
If true, the pad is updated while the motion of a dragged range.
void GetMinMaxMean()
Get mean, min and max of those variable.
Int_t GetHistBinning() const
void PaintHistogram()
Paint the histogram on the axis.
Double_t GetHistHeight()
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...
void PaintLabels()
Paint the axis labels and titles.
A doubly linked list.
Definition: TList.h:47
virtual void Paint(Option_t *option="")
Paint the axis.
TParallelCoord * fParallel
void SetHistogramBinning(Int_t n=100)
Set the histogram binning.
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
void SetInitMax(Double_t max)
void Init()
Initialise the TParallelVar variables.
void SetBarHisto(Bool_t h)
virtual void Print(Option_t *option="") const
Print the axis main data.
void GetQuantiles()
Get the box plot values (quantiles).
void SetHistogramHeight(Double_t h=0)
Set the height of the bar histogram.
virtual void Draw(Option_t *option="")
Draw the axis.
double Double_t
Definition: RtypesCore.h:55
void SavePrimitive(std::ostream &out, Option_t *options)
Save the TParallelCoordVar as a macro.
Double_t GetCurrentAverage() const
Double_t y[n]
Definition: legend1.C:17
Double_t GetCurrentMax() const
TParallelCoord * GetParallel()
void SetTitle(const char *)
Set the title of the TNamed.
#define BIT(n)
Definition: Rtypes.h:120
Parallel Coordinates class.
void SetHistogramLineWidth(Int_t lw=2)
TList * fRanges
[fNentries] Entries values for the variable.
#define NULL
Definition: Rtypes.h:82
const Int_t n
Definition: legend1.C:16
Line Attributes class.
Definition: TAttLine.h:24
Bool_t Eval(Long64_t evtidx, TParallelCoordSelect *select)
Check if the entry is within the range(s) of "select".
double log(double)