Re: [ROOT] variable size two dimensional array

From: Hajime Nanjyo (nanjyo@icepp.s.u-tokyo.ac.jp)
Date: Fri Jul 09 2004 - 10:41:25 MEST


Dear Rene,

I also filled the private member 'int *a;//[n]' in the TTree.
(You can see it in A.h attached in the last mail.)
The line 'tree->Draw("a[0][]");' you mentioned draw such variable.
The usage of  'tree->Draw("aa[0][]");' instead of 'tree->Draw("aa[][]");'
doesn't work at all.(It just make a histogram filled with 0.)
Do you have any other ideas?

Best Regards,
Hajime

> Hi Hajime,
> 
> tree->Draw("aa[][]");  is not supported in this special case.
> but you can do:
> 
>  tree->Draw("a[0][]");
>  tree->Draw("a[1][]");
>  tree->Draw("a[2][]");
>  
> 
> Rene Brun
> 
> Hajime Nanjyo wrote:
> > 
> > Dear ROOTers,
> > 
> > I have a trouble concerning a variable size two dimensional array.
> > 
> > I defined a class A with a member 'int    *aa[3];  //[n]'.
> > (A mamber 'int    n;' also included in the class A.)
> > A shared library was construced successfully for the ROOT I/O.
> > I could write or read a TTree in a TFile successfully
> > with the shared library but could not draw a histogram
> > with TTree::Draw("aa[][]") correctly in a ROOT interactive session.
> > 
> > Please help me to solve the problem.
> > 
> > By the way, I think it was useful if a syntax like
> > 'int  (*aa)[3];//[n]' was supported in rootcint.
> > Is it possible?
> > 
> > Best Regards,
> > Hajime
> > 
> > P.S.
> > 
> > I used the ROOT at /afs/cern.ch/sw/root/v4.00.06/rh73_gcc32/root
> > under Red Hat Linux 7.3 with gcc version 3.2.
> > 
> > The simple code to illustrate the problem was attached.
> > Files listed below was included in it.
> >   A.h,A.C,ALinkDef.h  // for class A
> >   write.C             // to write class A to TFile
> >   read.C              // to read the TFile
> >   make.sh             // make shell scrip
> >   run.C               // for '.x run.C' in ROOT session
> > 
> > The content of the file make.sh was as follows.
> > //////////////////////////////////////////////////////////////
> > rootcint -f ADict.C -c A.h ALinkDef.h
> > 
> > g++ -g --shared `root-config --cflags` `root-config --libs` \
> > -I. \
> > -o libData.so \
> > A.C ADict.C
> > 
> > g++ -g -o write `root-config --cflags` `root-config --libs` \
> > write.C -L. -lData
> > g++ -g -o read `root-config --cflags` `root-config --libs` \
> > read.C -L. -lData
> > //////////////////////////////////////////////////////////////
> > 
> > Run as follows.
> > source make.sh
> > ./write test.root
> > ./read  test.root
> > #--> succesfully operated
> > 
> > ROOT [0] .x test.C
> > #--> 'tree->Draw("aa[][]");' didn't work.
> > 
> >   --------------------------------------------------------------------------------
> >                Name: test.tgz
> >    test.tgz    Type: unspecified type (Application/Octet-Stream)
> >            Encoding: base64



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET