218 ((referenceObjects, referenceHistos), (parallObjects, parallHistos)),
219 (uniqueSerPaths, uniqueSerHistos),
220 (uniqueParPaths, uniqueParHistos),
232 print(
"Neither tuple is Reference Root file reference?")
241 omit = [re.compile(regex)
for regex
in gRegexBlackList]
245 if not any(regex.search(k)
is not None for regex
in omit):
246 if ds[k].__class__.__name__
in histos:
251 if not any(regex.search(k)
is not None for regex
in omit):
252 if dp[k].__class__.__name__
in histos:
267 identityDiffBins = {}
273 zeroIntegralMatch = 0
281 if sh.GetEntries() != ph.GetEntries():
282 diffEntries.append(h)
288 for i
in range(sh.GetNbinsX()):
289 sBinError += sh.GetBinError(i)
290 for i
in range(ph.GetNbinsX()):
291 pBinError += ph.GetBinError(i)
294 doKS = (bool(sint)
and bool(pint))
and (sBinError > 0
and pBinError > 0)
295 if checkBin2BinIdentity
and doKS:
301 diffIdentity.append(h)
302 identityDiffBins[h] = diffBins
303 if (bool(sint)
and bool(pint))
and (sBinError > 0
and pBinError > 0):
305 kTest = sh.KolmogorovTest(ph)
306 kTestResults[h] = kTest
316 if all((sint, pint))
and (sint == pint):
319 zeroIntegralMatch += 1
321 diffIntegrals.append(h)
325 print(
"not found? ", h)
328 print(
"\n\n" +
"-" * 80)
329 print(
"Summary of histos with different Entries")
333 for e
in diffEntries:
335 "\t\t\t%s:\t%i != %i"
336 % (e, int(ds[e].GetEntries()), int(dp[e].GetEntries()))
341 print(
"\n\n" +
"-" * 60)
342 print(
"Summary of histos which failed Kolmogorov Test")
347 result = kTestResults[e]
349 "%s\t\t%s :\tK-Test Result :\t %5.16f" % (ds[e].ClassName(), e, result)
354 print(
"\n\n" +
"-" * 60)
355 print(
"Summary of histos which failed Integral Check")
359 for e
in diffIntegrals:
360 diff = dp[e].Integral() - ds[e].Integral()
361 pc = (diff * 100) / ds[e].Integral()
363 "%s\t\t%s:\t Diff = %5.6f\tPercent Diff to Reference : %5.6f "
364 % (ds[e].ClassName(), e, diff, pc)
366 print(
"-" * 60 +
"\n")
367 print(
"=" * 80 +
"\n")
370 if checkBin2BinIdentity:
372 print(
"\n\n" +
"-" * 80)
373 print(
"Summary of histos with at least one bin with different Entries")
377 for e
in diffIdentity:
379 "%s\t\t%s: %i different bins"
380 % (ds[e].ClassName(), e, identityDiffBins[e])
384 print(
"\n" +
"=" * 80)
385 print(
"Comparison : Reference/Test ROOT Histo files")
386 print(
"\n\t\tReference\tTest")
388 "\tObjects : %i\t%i\t\t( p-s = %i )"
389 % (referenceObjects, parallObjects, parallObjects - referenceObjects)
392 "\tHistos : %i\t%i\t\t( p-s = %i )"
393 % (referenceHistos, parallHistos, parallHistos - referenceHistos)
395 print(
"\t __________")
398 % (referenceHistos + referenceObjects, parallHistos + parallObjects)
401 "Objects/Histos unique to Reference File : %i / %i"
402 % (len(uniqueSerPaths) - uniqueSerHistos, uniqueSerHistos)
405 "Objects/Histos unique to Test File : %i / %i"
406 % (len(uniqueParPaths) - uniqueParHistos, uniqueParHistos)
408 print(
"\nMatching Histograms valid for Comparison : %i" % (mh))
409 print(
"\nOmissions' patterns : ")
410 for entry
in gRegexBlackList:
411 print(
"\t%s" % (entry))
413 "\nHistograms for Comparison (after Omissions) : %i"
414 % (mh - len(gRegexBlackList))
416 print(
"\n\tHISTOGRAM TESTS : ")
417 print(
"\t\tKOLMOGOROV TEST : %i" % (kTested))
418 print(
"\t\tINTEGRAL TEST : %i" % (otherTest))
419 print(
"\t\tENTRIES TEST : %i" % (xEntries))
420 if checkBin2BinIdentity:
421 print(
"\t\tBIN2BIN TEST : %i" % (passedIdentity))
423 print(
"\t\tTested : %i" % (cEntries))
425 print(
"\n\tDISCREPANCIES : ")
426 print(
"\t\tK-Test : %i" % (failedKol))
427 print(
"\t\tIntegrals : %i" % (xIntegrals))
428 print(
"\t\tEntries : %i" % (xEntries))
429 retval = failedKol + xIntegrals + xEntries + failedIdentity
431 print(
"\nThe two sets of histograms were not identical")
432 print(
"\n" +
"=" * 80)