Hi Frank, The argument to Process is actually the entry number in the current tree and NOT in the chain. So current code when reaching the 2nd file keep going back and forth between the 2nd file (loaded by the system) and the 1st (reloaded by call to fChain->GetEntry). Instead use: fChain->GetTree()->GetEntry(entry); or somebranch->GetEntry(entry); Also fChain->SetBranchStatus("*",1); is a slow operation. If possible move it to the Begin. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Frank Winklmeier Sent: Friday, March 19, 2004 12:05 PM To: roottalk@pcroot.cern.ch Subject: [ROOT] Performance issue with TChain Hi, I experience some strange performance problems on using TChain. I am pretty sure that I am doing something wrong, but I cannot figure out what. I use the following code generated by TChain::MakeSelector. Bool_t analysis::Process(Int_t entry) { // Processing function. This function is called // to process an event. It is the user's responsability to read // the corresponding entry in memory (may be just a partial read). // Once the entry is in memory one can apply a selection and if the // event is selected histograms can be filled. fChain->SetBranchStatus("*",1); fChain->GetEntry(entry,1); cout <<entry<<" "<<event<<":"<<runNumber<<endl; // ... do a bunch of other stuff return 1; } The output looks something like that: 0 9:2001390 [...] 2198 64121:2004222 2199 64129:2004222 2200 64153:2004222 2201 64179:2004222 2202 64182:2004222 0 5:2032850 1 6:2032850 2 47:2032850 3 122:2032851 4 149:2032851 [...] To run over the first (here 2202) entries is really fast. But when it reaches the second file in the chain (where entry is resetted to 0) the speed goes down by a factor of 10! For me, it seems that the second file is not loaded into memory and thus is much slower. Anybody an idea how I can fix that. Thanks, Frank
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET