Skip to content

Commit f8f096d

Browse files
committed
exit with fatal error when eff vector is not monotonous
1 parent 9895db6 commit f8f096d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

PWGHF/D2H/Macros/compute_fraction_cutvar.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ def main(config):
200200
all_vectors_monotonous = MinimisationStatus.MonotonyViolation
201201
print("\0\33[33mWARNING! main(): the raw yield uncertainties vector is not monotonous. Check the input for stability.\0\33[0m")
202202
print(f"raw yield uncertainties vector elements = {unc_rawy}\n")
203+
if not (np.all(effp[1:] > effp[:-1]) or np.all(effp[1:] < effp[:-1])):
204+
sys.exit(f"\33[31mFatal error: the prompt efficiency vector is not monotonous. Check the input. Exit.\33[0m")
205+
if not (np.all(effnp[1:] > effnp[:-1]) or np.all(effnp[1:] < effnp[:-1])):
206+
sys.exit(f"\33[31mFatal error: the nonprompt efficiency vector is not monotonous. Check the input. Exit.\33[0m")
203207

204208
minimiser = CutVarMinimiser(rawy, effp, effnp, unc_rawy, unc_effp, unc_effnp)
205209
status = minimiser.minimise_system(cfg["minimisation"]["correlated"])

0 commit comments

Comments
 (0)