Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vkucera committed Feb 29, 2024
1 parent 2eeaee6 commit ba8025d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions exec/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def are_same_histograms(his1 : TH1, his2 : TH1) -> bool:
print(f"Different number of entries {his1.GetEntries()} vs {his2.GetEntries()}")
return False;
# Compare axes
for ax1, ax2 in zip((his1.GetXaxis(), his1.GetYaxis(), his1.GetZaxis()), (his2.GetXaxis(), his2.GetYaxis(), his2.GetZaxis())):
for ax1, ax2 in zip((his1.GetXaxis(), his1.GetYaxis(), his1.GetZaxis()),
(his2.GetXaxis(), his2.GetYaxis(), his2.GetZaxis())):
if not are_same_axes(ax1, ax2):
print("Different axes")
return False
Expand All @@ -98,8 +99,10 @@ def are_same_histograms(his1 : TH1, his2 : TH1) -> bool:
for bin_y in range(his1.GetNbinsY() + 2):
for bin_x in range(his1.GetNbinsX() + 2):
bin = his1.GetBin(bin_x, bin_y, bin_z)
if his1.GetBinContent(bin) != his2.GetBinContent(bin) or his1.GetBinError(bin) != his2.GetBinError(bin):
print(f"Different bin {bin} content: {his1.GetBinContent(bin)} ± {his1.GetBinError(bin)} vs {his2.GetBinContent(bin)} ± {his2.GetBinError(bin)}")
if his1.GetBinContent(bin) != his2.GetBinContent(bin) or \
his1.GetBinError(bin) != his2.GetBinError(bin):
print(f"Different bin {bin} content: {his1.GetBinContent(bin)} ± {his1.GetBinError(bin)} vs "
"{his2.GetBinContent(bin)} ± {his2.GetBinError(bin)}")
return False
return True

Expand Down Expand Up @@ -158,7 +161,7 @@ def are_same_objects(obj1, obj2) -> bool:
msg_fatal("Bad input objects")
return False
# Compare types
if type(obj1) != type(obj2):
if type(obj1) is not type(obj2):
print(f"Different types {type(obj1)} {type(obj2)}")
return False
# Get ROOT types
Expand Down

0 comments on commit ba8025d

Please sign in to comment.