Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created April 4, 2012 14:56
Show Gist options
  • Save gadamc/2302208 to your computer and use it in GitHub Desktop.
Save gadamc/2302208 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from ROOT import *
import sys,os, glob
runName = sys.argv[1]
fileList = glob.glob(runName+'_0[0-3][0-9].amp.root')
ml = TList()
for f in fileList:
print f
ff = TFile.Open(f)
ml.Add(ff.Get('t'))
fout = TFile.Open(runName+'.amp.root', 'recreate')
fout.cd()
print 'merging files into', fout.GetName()
outTree = TTree.MergeTrees(ml,'fast')
outTree.Write()
fout.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment