ROOT logo
ROOT » TREE » TREEVIEWER » TSpider

class TSpider: public TObject, public TAttFill, public TAttLine


Spider class

A spider view is a handy way to visualize a set of data stored in a TTree. It draws as many polar axes as selected data members. For each of them, it draws on the axis the position of the present event between the min and max of the data member. Two modes are availables:
  • The spider view: With each points on the axes is drawn a polyline.
  • The segment view: For each data member is drawn an arc segment with the radius corresponding to the event.
The spider plot is available from the treeviewer called by "atree->StartViewer()", or simply by calling its constructor and defining the variables to display.
output of MACRO_TSpider_1_c1
{
   TCanvas *c1 = new TCanvas("c1","TSpider example",200,10,700,700);
   TFile *f = new TFile("$(ROOTSYS)/tutorials/hsimple.root");
   if (!f || f->IsZombie()) {
      printf("Please run <ROOT location>/tutorials/hsimple.C before.");
      return;
   }
   TNtuple* ntuple = f->Get("ntuple");
   TString varexp = "px:py:pz:random:sin(px):log(px/py):log(pz)";
   TString select = "px>0 && py>0 && pz>0";
   TString options = "average";
   TSpider *spider = new TSpider(ntuple,varexp.Data(),select.Data(),options.Data());
   spider->Draw();
   c1->ToggleEditor();
   c1->Selected(c1,spider,1);
   return c1;
}

Function Members (Methods)

public:
TSpider()
TSpider(const TSpider&)
TSpider(TTree* tree, const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 0, Long64_t firstentry = 0)
virtual~TSpider()
voidTObject::AbstractMethod(const char* method) const
voidAddSuperposed(TSpider* sp)
voidAddVariable(const char* varexp)MENU
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
voidDeleteVariable(const char* varexp)MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* options = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Color_tGetAverageFillColor() const
Style_tGetAverageFillStyle() const
Color_tGetAverageLineColor() const
Style_tGetAverageLineStyle() const
Width_tGetAverageLineWidth() const
Long64_tGetCurrentEntry() const
Bool_tGetDisplayAverage() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Long64_tGetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual const char*TObject::GetName() const
Int_tGetNx() const
Int_tGetNy() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Bool_tGetSegmentDisplay() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
voidGotoEntry(Long64_t e)MENU
voidGotoFollowing()MENU
voidGotoNext()MENU
voidGotoPreceding()MENU
voidGotoPrevious()MENU
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttFill::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TSpider&operator=(const TSpider&)
virtual voidPaint(Option_t* options)
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSetAverageFillColor(Color_t col)
voidSetAverageFillStyle(Style_t sty)
voidSetAverageLineColor(Color_t col)
voidSetAverageLineStyle(Style_t sty)
voidSetAverageLineWidth(Width_t wid)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetDisplayAverage(Bool_t disp)TOGGLE
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidSetFillColor(Color_t col)
virtual voidSetFillStyle(Style_t sty)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidSetLineColor(Color_t col)
virtual voidSetLineStyle(Style_t sty)
virtual voidSetLineWidth(Width_t wid)
voidSetNdivRadial(Int_t div)MENU
voidSetNx(UInt_t nx)MENU
voidSetNy(UInt_t ny)MENU
static voidTObject::SetObjectStat(Bool_t stat)
voidSetSegmentDisplay(Bool_t seg)TOGGLE
voidSetSelectionExpression(const char* selexp)
voidSetShowRange(Bool_t showrange)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVariablesExpression(const char* varexp)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidSuperposeTo(TSpider* sp)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidDrawPoly(Option_t* options)
voidDrawPolyAverage(Option_t* options)
voidDrawSlices(Option_t* options)
voidDrawSlicesAverage(Option_t* options)
Int_tFindTextAlign(Double_t theta)
Double_tFindTextAngle(Double_t theta)
voidInitArrays(Int_t newsize)
voidInitVariables(Long64_t firstentry, Long64_t nentries)
voidSetCurrentEntries()
voidSyncFormulas()
voidUpdateView()

Data Members

private:
Bool_tfAngularLabelsTrue if the labels are oriented according to their axis.
Int_tfArraySizeActual size of the arrays.
Double_t*fAve[fNcols] Average value of each variable.
TPolyLine*fAveragePolyPolygon representing the average variables value.
TArc**fAverageSlices! Average slices.
TCanvas*fCanvas! Pointer to the mother pad.
Long64_t*fCurrentEntries![fNx*fNy] current selected entries;
Bool_tfDisplayAverageDisplay or not the average.
Long64_tfEntryPresent entry number in fTree.
Long64_tfFirstEntryFirst entry.
Bool_tfForceDimForce dimension.
TList*fFormulasList of all formulas to represent.
TList*fInputUsed for fSelector.
TTreeFormulaManager*fManagerCoordinator for the formulas.
Double_t*fMax[fNcols] Maximum value of the variables.
Double_t*fMin[fNcols] Minimum value of the variables.
UInt_tfNcolsNumber of variables.
Long64_tfNentriesNumber of entries.
UInt_tfNxNumber of horizontal spider plots.
UInt_tfNyNumber of vertical spider plots.
TGraphPolargram*fPolargramPolar graph.
TList*fPolyListPolygons representing the variables.
Bool_tfSegmentDisplayTrue if displaying a segment plot.
TTreeFormula*fSelectSelection condition
TSelectorDraw*fSelector! Selector.
Bool_tfShowRangeShow range of variables or not.
TList*fSuperposedSuperposed spider plots.
TTree*fTreePointer to the TTree to represent.

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TSpider()
 Default constructor.
TSpider(TTree* tree, const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 0, Long64_t firstentry = 0)
 Normal constructor. Options are:
~TSpider()
 Destructor.
void AddSuperposed(TSpider* sp)
 Allow to superpose several spider views.
void AddVariable(const char* varexp)
 Add a variable to the plot from its expression.
void DeleteVariable(const char* varexp)
 Delete a variable from its expression.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute the distance to the spider.
void Draw(Option_t* options = "")
 Draw the spider.
void DrawPolyAverage(Option_t* options)
 Paint the Polygon representing the average value of the variables.
void DrawPoly(Option_t* options)
 Paint the polygon representing the current entry.
void DrawSlices(Option_t* options)
 Draw the slices of the segment plot.
void DrawSlicesAverage(Option_t* options)
 Draw the slices representing the average for the segment plot.
Style_t GetAverageLineStyle() const
 Get the LineStyle of the average.
Color_t GetAverageLineColor() const
 Get the LineColor of the average.
Width_t GetAverageLineWidth() const
 Get the LineWidth of the average.
Color_t GetAverageFillColor() const
 Get the FillColor of the average.
Style_t GetAverageFillStyle() const
 Get the FillStyle of the average.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute the corresponding event.
Int_t FindTextAlign(Double_t theta)
 Find the alignement rule to apply for TText::SetTextAlign(Short_t).
Double_t FindTextAngle(Double_t theta)
 Determine the orientation of the polar labels according to their angle.
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 the number
 of entries in the Tree or in the associated TEventlist
void GotoEntry(Long64_t e)
 Go to a specified entry.
void GotoNext()
 Go to the next entries.
void GotoPrevious()
 Go to the prevous entries.
void GotoFollowing()
 Go to the next entry.
void GotoPreceding()
 Go to the last entry.
void InitArrays(Int_t newsize)
 Check if the arrays size is enough and reallocate them if not.
void InitVariables(Long64_t firstentry, Long64_t nentries)
 Browse the tree to set the min, max and average value of each variable of fVar.
void Paint(Option_t* options)
 Paint the spider.
void SetAverageLineStyle(Style_t sty)
 Set the LineStyle of the average.
void SetAverageLineColor(Color_t col)
 Set the LineColor of the average.
void SetAverageLineWidth(Width_t wid)
 Set the LineWidth of the average.
void SetAverageFillColor(Color_t col)
 Set the FillColor of the average.
void SetAverageFillStyle(Style_t sty)
 Set the FillStyle of the average.
void SetDisplayAverage(Bool_t disp)
 Display or not the average.
void SetCurrentEntries()
 Set the current selected entries.
void SetLineStyle(Style_t sty)
 Set line style.
void SetLineColor(Color_t col)
 Set lin color.
void SetLineWidth(Width_t wid)
Set line width.
void SetFillColor(Color_t col)
 Set fill color.
void SetFillStyle(Style_t sty)
 Set fill style.
void SetNdivRadial(Int_t div)
 Set number of radial divisions.
void SetNx(UInt_t nx)
 Set the X number of subpads.
void SetNy(UInt_t ny)
 Set the Y number of subpads.
void SetSegmentDisplay(Bool_t seg)
 Set the segment display or not.
void SetSelectionExpression(const char* selexp)
 Compile selection expression if there is one.
void SetVariablesExpression(const char* varexp)
 Compile the variables expression from the given string varexp.
void SyncFormulas()
 Create a TreeFormulaManager to coordinate the formulas.
void UpdateView()
 Update the polylines or the arcs for the current entries.
TSpider()
Bool_t GetDisplayAverage() const
{return fDisplayAverage;}
Long64_t GetCurrentEntry() const
{return fEntry;}
Int_t GetNx() const
{return fNx;}
Int_t GetNy() const
{return fNy;}
Bool_t GetSegmentDisplay() const
{return fSegmentDisplay;}
void SetShowRange(Bool_t showrange)
{fShowRange = showrange;}
void SuperposeTo(TSpider* sp)
{sp->AddSuperposed(this);}