Trees containing TObjArrays

Hello all,
I need to create a tree with class members that contain vectors of variable length. My first approach was to use TObjArrays in lieu of the commonly used TClonesArrays, but I have run into difficulty with this method (they cannot be set up in the same manner as TClonesArrays). So my questions are:

  1. Is it possible to implement TObjArrays in trees?

  2. If so, how is this done?

  3. Is there a better way to accomplish my goal without using TObjArrays?

Thanks!

-T.J.

Hi,
with any recent ROOT version (e.g. the current pro) you can simply use STL containers, e.g. std::list. Add it to the tree like this:

std::list<MyObj> myList; std::list<MyObj>* myListP=&myList; tree->Branch("myObjects", &myListP); and make sure you create a dictionary for the std::list, e.g. by putting

#ifdef __MAKECINT__ #pragma link C++ class MyObj+; #pragma link C++ class std::list<MyObj>+; #endif into the header file of MyObj, and compiling MyObj.cxx with Aclic (i.e. “.L MyObj.cxx+”)
Axel.

Thanks!

-T.J.