Skip to content

Commit

Permalink
check only fake factors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyi Wan committed May 7, 2024
1 parent 9e4ea60 commit e96fedb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions topeft/modules/datacard_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,21 +857,16 @@ def analyze(self,km_dist,ch,selected_wcs, crop_negative_bins, wcs_dict):
if arr[1] is not None:
arr[1][negative_bin_mask] = np.zeros_like( arr[1][negative_bin_mask] ) # if there's a sumw2 defined, that one's set to zero as well. Otherwise we will get 0 +/- something, which is compatible with negative

if len(arr[0][negative_bin_mask]) and syst =="nominal": # check systematics error for fake factors
if syst =="nominal": # check systematics error for fake factors
if sum(arr[0]) == 0:
check_zero_arr0 = True
if sum(arr[1]) == 0:
check_zero_arr1 = True
if "Up" in syst:
if "FF" in syst:
if check_zero_arr0 and sum(arr[0]) != 0:
print("Systematics Error arr[0]:Zero values in 'nominal' but non-zero in '%s'" % (syst))
raise Warning("Systematics Error arr[0]:Zero values in 'nominal' but non-zero in '%s'" % (syst))
if check_zero_arr1 and sum(arr[1]) != 0:
print("Systematics Error arr[1]:Zero values in 'nominal' but non-zero in '%s'" % (syst))
if "Down" in syst:
if check_zero_arr0 and sum(arr[0]) != 0:
print("Systematics Error arr[0]:Zero values in 'nominal' but non-zero in '%s'" % (syst))
if check_zero_arr1 and sum(arr[1]) != 0:
print("Systematics Error arr[1]:Zero values in 'nominal' but non-zero in '%s'" % (syst))
raise Warning("Systematics Error arr[1]:Zero values in 'nominal' but non-zero in '%s'" % (syst))

Check warning on line 869 in topeft/modules/datacard_tools.py

View check run for this annotation

Codecov / codecov/patch

topeft/modules/datacard_tools.py#L866-L869

Added lines #L866 - L869 were not covered by tests

sum_arr = sum(arr[0])
if syst == "nominal" and base == "sm":
Expand Down

0 comments on commit e96fedb

Please sign in to comment.