Processing a chain

Dear ROOTers,

I’m looking for a fast and simple method to get notyfied whenever another input file is opened during a loop over all entries in a TChain object. So far I can think only of comparing the names of chain->GetCurrentFile() of subsequent entries.

Thanks for your suggestions,


Use TChain::GetTreeNumber inside the event loop.
Outside the loop, set
int currentTreeNumber = -1;
In the loop
if (mychain.GetTreeNumber() != currentTreeNumber) {
//a new file
currentTreeNumber = mychain.GetTreeNumber();