-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmerger.py
More file actions
32 lines (27 loc) · 1.07 KB
/
merger.py
File metadata and controls
32 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os, glob
from array import array
import sys
from termcolor import colored
indir = "/mnt/hadoop/scratch/freerc/SUEP/Wonderland/"
outdir = "/mnt/hadoop/scratch/freerc/SUEP/Wonderland/merged"
def main():
pattern = "WZ"
for sample in os.listdir(indir):
print colored(" -- " + sample, "blue")
if "merged" in sample:
continue
#if pattern not in sample:
# continue
in_files = glob.glob("{indir}{sample}/*.root".format(sample=sample, indir=indir))
str1 = " "
in_files = str1.join(in_files)
out_file = "{outdir}/{sample}.root".format(sample=sample, outdir=outdir)
if len(in_files) == 0:
print colored(" -- [warning] empty directory for " + sample, "red")
continue
#print("python haddnano.py {} {}".format(out_file,in_files))
#os.system("python haddnano.py {} {}".format(out_file,in_files))
os.system("python haddnano.py {} {}".format("out.root",in_files))
os.system("mv out.root {}".format(out_file))
if __name__ == "__main__":
main()