RE: [ROOT] Array Arguments of tree->Branch(....)

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Jul 14 2003 - 19:19:36 MEST


Hi,

The reason is that 'TOTAL' is a variable of your program. This is NOT
accessible by the tree or the branch object.  Hence the problem which is
diagnotiqued by the error message:

   Error in <TBranch::TBranch>: Illegal leaf:AA/AA[TOTAL]/F

We recommend that you do not use this style of branches (it has a few
pitfalls that are hard to over-come).
Instead we recomment using a class.  This can be trivially done by written a
class definition and compiling it with ACLiC.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of zaldy
Sent: Monday, July 14, 2003 12:04 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Array Arguments of tree->Branch(....)



Dear ROOTers,

I'd like to understand and learn how to create a tree with an array
branch. I read the Tutorial section (tree3.C).

But why does the ff. line produces a segmentation problem/error messages:
--------------------------------------------------------
........
int TOTAL = 2;
float AA[TOTAL];
TTree * tree = new TTree("tree","What a nice Tree");
tree->Branch("AA",AA,"AA[TOTAL]/F");
......
--------------------------------------------------------
Pls see URLs:
http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/Report_Branch_Array_Arg.tx
t
http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/test.cc

while:
---------------------------------------------------------
.........
float AA[2];
TTree * tree = new TTree("tree","What a nice Tree");
tree->Branch("AA",AA,"AA[2]/F");
--------------------------------------------------------
dont.

Am using ROOTV: 3.04/02
gcc 2.91.66


Thank you.

--------------------------------------------------------
                   Zaldy A. Nawang
                   PS Users Room 2
                   Yon Gokan,
                   E362, Neutrino Group,
                   IPNS, KEK,
                   Japan

                   e-mail: zaldy@neutrino.kek.jp
                   Tel. No. : (81) 029864 - 5387
--------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET