TSpider.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TSpider.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Bastien Dalla Piazza  20/07/07
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TSpider
00013 #define ROOT_TSpider
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TSpider                                                              //
00018 //                                                                      //
00019 // TSpider is a manager used to paint a spider view                     //
00020 // of the events of a TNtuple.                                          //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_Object
00025 #include "TObject.h"
00026 #endif
00027 
00028 #ifndef ROOT_TAttFill
00029 #include "TAttFill.h"
00030 #endif
00031 
00032 #ifndef ROOT_TAttLine
00033 #include "TAttLine.h"
00034 #endif
00035 
00036 #ifndef ROOT_TAttText
00037 #include "TAttText.h"
00038 #endif
00039 
00040 class TTree;
00041 class TGraphPolargram;
00042 class TPolyLine;
00043 class TTreeFormula;
00044 class TTreeFormulaManager;
00045 class TList;
00046 class TSelectorDraw;
00047 class TString;
00048 class TLatex;
00049 class TCanvas;
00050 class TArc;
00051 
00052 class TSpider : public TObject, public TAttFill, public TAttLine {
00053 private:
00054    UInt_t                  fNx; // Number of horizontal spider plots.
00055    UInt_t                  fNy; // Number of vertical spider plots.
00056    UInt_t                  fNcols; // Number of variables.
00057    Int_t                   fArraySize; // Actual size of the arrays.
00058    Long64_t                fEntry; // Present entry number in fTree.
00059    Long64_t                fNentries; // Number of entries.
00060    Long64_t                fFirstEntry; // First entry.
00061    Long64_t*               fCurrentEntries; //![fNx*fNy] current selected entries;
00062    Double_t*               fAve; //[fNcols] Average value of each variable.
00063    Double_t*               fMax; //[fNcols]  Maximum value of the variables.
00064    Double_t*               fMin; //[fNcols]  Minimum value of the variables.
00065    TList*                  fSuperposed; // Superposed spider plots.
00066    TTree*                  fTree; // Pointer to the TTree to represent.
00067    TPolyLine*              fAveragePoly; // Polygon representing the average variables value.
00068    TArc**                  fAverageSlices; //! Average slices.
00069    TCanvas*                fCanvas; //! Pointer to the mother pad.
00070    TList*                  fFormulas; // List of all formulas to represent.
00071    TList*                  fInput; // Used for fSelector.
00072    TTreeFormulaManager*    fManager; // Coordinator for the formulas.
00073    TGraphPolargram*        fPolargram; // Polar graph.
00074    TList*                  fPolyList; // Polygons representing the variables.
00075    TTreeFormula*           fSelect; // Selection condition
00076    TSelectorDraw*          fSelector; //! Selector.
00077    Bool_t                  fAngularLabels; // True if the labels are oriented according to their axis.
00078    Bool_t                  fDisplayAverage; // Display or not the average.
00079    Bool_t                  fForceDim; // Force dimension.
00080    Bool_t                  fSegmentDisplay; // True if displaying a segment plot.
00081    Bool_t                  fShowRange; // Show range of variables or not.
00082 
00083    Int_t          FindTextAlign(Double_t theta);
00084    Double_t       FindTextAngle(Double_t theta);
00085    void           InitVariables(Long64_t firstentry, Long64_t nentries);
00086    void           DrawPoly(Option_t* options);
00087    void           DrawPolyAverage(Option_t* options);
00088    void           DrawSlices(Option_t* options);
00089    void           DrawSlicesAverage(Option_t* options);
00090    void           SyncFormulas();
00091    void           InitArrays(Int_t newsize);
00092    void           SetCurrentEntries();
00093    void           UpdateView();
00094 
00095 public:
00096    TSpider();
00097    TSpider(TTree* tree, const char *varexp, const char *selection, Option_t *option="",
00098                   Long64_t nentries=0, Long64_t firstentry=0);
00099    ~TSpider();
00100    void           AddSuperposed(TSpider* sp);
00101    void           AddVariable(const char* varexp); // *MENU*
00102    void           DeleteVariable(const char* varexp); // *MENU*
00103    virtual void   Draw(Option_t *options="");
00104    virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py);
00105    virtual void   ExecuteEvent(Int_t event, Int_t px, Int_t py);
00106    Style_t        GetAverageLineStyle() const;
00107    Color_t        GetAverageLineColor() const;
00108    Width_t        GetAverageLineWidth() const;
00109    Color_t        GetAverageFillColor() const;
00110    Style_t        GetAverageFillStyle() const;
00111    Bool_t         GetDisplayAverage() const {return fDisplayAverage;}
00112    Long64_t       GetCurrentEntry() const {return fEntry;}
00113    Long64_t       GetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const;
00114    Int_t          GetNx() const {return fNx;}
00115    Int_t          GetNy() const {return fNy;}
00116    Bool_t         GetSegmentDisplay() const {return fSegmentDisplay;}
00117    void           GotoEntry(Long64_t e); // *MENU*
00118    void           GotoNext(); // *MENU*
00119    void           GotoPrevious(); // *MENU*
00120    void           GotoFollowing(); // *MENU*
00121    void           GotoPreceding(); // *MENU*
00122    virtual void   Paint(Option_t *options);
00123    void           SetAverageLineStyle(Style_t sty);
00124    void           SetAverageLineColor(Color_t col);
00125    void           SetAverageLineWidth(Width_t wid);
00126    void           SetAverageFillColor(Color_t col);
00127    void           SetAverageFillStyle(Style_t sty);
00128    virtual void   SetLineStyle(Style_t sty);
00129    virtual void   SetLineColor(Color_t col);
00130    virtual void   SetLineWidth(Width_t wid);
00131    virtual void   SetFillColor(Color_t col);
00132    virtual void   SetFillStyle(Style_t sty);
00133    void           SetDisplayAverage(Bool_t disp); // *TOGGLE*
00134    void           SetVariablesExpression(const char* varexp);
00135    void           SetNdivRadial(Int_t div); // *MENU*
00136    void           SetNx(UInt_t nx); // *MENU*
00137    void           SetNy(UInt_t ny); // *MENU*
00138    void           SetSelectionExpression(const char* selexp);
00139    void           SetSegmentDisplay(Bool_t seg); // *TOGGLE*
00140    void           SetShowRange(Bool_t showrange) {fShowRange = showrange;}
00141    void           SuperposeTo(TSpider* sp) {sp->AddSuperposed(this);}
00142 
00143    ClassDef(TSpider,0)  //Helper class to draw spider
00144 };
00145 
00146 #endif

Generated on Tue Jul 5 14:28:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1