Hi,
In you Event class you have:
TClonesArray* fChannels; //[numChannels] This tell the I/O that you have 'numChannels' TClonesArray objects. This is obviously not what you meant :) You only have one TClonesArray with 64 elements inside. This information (the number of elements) is already known to the TClonesArray and you do not need to repeat it in this case.
So simply using:
TClonesArray* fChannels; //
solves your problem.
Even better you can use:
TClonesArray* fChannels; //->
which tell the I/O that you are allocating the TClonesArray in
the default constructor.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
Behalf Of Tobias Raufer
Sent: Monday, December 03, 2007 5:25 AM
To: Philippe Canal
Cc: roottalk_at_cern.ch
Subject: Re: [ROOT] Problem with writing my own object to TTree
Hi Philippe,
> You code looks correct and I can not reproduce the problem with > root 5.17/04 and up. Could you > try a newer version of ROOT? > > Also I noted that your makefile incorrect link twice against all > the .o files > (once in the library, directly in the executable). >
Thanks for spotting that. I'm fairly new to writing my own Makefiles and this was mostly a matter of cutting and pasting from other people.
As a matter of fact, after fixing the Makefile, I can't reproduce my problem anymore with the test code I sent you. I've now gone back to the full code and made a slightly more involved test case. The tarball is attached to this email. This code exhibits the same problem as before. I've tried with the slightly newer ROOT version 5.17/03 (which I happen to have available on my laptop).
Here is the backtrace:
#0 0x90029f07 in wait4 ()
#1 0x9004723b in system ()
#2 0x010d198f in TUnixSystem::Exec (this=0xad04120,
shellcmd=0xb028a10 "/usr/bin/gdb -batch -n -x /ROOT/pro/root/etc/gdb-
backtrace-script -p 17279 > /tmp/rootstack.17279 2>&1") at unix/src/
TUnixSystem.cxx:1834
#3 0x010d1d29 in TUnixSystem::StackTrace (this=0xad04120) at unix/
src/TUnixSystem.cxx:1925
#4 0x010d4bc9 in TUnixSystem::DispatchSignals (this=0xad04120,
sig=kSigBus) at unix/src/TUnixSystem.cxx:976
#5 0x010d4d91 in SigHandler (sig=kSigBus) at unix/src/
TUnixSystem.cxx:342
#6 0x010d3b7f in sighandler (sig=10) at unix/src/TUnixSystem.cxx:3212
#7 <signal handler called>
#8 0x00000000 in ?? ()
#9 0x010b14b9 in TClass::Streamer (this=0xb95acc0, object=0xb941040,
b=@0xb9b9460) at meta/src/TClass.cxx:4247
#10 0x036b11c7 in TBufferFile::WriteFastArray (this=0xb9b9460,
start=0xb941010, cl=0xb95acc0, n=64, streamer=0x0) at io/src/
TBufferFile.cxx:1641
#11 0x037c33a4 in TStreamerInfo::WriteBufferAux<char**>
(this=0xb992b80, b=@0xb9b9460, arr=@0xbfffee10, first=2, narr=1,
eoffset=0, arrayMode=0) at io/src/TStreamerInfoWriteBuffer.cxx:624
#12 0x065a22b6 in TBranchElement::FillLeaves (this=0xb9b8f90,
b=@0xb9b9460) at tree/src/TBranchElement.cxx:1144
#13 0x0659650d in TBranch::Fill (this=0xb9b8f90) at tree/src/
TBranch.cxx:762
#14 0x065a1e7c in TBranchElement::Fill (this=0xb9b8f90) at tree/src/
TBranchElement.cxx:1043
#15 0x065a1fe9 in TBranchElement::Fill (this=0xb9b73c0) at tree/src/
TBranchElement.cxx:1068
#16 0x065e2cd8 in TTree::Fill (this=0xb959ab0) at tree/src/TTree.cxx:
3180
#17 0x000d2aea in Decoder::ReadData ()
#18 0x000028e8 in main ()
Could you have a look at this, please?
Thank you very much,
Tobi Received on Mon Dec 03 2007 - 19:02:12 CET
This archive was generated by hypermail 2.2.0 : Wed Dec 05 2007 - 05:50:02 CET