TBranch


class description - source file - inheritance tree

class TBranch : public TNamed, public TAttFill


    public:
TBranch TBranch() TBranch TBranch(const char* name, void* address, const char* leaflist, Int_t basketsize = 32000, Int_t compress = -1) virtual void ~TBranch() virtual void Browse(TBrowser* b) static TClass* Class() virtual void DropBaskets() virtual Int_t Fill() virtual void FillLeaves(TBuffer& b) virtual TBranch* FindBranch(const char* name) virtual TLeaf* FindLeaf(const char* name) virtual char* GetAddress() const TBasket* GetBasket(Int_t basket) Int_t* GetBasketBytes() const Int_t* GetBasketEntry() const virtual Seek_t GetBasketSeek(Int_t basket) const virtual Int_t GetBasketSize() const virtual const char* GetClassName() const virtual Int_t GetCompressionLevel() const TDirectory* GetDirectory() const Stat_t GetEntries() const virtual Int_t GetEntry(Int_t entry = 0, Int_t getall = 0) virtual Int_t GetEntryExport(Int_t entry, Int_t getall, TClonesArray* list, Int_t n) Int_t GetEntryNumber() const Int_t GetEntryOffsetLen() const Int_t GetEvent(Int_t entry = 0) virtual TFile* GetFile(Int_t mode = 0) const char* GetFileName() const virtual const char* GetIconName() const virtual TLeaf* GetLeaf(const char* name) const TObjArray* GetListOfBaskets() TObjArray* GetListOfBranches() TObjArray* GetListOfLeaves() Int_t GetMaxBaskets() const Int_t GetNleaves() const Int_t GetOffset() const Int_t GetReadBasket() const Int_t GetReadEntry() const virtual Int_t GetRow(Int_t row) Int_t GetSplitLevel() const Stat_t GetTotalSize() const Stat_t GetTotBytes() const TTree* GetTree() const Int_t GetWriteBasket() const Stat_t GetZipBytes() const virtual TClass* IsA() const Bool_t IsAutoDelete() const virtual Bool_t IsFolder() const virtual void Print(Option_t* option) const virtual void ReadBasket(TBuffer& b) virtual void ReadLeaves(TBuffer& b) virtual void Reset(Option_t* option) static void ResetCount() virtual void ResetReadEntry() virtual void SetAddress(void* add) virtual void SetAutoDelete(Bool_t autodel = kTRUE) virtual void SetBasketSize(Int_t buffsize) virtual void SetBufferAddress(TBuffer* entryBuffer) virtual void SetCompressionLevel(Int_t level = 1) virtual void SetEntryOffsetLen(Int_t len) virtual void SetFile(TFile* file = 0) virtual void SetFile(const char* filename) virtual void SetOffset(Int_t offset = 0) virtual void SetTree(TTree* tree) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void UpdateAddress()

Data Members


    protected:
static Int_t fgCount ! branch counter Int_t fCompress (=1 branch is compressed, 0 otherwise) Int_t fBasketSize Initial Size of Basket Buffer Int_t fEntryOffsetLen Initial Length of fEntryOffset table in the basket buffers Int_t fWriteBasket Last basket number written Int_t fEntryNumber Current entry number (last one filled in this branch) Int_t fOffset Offset of this branch Int_t fMaxBaskets Maximum number of Baskets so far Int_t fSplitLevel Branch split level Int_t fNleaves ! Number of leaves Int_t fReadBasket ! Current basket number when reading Int_t fReadEntry ! Current entry number when reading Stat_t fEntries Number of entries Stat_t fTotBytes Total number of bytes in all leaves before compression Stat_t fZipBytes Total number of bytes in all leaves after compression TObjArray fBranches -> List of Branches of this branch TObjArray fLeaves -> List of leaves of this branch TObjArray fBaskets -> List of baskets of this branch Int_t fNBasketRAM ! Number of baskets in fBasketRAM Int_t* fBasketRAM ! [fNBasketRAM] table of basket numbers in memory Int_t* fBasketBytes [fMaxBaskets] Lenght of baskets on file Int_t* fBasketEntry [fMaxBaskets] Table of first entry in eack basket Seek_t* fBasketSeek [fMaxBaskets] Addresses of baskets on file TTree* fTree ! Pointer to Tree header char* fAddress ! Address of 1st leaf (variable or object) TDirectory* fDirectory ! Pointer to directory where this branch buffers are stored TString fFileName Name of file where buffers are stored ("" if in same file as Tree header) TBuffer* fEntryBuffer ! Buffer used to directly pass the content without streaming public:
static const enum TObject:: kAutoDelete


See also

TBranchClones, TBranchElement, TBranchObject, THbookBranch

