Re: [ROOT] TObjArray and TTree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu May 27 2004 - 21:42:01 MEST


Splitting a TObjArray is not possible because the objects in a TObjArray
can be of different classes.
Split mode is only supported for TClonesArray and std::vector<T> in 
version 4

Rene Brun

On 
Thu, 27 May 2004, [koi8-r] "J D[koi8-r] "  wrote:

> Hello, ROOT'ers.
> 
> The first code sample:
> 
> I have a class
> /////////////////////////////////////////////////
> class Test : public TObject
> {
> public:
>    //ctors e.t.c.
> private:
>    int i_;
>    int j_;
>    ClassDef(Test, 1)
> };
> 
> void SomeWhere()
> {
>     TClonesArray cl("Test", number);
>   ////
>     TTree tree("test", "test");
>     tree.Branch("test_branch", &p, 32000, splitlevel);//splitlevel != 0
>     tree.Fill();
>    //here I open the file and save tree to file.
> }
> ////////////////////////////
> Now, I can open this file in TBrowser and I'l see i_ and j_ leafs there.
> Can I get this functionality using TObjArray, not TClonesArray ? 
> If I try
> //////////
> void SomeWhere()
> {
>     TObjArray cl;
>   ////Filling cl with Test objects
>     TTree tree("test", "test");
>     tree.Branch("test_branch", "TObjArray", &p, 32000, splitlevel);//splitlevel != 0
>     tree.Fill();
>    //here I open the file and save tree to file.
> }
> /////////////////////
> I'll only see TObjArray's data members in browser, but I want to see i_'s and j_'s, as in the first case. Is it possible?
> 
> Thanks.
> 



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