Re: How to correctly add a branch to a saved TTree?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Sat, 20 Jun 2009 22:26:34 -0500


Hi Pierre-Luc,

This bug has been fixed a while back in the trunk (and I think also in the patch branch for v5.22).
You could try 5.23/04.

Cheers,
Philippe.

Pierre-Luc Drouin wrote:
> Hi,
>
> I am using 5.22/00. I have that version compiled with gcc on a 32 bits
> machine and the same version compiled with icc on a 64 bits machine. I
> get the same errors on both machines. As I said it works with a few
> thousand entries but fails with about 500 000 entries (like if it was
> failing when using multiple baskets?)
>
> The error messages are the following:
> Error in <TObjArray::AddAt>: index 10 out of bounds (size: 10, this:
> 0x09ce4fd0)
> Error in <TObjArray::AddAt>: index 10 out of bounds (size: 10, this:
> 0x09ce4fd0)
> Error in <TObjArray::AddAt>: index 10 out of bounds (size: 10, this:
> 0x09ce4fd0)
> Error in <TObjArray::AddAt>: index 10 out of bounds (size: 10, this:
> 0x09ce4fd0)
> ...
> ...(thousands of lines of the same error)
> ...
> *** Break *** segmentation violation
> (no debugging symbols found)
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
> Attaching to program: /proc/8235/exe, process 8235
> (no debugging symbols found)...done.
> [Thread debugging using libthread_db enabled]
> [New Thread -1218575712 (LWP 8235)]
> 0x0146a4de in __waitpid_nocancel () from /lib/tls/libc.so.6
> Thread 1 (Thread -1218575712 (LWP 8235)):
> #0 0x0146a4de in __waitpid_nocancel () from /lib/tls/libc.so.6
> #1 0x013ff1c4 in do_system () from /lib/tls/libc.so.6
> #2 0x008f1d7f in system () from /lib/tls/libpthread.so.0
> ...
>
> Thanks!
> Pierre-Luc
>
> Philippe Canal wrote:
>> Hi Pierre-Luc,
>>
>> I do not see any problem with this code, nor can I reproduce any issue.
>>
>> How does it fail in your case? Which version of ROOT are you using?
>>
>> Cheers,
>> Philippe.
>>
>> Pierre-Luc Drouin wrote:
>>> Hi,
>>>
>>> I am trying to add and fill a branch to an existing TTree and I get
>>> a segmentation violation error when the number of entries exceeds
>>> some value
>>>
>>> Here is some code to reproduce the problem:
>>> {
>>> Int_t nentries=500000;
>>> TFile *file=new TFile("file.root","recreate");
>>> TTree *tree=new TTree("tree","tree");
>>> Float_t val=0;
>>> tree->Branch("br1",&val,"br1/F");
>>>
>>> for(Int_t i=0; i<nentries; ++i) {
>>> val=i;
>>> tree->Fill();
>>> }
>>>
>>> file->Write();
>>> file->Close();
>>> delete file;
>>>
>>> file=new TFile("file.root","update");
>>> tree=(TTree*)file->Get("tree");
>>> TBranch *br=tree->Branch("br2",&val,"br2/F");
>>>
>>> for(Int_t i=0; i<nentries; ++i) {
>>> val=i;
>>> br->Fill();
>>> }
>>> tree->SetEntries(br->GetEntries());
>>>
>>> file->Write();
>>> file->Close();
>>> delete file;
>>>
>>> file=new TFile("file.root","read");
>>> tree=(TTree*)file->Get("tree");
>>> tree->Draw("br1");
>>> }
>>>
>>> The code above works correctly when nentries is 25000 but fails with
>>> 500000.
>>>
>>> How can I fix this problem?
>>>
>>> Thank you!
>>> Pierre-Luc Drouin
>>>
>>
>
Received on Sun Jun 21 2009 - 05:28:26 CEST

This archive was generated by hypermail 2.2.0 : Sun Jun 21 2009 - 23:50:01 CEST