Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TBranch.h

Go to the documentation of this file.
00001 // @(#)root/tree:$Name:  $:$Id: TBranch.h,v 1.18 2003/04/30 16:29:31 brun Exp $
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_TBranch
00013 #define ROOT_TBranch
00014 
00015 
00017 //                                                                      //
00018 // TBranch                                                              //
00019 //                                                                      //
00020 // A TTree object is a list of TBranchs.                                //
00021 //   A TBranch describes the branch data structure and supports :       //
00022 //     the list of TBaskets (branch buffers) associated to this branch. //
00023 //     the list of TLeaves (branch description)                         //
00025 
00026 
00027 #ifndef ROOT_TNamed
00028 #include "TNamed.h"
00029 #endif
00030 
00031 #ifndef ROOT_TObjArray
00032 #include "TObjArray.h"
00033 #endif
00034 
00035 #ifndef ROOT_TStringLong
00036 #include "TStringLong.h"
00037 #endif
00038 
00039 #ifndef ROOT_TAttFill
00040 #include "TAttFill.h"
00041 #endif
00042 
00043 #ifndef ROOT_Htypes
00044 #include "Htypes.h"
00045 #endif
00046 
00047 class TTree;
00048 class TBasket;
00049 class TLeaf;
00050 class TBrowser;
00051 class TDirectory;
00052 class TFile;
00053 class TClonesArray;
00054 
00055    const Int_t kDoNotProcess = BIT(10); // Active bit for branches
00056    const Int_t kIsClone      = BIT(11); // to indicate a TBranchClones
00057    const Int_t kBranchObject = BIT(12); // branch is a TObject*
00058 
00059 class TBranch : public TNamed , public TAttFill {
00060 
00061 protected:
00062     // TBranch status bits
00063     enum { kAutoDelete = BIT(15) };
00064 
00065    static Int_t fgCount;          
00066     Int_t       fCompress;        //  (=1 branch is compressed, 0 otherwise)
00067     Int_t       fBasketSize;      //  Initial Size of  Basket Buffer
00068     Int_t       fEntryOffsetLen;  //  Initial Length of fEntryOffset table in the basket buffers
00069     Int_t       fWriteBasket;     //  Last basket number written
00070     Int_t       fEntryNumber;     //  Current entry number (last one filled in this branch)
00071     Int_t       fOffset;          //  Offset of this branch
00072     Int_t       fMaxBaskets;      //  Maximum number of Baskets so far
00073     Int_t       fSplitLevel;      //  Branch split level
00074     Int_t       fNleaves;         
00075     Int_t       fReadBasket;      
00076     Int_t       fReadEntry;       
00077     Stat_t      fEntries;         //  Number of entries
00078     Stat_t      fTotBytes;        //  Total number of bytes in all leaves before compression
00079     Stat_t      fZipBytes;        //  Total number of bytes in all leaves after compression
00080     TObjArray   fBranches;        //-> List of Branches of this branch
00081     TObjArray   fLeaves;          //-> List of leaves of this branch
00082     TObjArray   fBaskets;         //-> List of baskets of this branch
00083     Int_t       fNBasketRAM;      
00084     Int_t      *fBasketRAM;       
00085     Int_t      *fBasketBytes;     //[fMaxBaskets] Lenght of baskets on file
00086     Int_t      *fBasketEntry;     //[fMaxBaskets] Table of first entry in eack basket
00087     Seek_t     *fBasketSeek;      //[fMaxBaskets] Addresses of baskets on file
00088     TTree      *fTree;            
00089     char       *fAddress;         
00090     TDirectory *fDirectory;       
00091     TString     fFileName;        //  Name of file where buffers are stored ("" if in same file as Tree header)
00092     TBuffer    *fEntryBuffer;     
00093 
00094     Bool_t      fSkipZip;         
00095        void     SetSkipZip(Bool_t skip = kTRUE) { fSkipZip = skip; }
00096        void     WriteBasket(TBasket* basket);
00097 
00098 public:
00099     TBranch();
00100     TBranch(const char *name, void *address, const char *leaflist, Int_t basketsize=32000, Int_t compress=-1);
00101     virtual ~TBranch();
00102 
00103     virtual void     Browse(TBrowser *b);
00104     virtual void     DropBaskets();
00105     virtual Int_t    Fill();
00106     virtual void     FillLeaves(TBuffer &b);
00107     virtual TBranch *FindBranch(const char *name);
00108     virtual TLeaf   *FindLeaf(const char *name);
00109     virtual char    *GetAddress() const {return fAddress;}
00110     virtual Int_t    GetBasketSize() const {return fBasketSize;}
00111     virtual const char* GetClassName() const { return ""; }
00112     virtual Int_t    GetCompressionLevel() const {return fCompress;}
00113     virtual Int_t    GetEntry(Int_t entry=0, Int_t getall = 0);
00114     virtual Int_t    GetEntryExport(Int_t entry, Int_t getall, TClonesArray *list, Int_t n);
00115             Int_t    GetEvent(Int_t entry=0) {return GetEntry(entry);}
00116             Int_t    GetEntryOffsetLen() const {return fEntryOffsetLen;}
00117     const char      *GetIconName() const;
00118     virtual TLeaf   *GetLeaf(const char *name) const;
00119             TBasket *GetBasket(Int_t basket);
00120             Int_t   *GetBasketBytes() const {return fBasketBytes;}
00121             Int_t   *GetBasketEntry() const {return fBasketEntry;}
00122     virtual Seek_t   GetBasketSeek(Int_t basket) const;
00123     TDirectory      *GetDirectory() const {return fDirectory;}
00124     virtual TFile   *GetFile(Int_t mode=0);
00125     const char      *GetFileName() const {return fFileName.Data();}
00126             Int_t    GetOffset() const {return fOffset;}
00127             Int_t    GetReadBasket() const {return fReadBasket;}
00128             Int_t    GetReadEntry() const {return fReadEntry;}
00129             Int_t    GetWriteBasket() const {return fWriteBasket;}
00130             Stat_t   GetTotalSize() const;
00131             Stat_t   GetTotBytes() const {return fTotBytes;}
00132             Stat_t   GetZipBytes() const {return fZipBytes;}
00133             Int_t    GetEntryNumber() const {return fEntryNumber;}
00134           TObjArray *GetListOfBaskets()  {return &fBaskets;}
00135           TObjArray *GetListOfBranches() {return &fBranches;}
00136           TObjArray *GetListOfLeaves()   {return &fLeaves;}
00137             Int_t    GetMaxBaskets() const  {return fMaxBaskets;}
00138             Int_t    GetNleaves() const {return fNleaves;}
00139             Int_t    GetSplitLevel() const {return fSplitLevel;}
00140             Stat_t   GetEntries() const {return fEntries;}
00141             TTree   *GetTree() const {return fTree;}
00142     virtual Int_t    GetRow(Int_t row);
00143     TBranch         *GetMother() const;
00144     TBranch         *GetSubBranch(const TBranch *br) const;
00145     Bool_t           IsAutoDelete() const;
00146     Bool_t           IsFolder() const;
00147     virtual void     Print(Option_t *option="") const;
00148     virtual void     ReadBasket(TBuffer &b);
00149     virtual void     ReadLeaves(TBuffer &b);
00150     virtual void     Reset(Option_t *option="");
00151     virtual void     ResetReadEntry() {fReadEntry = -1;}
00152     virtual void     SetAddress(void *add);
00153     virtual void     SetAutoDelete(Bool_t autodel=kTRUE);
00154     virtual void     SetBasketSize(Int_t buffsize);
00155     virtual void     SetBufferAddress(TBuffer *entryBuffer);
00156     virtual void     SetCompressionLevel(Int_t level=1);
00157     virtual void     SetEntryOffsetLen(Int_t len) {fEntryOffsetLen = len;}
00158     virtual void     SetFile(TFile *file=0);
00159     virtual void     SetFile(const char *filename);
00160     virtual void     SetOffset(Int_t offset=0) {fOffset=offset;}
00161     virtual void     SetTree(TTree *tree) { fTree = tree;}
00162     virtual void     UpdateAddress() {;}
00163     
00164     static  void     ResetCount() {fgCount = 0;}
00165 
00166     ClassDef(TBranch,8)  //Branch descriptor
00167 };
00168 
00169 #endif

Generated on Thu Dec 18 14:52:16 2003 for ROOT by doxygen1.2.16