Abstract class and writing a TTree

Hi,

I’m using ROOT 4.02.00 on Red Hat Linux Enterprise 3.

I am attempting to write out a TTree containing a set of user defined classes. That’s been working fine.

We have now added an abstract class which inherits from TObject and contains no data members, and three derived classes. I’ll call the abstract class Configuration, and the three derived classes A, B, and C.

The TTree contains an instance of another class, MetaEvent, also derived from TObject, and this class MetaEvent contains a data member which is a pointer of class Configuration.

What we hoped to accomplish was the ability to store any of A, B, or C in our TTree as determined at runtime.

When I attempt to do TTree::Fill after initializing our data, I get a segmentation fault. I’ve appended the gdb backtrace at the end of this email.

I figure I’ve managed to confuse ROOT in that the base class has no data members and when the streamer is called it is unclear how to handle the data. Do I have to create a customized streamer for this case? Or is it possible to arrange things such that rootcint produces a streamer that can handle this?

Thanks,
Heather

#0 0x0014a0fa in Configuration_IsA (obj=0x98722f0)
at …/digiRootData/digiRootData_rootcint.cxx:2336
#1 0x01263738 in TClass::GetActualClass ()
from /afs/slac/g/glast/ground/GLAST_EXT/rh9_gcc32/ROOT/v4.02.00/root/lib/libCore.so
#2 0x011c67b2 in TBuffer::WriteObjectAny ()
from /afs/slac/g/glast/ground/GLAST_EXT/rh9_gcc32/ROOT/v4.02.00/root/lib/libCore.so
#3 0x011c61cf in TBuffer::WriteFastArray ()
from /afs/slac/g/glast/ground/GLAST_EXT/rh9_gcc32/ROOT/v4.02.00/root/lib/libCore.so
#4 0x012ad258 in TStreamerInfo::WriteBufferAux<char**> ()
from /afs/slac/g/glast/ground/GLAST_EXT/rh9_gcc32/ROOT/v4.02.00/root/lib/libCore.so
#5 0x01268237 in TClass::WriteBuffer ()
from /afs/slac/g/glast/ground/GLAST_EXT/rh9_gcc32/ROOT/v4.02.00/root/lib/libCore.so
#6 0x0014bd8e in MetaEvent::Streamer (this=0x95a70ec, R(bool)=@0x985f908)
at …/digiRootData/digiRootData_rootcint.cxx:2632

Can you try with ROOT 5.10/00?

Any way this should work. So please provide us with a complete example so that we can solve the problem (if it is still broken in 5.10/00 :slight_smile: ).

Thanks,
Philippe