reading variables from a Tree

From: Olaf Hartmann <olaf.hartmann_at_oeaw.ac.at>
Date: Wed, 14 Jul 2010 13:57:03 +0200


Hi all,

I try to read values from a Tree ... somehow I only get useful data for the very first leaf, Npart, which is successfully copied onto the corresponding Int_t variable given in SetBranchAddress. All the others remains zero ...

The tree is named tr1 (TTree *tr1).

root [104] tr1->SetBranchStatus("*",0)
root [105] tr1->SetBranchStatus("Npart",1)
root [106] tr1->SetBranchStatus("pid",1)
root [107] tr1->SetBranchStatus("ptot",1)
root [108] tr1.Show(10)

======> EVENT:10
Npart = 6 Results = (Results*)0x5590fe0 pid = 2212 ptot = 0.484537 root [110] Int_t np,id root [111] Double_t ptot root [112] tr1->SetBranchAddress("Npart",&np); root [113] tr1->SetBranchAddress("pid",&id);
root [114] tr1->SetBranchAddress("ptot",&ptot); root [115] np
(Int_t)0
root [116] tr1.Show(10)
======> EVENT:10
  Npart           = 6
  Results         = (Results*)0x5590fe0
  pid             = 2212
  ptot            = 0.484537

root [117] np
(Int_t)6
root [118] id
(Int_t)0
root [119] ptot
(Double_t)0.00000000000000000e+00

What am I missing there?

Cheers
Olaf. Received on Wed Jul 14 2010 - 13:57:09 CEST

This archive was generated by hypermail 2.2.0 : Wed Jul 14 2010 - 17:50:01 CEST