Class Description

                                                                      
 A TTree is a list of TBranches                                       //                                                                      
                                                                      
 A TBranch supports:                                                  
   - The list of TLeaf describing this branch.                        
   - The list of TBasket (branch buffers).                            
                                                                      
       See TBranch structure in TTree.                                
                                                                      
 See also specialized branches:                                       
     TBranchObject in case the branch is one object                   
     TBranchClones in case the branch is an array of clone objects    


TBranch(): TNamed(), TAttFill(0,1001)
*-*-*-*-*-*Default constructor for Branch*-*-*-*-*-*-*-*-*-*
*-*        ===================================

TBranch(const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress) :TNamed(name,leaflist), TAttFill(0,1001)
*-*-*-*-*-*-*-*-*-*-*-*-*Create a Branch*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                =====================

       * address is the address of the first item of a structure
         or the address of a pointer to an object (see example).
       * leaflist is the concatenation of all the variable names and types
         separated by a colon character :
         The variable name and the variable type are separated by a slash (/).
         The variable type may be 0,1 or 2 characters. If no type is given,
         the type of the variable is assumed to be the same as the previous
         variable. If the first variable does not have a type, it is assumed
         of type F by default. The list of currently supported types is given below:
            - C : a character string terminated by the 0 character
            - B : an 8 bit signed integer (Char_t)
            - b : an 8 bit unsigned integer (UChar_t)
            - S : a 16 bit signed integer (Short_t)
            - s : a 16 bit unsigned integer (UShort_t)
            - I : a 32 bit signed integer (Int_t)
            - i : a 32 bit unsigned integer (UInt_t)
            - F : a 32 bit floating point (Float_t)
            - D : a 64 bit floating point (Double_t)

         By default, a variable will be copied to the buffer with the number of
         bytes specified in the type descriptor character. However, if the type
         consists of 2 characters, the second character is an integer that
         specifies the number of bytes to be used when copying the variable
         to the output buffer. Example:
             X         ; variable X, type Float_t
             Y/I       : variable Y, type Int_t
             Y/I2      ; variable Y, type Int_t converted to a 16 bits integer

   See an example of a Branch definition in the TTree constructor.

   Note that in case the data type is an object, this branch can contain
   only this object.

    Note that this function is invoked by TTree::Branch

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

~TBranch()
*-*-*-*-*-*Default destructor for a Branch*-*-*-*-*-*-*-*-*-*-*-*
*-*        ===============================

void Browse(TBrowser *b)
 Browser interface.

void DropBaskets()
   Loop on all branch baskets.  Drop all except readbasket

Int_t Fill()
*-*-*-*-*-*-*-*Loop on all leaves of this branch to fill Basket buffer*-*-*
*-*            =======================================================

void FillLeaves(TBuffer &b)

TBranch* FindBranch(const char* searchname)

TLeaf* FindLeaf(const char* searchname)

TBasket* GetBasket(Int_t basketnumber)
*-*-*-*-*Return pointer to basket basketnumber in this Branch*-*-*-*-*-*
*-*      ====================================================

Seek_t GetBasketSeek(Int_t basketnumber) const
*-*-*-*-*Return address of basket in the file*-*-*-*-*-*
*-*      ====================================

const char* GetIconName() const
 Return icon name depending on type of branch.

Int_t GetEntry(Int_t entry, Int_t getall)
*-*-*-*-*-*Read all leaves of entry and return total number of bytes*-*-*
*-*        =========================================================
 The input argument entry is the entry serial number in the current tree.
 In case of a TChain, the entry number in the current Tree must be found
  before calling this function. example with TChain *chain;
  Int_t localEntry = chain->LoadTree(entry);
  branch->GetEntry(localEntry);

  The function returns the number of bytes read from the input buffer.
  If entry does not exist  the function returns 0.
  If an I/O error occurs,  the function returns -1.

  See IMPORTANT REMARKS in TTree::GetEntry

Int_t GetEntryExport(Int_t entry, Int_t /*getall*/, TClonesArray *list, Int_t nentries)
*-*-*-*-*-*Read all leaves of entry and return total number of bytes*-*-*
*-* export buffers to real objects in the TClonesArray list.
*-*

TFile* GetFile(Int_t mode)
  Return pointer to the file where branch buffers reside

TLeaf* GetLeaf(const char *name) const
*-*-*-*-*-*Return pointer to the 1st Leaf named name in thisBranch-*-*-*-*-*
*-*        =======================================================

Int_t GetRow(Int_t)
*-*-*-*-*Return all elements of one row unpacked in internal array fValues*-*
*-*      =================================================================

Stat_t GetTotalSize() const
 Return total number of bytes in the branch (including current buffer)
 =====================================================================

Bool_t IsAutoDelete() const
*-*-*-*-*Return TRUE if an existing object in a TBranchObject must be deleted
*-*      ==================================================

