[ROOT] Filling a Tree with Array

From: zaldy (zaldy@neutrino.kek.jp)
Date: Tue Jul 15 2003 - 14:36:03 MEST


Dear ROOT Users,


I tried to implement tree3.C in the tutorial, via a compiled class
(., main.cc, myClass.cc myClass.hh). That is I wrote a code similar to 
tree3.C only that I want to run it in an executable file. I need to use 
about 400 to 500 arrays of Float or integer.


For instance, a portion of my code on filling the tree (see URL:)
http://neutrino.kek.jp/~zaldy/root_work/MyRootFaq/Report_FillingBranch.txt

I got segmentation messages on arrays. Not so much with simple 
types(plain int, float, variables)

    tree->Branch("aVariable",&aVariable,"aVariable/F"); <===for instance 



Somehow I also  noticed that in filling the Branch:

   const int kMax = 384;
   float arr[kMax];

   tree->Branch("arr", arr, "arr[kMax]/F");

kMax should be declared as "const type" to avoid segmention problem.

How can we correct this segmentation pr~oblem? I mean, in reference to my 
code (which I linked), how do we rewrite the : setting the branch.
in a compile code.

I would appreciate very much any help.


Thanks.



-- ROOT 3.04/02 December 2002
   gcc 2.91.66  RedHat Linux

--------------------------------------------------------
                   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