ROOT logo
// @(#)root/treeviewer:$Id: TParallelCoordVar.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Bastien Dalla Piazza  02/08/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TParallelCoordVar
#define ROOT_TParallelCoordVar

#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TAttFill
#include "TAttFill.h"
#endif

class TParallelCoord;
class TParallelCoordSelect;
class TParallelCoordRange;
class TH1F;

class TParallelCoordVar : public TNamed, public TAttLine, public TAttFill {
public:
   enum {
      kLogScale      =BIT(14),
      kShowBox       =BIT(15),
      kShowBarHisto  =BIT(16)
   };
private:
   Int_t             fNbins;        // Number of bins in fHistogram.
   Int_t             fHistoLW;      // Line width used to draw the histogram line.
   Int_t             fId;           // Id identifying the variable for the editor.
   Long64_t          fNentries;      // Number of stored entries values.
   Double_t          fX1;           // x1 coordinate of the axis.
   Double_t          fX2;           // x2 coordinate of the axis.
   Double_t          fY1;           // y1 coordinate of the axis.
   Double_t          fY2;           // y2 coordinate of the axis.
   Double_t          fMinInit;      // Memory of the minimum when first initialized.
   Double_t          fMaxInit;      // Memory of the maximum when first initialized.
   Double_t          fMean;         // Average.
   Double_t          fMinCurrent;   // Current used minimum.
   Double_t          fMaxCurrent;   // Current used maximum.
   Double_t          fMed;          // Median value (Q2).
   Double_t          fQua1;         // First quantile (Q1).
   Double_t          fQua3;         // Third quantile (Q3).
   Double_t          fHistoHeight;  // Histogram Height.
   Double_t         *fVal;          //![fNentries] Entries values for the variable.
   TList            *fRanges;       // List of the TParallelRange owned by TParallelCoordVar.
   TParallelCoord   *fParallel;     // Pointer to the TParallelCoord which owns the TParallelCoordVar.
   TH1F             *fHistogram;    //! Histogram holding the variable distribution.

public:
   TParallelCoordVar();
   TParallelCoordVar(Double_t *val, const char* title,Int_t id, TParallelCoord* gram);
   ~TParallelCoordVar();

   void           AddRange(TParallelCoordRange* range);
   void           AddRange() {AddRange(NULL);} // *MENU*
   void           DeleteVariable(); // *MENU*
   virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py);
   virtual void   Draw(Option_t *option="");
   Bool_t         Eval(Long64_t evtidx, TParallelCoordSelect *select); // Check an entry is within its ranges owned by a given TParallelSelect.
   virtual void   ExecuteEvent(Int_t entry, Int_t px, Int_t py);
   Bool_t         GetBarHisto() {return TestBit(kShowBarHisto);}
   Bool_t         GetBoxPlot() {return TestBit(kShowBox);}
   TH1F          *GetHistogram();
   Int_t          GetId() {return fId;}
   Bool_t         GetLogScale() const {return TestBit (kLogScale);}
   Int_t          GetHistBinning() const {return fNbins;}
   Double_t       GetCurrentMin() const {return fMinCurrent;}
   Double_t       GetCurrentMax() const {return fMaxCurrent;}
   Double_t       GetCurrentAverage() const {return fMean;}
   void           GetEntryXY(Long64_t n, Double_t & x, Double_t & y);
   Int_t          GetEntryWeight(Long64_t evtidx);
   Double_t       GetHistHeight() {return fHistoHeight;}
   Int_t          GetHistLineWidth() {return fHistoLW;}
   void           GetMinMaxMean();
   void           GetQuantiles();
   Double_t       GetX() {return fX1;}
   Double_t       GetY() {return fY1;}
   Int_t          GetNbins() {return fNbins;}
   Long64_t       GetNentries() const {return fNentries;}
   virtual char  *GetObjectInfo(Int_t px, Int_t py) const;
   TParallelCoord* GetParallel() {return fParallel;}
   TList         *GetRanges() {return fRanges;}
   Double_t      *GetValues() {return fVal;}
   Double_t       GetValuefromXY(Double_t x,Double_t y);
   Bool_t         GetVert() {return fX1 == fX2;} // Tells if the axis is vertical or not.
   void           GetXYfromValue(Double_t value, Double_t & x, Double_t & y);
   void           Init();
   virtual void   Paint(Option_t* option="");
   void           PaintBoxPlot();
   void           PaintHistogram();
   void           PaintLabels();
   virtual void   Print(Option_t* option="") const; // *MENU*
   void           SavePrimitive(ostream & out, Option_t *options);
   void           SetBoxPlot(Bool_t box); // *TOGGLE* *GETTER=GetBoxPlot
   void           SetBarHisto(Bool_t h) {SetBit(kShowBarHisto,h);} // *TOGGLE* *GETTER=GetBarHisto
   void           SetHistogramLineWidth(Int_t lw=2) {fHistoLW = lw;} // *MENU*
   void           SetHistogramHeight(Double_t h=0); // *MENU*
   void           SetHistogramBinning(Int_t n=100); // *MENU*
   void           SetCurrentLimits(Double_t min, Double_t max); // *MENU*
   void           SetCurrentMin(Double_t min);
   void           SetCurrentMax(Double_t max);
   void           SetInitMin(Double_t min) {fMinInit = min;}
   void           SetInitMax(Double_t max) {fMaxInit = max;}
   void           SetLiveRangesUpdate(Bool_t on);
   void           SetLogScale(Bool_t log); // *TOGGLE* *GETTER=GetLogScale
   void           SetTitle(const char* /*title*/) {} // To hide TNamed::SetTitle.
   void           SetValues(Long64_t length, Double_t* val);
   void           SetX(Double_t x, Bool_t gl);    // Set a new x position in case of a vertical display.
   void           SetY(Double_t y, Bool_t gl);    // Set a new y position in case of a horizontal display.
   void           Unzoom() {SetCurrentLimits(fMinInit,fMaxInit);} // *MENU* Reset fMin and fMax to their original value.

   ClassDef(TParallelCoordVar,1); // A Variable of a parallel coordinates plot.
};

