Re: [ROOT] using LoadTree with a TChain

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 07 2002 - 09:03:10 MET


Hi Ken,
The code generated by MakeClass is correct.
The statement:
     Int_t ientry = LoadTree(jentry);
is not necessary if you do not need the entry number in the current Tree.
The statements
    fChain->GetEntry(jentry)
and
    fChain->GetEntry(ientry)

will give identical results for the first file, but for subsequent
files, only the first statement will give the correct result.

I assume that you use the pro version 3.02/06

Rene Brun

On Sun, 6 Jan 2002,
Ken Bloom wrote:

> 	OK, I think I understand what is going on now -- at least some of my 
> trouble was pilot error, but not all of it, I think.  Let's take a look at 
> those lines of code again:
> 
>     for (Int_t jentry=0; jentry<nentries;jentry++) {
>        Int_t ientry = LoadTree(jentry); //in case of a TChain, ientry is the entry number in the current file
>        nb = fChain->GetEntry(jentry);   nbytes += nb;
> 
> I didn't read that comment line carefully enough -- it says that ientry is 
> the number that I want, as it will point me to the event number in the 
> current file.  If I do fChain->GetEntry(ientry) instead of 
> fChain->GetEntry(jentry), then all is well.
> 
> 	So, maybe the skeleton code made by MakeClass should have 
> GetEntry(ientry) instead of GetEntry(jentry)?  I think that's the way to go.  
> Thanks for the help, best wishes.
> 
> 						Ken
> 
> ------------------------------------------------------------------------------
> Ken Bloom, Karma Adjuster                                Department of Physics
> 734-763-2329 / 734-936-1817 (fax)                       University of Michigan
> kenbloom@umich.edu                              http://www.umich.edu/~kenbloom
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET