[ROOT] arrays in TTree

From: Marcelo G. Munhoz (munhoz@physics.wayne.edu)
Date: Fri Aug 11 2000 - 19:45:56 MEST


    Hi,

    I have a TTree composed of TClonesArray objects (TBranchClones).
>From the documentation (and empirically), I noticed that is possible to
refer to a specific element of my array using the [ ] operator. So, for
instance, let's say  my TTree has two branchs of TClonesArray called
clone1 and clone2. The object clone1 has data members a1 and b1, while
the object clone2 has data members a2 and b2. Now, I can do something
like:

myTree->Draw("clone1.a1:clone2.a2[2]")

i.e., I can draw all elements a1 from clone1 as a function of the
specific element a2[2] from clone2. However, that's not exactly what I
want to do. Instead of drawing always a2[2] in the x-axis, I'd like to
select the element of a2 with a index given by b1, i.e., b1 is a index
refering to the TClonesArray clone2. So, what I'd like to do is:

myTree->Draw("clone1.a1:clone2.a2[clone1.b1]")

    I've tried this syntax and it does not work. Unless  you introduce a
number between [ ], ROOT totally ignores what is inside.

    My question is: is there anyway to go around this limitation? I'd
like also to use such thing for selection. For instance, to do something
like:

myTree->Draw("clone1.a1","clone2.a2[clone1.b1]>0")


    Maybe my problem is too specific, but if someone had similar
experience, I'd apreciate any help. And I hope my explanation is not too
confusing...

    Thanks for any help,

        Marcelo.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET