Writing large array to TTree

Hi ROOTusers

I use ROOT v. 5.08/00 on a suse linux 9

This might be trivial, but I want to see if anybody has seen the same problem.

I have an “Event” Class that inherits from TObject. The class has 30 members that are arrays,

Int_t Particles[NUMBER_Of_PARTICLES];

and the other 20-30 memebers are Int and Double.

I have the TBranch split level set to 1.

If I set the array size to, i.e. 60 (just to mention a number) and run the program it will come to a segmentation fault when I hit the line

For completeness, here is the stack trace

Generating stack trace... 0x4021fc6b in THashTable::Clear(char const*) + 0x3f from /usr/local/root/lib/libCore.so 0x4021f1f1 in THashList::Delete(char const*) + 0x35 from /usr/local/root/lib/libCore.so 0x40181158 in TDirectory::Close(char const*) + 0x72 from /usr/local/root/lib/libCore.so 0x4018ba96 in TFile::Close(char const*) + 0x14a from /usr/local/root/lib/libCore.so 0x4018a588 in TFile::~TFile() + 0x30 from /usr/local/root/lib/libCore.so 0x402107b0 in TCollection::GarbageCollect(TObject*) + 0xd4 from /usr/local/root/lib/libCore.so 0x40221437 in TList::Delete(char const*) + 0x7f from /usr/local/root/lib/libCore.so 0x401ca70b in TROOT::~TROOT() + 0x65 from /usr/local/root/lib/libCore.so 0x401cfbb3 in <unknown> from /usr/local/root/lib/libCore.so 0x415f605c in __cxa_finalize + 0x6c from /lib/tls/libc.so.6 0x40165cd2 in <unknown> from /usr/local/root/lib/libCore.so 0x405a8f0a in <unknown> from /usr/local/root/lib/libCore.so 0x4000da5d in <unknown> from /lib/ld-linux.so.2 0x415f5df0 in exit + 0x60 from /lib/tls/libc.so.6 0x415e0e8a in __libc_start_main + 0xda from /lib/tls/libc.so.6 0x08051311 in <unknown> from ./sortcode Abort

and here is the info from gdb

code bt
#0 0x4021fc6b in THashTable::Clear () from /usr/local/root/lib/libCore.so
#1 0x4021f1f1 in THashList::Delete () from /usr/local/root/lib/libCore.so
#2 0x40181158 in TDirectory::Close () from /usr/local/root/lib/libCore.so
#3 0x4018ba96 in TFile::Close () from /usr/local/root/lib/libCore.so
#4 0x4018a588 in TFile::~TFile () from /usr/local/root/lib/libCore.so
#5 0x402107b0 in TCollection::GarbageCollect () from /usr/local/root/lib/libCore.so
#6 0x40221437 in TList::Delete () from /usr/local/root/lib/libCore.so
#7 0x401ca70b in TROOT::~TROOT () from /usr/local/root/lib/libCore.so
#8 0x401cfbb3 in __tcf_0 () from /usr/local/root/lib/libCore.so
#9 0x415f605c in __cxa_finalize () from /lib/tls/libc.so.6
#10 0x40165cd2 in __do_global_dtors_aux () from /usr/local/root/lib/libCore.so
#11 0x405a8f0a in _fini () from /usr/local/root/lib/libCore.so
#12 0x4000da5d in _dl_fini () from /lib/ld-linux.so.2
#13 0x415f5df0 in exit () from /lib/tls/libc.so.6
#14 0x415e0e8a in __libc_start_main () from /lib/tls/libc.so.6
#15 0x08051311 in _start () at start.S:119
[/code]

When I reduce the arrays size to 50% (i.e. 30), the problem disappears. But this does not fit my needs. And ofcourse I want to know where the problem came from

I have experimented with the bufsize of the TBranch. Without luck.
I have also tried different Autosave() methods.

I could look into the variable array size method i.e. //[size]

But before doing all the changes, what could prevent the program from segmentation fault upon write in case the size of the variable array hit 60 (or something) that could result in segmentation fault.

I realize that there is something that is too big for some buffer some where., ( fuzzy sentence :slight_smile: )

I have looked through the Event code example and could not find anything in the manual.

I would very much appreciate some pointers or tips.

I hope I included eth of importance to define the problem.
Please, let me know if you need additional info!

All the best!
Andreas

Could you send the shortest possible RUNNING example showing the problem?

Rene