GetEntries vs GetEntriesFast with TChain

From: Dean Andrew Hidas <dhidas_at_fnal.gov>
Date: Thu, 24 Feb 2005 16:44:41 -0600

Hi rooters!

Say I have: TChain* chain = new TChain("whatever");

I can use:

chain->GetEntries()

to get the correct number, but when I use

chain->GetEntriesFast()

it'll always gives me 1234567890. Why is this? I also notice that if I call GetEntries() first and then GetEntriesFast then GetEntriesFast will return the correct number. Anyway, I'd really like to use GetEntriesFast with my TChain if it's faster because on large datasets GetEntries can take a while... Here's the actual code that I'm compiling with gcc v3.3.1 and root "Version 4.00/03 24 March 2004":

#include <iostream>

#include "TChain.h"

int main ()
{
  TChain* chain = new TChain("Tree");

  chain->Add("file1.root");
  chain->Add("file2.root");

  std::cout << chain->GetEntriesFast() << std::endl;  // returns bad number
  std::cout << chain->GetEntries() << std::endl;  // returns good number
  std::cout << chain->GetEntriesFast() << std::endl;  // returns good number

  return 0;
}

Thanks,

-Dean

-- 
Dean Andrew Hidas                   Office: 630 840-2324
dhidas_at_fnal.gov                     Mobile: 626 379-2160
Received on Thu Feb 24 2005 - 23:44:48 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET