Belle II Software  release-05-01-25
hadd.py
1 import os
2 
3 # merges histograms from all files in g4sim/.../beast_hist
4 
5 folders = ["phase2.1.3_june_Touschek/EM_2"]
6 base = "/group/belle2/BGcampaigns/g4sim/"
7 ens = ["LER", "HER"]
8 types = ["Touschek", "Coulomb", "Brems"]
9 # types = ["BHWideLargeAngle","BHWide"]
10 # types = ["twoPhoton"]
11 
12 for folder in folders:
13  for en in ens:
14  for typee in types:
15  outfile = base + folder + "/beast_hist/" + typee + "_" + en + "_all.root"
16  infiles = base + folder + "/beast_hist/" + typee + "_" + en + "_*.root"
17 # outfile = base+folder + "/beast_hist/" + typee + "_all.root"
18 # infiles = base+folder + "/beast_hist/" + typee + "_*.root"
19  os.system("rm -rf " + outfile)
20  com = "hadd " + outfile + " " + infiles
21  print(com)
22  os.system(com)