library: libTree #include "TTreeFilePrefetch.h" |
TTreeFilePrefetch
class description - source file - inheritance tree (.pdf)
protected:
TTreeFilePrefetch(const TTreeFilePrefetch&)
TTreeFilePrefetch& operator=(const TTreeFilePrefetch&)
public:
TTreeFilePrefetch()
TTreeFilePrefetch(TTree* tree, Int_t buffersize = 0)
virtual ~TTreeFilePrefetch()
void AddBranch(TBranch* b)
static TClass* Class()
Bool_t FillBuffer()
static Int_t GetLearnEntries()
TTree* GetTree() const
virtual TClass* IsA() const
Bool_t IsLearning() const
virtual Bool_t ReadBuffer(char* buf, Long64_t pos, Int_t len)
void SetEntryRange(Long64_t emin, Long64_t emax)
static void SetLearnEntries(Int_t n = 100)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
void UpdateBranches(TTree* tree)
protected:
Long64_t fEntryMin ! first entry in the cache
Long64_t fEntryMax ! last entry in the cache
Long64_t fEntryNext ! next entry number where cache must be filled
Long64_t fZipBytes ! Total compressed size of branches in cache
Int_t fNbranches ! Number of branches in the cache
TBranch** fBranches ! [fNbranches] List of branches to be stored in the cache
TList* fBrNames ! list of branch names in the cache
TTree* fOwner ! pointer to the owner Tree/chain
TTree* fTree ! pointer to the current Tree
Bool_t fIsLearning ! true if cache is in learning mode
static Int_t fgLearnEntries Number of entries used for learning mode
TTreeFilePrefetch
A specialized TFilePrefetch object for a TTree
This class acts as a file cache, registering automatically the
baskets from the branches being processed (TTree::Draw or
TTree::Process and TSelectors) when in the learning phase.
The learning phase is by default 100 entries.
It can be changed via TTreeFileFrefetch::SetLearnEntries.
This cache speeds-up considerably the performance, in particular
when the Tree is accessed remotely via a high latency network.
The default cache size (10 Mbytes) may be changed via the function
TTreeFilePrefetch::SetCacheSize
Only the baskets for the requested entry range are put in the cache
For each Tree being processed a TTreeFilePrefetch object is created.
This object is automatically deleted when the Tree is deleted or
when the file is deleted.
-Special case of a TChain
Once the training is done on the first Tree, the list of branches
in the cache is kept for the following files.
-Special case of a TEventlist
if the Tree or TChain has a TEventlist, only the buffers
referenced by the list are put in the cache.
TTreeFilePrefetch() : TFilePrefetch(),
fEntryMin(0),
fEntryMax(1),
fEntryNext(1),
fZipBytes(0),
fNbranches(0),
fBranches(0),
fBrNames(0),
fOwner(0),
fTree(0),
fIsLearning(kTRUE)
Default Constructor.
TTreeFilePrefetch(TTree *tree, Int_t buffersize) : TFilePrefetch(tree->GetCurrentFile(),buffersize),
fEntryMin(0),
fEntryMax(tree->GetEntriesFast()),
fEntryNext(0),
fZipBytes(0),
fNbranches(0),
fBranches(0),
fBrNames(new TList),
fOwner(tree),
fTree(0),
fIsLearning(kTRUE)
Constructor.
TTreeFilePrefetch(const TTreeFilePrefetch &pf) : TFilePrefetch(pf)
Copy Constructor.
~TTreeFilePrefetch()
destructor. (in general called by the TFile destructor
void AddBranch(TBranch *b)
add a branch to the list of branches to be stored in the cache
this function is called by TBranch::GetBasket
Bool_t FillBuffer()
Fill the cache buffer with the branchse in the cache
Int_t GetLearnEntries()
static function returning the number of entries used to train the cache
see SetLearnEntries
TTree* GetTree() const
return Tree in the cache
Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Read buffer at position pos.
If pos is in the list of prefetched blocks read from fBuffer,
then try to fill the cache from the list of selected branches,
otherwise normal read from file. Returns kTRUE in case of failure.
This function overloads TFilePrefetch::ReadBuffer.
It returns kFALSE if the requested block is in the cache
void SetEntryRange(Long64_t emin, Long64_t emax)
Set the minimum and maximum entry number to be processed
this information helps to optimize the number of baskets to read
when prefetching the branch buffers.
void SetLearnEntries(Int_t n)
Static function to set the number of entries to be used in learning mode
The default value for n is 10. n must be >= 1
void UpdateBranches(TTree *tree)
update pointer to current Tree and recompute pointers to the branches in the cache
Inline Functions
TTreeFilePrefetch& operator=(const TTreeFilePrefetch&)
Bool_t IsLearning() const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Author: Rene Brun 04/06/2006
Last update: root/tree:$Name: $:$Id: TTreeFilePrefetch.cxx,v 1.12 2006/06/19 09:35:45 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.