Re: [ROOT] TTree::GetEntry(int) vs. TChain::GetEntry(int)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Dec 02 2002 - 17:42:23 MET


Hi Mike,

when using a TChain, you must set the branch addresses via
TChain::SetBranchAddress, not TTree::SetBranchAddress.

You do not indicate which version of Root that you are using.
I assume 3.03/09. If this does not work, please send me a script as short
as possible reproducing the problem and tell me where I can get your
files.

Rene Brun


On Mon, 2 Dec 2002, Mike Miller wrote:

> Hi all, I have a tree with 4 branches.  I know that the tree and the file
> it is stored in are fine, since I can open the file and draw all elementes
> of the tree.  Further, I can open the file, and (in compiled code) use
> TTree->SetBramchStatus() and TTree->SetBranchAddress() to set the address
> for three of the branches.  I can then call TTree::GetEntry() and read
> into memory all elements of these three branches for all events.  The 
> information read into memory is fine.  However, if I now make a TChain 
> object from the file, instead of simply retrieving the TTree itself, I 
> can't use TTree->SetBranchAddress() to properly read the info from my 
> branches.  It sef-faults in TBuffer::operator>> on the first call to 
> TTree::GetEntry().  Is there something fundamentally different between 
> TChain and TTree regarding how branches are treated and read?  Thanks, 
> Mike
> 
> -- 
> Michael L. Miller (Yale Physics) michael.miller@yale.edu
> 
> Seattle:	206.543.2908	EPE group, 2nd floor physics.
> BNL: 		631.344.8342	Building 118 Yale Software
> Yale:   	203.432.6615	Room 301 WNSL
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET