Logo ROOT   6.08/07
Reference Guide
TSpider.h
Go to the documentation of this file.
1 // @(#)root/treeviewer:$Id$
2 // Author: Bastien Dalla Piazza 20/07/07
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_TSpider
13 #define ROOT_TSpider
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TSpider //
18 // //
19 // TSpider is a manager used to paint a spider view //
20 // of the events of a TNtuple. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_Object
25 #include "TObject.h"
26 #endif
27 
28 #ifndef ROOT_TAttFill
29 #include "TAttFill.h"
30 #endif
31 
32 #ifndef ROOT_TAttLine
33 #include "TAttLine.h"
34 #endif
35 
36 #ifndef ROOT_TAttText
37 #include "TAttText.h"
38 #endif
39 
40 class TTree;
41 class TGraphPolargram;
42 class TPolyLine;
43 class TTreeFormula;
45 class TList;
46 class TSelectorDraw;
47 class TString;
48 class TLatex;
49 class TCanvas;
50 class TArc;
51 
52 class TSpider : public TObject, public TAttFill, public TAttLine {
53 private:
54  UInt_t fNx; // Number of horizontal spider plots.
55  UInt_t fNy; // Number of vertical spider plots.
56  UInt_t fNcols; // Number of variables.
57  Int_t fArraySize; // Actual size of the arrays.
58  Long64_t fEntry; // Present entry number in fTree.
59  Long64_t fNentries; // Number of entries.
60  Long64_t fFirstEntry; // First entry.
61  Long64_t* fCurrentEntries; //![fNx*fNy] current selected entries;
62  Double_t* fAve; //[fNcols] Average value of each variable.
63  Double_t* fMax; //[fNcols] Maximum value of the variables.
64  Double_t* fMin; //[fNcols] Minimum value of the variables.
65  TList* fSuperposed; // Superposed spider plots.
66  TTree* fTree; // Pointer to the TTree to represent.
67  TPolyLine* fAveragePoly; // Polygon representing the average variables value.
68  TArc** fAverageSlices; //! Average slices.
69  TCanvas* fCanvas; //! Pointer to the mother pad.
70  TList* fFormulas; // List of all formulas to represent.
71  TList* fInput; // Used for fSelector.
72  TTreeFormulaManager* fManager; // Coordinator for the formulas.
73  TGraphPolargram* fPolargram; // Polar graph.
74  TList* fPolyList; // Polygons representing the variables.
75  TTreeFormula* fSelect; // Selection condition
76  TSelectorDraw* fSelector; //! Selector.
77  Bool_t fAngularLabels; // True if the labels are oriented according to their axis.
78  Bool_t fDisplayAverage; // Display or not the average.
79  Bool_t fForceDim; // Force dimension.
80  Bool_t fSegmentDisplay; // True if displaying a segment plot.
81  Bool_t fShowRange; // Show range of variables or not.
82 
85  void InitVariables(Long64_t firstentry, Long64_t nentries);
86  void DrawPoly(Option_t* options);
87  void DrawPolyAverage(Option_t* options);
88  void DrawSlices(Option_t* options);
89  void DrawSlicesAverage(Option_t* options);
90  void SyncFormulas();
91  void InitArrays(Int_t newsize);
92  void SetCurrentEntries();
93  void UpdateView();
94 
95 public:
96  TSpider();
97  TSpider(TTree* tree, const char *varexp, const char *selection, Option_t *option="",
98  Long64_t nentries=0, Long64_t firstentry=0);
99  ~TSpider();
100  void AddSuperposed(TSpider* sp);
101  void AddVariable(const char* varexp); // *MENU*
102  void DeleteVariable(const char* varexp); // *MENU*
103  virtual void Draw(Option_t *options="");
104  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
105  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
112  Long64_t GetCurrentEntry() const {return fEntry;}
114  Int_t GetNx() const {return fNx;}
115  Int_t GetNy() const {return fNy;}
117  void GotoEntry(Long64_t e); // *MENU*
118  void GotoNext(); // *MENU*
119  void GotoPrevious(); // *MENU*
120  void GotoFollowing(); // *MENU*
121  void GotoPreceding(); // *MENU*
122  virtual void Paint(Option_t *options);
123  void SetAverageLineStyle(Style_t sty);
124  void SetAverageLineColor(Color_t col);
125  void SetAverageLineWidth(Width_t wid);
126  void SetAverageFillColor(Color_t col);
127  void SetAverageFillStyle(Style_t sty);
128  virtual void SetLineStyle(Style_t sty);
129  virtual void SetLineColor(Color_t col);
130  virtual void SetLineWidth(Width_t wid);
131  virtual void SetFillColor(Color_t col);
132  virtual void SetFillStyle(Style_t sty);
133  void SetDisplayAverage(Bool_t disp); // *TOGGLE*
134  void SetVariablesExpression(const char* varexp);
135  void SetNdivRadial(Int_t div); // *MENU*
136  void SetNx(UInt_t nx); // *MENU*
137  void SetNy(UInt_t ny); // *MENU*
138  void SetSelectionExpression(const char* selexp);
139  void SetSegmentDisplay(Bool_t seg); // *TOGGLE*
140  void SetShowRange(Bool_t showrange) {fShowRange = showrange;}
141  void SuperposeTo(TSpider* sp) {sp->AddSuperposed(this);}
142 
143  ClassDef(TSpider,0) //Helper class to draw spider
144 };
145 
146 #endif
const int nx
Definition: kalman.C:16
virtual void SetLineColor(Color_t col)
Set lin color.
Definition: TSpider.cxx:1152
void DrawPoly(Option_t *options)
Paint the polygon representing the current entry.
Definition: TSpider.cxx:529
Double_t * fMax
Definition: TSpider.h:63
TTree * fTree
Definition: TSpider.h:66
void SetAverageLineStyle(Style_t sty)
Set the LineStyle of the average.
Definition: TSpider.cxx:964
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance to the spider.
Definition: TSpider.cxx:438
long long Long64_t
Definition: RtypesCore.h:69
Long64_t fEntry
Definition: TSpider.h:58
void GotoPrevious()
Go to the previous entries.
Definition: TSpider.cxx:763
TList * fFormulas
Pointer to the mother pad.
Definition: TSpider.h:70
short Style_t
Definition: RtypesCore.h:76
void SetShowRange(Bool_t showrange)
Definition: TSpider.h:140
const char Option_t
Definition: RtypesCore.h:62
Int_t FindTextAlign(Double_t theta)
Find the alignement rule to apply for TText::SetTextAlign(Short_t).
Definition: TSpider.cxx:675
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute the corresponding event.
Definition: TSpider.cxx:666
Style_t GetAverageFillStyle() const
Get the FillStyle of the average.
Definition: TSpider.cxx:656
void SuperposeTo(TSpider *sp)
Definition: TSpider.h:141
Bool_t fSegmentDisplay
Definition: TSpider.h:80
void SetSegmentDisplay(Bool_t seg)
Set the segment display or not.
Definition: TSpider.cxx:1379
virtual void SetLineWidth(Width_t wid)
Set line width.
Definition: TSpider.cxx:1168
void InitVariables(Long64_t firstentry, Long64_t nentries)
Browse the tree to set the min, max and average value of each variable of fVar.
Definition: TSpider.cxx:831
void DrawSlicesAverage(Option_t *options)
Draw the slices representing the average for the segment plot.
Definition: TSpider.cxx:585
Long64_t * fCurrentEntries
Definition: TSpider.h:61
UInt_t fNx
Definition: TSpider.h:54
Basic string class.
Definition: TString.h:137
~TSpider()
Destructor.
Definition: TSpider.cxx:173
Bool_t GetDisplayAverage() const
Definition: TSpider.h:111
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc ** fAverageSlices
Definition: TSpider.h:68
Bool_t fForceDim
Definition: TSpider.h:79
Color_t GetAverageFillColor() const
Get the Fill Color of the average.
Definition: TSpider.cxx:646
TList * fInput
Definition: TSpider.h:71
Long64_t fNentries
Definition: TSpider.h:59
void GotoNext()
Go to the next entries.
Definition: TSpider.cxx:753
void UpdateView()
Update the polylines or the arcs for the current entries.
Definition: TSpider.cxx:1548
Bool_t fShowRange
Definition: TSpider.h:81
void DeleteVariable(const char *varexp)
Delete a variable from its expression.
Definition: TSpider.cxx:352
TList * fPolyList
Definition: TSpider.h:74
TCanvas * fCanvas
Average slices.
Definition: TSpider.h:69
Style_t GetAverageLineStyle() const
Get the LineStyle of the average.
Definition: TSpider.cxx:616
Fill Area Attributes class.
Definition: TAttFill.h:24
Used to coordinate one or more TTreeFormula objects.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Long64_t fFirstEntry
Definition: TSpider.h:60
void SetNdivRadial(Int_t div)
Set number of radial divisions.
Definition: TSpider.cxx:1216
const int ny
Definition: kalman.C:17
To draw Mathematical Formula.
Definition: TLatex.h:25
virtual void Paint(Option_t *options)
Paint the spider.
Definition: TSpider.cxx:917
void SetNx(UInt_t nx)
Set the X number of sub pads.
Definition: TSpider.cxx:1225
virtual void SetFillColor(Color_t col)
Set fill color.
Definition: TSpider.cxx:1184
Bool_t fDisplayAverage
Definition: TSpider.h:78
short Color_t
Definition: RtypesCore.h:79
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:64
virtual void SetFillStyle(Style_t sty)
Set fill style.
Definition: TSpider.cxx:1200
A doubly linked list.
Definition: TList.h:47
void SetAverageLineWidth(Width_t wid)
Set the LineWidth of the average.
Definition: TSpider.cxx:988
Create an Arc.
Definition: TArc.h:29
Double_t * fAve
[fNx*fNy] current selected entries;
Definition: TSpider.h:62
void InitArrays(Int_t newsize)
Check if the arrays size is enough and reallocate them if not.
Definition: TSpider.cxx:793
unsigned int UInt_t
Definition: RtypesCore.h:42
void SetNy(UInt_t ny)
Set the Y number of sub pads.
Definition: TSpider.cxx:1302
TPolyLine * fAveragePoly
Definition: TSpider.h:67
To draw polar axis.
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given string varexp.
Definition: TSpider.cxx:1478
void SetAverageFillColor(Color_t col)
Set the Fill Color of the average.
Definition: TSpider.cxx:1000
Double_t * fMin
Definition: TSpider.h:64
TTreeFormula * fSelect
Definition: TSpider.h:75
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
short Width_t
Definition: RtypesCore.h:78
Width_t GetAverageLineWidth() const
Get the LineWidth of the average.
Definition: TSpider.cxx:636
Bool_t fAngularLabels
Selector.
Definition: TSpider.h:77
void SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition: TSpider.cxx:1012
The Canvas class.
Definition: TCanvas.h:41
Long64_t GetCurrentEntry() const
Definition: TSpider.h:112
double Double_t
Definition: RtypesCore.h:55
TGraphPolargram * fPolargram
Definition: TSpider.h:73
void GotoFollowing()
Go to the next entry.
Definition: TSpider.cxx:773
Bool_t GetSegmentDisplay() const
Definition: TSpider.h:116
int nentries
Definition: THbookFile.cxx:89
virtual void Draw(Option_t *options="")
Draw the spider.
Definition: TSpider.cxx:453
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void SetDisplayAverage(Bool_t disp)
Display or not the average.
Definition: TSpider.cxx:1024
void SyncFormulas()
Create a TreeFormulaManager to coordinate the formulas.
Definition: TSpider.cxx:1516
void GotoPreceding()
Go to the last entry.
Definition: TSpider.cxx:783
UInt_t fNy
Definition: TSpider.h:55
virtual void SetLineStyle(Style_t sty)
Set line style.
Definition: TSpider.cxx:1136
void AddSuperposed(TSpider *sp)
Allow to superpose several spider views.
Definition: TSpider.cxx:205
TList * fSuperposed
Definition: TSpider.h:65
TTreeFormulaManager * fManager
Definition: TSpider.h:72
Mother of all ROOT objects.
Definition: TObject.h:37
Color_t GetAverageLineColor() const
Get the LineColor of the average.
Definition: TSpider.cxx:626
void DrawSlices(Option_t *options)
Draw the slices of the segment plot.
Definition: TSpider.cxx:559
Long64_t GetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const
return the number of entries to be processed this function checks that nentries is not bigger than th...
Definition: TSpider.cxx:726
void AddVariable(const char *varexp)
Add a variable to the plot from its expression.
Definition: TSpider.cxx:214
Int_t GetNx() const
Definition: TSpider.h:114
Spider class.
Definition: TSpider.h:52
UInt_t fNcols
Definition: TSpider.h:56
Defined by an array on N points in a 2-D space.
Definition: TPolyLine.h:31
Definition: tree.py:1
Int_t GetNy() const
Definition: TSpider.h:115
A TTree object has a header with a name and a title.
Definition: TTree.h:98
TSpider()
Default constructor.
Definition: TSpider.cxx:75
Double_t FindTextAngle(Double_t theta)
Determine the orientation of the polar labels according to their angle.
Definition: TSpider.cxx:704
Int_t fArraySize
Definition: TSpider.h:57
void GotoEntry(Long64_t e)
Go to a specified entry.
Definition: TSpider.cxx:743
Line Attributes class.
Definition: TAttLine.h:24
void SetCurrentEntries()
Set the current selected entries.
Definition: TSpider.cxx:1066
void SetAverageLineColor(Color_t col)
Set the LineColor of the average.
Definition: TSpider.cxx:976
TSelectorDraw * fSelector
Definition: TSpider.h:76
void DrawPolyAverage(Option_t *options)
Paint the Polygon representing the average value of the variables.
Definition: TSpider.cxx:491
void SetSelectionExpression(const char *selexp)
Compile selection expression if there is one.
Definition: TSpider.cxx:1465