Dear ROOTers,
I have a number of .root files all having the same architecture: they contain a tree (let’s call it “events”) and a directory (“Meta”), itself containing a number of trees.
What I want to do is to make a selection process on the “events” and merge all files together while keeping the “Meta” directory. Hence I want to create a .root file containing a subselection of “events” from all inputs, and all the “Meta”.
But I do not really know how to make that. I cannot use ROOT “hadd” (for some reason, doesn’t work on that data). Basic code to get the idea:
# setup, import, etc
chain = TChain("Events")
for file in filelist: #filelist loaded previously
chain.add(file)
for i in range(0,chain.GetEntries()):
# selection rules
# Here: find a way to load the "Meta" directory inside the TChain and write TChain to a file
The different examples found while Google-ing around only dealt with a single tree. Any hint would be greatly appreciated!