Dear Philippe, Sorry to bother. I did wrote a small class script which is very similar to my original code: http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/TT.hh http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/TT.cc http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/Test.cc http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/Report_Branch_Array_Arg1.txt Unfortunately, I was not able to understand very well. I tried this for non-array arguments(well no segmentation problem), but the file size of the rootfile is zero. May I know some explanation about this? Thanks. Zaldy N. > 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 > -------------------------------------------------------- > > > -- -------------------------------------------------------- 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