#endif
 TParallelCoordVar.h:1
 TParallelCoordVar.h:2
 TParallelCoordVar.h:3
 TParallelCoordVar.h:4
 TParallelCoordVar.h:5
 TParallelCoordVar.h:6
 TParallelCoordVar.h:7
 TParallelCoordVar.h:8
 TParallelCoordVar.h:9
 TParallelCoordVar.h:10
 TParallelCoordVar.h:11
 TParallelCoordVar.h:12
 TParallelCoordVar.h:13
 TParallelCoordVar.h:14
 TParallelCoordVar.h:15
 TParallelCoordVar.h:16
 TParallelCoordVar.h:17
 TParallelCoordVar.h:18
 TParallelCoordVar.h:19
 TParallelCoordVar.h:20
 TParallelCoordVar.h:21
 TParallelCoordVar.h:22
 TParallelCoordVar.h:23
 TParallelCoordVar.h:24
 TParallelCoordVar.h:25
 TParallelCoordVar.h:26
 TParallelCoordVar.h:27
 TParallelCoordVar.h:28
 TParallelCoordVar.h:29
 TParallelCoordVar.h:30
 TParallelCoordVar.h:31
 TParallelCoordVar.h:32
 TParallelCoordVar.h:33
 TParallelCoordVar.h:34
 TParallelCoordVar.h:35
 TParallelCoordVar.h:36
 TParallelCoordVar.h:37
 TParallelCoordVar.h:38
 TParallelCoordVar.h:39
 TParallelCoordVar.h:40
 TParallelCoordVar.h:41
 TParallelCoordVar.h:42
 TParallelCoordVar.h:43
 TParallelCoordVar.h:44
 TParallelCoordVar.h:45
 TParallelCoordVar.h:46
 TParallelCoordVar.h:47
 TParallelCoordVar.h:48
 TParallelCoordVar.h:49
 TParallelCoordVar.h:50
 TParallelCoordVar.h:51
 TParallelCoordVar.h:52
 TParallelCoordVar.h:53
 TParallelCoordVar.h:54
 TParallelCoordVar.h:55
 TParallelCoordVar.h:56
 TParallelCoordVar.h:57
 TParallelCoordVar.h:58
 TParallelCoordVar.h:59
 TParallelCoordVar.h:60
 TParallelCoordVar.h:61
 TParallelCoordVar.h:62
 TParallelCoordVar.h:63
 TParallelCoordVar.h:64
 TParallelCoordVar.h:65
 TParallelCoordVar.h:66
 TParallelCoordVar.h:67
 TParallelCoordVar.h:68
 TParallelCoordVar.h:69
 TParallelCoordVar.h:70
 TParallelCoordVar.h:71
 TParallelCoordVar.h:72
 TParallelCoordVar.h:73
 TParallelCoordVar.h:74
 TParallelCoordVar.h:75
 TParallelCoordVar.h:76
 TParallelCoordVar.h:77
 TParallelCoordVar.h:78
 TParallelCoordVar.h:79
 TParallelCoordVar.h:80
 TParallelCoordVar.h:81
 TParallelCoordVar.h:82
 TParallelCoordVar.h:83
 TParallelCoordVar.h:84
 TParallelCoordVar.h:85
 TParallelCoordVar.h:86
 TParallelCoordVar.h:87
 TParallelCoordVar.h:88
 TParallelCoordVar.h:89
 TParallelCoordVar.h:90
 TParallelCoordVar.h:91
 TParallelCoordVar.h:92
 TParallelCoordVar.h:93
 TParallelCoordVar.h:94
 TParallelCoordVar.h:95
 TParallelCoordVar.h:96
 TParallelCoordVar.h:97
 TParallelCoordVar.h:98
 TParallelCoordVar.h:99
 TParallelCoordVar.h:100
 TParallelCoordVar.h:101
 TParallelCoordVar.h:102
 TParallelCoordVar.h:103
 TParallelCoordVar.h:104
 TParallelCoordVar.h:105
 TParallelCoordVar.h:106
 TParallelCoordVar.h:107
 TParallelCoordVar.h:108
 TParallelCoordVar.h:109
 TParallelCoordVar.h:110
 TParallelCoordVar.h:111
 TParallelCoordVar.h:112
 TParallelCoordVar.h:113
 TParallelCoordVar.h:114
 TParallelCoordVar.h:115
 TParallelCoordVar.h:116
 TParallelCoordVar.h:117
 TParallelCoordVar.h:118
 TParallelCoordVar.h:119
 TParallelCoordVar.h:120
 TParallelCoordVar.h:121
 TParallelCoordVar.h:122
 TParallelCoordVar.h:123
 TParallelCoordVar.h:124
 TParallelCoordVar.h:125
 TParallelCoordVar.h:126