RE: [ROOT] Getting rows

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Nov 12 2001 - 22:51:28 MET


Hi Roberto,

I suppose that you have an ntuple that 3 variables which are 'arrays' in the
sense that for each entry, each of
the variables have 2 values (an array of 2 values).

If this is correct then the default behavior of TTree::Draw and the
TreeViewer is to histogram both the values
of the array.  This means that if you have 200 entries in your ntuple you
would 400 values in your histograms.

To access only one of the 2 values you need to use the array notations.
Let's assume a variable fPx:

    myntuple->Draw("fPx");  // draw all the values
    myntuple->Draw("fPx[0]"); // draw only the first value for ALL the
entries
    myntuple->Draw("fPx[1]"); // draw only the second value for ALL the
entries

In the TTreeViewer, you need to edit an expression to contain the value
"fPx[0]" or "fPx[1]".

Please refer to the ROOT Users' guide for more information.

Cheers,
Philippe.

  -----Original Message-----
  From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Roberto Catanuto
  Sent: Monday, November 12, 2001 11:41 AM
  To: roottalk@pcroot.cern.ch
  Subject: [ROOT] Getting rows


  Hello, i correctly get a root file using "h2root" from a row-wise ntuple.
  Now, the structure of this ntuple is of three variables and two rows. I
ask how i can have access to the rows separately, drawing the relative
histograms of one of the six variables.
  May i do it interactively using TreeViewer?
  Root draws the variable i want, but i cannot understand if it takes it
from the first or the second row or else sums the two in one histogram.
  Thank you
--

Roberto Catanuto
INFN, Milan
ITALY



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET