Hi, you should try > root [2] TLeaf *ntrack = t1.GetLeaf("ntrack") > root [3] TLeaf *stat = t1.GetLeaf("stat") // <-- it's "stat", not "stat[index]" > root [4] t1.GetEntry(50) > (Int_t)4400 > root [5] ntrack.GetValue() > (const Double_t)1.57000000000000000e+02 > root [6] stat.GetValue(100) // <-- you have to give the index as GetValue param Though I wonder why the ntrack branch in the tree Print yields *Entries : 1000 : Total Size= 0 bytes File Size = 0 * Cheers, Axel. > -----Original Message----- > From: owner-roottalk@pcroot.cern.ch > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Viatcheslav E. > Kouznetsov > Sent: Sunday, May 06, 2001 11:34 AM > To: roottalk@pcroot.cern.ch > Subject: [ROOT] Reading array elements from tree > > > Hi Rooters! > I collide with a strange problem: > I run the tree1.C macros from the standard tutorials and > want to read some values from the tree. Then I receive strange > message. Below you can read my log of ROOT session > > root [0] TFile f("tree1.root") > root [1] t1.Print() > ****************************************************************** > ************ > *Tree :t1 : Reconst ntuple > * > *Entries : 1000 : Total = 6925775 bytes File Size = > 4491608 * > * : : Tree compression factor = 1.56 > * > ****************************************************************** > ************ > *Br 0 :ntrack : ntrack/I > * > *Entries : 1000 : Total Size= 0 bytes File Size = > 0 * > *Baskets : 0 : Basket Size= 32000 bytes Compression= > 1.00 * > *................................................................. > ...........* > *Br 1 :stat : stat[ntrack]/I > * > *Entries : 1000 : Total Size= 971639 bytes File Size = > 12823 * > *Baskets : 31 : Basket Size= 32000 bytes Compression= > 75.77 * > *................................................................. > ...........* > root [2] TLeaf *ntrack = t1.GetLeaf("ntrack") > root [3] TLeaf *stat = t1.GetLeaf("stat[100]") > root [4] t1.GetEntry(50) > (Int_t)4400 > root [5] ntrack.GetValue() > (const Double_t)1.57000000000000000e+02 > root [6] stat.GetValue() > Error: illegal pointer to class object stat 0x0 20 FILE:/tmp/fileie7IKV_cint LI NE:1 *** Interpreter error recovered *** How I can get the value of stat[100] with entry number 50? Best wishes! GloryS --
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:44 MET