Hi Zaldy,
TTree::Branch has no way to find the value of your variable TOTAL.
You can generate a string, eg
tree->Branch("AA",AA,Form("AA[%D]/F",TOTAL);
Rene Brun
zaldy wrote:
>
> 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.txt
> 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