Skip to content

Commit a07bde3

Browse files
committed
Merge pull request #182 from kreczko/debug-nan
fixing issue #181
2 parents cd6c515 + 0cc0d5f commit a07bde3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tools/hist_utilities.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ def clean_control_region(histograms = {},
291291
data_hist -= histogram
292292
# next make sure there are no negative events
293293
if fix_to_zero:
294-
for bin_i, y in enumerate(data_hist.y()):
294+
for bin_i, y in enumerate(data_hist.y(overflow=True)):
295295
if y < 0:
296-
data_hist.SetBinContent(bin_i + 1, 0)
296+
data_hist.SetBinContent(bin_i, 0)
297297
# add the difference to 0 to the existing error
298-
data_hist.SetBinError(bin_i, data_hist.GetBinError(bin_i + 1) + abs(y))
298+
data_hist.SetBinError(bin_i, data_hist.GetBinError(bin_i) + abs(y))
299299
return data_hist
300300

301301
def adjust_overflow_to_limit(histogram, x_min, x_max):

0 commit comments

Comments
 (0)