50 def check(causes, result):
51 result[
"root_output_file"] = FILENAME
53 if not os.path.exists(FILENAME):
54 causes.append(
"missing histogram file")
60 f = ROOT.TFile.Open(FILENAME)
65 h = f.Get(f
"Alg/h{i}")
67 k = f.GetKey(f
"Alg/h{i}")
71 assert h, f
"missing histogram Alg/h{i}"
77 expected = defaultdict(dict)
78 found = defaultdict(dict)
79 for x
in [i - 0.5
for i
in range(12)]:
81 expected[
"h1"][x] = value
82 found[
"h1"][x] = h1.GetBinContent(h1.FindBin(x))
83 for y
in [i - 0.5
for i
in range(12)]:
85 expected[
"h2"][(x, y)] = value
86 found[
"h2"][(x, y)] = h2.GetBinContent(h2.FindBin(x, y))
87 for z
in [i - 0.5
for i
in range(12)]:
89 expected[
"h3"][(x, y, z)] = value
90 found[
"h3"][(x, y, z)] = h3.GetBinContent(h3.FindBin(x, y, z))
97 t.assertEqual(expected[name], found[name])
98 except AssertionError
as err:
99 diffs[name] = str(err).splitlines()[0]
102 causes.append(
"histograms content")
104 result[f
"{name}_diff"] = diffs[name]
106 except AssertionError
as err:
107 causes.append(str(err))
110 except Exception
as err:
111 causes.append(
"failure reading histogram file")
112 result[
"python_exception"] = result.Quote(format_exc())