Read trees from multiple root files


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?


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.


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.


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

1 Like

Thanks ! :grin:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.