#ifndef ROOT_TSpider
#define ROOT_TSpider
#ifndef ROOT_Object
#include "TObject.h"
#endif
#ifndef ROOT_TAttFill
#include "TAttFill.h"
#endif
#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif
#ifndef ROOT_TAttText
#include "TAttText.h"
#endif
class TTree;
class TGraphPolargram;
class TPolyLine;
class TTreeFormula;
class TTreeFormulaManager;
class TList;
class TSelectorDraw;
class TString;
class TLatex;
class TCanvas;
class TArc;
class TSpider : public TObject, public TAttFill, public TAttLine {
private:
UInt_t fNx;
UInt_t fNy;
UInt_t fNcols;
Int_t fArraySize;
Long64_t fEntry;
Long64_t fNentries;
Long64_t fFirstEntry;
Long64_t* fCurrentEntries;
Double_t* fAve;
Double_t* fMax;
Double_t* fMin;
TList* fSuperposed;
TTree* fTree;
TPolyLine* fAveragePoly;
TArc** fAverageSlices;
TCanvas* fCanvas;
TList* fFormulas;
TList* fInput;
TTreeFormulaManager* fManager;
TGraphPolargram* fPolargram;
TList* fPolyList;
TTreeFormula* fSelect;
TSelectorDraw* fSelector;
Bool_t fAngularLabels;
Bool_t fDisplayAverage;
Bool_t fForceDim;
Bool_t fSegmentDisplay;
Bool_t fShowRange;
Int_t FindTextAlign(Double_t theta);
Double_t FindTextAngle(Double_t theta);
void InitVariables(Long64_t firstentry, Long64_t nentries);
void DrawPoly(Option_t* options);
void DrawPolyAverage(Option_t* options);
void DrawSlices(Option_t* options);
void DrawSlicesAverage(Option_t* options);
void SyncFormulas();
void InitArrays(Int_t newsize);
void SetCurrentEntries();
void UpdateView();
public:
TSpider();
TSpider(TTree* tree, const char *varexp, const char *selection, Option_t *option="",
Long64_t nentries=0, Long64_t firstentry=0);
~TSpider();
void AddSuperposed(TSpider* sp);
void AddVariable(const char* varexp);
void DeleteVariable(const char* varexp);
virtual void Draw(Option_t *options="");
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
Style_t GetAverageLineStyle() const;
Color_t GetAverageLineColor() const;
Width_t GetAverageLineWidth() const;
Color_t GetAverageFillColor() const;
Style_t GetAverageFillStyle() const;
Bool_t GetDisplayAverage() const {return fDisplayAverage;}
Long64_t GetCurrentEntry() const {return fEntry;}
Long64_t GetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const;
Int_t GetNx() const {return fNx;}
Int_t GetNy() const {return fNy;}
Bool_t GetSegmentDisplay() const {return fSegmentDisplay;}
void GotoEntry(Long64_t e);
void GotoNext();
void GotoPrevious();
void GotoFollowing();
void GotoPreceding();
virtual void Paint(Option_t *options);
void SetAverageLineStyle(Style_t sty);
void SetAverageLineColor(Color_t col);
void SetAverageLineWidth(Width_t wid);
void SetAverageFillColor(Color_t col);
void SetAverageFillStyle(Style_t sty);
virtual void SetLineStyle(Style_t sty);
virtual void SetLineColor(Color_t col);
virtual void SetLineWidth(Width_t wid);
virtual void SetFillColor(Color_t col);
virtual void SetFillStyle(Style_t sty);
void SetDisplayAverage(Bool_t disp);
void SetVariablesExpression(const char* varexp);
void SetNdivRadial(Int_t div);
void SetNx(UInt_t nx);
void SetNy(UInt_t ny);
void SetSelectionExpression(const char* selexp);
void SetSegmentDisplay(Bool_t seg);
void SetShowRange(Bool_t showrange) {fShowRange = showrange;}
void SuperposeTo(TSpider* sp) {sp->AddSuperposed(this);}
ClassDef(TSpider,0)
};
#endif