Branch of class which ignores TObject Streamer, ROOT 5.13

I have a run time error when adding a branch which holds a Class.
It happens,

  • When I use TTree.cxx version 1.292 or later.
  • When I ignore TObject streamer. (MyClass::Class()->IgnoreTObjectStreamer())

Following is the error message.
*** Break *** segmentation violation
Generating stack trace…
0x04eb9e95 in TBranchElement::TBranchElement(char const*, TStreamerInfo*, int, char*, int, int, int) at tree/src/TBranchElement.cxx:361 from /cern/root/lib/
0x04efcbc9 in TTree::Bronch(char const*, char const*, void*, int, int) at tree/src/TTree.cxx:1774 from /cern/root/lib/
0x04efad7b in TTree::Branch(char const*, char const*, void*, int, int) at tree/src/TTree.cxx:1181 from /cern/root/lib/
0x04efa39d in TTree::BranchImp(char const*, char const*, TClass*, void*, int, int) at tree/src/TTree.cxx:907 from /cern/root/lib/
0x08049e9a in TBranch* TTree::Branch(char const*, char const*, Event**, int, int) + 0x42 from ./Event
0x08049a79 in main + 0x8b7 from ./Event
0x072dbe23 in __libc_start_main + 0xd3 from /lib/tls/
0x0804907d in __gxx_personality_v0 + 0x81 from ./Event

This problem was reproduced by $ROOTSYS/test/MainEvent.cxx when I modified Event.cxx to ignore TObject streamer.
------------ BEGIN OF PATCH ------------ 2006-09-06 15:02:15.000000000 +0200
+++ Event.cxx 2006-09-06 14:50:21.000000000 +0200
@@ -93,6 +93,7 @@
// Create an Event object.
// When the constructor is invoked for the first time, the class static
// variable fgTracks is 0 and the TClonesArray fgTracks is created.

  • Event::Class()->IgnoreTObjectStreamer();

    if (!fgTracks) fgTracks = new TClonesArray(“Track”, 1000);
    fTracks = fgTracks;
    ------------ END OF PATCH ------------

There is a difference of increment of ‘id’ in TTree::Bronch.
At version 1.291, it does not increment ‘id’ when elment loop is 'continue’d when splitting the branch. On the other hand at version 1.292, it does increment even the loop is 'continue’d. It causes different ‘id’ in case of 1.291 and 1.292.

Yes, your analysis is correct, this is a problem I am aware of, in fact
there is a comment in the code noting that this needs to be fixed!
I’ll submit a patch for this problem and it should be committed to
the repository before the end of the day.

– Paul Russo

Oops, I spoke too soon, however your analysis is still correc
that the id is incremented in the head version. This id number
is the offset into the streamer info element array for the data
member or base class (in the case). We are looping through
this array creating branches for each base class and data member
of the the branch class. When we skip the TObject base class
we must be careful not to forget that it actually is in the
streamer info element array occupying a slot, even though
we are not going to use it, so we should increment the index.

My memory was a little faulty, there used to be a comment
saying this one-off problem should be fixed in the case of
ignored TObject base classes and it did get changed already!

I’ll run $ROOTSYS/test/MainEvent.cxx with your change,
hopefully duplicate the problem, and continue from there.

– Paul Russo

I’ve submitted a fix for this problem, it should make it to the repository trunk within the next day.

The fix has been uploaded in the CVS repository.