[ROOT] reading from trees once more

From: Anne-Sylvie Nicollerat (Anne-Sylvie.Nicollerat@cern.ch)
Date: Tue Nov 20 2001 - 23:48:40 MET


Hello !

I am trying to read the variables from a tree (named Tracks), using the
following macro (that I start after having started the tree viewer):

{
tv__tree = (TTree *) gROOT->FindObject("Tracks");
tv__tree_list->Add(tv__tree);

Int_t nhitcot2;
Int_t nhitax2;
Int_t nhitst2;

tv__tree->SetBranchAddress("nhitcot",&nhitcot2);
tv__tree->SetBranchAddress("nhitax",&nhitax2);
tv__tree->SetBranchAddress("nhitst",&nhitst2);
....
}

Then root returns me the following error message :

Error in <TTree::SetBranchAddress>: unknown branch -> nhitcot
Error in <TTree::SetBranchAddress>: unknown branch -> nhitax
Error in <TTree::SetBranchAddress>: unknown branch -> nhitst

When I look in the contents of my tree, doing tv__tree->Print(), I get
the following:

root [1] tv__tree->Print()
******************************************************************************

*Tree    :Tracks    :
Tracks                                                 *
*Entries :    48820 : Total =         3536541 bytes  File  Size =
3536541 *
*        :          : Tree compression factor =
1.00                       *
******************************************************************************

*Br    0 :_1        :
alg/I:charge/I:d0/F:eta/F:event/I:nhitax/I:nhitcot/I:  *
*         |
nhitsil/I:nhitsilphi/I:nhitsilst/I:nhitsilz/I:nhitst/I:pT/F:     *
*         |
paralg/I:phi0/F:run/I:trknum/I:z0/F                              *
*Entries :    48820 : Total  Size=    3515490 bytes  File Size  =
3515490 *
*Baskets :      110 : Basket Size=      32000 bytes  Compression=
1.00     *

I think the suspicious thing is the 0:_1 thing. It look as the variables
are not directly accessible. Actually when I try to access the tree
variables from the browser, I first come to a _1 leave that I have to
open to access the tree variables.

Just another thing: I can for instance plot an histogram directly from
the viewer and then root executes the following command :
tv__tree->Draw("_1.nhitcot","","hist", 48820, 0);

Do you know how I could acces the arguments of the tree in my macro ?

Thanks a lot

Anne-Sylvie

--
-----------------------------------
Anne-Sylvie Nicollerat
office 327-52-56, phone 1-630-840-3899
Fermilab/CDF MS 223 PO box 500,
Batavia, IL 60510 USA

"Pour le croyant Dieu se trouve au debut, pour le physicien au terme de toute pensee." (Planck)



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