A class with TClonesArray in TTree

From: Maxim A. Nikulin <M.A.Nikulin_at_inp.nsk.su>
Date: Wed, 07 Sep 2005 17:37:32 +0700


I encountered a problem with TClonesArray contained in an event class as a member. Please, find attached a set of files demonstrating the problem. The header EventTcaMember.h contains definition of two classes. "Track" is a simple class to be put in TClonesArray, it has "p" data field. EventTcaMember has the member "tca" of type TClonesArray. If I write this event class to a tree and ask TTree::Draw plot any function of "p", ROOT reports segmentation violation. The script testEventTcaMember.C writes file test.root and attempts to draw cos(p). Type

.L EventTcaMember.cc+
.x testEventTcaMember.C

to reproduce the problem. I see it in ROOT-5.02/00 on Pentium IV with Fedora Core 2 Linux.

It seems that with pointer to TClonesArray instead of member of this type everything works. I wonder when I should use pointers and when I can include classes as members.

Thanks in advance

Maxim Nikulin

Received on Wed Sep 07 2005 - 12:40:07 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET