6 print(
"Decending into directory", indir.GetName())
7 for key
in indir.GetListOfKeys():
8 obj = indir.Get(key.GetName())
10 isdir = obj.InheritsFrom(
"TDirectory")
11 ishist = obj.InheritsFrom(
"TH1")
14 if isdir: match = re.match(dirfilt, obj.GetName()) !=
None
17 if not match:
continue
21 newoutdir = outdir.mkdir(obj.GetName())
23 copyHist(newindir, newoutdir, dirfilt)
29 dirfilt =
'run_.*|GLOBAL|lb_.*|lowStat_LB.*|DQTGlobalWZFinder'
40 print (
"Copy from", source,
"to", target,
"with directory filter", dirfilt)
43 infile = ROOT.TFile(source)
44 if not infile.IsOpen():
45 print (
'Problem with input file', source)
48 outfile = ROOT.TFile.Open(target,
"RECREATE")
49 if not outfile.IsOpen():
50 print (
'Problem with output file', target)