library: libTree
#include "TBranch.h"


class description - header file - source file
viewCVS header - viewCVS source

class TBranch: public TNamed, public TAttFill

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TBranch(const char* name, void* address, const char* leaflist, Int_t basketsize = 32000, Int_t compress = -1)
voidTObject::AbstractMethod(const char* method) const
virtual voidAddBasket(TBasket& b, Bool_t ondisk, Long64_t startEntry)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidDropBaskets(Option_t* option = "")
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual Int_tFill()
virtual voidTNamed::FillBuffer(char*& buffer)
virtual voidFillLeaves(TBuffer& b)
virtual TBranch*FindBranch(const char* name)
virtual TLeaf*FindLeaf(const char* name)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual char*GetAddress() const
TBasket*GetBasket(Int_t basket)
Int_t*GetBasketBytes() const
Long64_t*GetBasketEntry() const
virtual Long64_tGetBasketSeek(Int_t basket) const
virtual Int_tGetBasketSize() const
virtual TList*GetBrowsables()
virtual const char*GetClassName() const
virtual Int_tGetCompressionLevel() const
TDirectory*GetDirectory() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Long64_tGetEntries() const
virtual Int_tGetEntry(Long64_t entry = 0, Int_t getall = 0)
virtual Int_tGetEntryExport(Long64_t entry, Int_t getall, TClonesArray* list, Int_t n)
Long64_tGetEntryNumber() const
Int_tGetEntryOffsetLen() const
Int_tGetEvent(Long64_t entry = 0)
virtual TFile*GetFile(Int_t mode = 0)
const char*GetFileName() const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*GetIconName() const
virtual TLeaf*GetLeaf(const char* name) const
Int_tGetMaxBaskets() const
TBranch*GetMother() const
virtual const char*TNamed::GetName() const
Int_tGetNleaves() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
Int_tGetOffset() const
virtual Option_t*TObject::GetOption() const
Int_tGetReadBasket() const
Long64_tGetReadEntry() const
virtual Int_tGetRow(Int_t row)
Int_tGetSplitLevel() const
TBranch*GetSubBranch(const TBranch* br) const
virtual const char*TNamed::GetTitle() const
Long64_tGetTotalSize() const
Long64_tGetTotBytes() const
TTree*GetTree() const
virtual UInt_tTObject::GetUniqueID() const
Int_tGetWriteBasket() const
Long64_tGetZipBytes() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsAutoDelete() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidKeepCircular(Long64_t maxEntries)
virtual Int_tLoadBaskets()
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttFill::Modify()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidReadBasket(TBuffer& b)
virtual voidReadLeaves(TBuffer& b)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidRefresh(TBranch* b)
virtual voidReset(Option_t* option = "")
virtual voidResetAddress()
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
static voidResetCount()
virtual voidResetReadEntry()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidSetAddress(void* add)
virtual voidSetAutoDelete(Bool_t autodel = kTRUE)
virtual voidSetBasketSize(Int_t buffsize)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetBufferAddress(TBuffer* entryBuffer)
virtual voidSetCompressionLevel(Int_t level = 1)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetEntries(Long64_t entries)
virtual voidSetEntryOffsetLen(Int_t len)
virtual voidSetFile(TFile* file = 0)
virtual voidSetFile(const char* filename)
virtual voidTAttFill::SetFillAttributes()
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOffset(Int_t offset = 0)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidSetTree(TTree* tree)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidUpdateAddress()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
voidWriteBasket(TBasket* basket)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidSetSkipZip(Bool_t skip = kTRUE)
TBranch(const TBranch&)
TBranch&operator=(const TBranch&)

Data Members

enum { kAutoDelete
enum TObject::EStatusBits { kCanDelete
enum TObject::[unnamed] { kIsOnHeap
static Int_tfgCount! branch counter
Int_tfCompress(=1 branch is compressed, 0 otherwise)
Int_tfBasketSizeInitial Size of Basket Buffer
Int_tfEntryOffsetLenInitial Length of fEntryOffset table in the basket buffers
Int_tfWriteBasketLast basket number written
Long64_tfEntryNumberCurrent entry number (last one filled in this branch)
Int_tfOffsetOffset of this branch
Int_tfMaxBasketsMaximum number of Baskets so far
Int_tfSplitLevelBranch split level
Int_tfNleaves! Number of leaves
Int_tfReadBasket! Current basket number when reading
Long64_tfReadEntry! Current entry number when reading
Long64_tfEntriesNumber of entries
Long64_tfTotBytesTotal number of bytes in all leaves before compression
Long64_tfZipBytesTotal number of bytes in all leaves after compression
TObjArrayfBranches-> List of Branches of this branch
TObjArrayfLeaves-> List of leaves of this branch
TObjArrayfBaskets-> List of baskets of this branch
Int_tfNBasketRAM! Number of baskets in fBasketRAM
Int_t*fBasketRAM! [fNBasketRAM] table of basket numbers in memory
Int_t*fBasketBytes[fMaxBaskets] Lenght of baskets on file
Long64_t*fBasketEntry[fMaxBaskets] Table of first entry in eack basket
Long64_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
TStringfFileNameName of file where buffers are stored ("" if in same file as Tree header)
TBuffer*fEntryBuffer! Buffer used to directly pass the content without streaming
TList*fBrowsables! List of TVirtualBranchBrowsables used for Browse()
Bool_tfSkipZip!After being read, the buffer will not be unziped.
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style

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    

 Default constructor.  Used for I/O by default.
TBranch(const char* name, void* address, const char* leaflist, Int_t basketsize, Int_t compress)
*-*-*-*-*-*-*-*-*-*-*-*-*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)
            - L : a 64 bit signed integer (Long64_t)
            - l : a 64 bit unsigned integer (ULong64_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

void AddBasket(TBasket& b, Bool_t ondisk, Long64_t startEntry)
 Add the basket to this branch.
void Browse(TBrowser* b)
 Browser interface.
void DropBaskets(Option_t* option)
 Loop on all branch baskets. Drop all except readbasket.
 If the option contains "all", drop all baskets including
 read- and write-baskets.
void ExpandBasketArrays()
 Increase BasketEntry buffer of a minimum of 10 locations
 and a maximum of 50 per cent of current size.
Int_t Fill()
 Loop on all leaves of this branch to fill Basket buffer.

 The function returns the number of bytes committed to the memory basket.
 If a write error occurs, the number of bytes returned is -1.
 If no data are written, because e.g. the branch is disabled,
 the number of bytes returned is 0.

void FillLeaves(TBuffer& b)
 Fill each of the leaf of the branch.
TBranch* FindBranch(const char* name)
 -- Find the immediate sub-branch with passed name.
TLeaf* FindLeaf(const char* searchname)
 -- Find the leaf corresponding to the name 'searchname'.
TBasket* GetBasket(Int_t basketnumber)
*-*-*-*-*Return pointer to basket basketnumber in this Branch*-*-*-*-*-*
*-*      ====================================================
Long64_t GetBasketSeek(Int_t basketnumber)
*-*-*-*-*Return address of basket in the file*-*-*-*-*-*
*-*      ====================================
TList* GetBrowsables()
 Returns (and, if 0, creates) browsable objects for this branch
 See TVirtualBranchBrowsable::FillListOfBrowsables.
const char* GetIconName()
 Return icon name depending on type of branch.
Int_t GetEntry(Long64_t entry, Int_t getall)
 Read all leaves of entry and return total number of bytes read.

 The input argument "entry" is the entry number in the current tree.
 In case of a TChain, the entry number in the current Tree must be found
 before calling this function. For example:

     TChain* chain = ...;
     Long64_t localEntry = chain->LoadTree(entry);

 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(Long64_t entry, Int_t /*getall*/, TClonesArray* li, Int_t nentries)
 Read all leaves of an entry and export buffers to real objects in a TClonesArray list.

 Returns total number of bytes read.
TFile* GetFile(Int_t mode)
 Return pointer to the file where branch buffers reside, returns 0
 in case branch buffers reside in the same file as tree header.
 If mode is 1 the branch buffer file is recreated.
TLeaf* GetLeaf(const char* name)
*-*-*-*-*-*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*-*
*-*      =================================================================
TBranch* GetMother()
 Get our top-level parent branch in the tree.
TBranch* GetSubBranch(const TBranch* child)
 Find the parent branch of child.
 Return 0 if child is not in this branch hierarchy.
Long64_t GetTotalSize()
 Return total number of bytes in the branch (including current buffer)
Bool_t IsAutoDelete()
 Return kTRUE if an existing object in a TBranchObject must be deleted.
Bool_t IsFolder()
 Return kTRUE if more than one leaf or browsables, kFALSE otherwise.
void KeepCircular(Long64_t maxEntries)
 keep a maximum of fMaxEntries in memory
Int_t LoadBaskets()
  Baskets associated to this branch are forced to be in memory.
  You can call TTree::SetMaxVirtualSize(maxmemory) to instruct
  the system that the total size of the imported baskets does not
  exceed maxmemory bytes.
  The function returns the number of baskets that have been put in memory.
  This method may be called to force all baskets of one or more branches
  in memory when random access to entries in this branch is required.
  See also TTree::LoadBaskets to load all baskets of all branches in memory.
void Print(Option_t*)
 Print TBranch parameters
void ReadBasket(TBuffer&)
 Loop on all leaves of this branch to read Basket buffer.
void ReadLeaves(TBuffer& b)
 Loop on all leaves of this branch to read Basket buffer.
void Refresh(TBranch* b)
  refresh this branch using new information in b
  This function is called by TTree::Refresh
void Reset(Option_t*)
 Reset a Branch.

 Existing buffers are deleted.
 Entries, max and min are reset.

void ResetAddress()
 Reset the address of the branch.
void SetAddress(void* addr)
 Set address of this branch.
void SetAutoDelete(Bool_t autodel)
 Set the automatic delete 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 read from disk by the 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 the streamer).
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.

 Note: We do not take ownership of the buffer.

void SetCompressionLevel(Int_t level)
*-*-*-*-*-*-*-*Set the branch/subbranches compression level
*-*            ============================================
void SetEntries(Long64_t entries)
 Set the number of entries in this branch.
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
void WriteBasket(TBasket* basket)
 Write the current basket to disk
void SetSkipZip(Bool_t skip = kTRUE)
{ fSkipZip = skip; }
TBranch(const TBranch&)
TBranch& operator=(const TBranch&)
char * GetAddress()
{return fAddress;}
Int_t GetBasketSize()
{return fBasketSize;}
const char* GetClassName()
{ return ""; }
Int_t GetCompressionLevel()
{return fCompress;}
Int_t GetEvent(Long64_t entry=0)
{return GetEntry(entry);}
Int_t GetEntryOffsetLen()
{return fEntryOffsetLen;}
Int_t * GetBasketBytes()
{return fBasketBytes;}
Long64_t * GetBasketEntry()
{return fBasketEntry;}
TDirectory * GetDirectory()
{return fDirectory;}
const char * GetFileName()
{return fFileName.Data();}
Int_t GetOffset()
{return fOffset;}
Int_t GetReadBasket()
{return fReadBasket;}
Long64_t GetReadEntry()
{return fReadEntry;}
Int_t GetWriteBasket()
{return fWriteBasket;}
Long64_t GetTotBytes()
{return fTotBytes;}
Long64_t GetZipBytes()
{return fZipBytes;}
Long64_t GetEntryNumber()
{return fEntryNumber;}
TObjArray * GetListOfBaskets()
{return &fBaskets;}
TObjArray * GetListOfBranches()
{return &fBranches;}
TObjArray * GetListOfLeaves()
{return &fLeaves;}
Int_t GetMaxBaskets()
{return fMaxBaskets;}
Int_t GetNleaves()
{return fNleaves;}
Int_t GetSplitLevel()
{return fSplitLevel;}
Long64_t GetEntries()
{return fEntries;}
TTree * GetTree()
{return fTree;}
void ResetReadEntry()
{fReadEntry = -1;}
void SetEntryOffsetLen(Int_t len)
{fEntryOffsetLen = len;}
void SetOffset(Int_t offset=0)
void SetTree(TTree *tree)
{ fTree = tree;}
void UpdateAddress()
void ResetCount()
{fgCount = 0;}

Author: Rene Brun 12/01/96
Last update: root/tree:$Name: $:$Id: TBranch.cxx,v 1.117 2006/12/12 17:29:03 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.