Hi, I have a set of tiles with compatible TTrees that I wish to merge. My current code is very simple (PyROOT):
import ROOT
infilenames = ["foo1.root","foo2.root",...]
outfilename = "merged.root"
tc = ROOT.TChain("environment","environment")
for fn in infilenames:
f = ROOT.TFile(fn,"READ")
t = f.Get("environment")
tc.Add(fn)
tc.Merge(outfilename)
I have realized that some of the input .root files actually have duplicates of entries from some of the other files. When I say duplicate I mean exactly: every branch compares “==”, but each entry has an integer time branch so comparing just the time is enough.
Is there a simple way to deduplicate the entries in the output tree? My only solution is to iterate over every entry and manually look for it in the growing output tree. This seems very inefficient and hard to code correctly.