Logo ROOT  
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 #include "TObject.h"
25 #include "TAttFill.h"
26 #include "TAttLine.h"
27 
28 class TTree;
29 class TGraphPolargram;
30 class TPolyLine;
31 class TTreeFormula;
33 class TList;
34 class TSelectorDraw;
35 class TString;
36 class TLatex;
37 class TCanvas;
38 class TArc;
39 
40 class TSpider : public TObject, public TAttFill, public TAttLine {
41 private:
42  UInt_t fNx; // Number of horizontal spider plots.
43  UInt_t fNy; // Number of vertical spider plots.
44  UInt_t fNcols; // Number of variables.
45  Int_t fArraySize; // Actual size of the arrays.
46  Long64_t fEntry; // Present entry number in fTree.
47  Long64_t fNentries; // Number of entries.
48  Long64_t fFirstEntry; // First entry.
49  Long64_t* fCurrentEntries; //![fNx*fNy] current selected entries;
50  Double_t* fAve; //[fNcols] Average value of each variable.
51  Double_t* fMax; //[fNcols] Maximum value of the variables.
52  Double_t* fMin; //[fNcols] Minimum value of the variables.
53  TList* fSuperposed; // Superposed spider plots.
54  TTree* fTree; // Pointer to the TTree to represent.
55  TPolyLine* fAveragePoly; // Polygon representing the average variables value.
56  TArc** fAverageSlices; //! Average slices.
57  TCanvas* fCanvas; //! Pointer to the mother pad.
58  TList* fFormulas; // List of all formulas to represent.
59  TList* fInput; // Used for fSelector.
60  TTreeFormulaManager* fManager; // Coordinator for the formulas.
61  TGraphPolargram* fPolargram; // Polar graph.
62  TList* fPolyList; // Polygons representing the variables.
63  TTreeFormula* fSelect; // Selection condition
64  TSelectorDraw* fSelector; //! Selector.
65  Bool_t fAngularLabels; // True if the labels are oriented according to their axis.
66  Bool_t fDisplayAverage; // Display or not the average.
67  Bool_t fForceDim; // Force dimension.
68  Bool_t fSegmentDisplay; // True if displaying a segment plot.
69  Bool_t fShowRange; // Show range of variables or not.
70 
73  void InitVariables(Long64_t firstentry, Long64_t nentries);
74  void DrawPoly(Option_t* options);
75  void DrawPolyAverage(Option_t* options);
76  void DrawSlices(Option_t* options);
77  void DrawSlicesAverage(Option_t* options);
78  void SyncFormulas();
79  void InitArrays(Int_t newsize);
80  void SetCurrentEntries();
81  void UpdateView();
82 
83 public:
84  TSpider();
85  TSpider(TTree* tree, const char *varexp, const char *selection, Option_t *option="",
86  Long64_t nentries=0, Long64_t firstentry=0);
87  ~TSpider();
88  void AddSuperposed(TSpider* sp);
89  void AddVariable(const char* varexp); // *MENU*
90  void DeleteVariable(const char* varexp); // *MENU*
91  virtual void Draw(Option_t *options="");
92  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
93  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
100  Long64_t GetCurrentEntry() const {return fEntry;}
102  Int_t GetNx() const {return fNx;}
103  Int_t GetNy() const {return fNy;}
105  void GotoEntry(Long64_t e); // *MENU*
106  void GotoNext(); // *MENU*
107  void GotoPrevious(); // *MENU*
108  void GotoFollowing(); // *MENU*
109  void GotoPreceding(); // *MENU*
110  virtual void Paint(Option_t *options);
111  void SetAverageLineStyle(Style_t sty);
112  void SetAverageLineColor(Color_t col);
113  void SetAverageLineWidth(Width_t wid);
114  void SetAverageFillColor(Color_t col);
115  void SetAverageFillStyle(Style_t sty);
116  virtual void SetLineStyle(Style_t sty);
117  virtual void SetLineColor(Color_t col);
118  virtual void SetLineWidth(Width_t wid);
119  virtual void SetFillColor(Color_t col);
120  virtual void SetFillStyle(Style_t sty);
121  void SetDisplayAverage(Bool_t disp); // *TOGGLE*
122  void SetVariablesExpression(const char* varexp);
123  void SetNdivRadial(Int_t div); // *MENU*
124  void SetNx(UInt_t nx); // *MENU*
125  void SetNy(UInt_t ny); // *MENU*
126  void SetSelectionExpression(const char* selexp);
127  void SetSegmentDisplay(Bool_t seg); // *TOGGLE*
128  void SetShowRange(Bool_t showrange) {fShowRange = showrange;}
129  void SuperposeTo(TSpider* sp) {sp->AddSuperposed(this);}
130 
131  ClassDef(TSpider,0) //Helper class to draw spider
132 };
133 
134 #endif
TSpider::fSegmentDisplay
Bool_t fSegmentDisplay
Definition: TSpider.h:68
TPolyLine
Defined by an array on N points in a 2-D space.
Definition: TPolyLine.h:23
TSpider::GetAverageLineStyle
Style_t GetAverageLineStyle() const
Get the LineStyle of the average.
Definition: TSpider.cxx:617
e
#define e(i)
Definition: RSha256.hxx:103
Style_t
short Style_t
Definition: RtypesCore.h:80
TSpider::Draw
virtual void Draw(Option_t *options="")
Draw the spider.
Definition: TSpider.cxx:454
TArc
Create an Arc.
Definition: TArc.h:26
TSpider::SetDisplayAverage
void SetDisplayAverage(Bool_t disp)
Display or not the average.
Definition: TSpider.cxx:1025
TSpider::~TSpider
~TSpider()
Destructor.
Definition: TSpider.cxx:174
Option_t
const char Option_t
Definition: RtypesCore.h:66
TSpider::SetAverageFillColor
void SetAverageFillColor(Color_t col)
Set the Fill Color of the average.
Definition: TSpider.cxx:1001
TSpider::DrawPolyAverage
void DrawPolyAverage(Option_t *options)
Paint the Polygon representing the average value of the variables.
Definition: TSpider.cxx:492
TSpider::SetVariablesExpression
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given string varexp.
Definition: TSpider.cxx:1484
tree
Definition: tree.py:1
TSpider::DrawSlices
void DrawSlices(Option_t *options)
Draw the slices of the segment plot.
Definition: TSpider.cxx:560
TSpider::GetNx
Int_t GetNx() const
Definition: TSpider.h:102
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TSpider::GetCurrentEntry
Long64_t GetCurrentEntry() const
Definition: TSpider.h:100
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TSpider::GotoFollowing
void GotoFollowing()
Go to the next entry.
Definition: TSpider.cxx:774
TSpider::fPolargram
TGraphPolargram * fPolargram
Definition: TSpider.h:61
TSpider::SetNdivRadial
void SetNdivRadial(Int_t div)
Set number of radial divisions.
Definition: TSpider.cxx:1217
Int_t
int Int_t
Definition: RtypesCore.h:45
TSpider::SuperposeTo
void SuperposeTo(TSpider *sp)
Definition: TSpider.h:129
TSpider::SetNy
void SetNy(UInt_t ny)
Set the Y number of sub pads.
Definition: TSpider.cxx:1303
TSpider::FindTextAngle
Double_t FindTextAngle(Double_t theta)
Determine the orientation of the polar labels according to their angle.
Definition: TSpider.cxx:705
TSpider::GotoPreceding
void GotoPreceding()
Go to the last entry.
Definition: TSpider.cxx:784
TSpider::SetAverageLineColor
void SetAverageLineColor(Color_t col)
Set the LineColor of the average.
Definition: TSpider.cxx:977
TSpider::SetSegmentDisplay
void SetSegmentDisplay(Bool_t seg)
Set the segment display or not.
Definition: TSpider.cxx:1380
TLatex
To draw Mathematical Formula.
Definition: TLatex.h:18
nentries
int nentries
Definition: THbookFile.cxx:91
TSpider::fAveragePoly
TPolyLine * fAveragePoly
Definition: TSpider.h:55
TSpider::SetCurrentEntries
void SetCurrentEntries()
Set the current selected entries.
Definition: TSpider.cxx:1067
TSpider::DrawSlicesAverage
void DrawSlicesAverage(Option_t *options)
Draw the slices representing the average for the segment plot.
Definition: TSpider.cxx:586
TSpider::fCurrentEntries
Long64_t * fCurrentEntries
Definition: TSpider.h:49
TString
Basic string class.
Definition: TString.h:136
TSpider::fMin
Double_t * fMin
Definition: TSpider.h:52
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TSpider::GetAverageLineWidth
Width_t GetAverageLineWidth() const
Get the LineWidth of the average.
Definition: TSpider.cxx:637
TSpider::AddVariable
void AddVariable(const char *varexp)
Add a variable to the plot from its expression.
Definition: TSpider.cxx:215
Color_t
short Color_t
Definition: RtypesCore.h:83
TSpider::SetAverageFillStyle
void SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition: TSpider.cxx:1013
TSpider::SetAverageLineWidth
void SetAverageLineWidth(Width_t wid)
Set the LineWidth of the average.
Definition: TSpider.cxx:989
TSpider::fAverageSlices
TArc ** fAverageSlices
Definition: TSpider.h:56
TSpider::fMax
Double_t * fMax
Definition: TSpider.h:51
TSpider::fNcols
UInt_t fNcols
Definition: TSpider.h:44
bool
TSpider::SetAverageLineStyle
void SetAverageLineStyle(Style_t sty)
Set the LineStyle of the average.
Definition: TSpider.cxx:965
TSpider::fFormulas
TList * fFormulas
Pointer to the mother pad.
Definition: TSpider.h:58
TAttLine.h
TSpider::SetShowRange
void SetShowRange(Bool_t showrange)
Definition: TSpider.h:128
TSpider::fArraySize
Int_t fArraySize
Definition: TSpider.h:45
TSpider::GotoEntry
void GotoEntry(Long64_t e)
Go to a specified entry.
Definition: TSpider.cxx:744
TSpider::SetLineStyle
virtual void SetLineStyle(Style_t sty)
Set line style.
Definition: TSpider.cxx:1137
TTreeFormulaManager
Used to coordinate one or more TTreeFormula objects.
Definition: TTreeFormulaManager.h:30
TAttFill.h
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TSpider::InitVariables
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:832
TSpider::SetLineColor
virtual void SetLineColor(Color_t col)
Set lin color.
Definition: TSpider.cxx:1153
TSpider::GetAverageLineColor
Color_t GetAverageLineColor() const
Get the LineColor of the average.
Definition: TSpider.cxx:627
Width_t
short Width_t
Definition: RtypesCore.h:82
TSpider::fTree
TTree * fTree
Definition: TSpider.h:54
TSpider
Spider class.
Definition: TSpider.h:40
TSpider::fEntry
Long64_t fEntry
Definition: TSpider.h:46
TSpider::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance to the spider.
Definition: TSpider.cxx:439
TSpider::fInput
TList * fInput
Definition: TSpider.h:59
TTreeFormula
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
TSpider::UpdateView
void UpdateView()
Update the polylines or the arcs for the current entries.
Definition: TSpider.cxx:1554
TSpider::fShowRange
Bool_t fShowRange
Definition: TSpider.h:69
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TSpider::GetSegmentDisplay
Bool_t GetSegmentDisplay() const
Definition: TSpider.h:104
TSpider::FindTextAlign
Int_t FindTextAlign(Double_t theta)
Find the alignement rule to apply for TText::SetTextAlign(Short_t).
Definition: TSpider.cxx:676
TSpider::SyncFormulas
void SyncFormulas()
Create a TreeFormulaManager to coordinate the formulas.
Definition: TSpider.cxx:1522
TSpider::fNy
UInt_t fNy
Definition: TSpider.h:43
TSpider::AddSuperposed
void AddSuperposed(TSpider *sp)
Allow to superpose several spider views.
Definition: TSpider.cxx:206
TSpider::fSuperposed
TList * fSuperposed
Definition: TSpider.h:53
TSpider::fCanvas
TCanvas * fCanvas
Average slices.
Definition: TSpider.h:57
TSpider::SetLineWidth
virtual void SetLineWidth(Width_t wid)
Set line width.
Definition: TSpider.cxx:1169
unsigned int
TSpider::GetEntriesToProcess
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:727
TSpider::fForceDim
Bool_t fForceDim
Definition: TSpider.h:67
TSpider::SetNx
void SetNx(UInt_t nx)
Set the X number of sub pads.
Definition: TSpider.cxx:1226
Double_t
double Double_t
Definition: RtypesCore.h:59
TSpider::fDisplayAverage
Bool_t fDisplayAverage
Definition: TSpider.h:66
TObject.h
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TSpider::GetNy
Int_t GetNy() const
Definition: TSpider.h:103
TGraphPolargram
To draw polar axis.
Definition: TGraphPolargram.h:20
TSpider::GotoPrevious
void GotoPrevious()
Go to the previous entries.
Definition: TSpider.cxx:764
TSpider::fNentries
Long64_t fNentries
Definition: TSpider.h:47
TSpider::SetFillStyle
virtual void SetFillStyle(Style_t sty)
Set fill style.
Definition: TSpider.cxx:1201
TSpider::GotoNext
void GotoNext()
Go to the next entries.
Definition: TSpider.cxx:754
TSpider::TSpider
TSpider()
Default constructor.
Definition: TSpider.cxx:76
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TSpider::fAve
Double_t * fAve
[fNx*fNy] current selected entries;
Definition: TSpider.h:50
TSpider::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute the corresponding event.
Definition: TSpider.cxx:667
TSpider::GetAverageFillStyle
Style_t GetAverageFillStyle() const
Get the FillStyle of the average.
Definition: TSpider.cxx:657
TSpider::InitArrays
void InitArrays(Int_t newsize)
Check if the arrays size is enough and reallocate them if not.
Definition: TSpider.cxx:794
TSpider::fSelector
TSelectorDraw * fSelector
Definition: TSpider.h:64
TSpider::fFirstEntry
Long64_t fFirstEntry
Definition: TSpider.h:48
TSpider::SetSelectionExpression
void SetSelectionExpression(const char *selexp)
Compile selection expression if there is one.
Definition: TSpider.cxx:1471
TAttFill
Fill Area Attributes class.
Definition: TAttFill.h:19
TSpider::fNx
UInt_t fNx
Definition: TSpider.h:42
TSpider::DrawPoly
void DrawPoly(Option_t *options)
Paint the polygon representing the current entry.
Definition: TSpider.cxx:530
TSpider::GetDisplayAverage
Bool_t GetDisplayAverage() const
Definition: TSpider.h:99
TSpider::SetFillColor
virtual void SetFillColor(Color_t col)
Set fill color.
Definition: TSpider.cxx:1185
TSpider::Paint
virtual void Paint(Option_t *options)
Paint the spider.
Definition: TSpider.cxx:918
TSpider::fManager
TTreeFormulaManager * fManager
Definition: TSpider.h:60
TSpider::GetAverageFillColor
Color_t GetAverageFillColor() const
Get the Fill Color of the average.
Definition: TSpider.cxx:647
TSpider::fSelect
TTreeFormula * fSelect
Definition: TSpider.h:63
TList
A doubly linked list.
Definition: TList.h:44
TSelectorDraw
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:33
TSpider::DeleteVariable
void DeleteVariable(const char *varexp)
Delete a variable from its expression.
Definition: TSpider.cxx:353
TSpider::fPolyList
TList * fPolyList
Definition: TSpider.h:62
int
TSpider::fAngularLabels
Bool_t fAngularLabels
Selector.
Definition: TSpider.h:65