Bool_t IsFolder() const
*-*-*-*-*Return TRUE if more than one leaf, FALSE otherwise*-*
*-*      ==================================================

void Print(Option_t *) const
*-*-*-*-*-*-*-*-*-*-*-*Print TBranch parameters*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                    ========================

void ReadBasket(TBuffer &)
*-*-*-*-*-*-*-*Loop on all leaves of this branch to read Basket buffer*-*-*
*-*            =======================================================

void ReadLeaves(TBuffer &b)

void Reset(Option_t *)
*-*-*-*-*-*-*-*Reset a Branch*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*            ====================

    Existing buffers are deleted
    Entries, max and min are reset


void SetAddress(void *add)
*-*-*-*-*-*-*-*Set address of this branch*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*            ====================


void SetAutoDelete(Bool_t autodel)
*-*-*-*-*-*-*-*Set the AutoDelete bit
*-*            ====================
 this bit is used by TBranchObject::ReadBasket to decide if an object
 referenced by a TBranchObject must be deleted or not before reading
 a new entry
 if autodel is kTRUE, this existing object will be deleted, a new object
    created by the default constructor, then object->Streamer
 if autodel is kFALSE, the existing object is not deleted. Root assumes
    that the user is taking care of deleting any internal object or array
    This can be done in Streamer itself.

void SetBasketSize(Int_t buffsize)
 Set the basket size
 The function makes sure that the basket size is greater than fEntryOffsetlen

void SetBufferAddress(TBuffer *buf)
 Set address of this branch directly from a TBuffer to avoid streaming.

void SetCompressionLevel(Int_t level)
*-*-*-*-*-*-*-*Set the branch/subbranches compression level
*-*            ============================================

void SetFile(TFile *file)
 Set file where this branch writes/reads its buffers.
 By default the branch buffers reside in the file where the
 Tree was created.
 If the file name where the tree was created is an absolute
 path name or an URL (e.g. /castor/... or root://host/...)
 and if the fname is not an absolute path name or an URL then
 the path of the tree file is prepended to fname to make the
 branch file relative to the tree file. In this case one can
 move the tree + all branch files to a different location in
 the file system and still access the branch files.
 The ROOT file will be connected only when necessary.
 If called by TBranch::Fill (via TBasket::WriteFile), the file
 will be created with the option "recreate".
 If called by TBranch::GetEntry (via TBranch::GetBasket), the file
 will be opened in read mode.
 To open a file in "update" mode or with a certain compression
 level, use TBranch::SetFile(TFile *file).

void SetFile(const char *fname)
 Set file where this branch writes/reads its buffers.
 By default the branch buffers reside in the file where the
 Tree was created.
 If the file name where the tree was created is an absolute
 path name or an URL (e.g. /castor/... or root://host/...)
 and if the fname is not an absolute path name or an URL then
 the path of the tree file is prepended to fname to make the
 branch file relative to the tree file. In this case one can
 move the tree + all branch files to a different location in
 the file system and still access the branch files.
 The ROOT file will be connected only when necessary.
 If called by TBranch::Fill (via TBasket::WriteFile), the file
 will be created with the option "recreate".
 If called by TBranch::GetEntry (via TBranch::GetBasket), the file
 will be opened in read mode.
 To open a file in "update" mode or with a certain compression
 level, use TBranch::SetFile(TFile *file).

void Streamer(TBuffer &b)
*-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*              =========================================



Inline Functions


              char* GetAddress() const
              Int_t GetBasketSize() const
        const char* GetClassName() const
              Int_t GetCompressionLevel() const
              Int_t GetEvent(Int_t entry = 0)
              Int_t GetEntryOffsetLen() const
             Int_t* GetBasketBytes() const
             Int_t* GetBasketEntry() const
        TDirectory* GetDirectory() const
        const char* GetFileName() const
              Int_t GetOffset() const
              Int_t GetReadBasket() const
              Int_t GetReadEntry() const
              Int_t GetWriteBasket() const
             Stat_t GetTotBytes() const
             Stat_t GetZipBytes() const
              Int_t GetEntryNumber() const
         TObjArray* GetListOfBaskets()
         TObjArray* GetListOfBranches()
         TObjArray* GetListOfLeaves()
              Int_t GetMaxBaskets() const
              Int_t GetNleaves() const
              Int_t GetSplitLevel() const
             Stat_t GetEntries() const
             TTree* GetTree() const
               void ResetReadEntry()
               void SetEntryOffsetLen(Int_t len)
               void SetOffset(Int_t offset = 0)
               void SetTree(TTree* tree)
               void UpdateAddress()
               void ResetCount()
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void StreamerNVirtual(TBuffer& b)


Author: Rene Brun 12/01/96
Last update: root/tree:$Name: $:$Id: TBranch.cxx,v 1.51 2003/02/05 15:07:29 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - 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.