TRefArray nested in TClonesArray


Is it possible to have a TRefArray nested inside TClonesArray? The latest post I could find on this question was from April 2005, which said TCollections wasn’t implemented inside TClonesArray.

I tried creating a TTree structure containing two TClonesArray branches, and wanted each object in one of those branches to hold a TRefArray for TRefs pointing to objects in the other TClonesArray branch.

The code to generate the TTree ran fine, but not for reading the resulting TTree. When a TRefArray is included, a TTree::GetEntry will end in a Segmentation Violation. When the TRefArray is removed, things seemed to work fine. All this with Root 5.12.00.

I probably should take that as a sign that the answer hasn’t changed, but a confirmation is appreciated.



Although not recommended for performance reasons, one can use variable length structures (eg TRefArray) inside a TClonesArray.
Simply upgrade your version to a more recent version.