TTreePlayer.h

Go to the documentation of this file.
00001 // @(#)root/treeplayer:$Id: TTreePlayer.h 31561 2009-12-04 16:31:47Z brun $
00002 // Author: Rene Brun   12/01/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, 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_TTreePlayer
00013 #define ROOT_TTreePlayer
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TTreePlayer                                                          //
00019 //                                                                      //
00020 // A TTree object is a list of TBranch.                                 //
00021 //   To Create a TTree object one must:                                 //
00022 //    - Create the TTree header via the TTree constructor               //
00023 //    - Call the TBranch constructor for every branch.                  //
00024 //                                                                      //
00025 //   To Fill this object, use member function Fill with no parameters.  //
00026 //     The Fill function loops on all defined TBranch.                  //
00027 //                                                                      //
00028 //////////////////////////////////////////////////////////////////////////
00029 
00030 #ifndef ROOT_TTree
00031 #include "TTree.h"
00032 #endif
00033 #ifndef ROOT_TSelectorDraw
00034 #include "TSelectorDraw.h"
00035 #endif
00036 #ifndef ROOT_TVirtualTreePlayer
00037 #include "TVirtualTreePlayer.h"
00038 #endif
00039 
00040 
00041 class TVirtualIndex;
00042 
00043 class TTreePlayer : public TVirtualTreePlayer {
00044 
00045 private:
00046    TTreePlayer(const TTreePlayer &);
00047    TTreePlayer& operator=(const TTreePlayer &);
00048 
00049 protected:
00050    TTree         *fTree;            //!  Pointer to current Tree
00051    Bool_t         fScanRedirect;    //  Switch to redirect TTree::Scan output to a file
00052    const char    *fScanFileName;    //  Name of the file where Scan is redirected
00053    Int_t          fDimension;       //  Dimension of the current expression
00054    Long64_t       fSelectedRows;    //  Number of selected entries
00055    TH1           *fHistogram;       //! Pointer to histogram used for the projection
00056    TSelectorDraw *fSelector;        //! Pointer to current selector
00057    TSelector     *fSelectorFromFile;//! Pointer to a user defined selector created by this TTreePlayer object
00058    TClass        *fSelectorClass;   //! Pointer to the actual class of the TSelectorFromFile
00059    TList         *fInput;           //! input list to the selector
00060    TList         *fFormulaList;     //! Pointer to a list of coordinated list TTreeFormula (used by Scan and Query)
00061    TSelector     *fSelectorUpdate;  //! Set to the selector address when it's entry list needs to be updated by the UpdateFormulaLeaves function
00062 
00063 protected:
00064    const   char  *GetNameByIndex(TString &varexp, Int_t *index,Int_t colindex);
00065    void           TakeAction(Int_t nfill, Int_t &npoints, Int_t &action, TObject *obj, Option_t *option);
00066    void           TakeEstimate(Int_t nfill, Int_t &npoints, Int_t action, TObject *obj, Option_t *option);
00067    void           DeleteSelectorFromFile();
00068    
00069 public:
00070    TTreePlayer();
00071    virtual ~TTreePlayer();   
00072    virtual TVirtualIndex *BuildIndex(const TTree *T, const char *majorname, const char *minorname);
00073    virtual TTree    *CopyTree(const char *selection, Option_t *option
00074                               ,Long64_t nentries, Long64_t firstentry);
00075    virtual Long64_t  DrawScript(const char* wrapperPrefix,
00076                                 const char *macrofilename, const char *cutfilename,
00077                                 Option_t *option, Long64_t nentries, Long64_t firstentry);
00078    virtual Long64_t  DrawSelect(const char *varexp, const char *selection, Option_t *option
00079                                 ,Long64_t nentries, Long64_t firstentry);
00080    virtual Int_t     Fit(const char *formula ,const char *varexp, const char *selection,Option_t *option ,
00081                          Option_t *goption ,Long64_t nentries, Long64_t firstentry);
00082    virtual Int_t     GetDimension() const {return fDimension;}
00083    TH1              *GetHistogram() const {return fHistogram;}
00084    virtual Long64_t  GetEntries(const char *selection);
00085    virtual Long64_t  GetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const;
00086    virtual Int_t     GetNfill() const {return fSelector->GetNfill();}
00087    const char       *GetScanFileName() const {return fScanFileName;}
00088    TTreeFormula     *GetSelect() const    {return fSelector->GetSelect();}
00089    virtual Long64_t  GetSelectedRows() const {return fSelectedRows;}
00090    TSelector        *GetSelector() const {return fSelector;}
00091    TSelector        *GetSelectorFromFile() const {return fSelectorFromFile;}
00092    TTreeFormula     *GetVar(Int_t i) const {return fSelector->GetVar(i);};
00093    TTreeFormula     *GetVar1() const {return fSelector->GetVar1();}
00094    TTreeFormula     *GetVar2() const {return fSelector->GetVar2();}
00095    TTreeFormula     *GetVar3() const {return fSelector->GetVar3();}
00096    TTreeFormula     *GetVar4() const {return fSelector->GetVar4();}
00097    virtual Double_t *GetVal(Int_t i) const {return fSelector->GetVal(i);};
00098    virtual Double_t *GetV1() const   {return fSelector->GetV1();}
00099    virtual Double_t *GetV2() const   {return fSelector->GetV2();}
00100    virtual Double_t *GetV3() const   {return fSelector->GetV3();}
00101    virtual Double_t *GetV4() const   {return fSelector->GetV4();}
00102    virtual Double_t *GetW() const    {return fSelector->GetW();}
00103    virtual Int_t     MakeClass(const char *classname, Option_t *option);
00104    virtual Int_t     MakeCode(const char *filename);
00105    virtual Int_t     MakeProxy(const char *classname,
00106                                const char *macrofilename = 0, const char *cutfilename = 0,
00107                                const char *option = 0, Int_t maxUnrolling = 3);
00108    TPrincipal       *Principal(const char *varexp, const char *selection, Option_t *option
00109                                ,Long64_t nentries, Long64_t firstentry);
00110    virtual Long64_t  Process(const char *filename,Option_t *option, Long64_t nentries, Long64_t firstentry);
00111    virtual Long64_t  Process(TSelector *selector,Option_t *option,  Long64_t nentries, Long64_t firstentry);
00112    virtual void      RecursiveRemove(TObject *obj);
00113    virtual Long64_t  Scan(const char *varexp, const char *selection, Option_t *option
00114                           ,Long64_t nentries, Long64_t firstentry);
00115    Bool_t            ScanRedirected() {return fScanRedirect;}
00116    virtual TSQLResult *Query(const char *varexp, const char *selection, Option_t *option
00117                              ,Long64_t nentries, Long64_t firstentry);
00118    virtual void      SetEstimate(Long64_t n);
00119    void              SetScanRedirect(Bool_t on=kFALSE) {fScanRedirect = on;}
00120    void              SetScanFileName(const char *name) {fScanFileName=name;}
00121    virtual void      SetTree(TTree *t) {fTree = t;}
00122    virtual void      StartViewer(Int_t ww, Int_t wh);
00123    virtual Int_t     UnbinnedFit(const char *formula ,const char *varexp, const char *selection,Option_t *option
00124                                  ,Long64_t nentries, Long64_t firstentry);
00125    virtual void      UpdateFormulaLeaves();
00126 
00127    ClassDef(TTreePlayer,3);  //Manager class to play with TTrees
00128 };
00129 
00130 #endif

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