Hi Carter, MakeClass is not able to generate correct code for your configuration with nested variable length arrays. As a result, the declaration for your variables is wrong. You can edit the generated code of testClass.h replacing: Int_t arrays_nlen[kMaxarrays]; //[arrays_] Int_t *arrays_data[kMaxarrays]; //[arrays_nlen] by Int_t arrays_nlen[4000]; //[arrays_] Int_t *arrays_data[4000]; //[arrays_nlen] Your test will not crash anymore. However the arrays nlen and data will contain data in a wrong order. Rene Brun "Hall, Carter R." wrote: > > 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 > > -------------------------------------------------------------------------------- > Name: test_it.tar.gz > test_it.tar.gz Type: Unix Tape Archive (application/x-tar) > Encoding: base64 > Description: test_it.tar.gz
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET