TTreeCache.h

Go to the documentation of this file.
00001 // @(#)root/tree:$Id: TTreeCache.h 34935 2010-08-23 09:13:37Z brun $
00002 // Author: Rene Brun   04/06/2006
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_TTreeCache
00013 #define ROOT_TTreeCache
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TTreeCache                                                           //
00019 //                                                                      //
00020 // Specialization of TFileCacheRead for a TTree                         //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TFileCacheRead
00025 #include "TFileCacheRead.h"
00026 #endif
00027 #ifndef ROOT_TObjArray
00028 #include "TObjArray.h"
00029 #endif
00030 
00031 class TTree;
00032 class TBranch;
00033 
00034 class TTreeCache : public TFileCacheRead {
00035 
00036 protected:
00037    Long64_t        fEntryMin;    //! first entry in the cache
00038    Long64_t        fEntryMax;    //! last entry in the cache
00039    Long64_t        fEntryCurrent;//! current lowest entry number in the cache
00040    Long64_t        fEntryNext;   //! next entry number where cache must be filled
00041    Long64_t        fZipBytes;    //! Total compressed size of branches in cache
00042    Int_t           fNbranches;   //! Number of branches in the cache
00043    Int_t           fNReadOk;     //Number of blocks read and found in the cache
00044    Int_t           fNReadMiss;   //Number of blocks read and not found in the chache
00045    Int_t           fNReadPref;   //Number of blocks that were prefetched
00046    TObjArray      *fBranches;    //! List of branches to be stored in the cache
00047    TList          *fBrNames;     //! list of branch names in the cache
00048    TTree          *fOwner;       //! pointer to the owner Tree/chain
00049    TTree          *fTree;        //! pointer to the current Tree
00050    Bool_t          fIsLearning;  //! true if cache is in learning mode
00051    Bool_t          fIsManual;    //! true if cache is StopLearningPhase was used
00052    static  Int_t fgLearnEntries; //Number of entries used for learning mode
00053 
00054 private:
00055    TTreeCache(const TTreeCache &);            //this class cannot be copied
00056    TTreeCache& operator=(const TTreeCache &);
00057 
00058 public:
00059    TTreeCache();
00060    TTreeCache(TTree *tree, Int_t buffersize=0);
00061    virtual ~TTreeCache();
00062    virtual void        AddBranch(TBranch *b, Bool_t subbranches = kFALSE);
00063    virtual void        AddBranch(const char *branch, Bool_t subbranches = kFALSE);
00064    Double_t            GetEfficiency() const;
00065    Double_t            GetEfficiencyRel() const;
00066    static Int_t        GetLearnEntries();
00067 
00068    virtual Bool_t      FillBuffer();
00069    TTree              *GetOwner() const;
00070    TTree              *GetTree() const;
00071    virtual Bool_t      IsLearning() const {return fIsLearning;}
00072    virtual void        Print(Option_t *option="") const;
00073    virtual Int_t       ReadBuffer(char *buf, Long64_t pos, Int_t len);
00074    virtual void        ResetCache();
00075    virtual void        SetEntryRange(Long64_t emin,   Long64_t emax);
00076    static void         SetLearnEntries(Int_t n = 10);
00077    void                StartLearningPhase();
00078    virtual void        StopLearningPhase();
00079    virtual void        UpdateBranches(TTree *tree, Bool_t owner = kFALSE);
00080 
00081    ClassDef(TTreeCache,2)  //Specialization of TFileCacheRead for a TTree
00082 };
00083 
00084 #endif

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