Re: [ROOT] TTree::MakeClass and 2D arrays

From: Julien Bolmont (Julien.Bolmont@gamum2.in2p3.fr)
Date: Mon Oct 20 2003 - 09:20:11 MEST


Hi Rene,

Sorry, I forgot ! 
I use root 3.04/02 on RH Linux 7.3.

I can add that GetEntry in the Loop function returns 0, so it's just 
like my entry does not exist, but I can see it and plot histograms from 
the Tree viewer and with the command line :

root [0] TFile f("1-02.root")  // the file containing the tree 'h1'
root [1] h1->Draw("dir[0][2]")


Thanks again,
Julien


On Fri, 17 Oct 2003, Rene Brun wrote:

> Hi Julien,
> 
> I cannot reproduce this problem. Unfortunately, you do not indicate
> which version of ROOT and which machine.
> 
> Rene Brun
> 
> 
> On Fri, 
> 17 Oct 2003, Julien Bolmont wrote:
> 
> > 
> > 
> > Hello rooters,
> > 
> > I used TTree::MakeClass to generate a skeleton class for my tree.
> > This tree contains simple variables, some 1D arrays and some 2D arrays.
> > 
> > All works well when I try to use simple variables or 1D arrays, ie I get 
> > the right numbers.
> > 
> > But it doesn't work with 2D arrays. For example, I got a table:
> >    Float_t         dir[100][3];
> > which coresponds to the branch
> >    TBranch        *b_dir;
> > 
> > In Init(..) we have :
> >    fChain->SetBranchAddress("dir", dir);
> > 
> > In Notify() :
> >    b_dir = fChain->GetBranch("dir");
> > 
> > 
> > And now, if I have a Loop function with
> > 
> >    for (Int_t jentry = 0 ; jentry < nentries ; jentry++) {
> > 
> >       Int_t ientry = LoadTree(jentry);
> >       if (ientry < 0) break;
> > 
> > 		nb1 += b_dir->GetEntry(ientry);
> > 		
> > 		
> > 		cout << dir[0][2] << endl;
> > 		
> >    }
> > 
> > All I got is a lot's of 0.
> > 
> > 
> > I think it's probably a problem of adress, but how to solve it ??
> > 
> > Thanks for your help !
> > 
> > JB.
> > 
> > 
> > 
> > 
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Julien Bolmont                          | julien.bolmont@gamum2.in2p3.fr
Ingénieur diplômé, doctorant            | Tél. bureau: +33 4 67 14 41 91
Groupe d'Astroparticules de Montpellier | Fax:         +33 4 67 14 41 90
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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