219 ((referenceObjects, referenceHistos), (parallObjects, parallHistos)),
220 (uniqueSerPaths, uniqueSerHistos),
221 (uniqueParPaths, uniqueParHistos),
233 print(
"Neither tuple is Reference Root file reference?")
242 omit = [re.compile(regex)
for regex
in gRegexBlackList]
246 if not any(regex.search(k)
is not None for regex
in omit):
247 if ds[k].__class__.__name__
in histos:
252 if not any(regex.search(k)
is not None for regex
in omit):
253 if dp[k].__class__.__name__
in histos:
268 identityDiffBins = {}
274 zeroIntegralMatch = 0
282 if sh.GetEntries() != ph.GetEntries():
283 diffEntries.append(h)
289 for i
in range(sh.GetNbinsX()):
290 sBinError += sh.GetBinError(i)
291 for i
in range(ph.GetNbinsX()):
292 pBinError += ph.GetBinError(i)
295 doKS = (bool(sint)
and bool(pint))
and (sBinError > 0
and pBinError > 0)
296 if checkBin2BinIdentity
and doKS:
302 diffIdentity.append(h)
303 identityDiffBins[h] = diffBins
304 if (bool(sint)
and bool(pint))
and (sBinError > 0
and pBinError > 0):
306 kTest = sh.KolmogorovTest(ph)
307 kTestResults[h] = kTest
317 if all((sint, pint))
and (sint == pint):
320 zeroIntegralMatch += 1
322 diffIntegrals.append(h)
326 print(
"not found? ", h)
329 print(
"\n\n" +
"-" * 80)
330 print(
"Summary of histos with different Entries")
334 for e
in diffEntries:
336 "\t\t\t%s:\t%i != %i"
337 % (e, int(ds[e].GetEntries()), int(dp[e].GetEntries()))
342 print(
"\n\n" +
"-" * 60)
343 print(
"Summary of histos which failed Kolmogorov Test")
348 result = kTestResults[e]
350 "%s\t\t%s :\tK-Test Result :\t %5.16f" % (ds[e].ClassName(), e, result)
355 print(
"\n\n" +
"-" * 60)
356 print(
"Summary of histos which failed Integral Check")
360 for e
in diffIntegrals:
361 diff = dp[e].Integral() - ds[e].Integral()
362 pc = (diff * 100) / ds[e].Integral()
364 "%s\t\t%s:\t Diff = %5.6f\tPercent Diff to Reference : %5.6f "
365 % (ds[e].ClassName(), e, diff, pc)
367 print(
"-" * 60 +
"\n")
368 print(
"=" * 80 +
"\n")
371 if checkBin2BinIdentity:
373 print(
"\n\n" +
"-" * 80)
374 print(
"Summary of histos with at least one bin with different Entries")
378 for e
in diffIdentity:
380 "%s\t\t%s: %i different bins"
381 % (ds[e].ClassName(), e, identityDiffBins[e])
385 print(
"\n" +
"=" * 80)
386 print(
"Comparison : Reference/Test ROOT Histo files")
387 print(
"\n\t\tReference\tTest")
389 "\tObjects : %i\t%i\t\t( p-s = %i )"
390 % (referenceObjects, parallObjects, parallObjects - referenceObjects)
393 "\tHistos : %i\t%i\t\t( p-s = %i )"
394 % (referenceHistos, parallHistos, parallHistos - referenceHistos)
396 print(
"\t __________")
399 % (referenceHistos + referenceObjects, parallHistos + parallObjects)
402 "Objects/Histos unique to Reference File : %i / %i"
403 % (len(uniqueSerPaths) - uniqueSerHistos, uniqueSerHistos)
406 "Objects/Histos unique to Test File : %i / %i"
407 % (len(uniqueParPaths) - uniqueParHistos, uniqueParHistos)
409 print(
"\nMatching Histograms valid for Comparison : %i" % (mh))
410 print(
"\nOmissions' patterns : ")
411 for entry
in gRegexBlackList:
412 print(
"\t%s" % (entry))
414 "\nHistograms for Comparison (after Omissions) : %i"
415 % (mh - len(gRegexBlackList))
417 print(
"\n\tHISTOGRAM TESTS : ")
418 print(
"\t\tKOLMOGOROV TEST : %i" % (kTested))
419 print(
"\t\tINTEGRAL TEST : %i" % (otherTest))
420 print(
"\t\tENTRIES TEST : %i" % (xEntries))
421 if checkBin2BinIdentity:
422 print(
"\t\tBIN2BIN TEST : %i" % (passedIdentity))
424 print(
"\t\tTested : %i" % (cEntries))
426 print(
"\n\tDISCREPANCIES : ")
427 print(
"\t\tK-Test : %i" % (failedKol))
428 print(
"\t\tIntegrals : %i" % (xIntegrals))
429 print(
"\t\tEntries : %i" % (xEntries))
430 retval = failedKol + xIntegrals + xEntries + failedIdentity
432 print(
"\nThe two sets of histograms were not identical")
433 print(
"\n" +
"=" * 80)