ROOT Version: 6.18/04
Platform: Ubuntu 18.04 LTS
Compiler: g++ 7.5.0
While trying to read data from TChain
using TTreeReader
, I observe a difference in output between two almost identical codes. In case number one, given below,
TChain* chain = new TChain("mmtree/tree");
chain->Add(filename);
TTreeReader* tree = new TTreeReader(chain);
cout<<tree->GetEntries()<<endl;
Output
===============
9223372036854775807
I obtain random output, which means that the tree is not reading the chain. However, if I add chain->GetEntries()
before initializing the TTreeReader
, given below, I get the correct output.
TChain* chain = new TChain("mmtree/tree");
chain->Add(filename);
cout<<chain->GetEntries()<<endl;
TTreeReader* tree = new TTreeReader(chain);
cout<<tree->GetEntries()<<endl;
Output
===============
294703
294703
Is there something missing in my understanding or is this a buggy implementation?