[ROOT] 2.25.03: workaround for TChain::Process + user defined TSelector problem

From: Matthew D. Langston (langston@SLAC.stanford.edu)
Date: Wed Sep 27 2000 - 18:33:44 MEST


I have found a workaround for the "TChain::Process + user defined TSelector
problem" (see http://root.cern.ch/root/roottalk/roottalk00/2583.html).

The problem is that calls to "TChain::GetEntry" do not work (it iterates
over the first TFile in a TChain over and over again, and ignores the second
and subsequent TFiles in the TChain, and it also slows down TFile I/O by an
order of magnitude).

The solution is to manually call "TBranch::GetEntry" for each specific
TBranch.  So, for example, instead of overriding TSelector::ProcessCut to
look like this:

  Bool_t ProcessCut( Int_t entry )
  {
     fTree->GetEntry( entry );
     return kTRUE;
  }

you must write it to look like this:

  Bool_t ProcessCut( Int_t entry )
  {
     b_1->GetEntry( entry );
     b_2->GetEntry( entry );
     ...
     b_n->GetEntry( entry );
     return kTRUE;
  }

In my original bug report, I mistakenly claimed that the "TBranch::GetEntry"
solution didn't work either.  I was wrong - it appears that this is the only
solution that will work.

Regards, Matt

--
Matthew D. Langston
SLD, Stanford Linear Accelerator Center
langston@SLAC.Stanford.EDU



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:33 MET