[ROOT] TTree: drawing leaves with different # of entries

From: Gene Van Buren (gene@bnl.gov)
Date: Fri Apr 14 2000 - 18:13:17 MEST


Hi there. I'm trying to create a TTree with two main
branches: one for a primary vertex (PV) for an event,
and one for secondary vertices (SV) for an event. I'm
using TClonesArrays for both so that only the data
members I need get read in from file.

For every event, there's just one PV, but many SVs.

Both PVs and SVs have 3 data members indicating
their X,Y,Z position. What I would like to be able to
do is examine deltaX, deltaY, and deltaZ for each
SV, where deltaX = X(SV) - X(PV), etc.

Now, I know that the TTree somehow keeps events
separated, such that if I read back into TClonesArrays,
only one PV gets read in for each event, and the
proper number of SVs get read in for each event.

What I'd like to do is something like:
tree.Draw("SV.X-PV.X");
This indeed gives an entry for each SV, but PV.X
is non-zero only for the first SV in each event
(as there is only one PV per event). So only once
per event is SV.X-PV.X calculated the way I want.
The reset are the equivalent of just doing:
tree.Draw("SV.X");

Any ideas on a solution to this? Has anyone else
tried to deal with this?

TTree::Draw is orders of magnitude faster than
creating arrays, reading the TTree into them event
by event, and filling histograms from the data in
the arrays, so I'm hoping to be able to stick with it.

-Gene



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