TTree with a TObject class containing a std::vector

Hey Everyone,
I’ve created a class “PulseTiming” to hold some pulse information, deriving from TObject. I’ve created the dictionary via rootcint and everything seems to compile fine and run as expected in an interactive CINT session.

However, when I link to the library in an executable and attempt to save into a TTree, it returns a seg fault at the TTree::Branch(…) declaration:

#10 0xb7f94ad6 in TInstrumentedIsAProxy<PulseTiming>::operator() ( this=0x976a1b0, obj=0x1) at /usr/include/root/TIsAProxy.h:83 #11 0xb7a2f426 in TClass::GetActualClass () from /usr/lib/root/ #12 0xb68887e3 in TTree::BranchImp () from /usr/lib/root/ #13 0x08049541 in TTree::Branch<PulseTiming> (this=0x9999c58, name=0x804964d "promptT.", classname=0x8049641 "PulseTiming", addobj=0xbfeb75e0, bufsize=32000, splitlevel=0) at /usr/include/root/TTree.h:212

I am pretty stuck on this. I’ve attempted to rewrite things without using a vector, and it works…but it makes things rather impractical.

The code for PMTlib, containing the PulseTiming class, and a very simple program testPMTlib reproducing the error is attached.

PMTlib.tar (70 KB)


When using your own executable, you must explicitly load the pre-generated dictionary for the vector of simple types. DogROOT->ProcessLine("#include <vector>");