1 from __future__
import print_function
7 print(
"Decending into directory", indir.GetName())
8 for key
in indir.GetListOfKeys():
9 obj = indir.Get(key.GetName())
11 isdir = obj.InheritsFrom(
"TDirectory")
12 ishist = obj.InheritsFrom(
"TH1")
15 if isdir: match = re.match(dirfilt, obj.GetName()) !=
None
18 if not match:
continue
22 newoutdir = outdir.mkdir(obj.GetName())
24 copyHist(newindir, newoutdir, dirfilt)
30 dirfilt =
'run_.*|GLOBAL|lb_.*|lowStat_LB.*|DQTGlobalWZFinder'
41 print (
"Copy from", source,
"to", target,
"with directory filter", dirfilt)
44 infile = ROOT.TFile(source)
45 if not infile.IsOpen():
46 print (
'Problem with input file', source)
49 outfile = ROOT.TFile.Open(target,
"RECREATE")
50 if not outfile.IsOpen():
51 print (
'Problem with output file', target)