Re: fData[2] and TBranchClones
Rene Brun (Rene.Brun@cern.ch)
Tue, 17 Nov 1998 23:42:41 +0100
Manuel Sanchez wrote:
>
> Hello,
>
> I have a class which looks like:
>
> class HTofRaw {
> public:
> Float_t vars[2];
> ClassDef(HTofRaw)
> };
>
> I store a TClonesArray with objects of this class using a tree in split
> mode=1. Then if i try
> tree.Draw("data.vars[0]")
> i get "Unknown name ...". The same happens with tree.Draw("data.vars").
>
> Then i've modified the TBranchClones constructor in
> TREE_TBranchClones.cxx changing
> sprintf(leaflist,"%s[%s]/%s",member->GetName(),branchcount,itype);
> by
> sprintf(leaflist,"%s[%s]/%s",rd->GetName(),branchcount,itype);
>
> and
> sprintf(branchname,"%s.%s",name,rd->GetName());
> by
> sprintf(branchname,"%s.%s",name,member->GetName());
>
> Now i get the right result when doing tree.Draw("data.vars"). Is there
> any reason why i shouldn't use this patch?.
>
> However i still get the wrong result with tree.Draw("data.vars[0]") (The
> tree has 10 events each of them with 1000 HTofRaw objects... when
> calling the Draw() function what i get is a histogram with 10 entries
> instead of 10000). I guess this is due to the fact that ROOT does not
> support multidimensional arrays (is this right?); if so, is it difficult
> to add such a thing?
>
> Regards,
> Manuel
Hi Manuel,
The syntax to histogram one element of a multi-dimensional
and variable length array is not implemented in the command line
of TTree::Draw. As you have found out, specifying fData[2]
will histogram only the element [2] of the variable length array
and will not make the loop on all the elements.
I personally believe that you will get a simpler interface
fot these complex cases by using C++ directly in the event loop.
Use for example the code generated by TTree::MakeClass.
Rene Brun