[ROOT] MakeClass with variable length arrays

From: Hall, Carter R. (chall@slac.stanford.edu)
Date: Thu Sep 23 2004 - 02:57:45 MEST


Hello ROOTers, 

I'm need some advice about variable
length arrays. I'd like to make a tree which
contains several arrays. In any one tree
the arrays will all have the same length, but
I may produce several trees in which the 
array lengths will differ, so I've declared
the arrays as having variable length for rootcint.
(Also, the number of arrays can change from 
one event to the next within the same tree.)

To do this I put the array into a class, "MyArray", 
along with a data member giving the length. Then I 
make a TClonesArray of MyArrays, and put them into 
an "Event" object that goes in a tree. 

I'm able to create the tree, write it to a file, 
read it, and look at the data with Draw. However, 
when I use MakeClass to create a macro, called
"TestClass", and execute its constructor, the
data in my tree becomes lost. This occurs when
the SetMakeClass(1) statement is executed.
The attached tarfile contains a script called
"test_it.C" that should make the library containing 
the classes and illustrate the problem.

I'm guessing that the problem is with the way
I've defined my tree... perhaps there is a simpler
solution?

I'm using ROOT 4.00/08 on a Sun Enterprise 420.

Thanks in advance, 

Carter Hall








This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET