#ifndef ROOT_TTreeCache
#define ROOT_TTreeCache
#ifndef ROOT_TFileCacheRead
#include "TFileCacheRead.h"
#endif
#ifndef ROOT_TObjArray
#include "TObjArray.h"
#endif
class TTree;
class TBranch;
class TTreeCache : public TFileCacheRead {
public:
enum EPrefillType { kNoPrefill, kAllBranches };
protected:
Long64_t fEntryMin;
Long64_t fEntryMax;
Long64_t fEntryCurrent;
Long64_t fEntryNext;
Int_t fNbranches;
Int_t fNReadOk;
Int_t fNReadMiss;
Int_t fNReadPref;
TObjArray *fBranches;
TList *fBrNames;
TTree *fTree;
Bool_t fIsLearning;
Bool_t fIsManual;
Bool_t fFirstBuffer;
Bool_t fOneTime;
Bool_t fReverseRead;
Int_t fFillTimes;
Bool_t fFirstTime;
Long64_t fFirstEntry;
Bool_t fReadDirectionSet;
Bool_t fEnabled;
EPrefillType fPrefillType;
static Int_t fgLearnEntries;
Bool_t fAutoCreated;
private:
TTreeCache(const TTreeCache &);
TTreeCache& operator=(const TTreeCache &);
public:
TTreeCache();
TTreeCache(TTree *tree, Int_t buffersize=0);
virtual ~TTreeCache();
virtual void AddBranch(TBranch *b, Bool_t subgbranches = kFALSE);
virtual void AddBranch(const char *branch, Bool_t subbranches = kFALSE);
virtual void DropBranch(TBranch *b, Bool_t subbranches = kFALSE);
virtual void DropBranch(const char *branch, Bool_t subbranches = kFALSE);
virtual void Disable() {fEnabled = kFALSE;}
virtual void Enable() {fEnabled = kTRUE;}
const TObjArray *GetCachedBranches() const { return fBranches; }
EPrefillType GetConfiguredPrefillType() const;
Double_t GetEfficiency() const;
Double_t GetEfficiencyRel() const;
virtual Int_t GetEntryMin() const {return fEntryMin;}
virtual Int_t GetEntryMax() const {return fEntryMax;}
static Int_t GetLearnEntries();
virtual EPrefillType GetLearnPrefill() const {return fPrefillType;}
TTree *GetTree() const {return fTree;}
Bool_t IsAutoCreated() const {return fAutoCreated;}
virtual Bool_t IsEnabled() const {return fEnabled;}
virtual Bool_t IsLearning() const {return fIsLearning;}
virtual Bool_t FillBuffer();
virtual void LearnPrefill();
virtual void Print(Option_t *option="") const;
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
virtual Int_t ReadBufferNormal(char *buf, Long64_t pos, Int_t len);
virtual Int_t ReadBufferPrefetch(char *buf, Long64_t pos, Int_t len);
virtual void ResetCache();
void SetAutoCreated(Bool_t val) {fAutoCreated = val;}
virtual void SetEntryRange(Long64_t emin, Long64_t emax);
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect);
virtual void SetLearnPrefill(EPrefillType type = kNoPrefill);
static void SetLearnEntries(Int_t n = 10);
void StartLearningPhase();
virtual void StopLearningPhase();
virtual void UpdateBranches(TTree *tree);
ClassDef(TTreeCache,2)
};
#endif