Organizing Trees by branch value

Hello! I have a job that requires me to run my code multiple times with a specific number of event entries. All my entries are trees, the issue is that each has a different value of events inside, and I need to separate them into groups of around 30k events per run. So far I’ve managed to run my tests by manually opening the files and organizing them myself, but I was hoping to be able to code, but I was hoping to do a small code to help me with that!
My issue is that I have no idea how to read those files without running a complex code that opens all the trees and takes too long - is there an easy way to get one branch of information in a loop of trees?
thank you in advance! I’m still quite new to root!

Have you looked at using a TChain ?

1 Like

Thank you for the reply! I had before but was unsure how not to make it in a huge file, I followed this (old) code but my root simply doesn’t print the entries. Am I using Tchain wrong?

Regarding GetEntriesFast the behavior in the linked post is as expected.
Read: ROOT: TChain Class Reference.

it worked! thank you a lot.

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