Re: [ROOT] TSelector::ProcessFill(Int_t entry) speed problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 17 2002 - 10:09:23 MEST


Hi Jacek,

What you do is extremely innefficient. You destroy the Root cache.
Instead, open the same file twice (in addition to the selector) with
  double x0, x2; //global variables or class variables
  TFile *f0 = new TFile("myfile.root")
  TTree *T0= (TTree*)f0->Get("myntuple");
  TBranch *b_x0 = T0->GetBranch("x");
  b_x0->SetBranchAddress(&x0);
  TFile *f2 = new TFile("myfile.root")
  TTree *T2= (TTree*)f2->Get("myntuple");
  TBranch *b_x2 = T2->GetBranch("x");
  b_x2->SetBranchAddress(&x2);
,

then in ProcessFill, do;
         b_x->GetEntry(entry); 
         b_x0->GetEntry(entry - 100000);
         b_x2->GetEntry(entry + 100000); 
you can now use x,x0 and x2

Rene Brun



Jacek M. Holeczek wrote:
> 
> Hi,
> I have met a stupid problem ...
> I use TSelector to analyze a disk resident TNtuple.
> The TNtuple has a "simple" branch :
>         Float_t x;
>         TBranch *b_x;
> In my "TSelector::ProcessFill(Int_t entry)" I need, however, to access not
> only the "entry", but also "entry - 100000" and "entry + 100000" for that
> specific branch :
>         b_x->GetEntry(entry); x1 = x;
>         b_x->GetEntry(entry - 100000); x0 = x;
>         b_x->GetEntry(entry + 100000); x2 = x;
> The result is that the analysis ("Process") of the ntuple takes ages ...
> Can I somehow speed it up ?
> Thanks in advance,
> Jacek.



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