Re: Problems with chains(?)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Sep 08 1998 - 00:24:38 MEST


Tkachev A.L. wrote:
> 
>     Dear ROOTers,
>   As a newcomer, let me thank you a lot for introducing this
> great product.
> 
>   Working with trees and object I/O I found the following. Running the
> "event" example from $ROOTSYS/test I produced several "Event.root" files
> and called them "file1.root", "file2.root" etc. I tried to merge these ROOT
> files and got the following:
> root [0] .x eventload.cxx
> root [1] TChain chain("T");
> root [2] chain.Add("file1.root");
> root [3] chain.Add("file2.root");
> root [4] chain.Merge("newfile.root");
> 
>  *** Break *** bus error
> 
> Is it the same problem as in TTree::CloneTree() that was mentioned recently?
> If this problem is well known than sorry for that...
> Version of ROOT used is 2.00.11 for HP-UX aCC1.09.
> 

Hi Alexander,
I have found (and corrected) a problem in TChain::Merge in case
your Root file contains TNtuple objects (instead of TTrees).
If this is not the case, please send me a small file1.root file.

> Another thing occurs when while reading (not merging) the above chain.
> Changing the line
>     chain->SetBranchAddress("event",&event);
> in the event reading program
> (see http://wwwinfo.cern.ch/~tkatchea/testchain.cxx )
> into the following sequence:
>     chain->GetListOfBranches();
>     TBranch* branch = chain->GetBranch("event");
>     branch->SetAddress(&event);
> causes a core dump. In case of my own private tree there were no core
> dump but incorrect number of entries in my hisograms instead. Unfortunately
> I was unable to produce this error for "event" example. Also, function
> TChain::GetListOfBranches() must executed before
> TChain::GetBranch(const Text_t *name) {return fTree->GetBranch(name);}
> because fTree is otherwise a NULL pointer.
>   As a workaround of all that I have to build my own TObjArray of filenames
> and open/close files by hand.
> 
> Cheers, Alexander Tkatchev.

This is likely connected with the problem above and should be fixed
in my version.
I recommend to use the form
   tree->SetBranchAddress
or
   chain->SetBranchAddress
instead of
   branch->SetAddress

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET