Read trees from multiple root files

Hello,

I have multiple root files each containing the same number of entries. I want to read trees and branches from these files. I think there is something as TChain. Can someone help me with this?

Thanks!

Hi @tanmaya_shree,

Yes, vertical combinations, i.e. reading entries from multiple TTrees is supported via the TChain class. For more information, refer to this section of the manual.

Cheers,
J.

1 Like

If I add the root files one by one, its working fine. But I want to add large number of files using a for loop. I have tried something like this, but it is not working.

Thanks!

ch1->Add(TString::Format("blahblah_%d.root", i));

1 Like

Thanks ! :grin: