5def copyHist(indir, outdir, dirfilt):
6 print(
"Decending into directory", indir.GetName())
7 for key in indir.GetListOfKeys():
8 obj = indir.Get(key.GetName())
9
10 isdir = obj.InheritsFrom("TDirectory")
11 ishist = obj.InheritsFrom("TH1")
12
13 match = True
14 if isdir: match = re.match(dirfilt, obj.GetName()) != None
15
16
17 if not match: continue
18
19 outdir.cd()
20 if isdir:
21 newoutdir = outdir.mkdir(obj.GetName())
22 newindir = obj
23 copyHist(newindir, newoutdir, dirfilt)
24
25 if ishist:
26 obj.Write()
27
28
void print(char *figname, TCanvas *c1)