diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/calibmon.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/calibmon.py index c54bcda009b8e8b7865de300a0025fcc999c58fc..4873e102a6b80f84ccc7a0b399414a354d382199 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/calibmon.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/calibmon.py @@ -23,6 +23,8 @@ Uses the following postscaled Hlt2 lines: - Hlt2CalibMon_KshortVeloLongAllHlt1 """ +import operator + import Functors as F from DecayTreeFitter import DecayTreeFitter from Functors.math import in_range @@ -409,242 +411,279 @@ def calibmon_dst_to_d0_pi(name="Hlt2CalibMon_DstToD0Pi"): } for pid_cut in pid_bins: - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__K_PID_K-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() * (_GCHILDPID_K() > pid_cut), - variable_y=_DELTAMASS() * (_GCHILDPID_K() > pid_cut), - ) - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__K_PID_P-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ((_GCHILDPID_P() > pid_cut) & (_GCHILDP() > 10 * GeV)), - variable_y=_DELTAMASS() - * ((_GCHILDPID_P() > pid_cut) & (_GCHILDP() > 10 * GeV)), - ) - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__K_PID_PK-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ((_GCHILDPID_PK() > pid_cut) & (_GCHILDP() > 10 * GeV)), - variable_y=_DELTAMASS() - * ((_GCHILDPID_PK() > pid_cut) & (_GCHILDP() > 10 * GeV)), - ) - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__pi_PID_K-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() * (_GCHILDPID_K(j=2) > pid_cut), - variable_y=_DELTAMASS() * (_GCHILDPID_K(j=2) > pid_cut), - ) - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__pi_PID_P-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() * (_GCHILDPID_P(j=2) > pid_cut), - variable_y=_DELTAMASS() * (_GCHILDPID_P(j=2) > pid_cut), - ) - dst_hist_dict[f"integrated__D_MvsDst_D0_DeltaM__pi_PID_PK-{pid_cut}"] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() * (_GCHILDPID_PK(j=2) > pid_cut), - variable_y=_DELTAMASS() * (_GCHILDPID_PK(j=2) > pid_cut), - ) - for p_idx in range(0, len(p_bins) - 1): - dst_hist_dict[ - f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_K-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_K() > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_K() > pid_cut) - ), - ) - dst_hist_dict[ - f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_P-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_P() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), - variable_y=_DELTAMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_P() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), - ) - dst_hist_dict[ - f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_PK-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_PK() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), - variable_y=_DELTAMASS() - * ( - in_range(p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV) - & (_GCHILDPID_PK() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), - ) - dst_hist_dict[ - f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_K-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_K(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_K(j=2) > pid_cut) - ), - ) - dst_hist_dict[ - f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_P-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_P(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_P(j=2) > pid_cut) - ), - ) - dst_hist_dict[ - f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_PK-{pid_cut}" - ] = dict( - dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_PK(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range( - p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV - ) - & (_GCHILDPID_PK(j=2) > pid_cut) - ), - ) - for eta_idx in range(0, len(eta_bins) - 1): + for opn, op in {"gt": operator.gt, "le": operator.le}.items(): dst_hist_dict[ - f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_K-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__K_PID_K-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_K() > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_K() > pid_cut) - ), + variable_x=_CHILDMASS() * (op(_GCHILDPID_K(), pid_cut)), + variable_y=_DELTAMASS() * (op(_GCHILDPID_K(), pid_cut)), ) dst_hist_dict[ - f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_P-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__K_PID_P-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_P() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), + * ((op(_GCHILDPID_P(), pid_cut)) & (_GCHILDP() > 10 * GeV)), variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_P() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), + * ((op(_GCHILDPID_P(), pid_cut)) & (_GCHILDP() > 10 * GeV)), ) dst_hist_dict[ - f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_PK-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__K_PID_PK-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_PK() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), + * ((op(_GCHILDPID_PK(), pid_cut)) & (_GCHILDP() > 10 * GeV)), variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) - & (_GCHILDPID_PK() > pid_cut) - & (_GCHILDP() > 10 * GeV) - ), + * ((op(_GCHILDPID_PK(), pid_cut)) & (_GCHILDP() > 10 * GeV)), ) dst_hist_dict[ - f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_K-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__pi_PID_K-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_K(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_K(j=2) > pid_cut) - ), + variable_x=_CHILDMASS() * (op(_GCHILDPID_K(j=2), pid_cut)), + variable_y=_DELTAMASS() * (op(_GCHILDPID_K(j=2), pid_cut)), ) dst_hist_dict[ - f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_P-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__pi_PID_P-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_P(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_P(j=2) > pid_cut) - ), + variable_x=_CHILDMASS() * (op(_GCHILDPID_P(j=2), pid_cut)), + variable_y=_DELTAMASS() * (op(_GCHILDPID_P(j=2), pid_cut)), ) dst_hist_dict[ - f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_PK-{pid_cut}" + f"integrated__D_MvsDst_D0_DeltaM__pi_PID_PK-{opn}-{pid_cut}" ] = dict( dst_mass_part_dict, - variable_x=_CHILDMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_PK(j=2) > pid_cut) - ), - variable_y=_DELTAMASS() - * ( - in_range(eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1]) - & (_GCHILDPID_PK(j=2) > pid_cut) - ), + variable_x=_CHILDMASS() * (op(_GCHILDPID_PK(j=2), pid_cut)), + variable_y=_DELTAMASS() * (op(_GCHILDPID_PK(j=2), pid_cut)), ) + for p_idx in range(0, len(p_bins) - 1): + dst_hist_dict[ + f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_K-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_K(), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_K(), pid_cut)) + ), + ) + dst_hist_dict[ + f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_P-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_P(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_P(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + ) + dst_hist_dict[ + f"K_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_PK-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_PK(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_PK(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + ) + dst_hist_dict[ + f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_K-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_K(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_K(j=2), pid_cut)) + ), + ) + dst_hist_dict[ + f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_P-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_P(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_P(j=2), pid_cut)) + ), + ) + dst_hist_dict[ + f"pi_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_PK-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_PK(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + p_bins[p_idx] * GeV, _GCHILDP(j=2), p_bins[p_idx + 1] * GeV + ) + & (op(_GCHILDPID_PK(j=2), pid_cut)) + ), + ) + for eta_idx in range(0, len(eta_bins) - 1): + dst_hist_dict[ + f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_K-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_K(), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_K(), pid_cut)) + ), + ) + dst_hist_dict[ + f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_P-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_P(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + variable_y=_DELTAMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_P(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + ) + dst_hist_dict[ + f"K_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__K_PID_PK-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_PK(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + variable_y=_DELTAMASS() + * ( + in_range(eta_bins[eta_idx], _GCHILDETA(), eta_bins[eta_idx + 1]) + & (op(_GCHILDPID_PK(), pid_cut)) + & (_GCHILDP() > 10 * GeV) + ), + ) + dst_hist_dict[ + f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_K-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_K(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_K(j=2), pid_cut)) + ), + ) + dst_hist_dict[ + f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_P-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_P(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_P(j=2), pid_cut)) + ), + ) + dst_hist_dict[ + f"pi_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__D_MvsDst_D0_DeltaM__pi_PID_PK-{opn}-{pid_cut}" + ] = dict( + dst_mass_part_dict, + variable_x=_CHILDMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_PK(j=2), pid_cut)) + ), + variable_y=_DELTAMASS() + * ( + in_range( + eta_bins[eta_idx], _GCHILDETA(j=2), eta_bins[eta_idx + 1] + ) + & (op(_GCHILDPID_PK(j=2), pid_cut)) + ), + ) dst_hist_list = _make_hist_list(dst_hist_dict, name) global_hists = monitor( @@ -789,90 +828,96 @@ def calibmon_l0_to_p_pi(name="Hlt2CalibMon_L0ToPPi_LL"): } # Update the dict in loops for pid_cut in pid_bins: - l0_hist_dict[f"integrated__L0_M__p_PID_P-{pid_cut}"] = dict( - l_mass_part_dict, variable=F.MASS * (_CHILDPID_P() > pid_cut) - ) - l0_hist_dict[f"integrated__L0_M__p_PID_PK-{pid_cut}"] = dict( - l_mass_part_dict, - variable=F.MASS * ((_CHILDPID_PK() > pid_cut) & (_CHILDP() > 10 * GeV)), - ) - for pt_idx in range(0, len(pt_bins) - 1): - for p_idx in range(0, len(p_bins) - 1): - l0_hist_dict[ - f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__L0_M__p_PID_P-{pid_cut}" - ] = dict( - l_mass_part_dict, - variable=F.MASS - * ( - in_range( - pt_bins[pt_idx] * GeV, - F.CHILD(1, F.PT), - pt_bins[pt_idx + 1] * GeV, - ) - & in_range( - p_bins[p_idx] * GeV, - F.CHILD(1, F.P), - p_bins[p_idx + 1] * GeV, - ) - & (_CHILDPID_P() > pid_cut) - ), - ) - l0_hist_dict[ - f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__L0_M__p_PID_PK-{pid_cut}" - ] = dict( - l_mass_part_dict, - variable=F.MASS - * ( - in_range( - pt_bins[pt_idx] * GeV, - F.CHILD(1, F.PT), - pt_bins[pt_idx + 1] * GeV, - ) - & in_range( - p_bins[p_idx] * GeV, - F.CHILD(1, F.P), - p_bins[p_idx + 1] * GeV, - ) - & (_CHILDPID_PK() > pid_cut) - & (_CHILDP() > 10 * GeV) - ), - ) - for eta_idx in range(0, len(eta_bins) - 1): - l0_hist_dict[ - f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__L0_M__p_PID_P-{pid_cut}" - ] = dict( - l_mass_part_dict, - variable=F.MASS - * ( - in_range( - pt_bins[pt_idx] * GeV, - F.CHILD(1, F.PT), - pt_bins[pt_idx + 1] * GeV, - ) - & in_range( - eta_bins[p_idx], F.CHILD(1, F.ETA), eta_bins[eta_idx + 1] - ) - & (_CHILDPID_P() > pid_cut) - ), - ) - l0_hist_dict[ - f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__L0_M__p_PID_PK-{pid_cut}" - ] = dict( - l_mass_part_dict, - variable=F.MASS - * ( - in_range( - pt_bins[pt_idx] * GeV, - F.CHILD(1, F.PT), - pt_bins[pt_idx + 1] * GeV, - ) - & in_range( - eta_bins[p_idx], F.CHILD(1, F.ETA), eta_bins[eta_idx + 1] - ) - & (_CHILDPID_PK() > pid_cut) - & (_CHILDP() > 10 * GeV) - ), - ) + for opn, op in {"gt": operator.gt, "le": operator.le}.items(): + l0_hist_dict[f"integrated__L0_M__p_PID_P-{opn}-{pid_cut}"] = dict( + l_mass_part_dict, variable=F.MASS * (op(_CHILDPID_P(), pid_cut)) + ) + l0_hist_dict[f"integrated__L0_M__p_PID_PK-{opn}-{pid_cut}"] = dict( + l_mass_part_dict, + variable=F.MASS + * ((op(_CHILDPID_PK(), pid_cut)) & (_CHILDP() > 10 * GeV)), + ) + for pt_idx in range(0, len(pt_bins) - 1): + for p_idx in range(0, len(p_bins) - 1): + l0_hist_dict[ + f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__L0_M__p_PID_P-{opn}-{pid_cut}" + ] = dict( + l_mass_part_dict, + variable=F.MASS + * ( + in_range( + pt_bins[pt_idx] * GeV, + F.CHILD(1, F.PT), + pt_bins[pt_idx + 1] * GeV, + ) + & in_range( + p_bins[p_idx] * GeV, + F.CHILD(1, F.P), + p_bins[p_idx + 1] * GeV, + ) + & (op(_CHILDPID_P(), pid_cut)) + ), + ) + l0_hist_dict[ + f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_P-{p_bins[p_idx]}-{p_bins[p_idx + 1]}__L0_M__p_PID_PK-{opn}-{pid_cut}" + ] = dict( + l_mass_part_dict, + variable=F.MASS + * ( + in_range( + pt_bins[pt_idx] * GeV, + F.CHILD(1, F.PT), + pt_bins[pt_idx + 1] * GeV, + ) + & in_range( + p_bins[p_idx] * GeV, + F.CHILD(1, F.P), + p_bins[p_idx + 1] * GeV, + ) + & (op(_CHILDPID_PK(), pid_cut)) + & (_CHILDP() > 10 * GeV) + ), + ) + for eta_idx in range(0, len(eta_bins) - 1): + l0_hist_dict[ + f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__L0_M__p_PID_P-{opn}-{pid_cut}" + ] = dict( + l_mass_part_dict, + variable=F.MASS + * ( + in_range( + pt_bins[pt_idx] * GeV, + F.CHILD(1, F.PT), + pt_bins[pt_idx + 1] * GeV, + ) + & in_range( + eta_bins[p_idx], + F.CHILD(1, F.ETA), + eta_bins[eta_idx + 1], + ) + & (op(_CHILDPID_P(), pid_cut)) + ), + ) + l0_hist_dict[ + f"pT_P-{pt_bins[pt_idx]}-{pt_bins[pt_idx + 1]}__p_ETA-{eta_bins[eta_idx]}-{eta_bins[eta_idx + 1]}__L0_M__p_PID_PK-{opn}-{pid_cut}" + ] = dict( + l_mass_part_dict, + variable=F.MASS + * ( + in_range( + pt_bins[pt_idx] * GeV, + F.CHILD(1, F.PT), + pt_bins[pt_idx + 1] * GeV, + ) + & in_range( + eta_bins[p_idx], + F.CHILD(1, F.ETA), + eta_bins[eta_idx + 1], + ) + & (op(_CHILDPID_PK(), pid_cut)) + & (_CHILDP() > 10 * GeV) + ), + ) l0_hist_list = _make_hist_list(l0_hist_dict, name) global_hists = monitor( diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/data_quality_pp.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/data_quality_pp.py index 0ec9eb2298f3096843581cce393adb29dc8ade78..35f9c6949a29b6cde6152492bcf494b8ac294cd4 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/data_quality_pp.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/monitoring/data_quality_pp.py @@ -12,13 +12,15 @@ Postscaled (zero rate) monitoring lines for Offline DQ. The module contains the following lines: -- Hlt2DQ_Passthrough (prescaled with plots from RecoMon) +- Hlt2DQ_TrackPV2HalfMonitor & Hlt2DQ_TrackPV2HalfMonitor_NoBias (passthrough line for Velo alignment monitors) +- Hlt2DQ_TrackMonitors & Hlt2DQ_TrackMonitors_NoBias (passthrough line for track monitors) - Hlt2DQ_DiPhoton (pi0 -> gamma gamma) - Hlt2DQ_KsToPimPip_LL and DD (KS0 -> pi+ pi-) - Hlt2DQ_L0ToPpPim_LL and DD ([Lambda0 -> p+ pi-]cc) - Hlt2DQ_XimToL0Pim_LLL + DDL and DDD ([Xi- -> Lambda0 -> pi-]cc) - Hlt2DQ_OmegamToL0Km_LLL and DDD ([Omega- -> Lambda0 -> K-]cc) - Hlt2DQ_D0ToKmPip ([D0 -> K- pi+]cc) +- Hlt2DQ_D0ToKmPipPi0 ([D0 -> K- pi+ pi0]cc) - Hlt2DQ_DstpToD0Pip ([D*(2010)+ -> D0 pi+]cc) - Hlt2DQ_DpToKmPipPip ([D+ -> K- pi+ pi+]cc) - Hlt2DQ_DspToPhiPip ([D_s+ -> K- K+ pi+]cc) @@ -27,6 +29,7 @@ The module contains the following lines: """ import Functors as F +from DecayTreeFitter import DecayTreeFitter from Functors.math import log from Moore import options from Moore.config import register_line_builder @@ -37,6 +40,7 @@ from PyConf.Algorithms import ( TrackMonitor, TrackPV2HalfMonitor, TrackSelectionMerger, + TracksToSelection, TrackVertexMonitor, ) from PyConf.Algorithms import Rich__Future__Rec__Moni__DLLs as DLLs @@ -112,75 +116,20 @@ def _get_properties(data_handle: DataHandle): all_lines = {} -# don't register this for now, as none of the monitors is threadsafe -def _dq_richmon(name="Hlt2DQ_RICHMon", prescale=1): - richmon = [] - - # we have to traverse the data flow to configure the cherenkov angle plots with the proper reconstruction objects - long_rich_pids = reconstruction()["LongRichPIDs"] - long_rich_pids_props = _get_properties(long_rich_pids) - long_rich_pids_inputs = _get_inputs(long_rich_pids) - long_rich_pids_recsummary = long_rich_pids_inputs["SummaryTracksLocation"] - long_rich_pids_recsummary_inputs = _get_inputs(long_rich_pids_recsummary) - - # leave the Cherenkov resoluiton plots out for now as the algorithm is slow(er than e.g. 3xHybridSeeding) - # we can probably live with the online version of the plot for DQ - long_rich_pids_photon_signals_inputs = _get_inputs( - long_rich_pids_recsummary_inputs["PhotonSignalsLocation"] - ) - richmon.append( - PhotAngles( - name="DQ_RiCKResLong", - Detectors=long_rich_pids_props["Detectors"], - Radiators=long_rich_pids_props["Radiators"], - CKResHistoRange=(0.025, 0.0026, 0.002), - TracksLocation=long_rich_pids_inputs["TracksLocation"], - TrackSegmentsLocation=long_rich_pids_recsummary_inputs[ - "TrackSegmentsLocation" - ], - CherenkovPhotonLocation=long_rich_pids_photon_signals_inputs[ - "CherenkovPhotonLocation" - ], - CherenkovAnglesLocation=long_rich_pids_photon_signals_inputs[ - "CherenkovAnglesLocation" - ], - SummaryTracksLocation=long_rich_pids_recsummary, - PhotonToParentsLocation=long_rich_pids_recsummary_inputs[ - "PhotonToParentsLocation" - ], - ) - ) - richmon.append( - DLLs( - name="DQ_RichDLLsLong", - Detectors=long_rich_pids_props["Detectors"], - Radiators=long_rich_pids_props["Radiators"], - RichPIDsLocation=long_rich_pids, - ) - ) - - return Hlt2Line( +def _dq_halfmon_alg(name): + return TrackPV2HalfMonitor( name=name, - algs=_dq_filters() + richmon, - postscale=0, - persistreco=True, - monitoring_variables=(), - prescale=prescale, - ) - - -@register_line_builder(all_lines) -def dq_pv_2half_mon(name="Hlt2DQ_TrackPV2HalfMonitor", prescale=1): - mon = TrackPV2HalfMonitor( - name="DQ_TrackPV2HalfMonitor", TrackContainer=reconstruction()["AllTrackHandles"]["Velo"]["v1"], ODINLocation=make_odin(), allow_duplicate_instances_with_distinct_names=True, ) + +@register_line_builder(all_lines) +def dq_pv_2half_mon(name="Hlt2DQ_TrackPV2HalfMonitor", prescale=1): return Hlt2Line( name=name, - algs=_dq_filters() + [mon], + algs=_dq_filters() + [_dq_halfmon_alg(name)], postscale=0, persistreco=True, monitoring_variables=(), @@ -190,16 +139,9 @@ def dq_pv_2half_mon(name="Hlt2DQ_TrackPV2HalfMonitor", prescale=1): @register_line_builder(all_lines) def dq_pv_2half_mon_nobias(name="Hlt2DQ_TrackPV2HalfMonitor_NoBias", prescale=1): - mon = TrackPV2HalfMonitor( - name="DQ_TrackPV2HalfMonitor_NoBias", - TrackContainer=reconstruction()["AllTrackHandles"]["Velo"]["v1"], - ODINLocation=make_odin(), - allow_duplicate_instances_with_distinct_names=True, - ) - return Hlt2Line( name=name, - algs=_dq_filters(unbiased=True) + [mon], + algs=_dq_filters(unbiased=True) + [_dq_halfmon_alg(name)], postscale=0, persistreco=True, monitoring_variables=(), @@ -208,19 +150,15 @@ def dq_pv_2half_mon_nobias(name="Hlt2DQ_TrackPV2HalfMonitor_NoBias", prescale=1) ) -@register_line_builder(all_lines) -def _dq_tracking(name="Hlt2DQ_TrackMonitors", prescale=0.01): - pvs = make_pvs() - - all_tracks = reconstruction()["AllTrackHandles"] - +def _dq_track_monitors(name): trackmon = [] + all_tracks = reconstruction()["AllTrackHandles"] calo_objects = reconstruction()["AllCaloHandles"] trackmon.append( MonitorDetectorCorrelations( - name="DQ_MonitorDetectorCorrelations", + name=f"{name}_DetectorCorrelations", VeloHits=all_tracks["Velo"]["Pr"].producer.HitsLocation, # TODO: there are now 3 different types of UT hits. # MonitorDetectorCorrelations uses the first one of https://gitlab.cern.ch/lhcb/Rec/-/blob/51834236b66bee0ab92b763973a64e85be466f05/Pr/PrAlgorithms/src/PrStoreUTHit.cpp#L231 @@ -250,29 +188,39 @@ def _dq_tracking(name="Hlt2DQ_TrackMonitors", prescale=0.01): # merge all best tracks all_best_tracks = TrackSelectionMerger( - InputLocations=[v["v1"] for k, v in all_tracks.items() if k.startswith("Best")] + InputLocations=[ + TracksToSelection(InputLocation=v["v1"]).OutputLocation + for k, v in all_tracks.items() + if k.startswith("Best") + ] ).OutputLocation trackmon.append( TrackVertexMonitor( - name="DQ_TrackVertexMonitor", - PVContainer=pvs, + name=f"{name}_TrackVertex", + PVContainer=make_pvs(), TrackContainer=all_best_tracks, allow_duplicate_instances_with_distinct_names=True, ) ) + # NB: to get track residuals, one would have to store the fitresult of the KF (`make_PrKalmanFilter_tracks.bind(fill_fit_result=True)`). That's a bit too slow to justify switching it on in HLT2 given that RecoMon produces sufficient stats. trackmon.append( TrackMonitor( - name="DQ_TrackMonitor", + name=f"{name}_Track", TracksInContainer=all_best_tracks, allow_duplicate_instances_with_distinct_names=True, ) ) + return trackmon + + +@register_line_builder(all_lines) +def _dq_tracking(name="Hlt2DQ_TrackMonitors", prescale=0.01): return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(pvs)] + trackmon, + algs=_dq_filters() + [require_pvs(make_pvs())] + _dq_track_monitors(name), postscale=0, persistreco=True, monitoring_variables=(), @@ -282,69 +230,11 @@ def _dq_tracking(name="Hlt2DQ_TrackMonitors", prescale=0.01): @register_line_builder(all_lines) def _dq_tracking_nobias(name="Hlt2DQ_TrackMonitors_NoBias", prescale=1): - pvs = make_pvs() - - all_tracks = reconstruction()["AllTrackHandles"] - - trackmon = [] - - calo_objects = reconstruction()["AllCaloHandles"] - - trackmon.append( - MonitorDetectorCorrelations( - name="DQ_MonitorDetectorCorrelations_NoBias", - VeloHits=all_tracks["Velo"]["Pr"].producer.HitsLocation, - # TODO: there are now 3 different types of UT hits. - # MonitorDetectorCorrelations uses the first one of https://gitlab.cern.ch/lhcb/Rec/-/blob/51834236b66bee0ab92b763973a64e85be466f05/Pr/PrAlgorithms/src/PrStoreUTHit.cpp#L231 - # while the reconstruction uses SoA hits - # UTHits=_get_inputs(all_tracks["Downstream"]["Pr"])["UTHits"], - UTHits=make_PrStoreUTHit_empty_hits(), - SciFiHits=_get_inputs(all_tracks["Seed"]["Pr"])["FTHitsLocation"], - MuonHits=_get_inputs( - _get_inputs(reconstruction()["LongMuonPIDs"])["InputMuonPIDs"] - )["InputMuonHits"], - ECALClusters=calo_objects["ecalClusters"], - ECALDigits=calo_objects["digitsEcal"], - HCALDigits=calo_objects["digitsHcal"], - RichPixels=_get_inputs( - _get_inputs( - _get_inputs( - _get_inputs(reconstruction()["LongRichPIDs"])[ - "SummaryTracksLocation" - ] - )["RichSIMDPixelSummariesLocation"] - )["RichPixelClustersLocation"] - )["DecodedDataLocation"], - CollisionType="pp", - allow_duplicate_instances_with_distinct_names=True, - ) - ) - - # merge all best tracks - all_best_tracks = TrackSelectionMerger( - InputLocations=[v["v1"] for k, v in all_tracks.items() if k.startswith("Best")] - ).OutputLocation - - trackmon.append( - TrackVertexMonitor( - name="DQ_TrackVertexMonitor_NoBias", - PVContainer=pvs, - TrackContainer=all_best_tracks, - allow_duplicate_instances_with_distinct_names=True, - ) - ) - - trackmon.append( - TrackMonitor( - name="DQ_TrackMonitor_NoBias", - TracksInContainer=all_best_tracks, - allow_duplicate_instances_with_distinct_names=True, - ) - ) - return Hlt2Line( name=name, - algs=_dq_filters(unbiased=True) + [require_pvs(pvs)] + trackmon, + algs=_dq_filters(unbiased=True) + + [require_pvs(make_pvs())] + + _dq_track_monitors(name), postscale=0, persistreco=True, monitoring_variables=(), @@ -400,7 +290,7 @@ def _kshort_ll_line(name="Hlt2DQ_KsToPimPip_LL", prescale=1): return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [ks, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), ks, mon], postscale=0, persistreco=True, monitoring_variables=( @@ -436,7 +326,7 @@ def _kshort_dd_line(name="Hlt2DQ_KsToPimPip_DD", prescale=1): return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [ks, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), ks, mon], postscale=0, persistreco=True, prescale=prescale, @@ -471,7 +361,7 @@ def _kshort_uu_line(name="Hlt2DQ_KsToPimPip_UU", prescale=1): return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [ks, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), ks, mon], postscale=0, persistreco=True, prescale=prescale, @@ -547,7 +437,42 @@ def _lambda_ll_line(name="Hlt2DQ_L0ToPpPim_LL", prescale=1): return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [lz, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), lz, mon], + postscale=0, + persistreco=True, + prescale=prescale, + ) + + +@register_line_builder(all_lines) +def _lambda_lu_line(name="Hlt2DQ_L0ToPpPim_LU", prescale=1): + lz = monitoring_particles.prompt_lambda_lu() + + mon = monitor( + data=lz, + histograms=[ + histogram_1d( + functor=log(F.OWNPVFD), + name=f"/{name}/Lambda_FDlog", + title="Lambda_FDlog", + label="log(#Lambda FD [mm])", + bins=100, + range=(1, 8), + ), + histogram_1d( + functor=F.MASS, + name=f"/{name}/m_L", + title="Lambda mass", + label="m(p #pi^{-}) [MeV]", + bins=100, + range=(1080, 1180), + ), + ], + ) + + return Hlt2Line( + name=name, + algs=_dq_filters() + [require_pvs(make_pvs()), lz, mon], postscale=0, persistreco=True, prescale=prescale, @@ -635,7 +560,7 @@ def _lambda_dd_line(name="Hlt2DQ_L0ToPpPim_DD", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [lz, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), lz, mon], postscale=0, persistreco=True, prescale=prescale, @@ -676,7 +601,7 @@ def _xi_lll_line(name="Hlt2DQ_XimToL0Pim_LLL", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [xi, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), xi, mon], postscale=0, persistreco=True, prescale=prescale, @@ -709,7 +634,7 @@ def _xi_ddl_line(name="Hlt2DQ_XimToL0Pim_DDL", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [xi, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), xi, mon], postscale=0, persistreco=True, prescale=prescale, @@ -728,7 +653,7 @@ def _xi_ddd_line(name="Hlt2DQ_XimToL0Pim_DDD", prescale=1): title="Xi_FDlog", label="log(#Xi^{-} FD [mm])", bins=100, - range=(1, 8), + range=(5, 9), ), histogram_1d( functor=F.MASS, @@ -742,7 +667,7 @@ def _xi_ddd_line(name="Hlt2DQ_XimToL0Pim_DDD", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [xi, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), xi, mon], postscale=0, persistreco=True, prescale=prescale, @@ -783,7 +708,7 @@ def _omega_lll_line(name="Hlt2DQ_OmegamToL0Km_LLL", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [omega, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), omega, mon], postscale=0, persistreco=True, prescale=prescale, @@ -832,7 +757,7 @@ def _omega_ddd_line(name="Hlt2DQ_OmegamToL0Km_DDD", prescale=1): ) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [omega, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), omega, mon], postscale=0, persistreco=True, prescale=prescale, @@ -841,15 +766,15 @@ def _omega_ddd_line(name="Hlt2DQ_OmegamToL0Km_DDD", prescale=1): @register_line_builder(all_lines) def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): - d0 = monitoring_particles.prompt_d0() + d0 = monitoring_particles.d0() def _d0_hists(tos: bool): return [ histogram_1d( functor=F.MASS * (_HLT1_RE_DEC("Hlt1D2KPiDecision") if tos else 1), name=f"/{name}/D0_M{'_Hlt1D2KPiTOS' if tos else ''}", - bins=66, - range=(1700, 2030), + bins=100, + range=(1820, 1920), title="", label="m(K^{#minus}#pi^{+}) [MeV]", ), @@ -874,15 +799,15 @@ def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): + (0 if not tos else 9999 * (_HLT1_RE_DEC("Hlt1D2KPiDecision") - 1)), name=f"/{name}/D0_logIPCHI2{'_Hlt1D2KPiTOS' if tos else ''}", bins=120, - range=(-6, 12), + range=(-6, 6), title="", - label="log(#chi^{2}_{IP}) (D^{0})", + label="log(#chi^{2}_{IP})(D^{0})", ), histogram_1d( functor=_ASYM(F.P) + (0 if not tos else 9999 * (_HLT1_RE_DEC("Hlt1D2KPiDecision") - 1)), name=f"/{name}/D0_Daughters_Pasy{'_Hlt1D2KPiTOS' if tos else ''}", - bins=120, + bins=100, range=(-1, 1), title="", label="p asymmetry (K,#pi)_{D^{0}}", @@ -891,7 +816,7 @@ def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): functor=_ASYM(F.PT) + (0 if not tos else 9999 * (_HLT1_RE_DEC("Hlt1D2KPiDecision") - 1)), name=f"/{name}/D0_Daughters_PTasy{'_Hlt1D2KPiTOS' if tos else ''}", - bins=60, + bins=100, range=(-1, 1), title="", label="p_{T} asymmetry (K,#pi)_{D^{0}}", @@ -900,8 +825,8 @@ def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): functor=F.CHILD(1, F.PID_K) * (_HLT1_RE_DEC("Hlt1D2KPiDecision") if tos else 1), name=f"/{name}/K_PIDk{'_Hlt1D2KPiTOS' if tos else ''}", - bins=60, - range=(5, 150), + bins=100, + range=(0, 200), title="", label="PIDK (K)", ), @@ -909,8 +834,8 @@ def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): functor=F.CHILD(2, F.PID_K) + (0 if not tos else 9999 * (_HLT1_RE_DEC("Hlt1D2KPiDecision") - 1)), name=f"/{name}/pi_PIDk{'_Hlt1D2KPiTOS' if tos else ''}", - bins=60, - range=(-150, 5), + bins=100, + range=(-197, 3), title="", label="PIDK (#pi)", ), @@ -937,7 +862,7 @@ def _d0_to_kpi_line(name="Hlt2DQ_D0ToKmPip", prescale=1): mon = monitor(data=d0, histograms=_d0_hists(tos=False) + _d0_hists(tos=True)) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [d0, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), d0, mon], postscale=0, persistreco=True, prescale=prescale, @@ -949,8 +874,7 @@ def _dst_line(name="Hlt2DQ_DstpToD0Pip", prescale=1): return Hlt2Line( name=name, algs=_dq_filters() - + [require_pvs(make_pvs())] - + [monitoring_particles.prompt_dst()], + + [require_pvs(make_pvs()), monitoring_particles.prompt_dst()], postscale=0, persistreco=True, prescale=prescale, @@ -959,7 +883,7 @@ def _dst_line(name="Hlt2DQ_DstpToD0Pip", prescale=1): @register_line_builder(all_lines) def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): - dp = monitoring_particles.prompt_dp() + dp = monitoring_particles.dp() def _dp_hists(tos: bool): return [ @@ -970,7 +894,7 @@ def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): title="DMassMon", label="m(K^{#minus}#pi^{+}#pi^{+} + c.c.) [MeV]", bins=100, - range=(1670, 2070), + range=(1820, 1920), ), histogram_1d( functor=F.MASS @@ -982,7 +906,7 @@ def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): title="DplusMassMon", label="m(K^{#minus}#pi^{+}#pi^{+}) [MeV]", bins=100, - range=(1670, 2070), + range=(1820, 1920), ), histogram_1d( functor=F.MASS @@ -993,8 +917,8 @@ def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): name=f"/{name}/dminus_m{'_Hlt1TrackMVATOS' if tos else ''}", title="DminusMassMon", label="m(K^{+}#pi^{#minus}#pi^{#minus}) [MeV]", - bins=200, - range=(1670, 2070), + bins=100, + range=(1820, 1920), ), histogram_1d( functor=F.PT * (_HLT1_RE_DEC(r"Hlt1.*TrackMVADecision") if tos else 1), @@ -1034,7 +958,7 @@ def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): ), name=f"/{name}/D_logIPCHI2{'_Hlt1TrackMVATOS' if tos else ''}", bins=120, - range=(-6, 12), + range=(-6, 6), title="", label="log(#chi^{2}_{IP}) (D^{+})", ), @@ -1043,7 +967,7 @@ def _dp_to_kpipi_line(name="Hlt2DQ_DpToKmPipPip", prescale=1): mon = monitor(data=dp, histograms=_dp_hists(tos=False) + _dp_hists(tos=True)) return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [dp, mon], + algs=_dq_filters() + [require_pvs(make_pvs()), dp, mon], postscale=0, persistreco=True, prescale=prescale, @@ -1055,8 +979,7 @@ def _ds_line(name="Hlt2DQ_DspToPhiPip", prescale=1): return Hlt2Line( name=name, algs=_dq_filters() - + [require_pvs(make_pvs())] - + [monitoring_particles.prompt_ds()], + + [require_pvs(make_pvs()), monitoring_particles.prompt_ds()], postscale=0, persistreco=True, prescale=prescale, @@ -1068,8 +991,7 @@ def _lc_line(name="Hlt2DQ_LcpToPpKmPip", prescale=1): return Hlt2Line( name=name, algs=_dq_filters() - + [require_pvs(make_pvs())] - + [monitoring_particles.prompt_lc()], + + [require_pvs(make_pvs()), monitoring_particles.prompt_lc()], postscale=0, persistreco=True, prescale=prescale, @@ -1081,8 +1003,7 @@ def _jpsi_to_mumu_line(name="Hlt2DQ_JpsiToMumMup", prescale=1): return Hlt2Line( name=name, algs=_dq_filters() - + [require_pvs(make_pvs())] - + [monitoring_particles.prompt_jpsi_to_mumu()], + + [require_pvs(make_pvs()), monitoring_particles.prompt_jpsi_to_mumu()], postscale=0, persistreco=True, prescale=prescale, @@ -1091,47 +1012,10 @@ def _jpsi_to_mumu_line(name="Hlt2DQ_JpsiToMumMup", prescale=1): @register_line_builder(all_lines) def _jpsi_to_ee_line(name="Hlt2DQ_JpsiToEmEp", prescale=1): - jpsi = monitoring_particles.prompt_jpsi_to_ee() - mon = monitor( - data=jpsi, - histograms=[ - histogram_1d( - functor=F.MASS - * ( - F.require_any( - F.CHILD(1, F.HASBREMADDED) & F.CHILD(2, ~F.HASBREMADDED), - F.CHILD(2, F.HASBREMADDED) & F.CHILD(1, ~F.HASBREMADDED), - ) - ), - name=f"/{name}/M_one_brem", - title="Jpsi_m_one_brem", - label="m(e^{+}e^{#minus}) [MeV]", - bins=60, - range=(2300, 3500), - ), - histogram_1d( - functor=F.MASS - * (F.CHILD(1, F.HASBREMADDED) & F.CHILD(2, F.HASBREMADDED)), - name=f"/{name}/M_both_brem", - title="Jpsi_m_both_brem", - label="m(e^{+}e^{#minus}) [MeV]", - bins=60, - range=(2300, 3500), - ), - histogram_1d( - functor=F.MASS, - name=f"/{name}/M", - title="Jpsi_m_any_brem", - label="m(e^{+}e^{#minus}) [MeV]", - bins=60, - range=(2300, 3500), - ), - ], - ) - return Hlt2Line( name=name, - algs=_dq_filters() + [require_pvs(make_pvs())] + [jpsi, mon], + algs=_dq_filters() + + [require_pvs(make_pvs()), monitoring_particles.prompt_jpsi_to_ee()], postscale=0, persistreco=True, prescale=prescale, diff --git a/Hlt/Moore/python/Moore/monitoring.py b/Hlt/Moore/python/Moore/monitoring.py index 5a81418585e810579ee1b2b05f1292d7ac7c05dc..2706c84fd32140867659bc9dcfb9b7370c01b0b1 100644 --- a/Hlt/Moore/python/Moore/monitoring.py +++ b/Hlt/Moore/python/Moore/monitoring.py @@ -129,7 +129,7 @@ def monitoring(algs, name, mon_vars): def _parse_range(functor, cut): # match the use of in_range with a given functor, and store the numbers in a capturing group (.*?) # to find the end of a functor, go to the last closing bracket and match either the AND with the nex functor, or the end of line "?( &|$)" - m = re.search(rf"in_range\( (.\S*?), {functor}, (.\S*?) \)?( &|$)", cut) + m = re.search(rf"in_range\( (.\S*?), {functor}, (.\S*?) \)?( &|$| \))", cut) return None if m is None else (float(m.group(1)), float(m.group(2))) def _parse_limits(functor, cut, default_lo, default_hi): diff --git a/Hlt/RecoConf/python/RecoConf/mass_monitors.py b/Hlt/RecoConf/python/RecoConf/mass_monitors.py index ed85bb0f89ba9ac28ab8c45f461890bbd4e81819..dba0f3aa67cc8004d752d0a29743456b7df78b22 100644 --- a/Hlt/RecoConf/python/RecoConf/mass_monitors.py +++ b/Hlt/RecoConf/python/RecoConf/mass_monitors.py @@ -142,7 +142,7 @@ def _omega_lll_mass_mon(): def _d0_mass_mon(): return monitor( name="D0MassMon", - data=monitoring_particles.prompt_d0(), + data=monitoring_particles.d0(), histograms=[ histogram_1d( name="d0_m", @@ -176,7 +176,7 @@ def _dst_mass_mon(): def _dp_mass_mon(): return monitor( name="DpMassMon", - data=monitoring_particles.prompt_dp(), + data=monitoring_particles.dp(), histograms=[ histogram_1d( name="dp_m", @@ -311,7 +311,7 @@ def make_mass_monitors(): filters=[monitoring_particles.prompt_omega_lll()], ) d0_mon_reco = Reconstruction( - "D0MassMonCF", [_d0_mass_mon()], filters=[monitoring_particles.prompt_d0()] + "D0MassMonCF", [_d0_mass_mon()], filters=[monitoring_particles.d0()] ) dst_mon_reco = Reconstruction( "DstMassMonCF", @@ -319,7 +319,7 @@ def make_mass_monitors(): filters=[monitoring_particles.prompt_dst()], ) dp_mon_reco = Reconstruction( - "DpMassMonCF", [_dp_mass_mon()], filters=[monitoring_particles.prompt_dp()] + "DpMassMonCF", [_dp_mass_mon()], filters=[monitoring_particles.dp()] ) ds_mon_reco = Reconstruction( "DsMassMonCF", [_ds_mass_mon()], filters=[monitoring_particles.prompt_ds()] diff --git a/Hlt/RecoConf/python/RecoConf/monitoring_particles.py b/Hlt/RecoConf/python/RecoConf/monitoring_particles.py index 160450c10fcc0bb058219b735143ced650e56e20..0ef98a6d1a45c8808256999ac40e1098c9ac086f 100644 --- a/Hlt/RecoConf/python/RecoConf/monitoring_particles.py +++ b/Hlt/RecoConf/python/RecoConf/monitoring_particles.py @@ -9,9 +9,9 @@ # or submit itself to any jurisdiction. # ############################################################################### import Functors as F +from DecayTreeFitter import DecayTreeFitter from GaudiKernel.SystemOfUnits import GeV, MeV, mm from GaudiKernel.SystemOfUnits import micrometer as um -from PyConf.Algorithms import FunctionalDiElectronMaker from PyConf.Tools import ParticleVertexFitter from RecoConf.algorithms_thor import ParticleCombiner, ParticleFilter @@ -25,16 +25,12 @@ from .standard_particles import ( make_has_rich_long_pions, make_has_rich_long_protons, make_ismuon_long_muon, - make_long_electrons_no_brem, + make_long_electrons_with_brem, make_photons, make_up_pions, ) -def _MIPCHI2_MIN(cut, pvs=make_pvs): - return F.MINIPCHI2CUT(IPChi2Cut=cut, Vertices=pvs()) - - def _DZ_CHILD(i): return F.CHILD(i, F.END_VZ) - F.END_VZ @@ -62,7 +58,7 @@ def _filter_photons(): def _filter_long_pions_for_strange(): return ParticleFilter( make_has_rich_long_pions(), - F.FILTER(F.require_all(F.PT > 80 * MeV, _MIPCHI2_MIN(9), F.PID_K < 5)), + F.FILTER(F.require_all(F.PT > 80 * MeV, F.OWNPVIPCHI2 > 9.0, F.PID_K < 5)), ) @@ -75,7 +71,18 @@ def _filter_down_pions_for_strange(): def _filter_upstream_pions_for_strange(): return ParticleFilter( - make_up_pions(), F.FILTER(F.require_all(F.PT > 80 * MeV, _MIPCHI2_MIN(9))) + make_up_pions(), F.FILTER(F.require_all(F.PT > 80 * MeV, F.OWNPVIPCHI2 > 9.0)) + ) + + +def _filter_long_protons_for_strange(): + return ParticleFilter( + make_has_rich_long_protons(), + F.FILTER( + F.require_all( + F.PT > 350 * MeV, F.P > 2.3 * GeV, F.OWNPVIPCHI2 > 6.0, F.PID_P > 3 + ) + ), ) @@ -85,8 +92,8 @@ def _filter_long_pions_for_charm(): F.FILTER( F.require_all( F.PT > 180 * MeV, - F.PID_K < 3, - _MIPCHI2_MIN(6), + F.PID_K < 3.0, + F.OWNPVIPCHI2 > 6.0, ), ), ) @@ -95,7 +102,7 @@ def _filter_long_pions_for_charm(): def _filter_long_kaons_for_strange(): return ParticleFilter( make_has_rich_long_kaons(), - F.FILTER(F.require_all(F.PT > 150 * MeV, _MIPCHI2_MIN(6), F.PID_K > 2)), + F.FILTER(F.require_all(F.PT > 150 * MeV, F.OWNPVIPCHI2 > 6.0, F.PID_K > 2.0)), ) @@ -106,21 +113,34 @@ def _filter_long_kaons_for_charm(): F.require_all( F.PT > 300 * MeV, F.P > 2.3 * GeV, - F.PID_K > 0, - _MIPCHI2_MIN(4), + F.PID_K > 0.0, + F.OWNPVIPCHI2 > 4.0, ), ), ) +def _piz_resolved(): + return ParticleCombiner( + name="Monitoring_PizToGG", + ParticleCombiner="ParticleAdder", + Inputs=[_filter_photons(), _filter_photons()], + DecayDescriptor="pi0 -> gamma gamma", + CombinationCut=F.require_all( + F.math.in_range(45 * MeV, F.MASS, 220 * MeV), F.PT > 300 * MeV + ), + CompositeCut=F.ALL, + ) + + def diphoton(): return ParticleCombiner( name="Monitoring_DiPhoton", Inputs=[_filter_photons(), _filter_photons()], - ParticleCombiner="ParticleAdder", DecayDescriptor="eta -> gamma gamma", + ParticleCombiner="ParticleAdder", CombinationCut=F.require_all( - F.math.in_range(0 * MeV, F.MASS, 1200 * MeV), F.PT > 1 * GeV + F.math.in_range(0 * MeV, F.MASS, 640 * MeV), F.PT > 1 * GeV ), CompositeCut=F.ALL, ) @@ -137,13 +157,13 @@ def prompt_ks_ll(): ), CompositeCut=F.require_all( F.math.in_range(410 * MeV, F.MASS, 590 * MeV), - F.CHI2DOF < 24, + F.CHI2DOF < 24.0, F.math.in_range(-200 * mm, F.END_VZ, 640 * mm), F.OWNPVVDZ > 3 * mm, F.OWNPVVDRHO > 0.1 * mm, - F.OWNPVDLS > 6, + F.OWNPVDLS > 6.0, F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVIPCHI2 < 9.0, ), ) @@ -161,10 +181,10 @@ def prompt_ks_dd(): CompositeCut=F.require_all( F.math.in_range(410 * MeV, F.MASS, 590 * MeV), F.PT > 350 * MeV, - F.CHI2DOF < 24, + F.CHI2DOF < 24.0, F.math.in_range(250 * mm, F.END_VZ, 2485 * mm), F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 12, + F.OWNPVIPCHI2 < 12.0, ), ) @@ -176,32 +196,25 @@ def prompt_ks_uu(): name="Monitoring_KS0_UU", CombinationCut=F.require_all( F.math.in_range(300 * MeV, F.MASS, 700 * MeV), - F.PT > 50 * MeV, - F.P > 0.4 * GeV, + F.PT > 250 * MeV, F.MAXDOCACUT(200 * um), ), CompositeCut=F.require_all( F.math.in_range(300 * MeV, F.MASS, 700 * MeV), - F.PT > 100 * MeV, - F.P > 0.5 * GeV, + F.PT > 300 * MeV, + F.math.in_range(-200 * mm, F.END_VZ, 640 * mm), F.CHI2DOF < 12.0, - F.BPVVDZ(make_pvs()) > 4 * mm, - F.BPVVDRHO(make_pvs()) > 1.5 * mm, - F.BPVFDCHI2(make_pvs()) > 80.0, - F.BPVDIRA(make_pvs()) < 0.9995, + F.OWNPVVDZ > 4 * mm, + F.OWNPVVDRHO > 1.5 * mm, + F.OWNPVDLS > 6.0, + F.OWNPVDIRA > 0.999, + F.OWNPVIPCHI2 < 9.0, ), ) def _lambda_ll(): - protons = ParticleFilter( - make_has_rich_long_protons(), - F.FILTER( - F.require_all( - F.PT > 350 * MeV, F.P > 2.3 * GeV, _MIPCHI2_MIN(6.0), F.PID_P > 3 - ) - ), - ) + protons = _filter_long_protons_for_strange() return ParticleCombiner( [protons, _filter_long_pions_for_strange()], DecayDescriptor="[Lambda0 -> p+ pi-]cc", @@ -216,14 +229,14 @@ def _lambda_ll(): F.math.in_range(-200 * mm, F.END_VZ, 640 * mm), F.OWNPVVDZ > 4 * mm, F.OWNPVVDRHO > 0.6 * mm, - F.OWNPVDLS > 6, + F.OWNPVDLS > 6.0, ), ) def prompt_lambda_ll(): return ParticleFilter( - _lambda_ll(), F.FILTER(F.require_all(F.OWNPVDIRA > 0.999, F.OWNPVIPCHI2 < 9)) + _lambda_ll(), F.FILTER(F.require_all(F.OWNPVDIRA > 0.999, F.OWNPVIPCHI2 < 9.0)) ) @@ -234,13 +247,35 @@ def _lambda_ll_for_strange(): F.require_all( F.OWNPVVDZ > 6 * mm, F.OWNPVVDRHO > 1 * mm, - F.OWNPVDLS > 8, + F.OWNPVDLS > 8.0, F.math.in_range(1109 * MeV, F.MASS, 1123 * MeV), ) ), ) +def prompt_lambda_lu(): + return ParticleCombiner( + [_filter_long_protons_for_strange(), _filter_upstream_pions_for_strange()], + DecayDescriptor="[Lambda0 -> p+ pi-]cc", + name="Monitoring_Lambda_LU", + CombinationCut=F.require_all( + F.MASS < 1200 * MeV, + F.MAXDOCACUT(200 * um), + ), + CompositeCut=F.require_all( + F.MASS < 1180 * MeV, + F.CHI2DOF < 16.0, + F.math.in_range(-200 * mm, F.END_VZ, 640 * mm), + F.OWNPVVDZ > 4 * mm, + F.OWNPVVDRHO > 0.6 * mm, + F.OWNPVDLS > 6.0, + F.OWNPVDIRA > 0.999, + F.OWNPVIPCHI2 < 9.0, + ), + ) + + def _lambda_dd(): protons = ParticleFilter( make_has_rich_down_protons(), @@ -256,7 +291,7 @@ def _lambda_dd(): ), CompositeCut=F.require_all( F.MASS < 1140 * MeV, - F.CHI2DOF < 24, + F.CHI2DOF < 24.0, F.math.in_range(250 * mm, F.END_VZ, 2485 * mm), ), ) @@ -264,7 +299,7 @@ def _lambda_dd(): def prompt_lambda_dd(): return ParticleFilter( - _lambda_dd(), F.FILTER(F.require_all(F.OWNPVDIRA > 0.99, F.OWNPVIPCHI2 < 12)) + _lambda_dd(), F.FILTER(F.require_all(F.OWNPVDIRA > 0.99, F.OWNPVIPCHI2 < 12.0)) ) @@ -290,10 +325,10 @@ def prompt_xi_lll(): _DZ_CHILD(1) > 4 * mm, _DRHO2_CHILD(1) > 20 * 20 * um * um, F.OWNPVVDZ > 4 * mm, - F.OWNPVDLS > 6, + F.OWNPVDLS > 6.0, F.math.in_range(-200 * mm, F.END_VZ, 630 * mm), F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVIPCHI2 < 9.0, ), ParticleCombiner=ParticleVertexFitter(MassConstraints=["Lambda0"]), ) @@ -312,10 +347,10 @@ def prompt_xi_ddl(): F.MASS < 1380 * MeV, F.CHI2DOF < 12.0, F.OWNPVVDZ > 4 * mm, - F.OWNPVDLS > 16, + F.OWNPVDLS > 16.0, F.math.in_range(-200 * mm, F.END_VZ, 630 * mm), F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 12, + F.OWNPVIPCHI2 < 12.0, ), ParticleCombiner=ParticleVertexFitter(MassConstraints=["Lambda0"]), ) @@ -352,14 +387,14 @@ def prompt_omega_lll(): ), CompositeCut=F.require_all( F.MASS < 1740 * MeV, - F.CHI2DOF < 24, + F.CHI2DOF < 24.0, _DZ_CHILD(1) > 1 * mm, _DRHO2_CHILD(1) > 20 * 20 * um * um, F.OWNPVVDZ > 1 * mm, - F.OWNPVDLS > 5, + F.OWNPVDLS > 5.0, F.math.in_range(-200 * mm, F.END_VZ, 630 * mm), F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVIPCHI2 < 9.0, ), ParticleCombiner=ParticleVertexFitter(MassConstraints=["Lambda0"]), ) @@ -389,7 +424,7 @@ def prompt_omega_ddd(): ) -def prompt_d0(): +def d0(): return ParticleCombiner( [_filter_long_kaons_for_charm(), _filter_long_pions_for_charm()], DecayDescriptor="[D0 -> K- pi+]cc", @@ -398,17 +433,15 @@ def prompt_d0(): F.math.in_range(1665 * MeV, F.MASS, 2065 * MeV), F.PT > 1.3 * GeV, F.CHILD(2, F.PT) > 300 * MeV, - F.CHILD(1, _MIPCHI2_MIN(6)), + F.CHILD(1, F.OWNPVIPCHI2 > 6.0), F.MAXSDOCACUT(100 * um), ), CompositeCut=F.require_all( F.math.in_range(1700 * MeV, F.MASS, 2030 * MeV), F.PT > 1.5 * GeV, - F.CHI2DOF < 7, - F.OWNPVVDZ > 0.8 * mm, + F.CHI2DOF < 7.0, + F.OWNPVVDZ > 1 * mm, F.OWNPVDLS > 4.5, - F.OWNPVIPCHI2 < 9, - F.OWNPVDIRA > 0.999, ), ) @@ -416,12 +449,10 @@ def prompt_d0(): def prompt_dst(): slow_pi = ParticleFilter( make_has_rich_long_pions(), - F.FILTER( - F.require_all(F.PT > 120 * MeV, F.MINIPCHI2(make_pvs()) < 6, F.PID_K < 16) - ), + F.FILTER(F.require_all(F.PT > 120 * MeV, F.OWNPVIPCHI2 < 6.0, F.PID_K < 16.0)), ) return ParticleCombiner( - [prompt_d0(), slow_pi], + [d0(), slow_pi], DecayDescriptor="[D*(2010)+ -> D0 pi+]cc", name="Monitoring_Dstar", CombinationCut=F.require_all( @@ -431,12 +462,12 @@ def prompt_dst(): F.MAXSDOCACUT(180 * um), ), CompositeCut=F.require_all( - F.MASS - F.CHILD(1, F.MASS) < 180 * MeV, F.CHI2DOF < 6, F.PT > 2 * GeV + F.MASS - F.CHILD(1, F.MASS) < 180 * MeV, F.CHI2DOF < 6.0, F.PT > 2 * GeV ), ) -def prompt_dp(): +def dp(): return ParticleCombiner( [ _filter_long_kaons_for_charm(), @@ -446,7 +477,9 @@ def prompt_dp(): DecayDescriptor="[D+ -> K- pi+ pi+]cc", name="Monitoring_DpToKmPipPip", Combination12Cut=F.require_all( - F.MASS < 1960 * MeV, F.MAXSDOCACUT(120 * um), F.CHILD(1, _MIPCHI2_MIN(6)) + F.MASS < 1960 * MeV, + F.MAXSDOCACUT(120 * um), + F.CHILD(1, F.OWNPVIPCHI2 > 6.0), ), CombinationCut=F.require_all( F.math.in_range(1640 * MeV, F.MASS, 2100 * MeV), @@ -456,11 +489,9 @@ def prompt_dp(): CompositeCut=F.require_all( F.math.in_range(1670 * MeV, F.MASS, 2070 * MeV), F.PT > 1.5 * GeV, - F.CHI2DOF < 6, + F.CHI2DOF < 6.0, F.OWNPVVDZ > 2 * mm, - F.OWNPVDLS > 8, - F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVDLS > 6, ), ) @@ -483,11 +514,11 @@ def prompt_ds(): CompositeCut=F.require_all( F.math.in_range(1700 * MeV, F.MASS, 2100 * MeV), F.PT > 1.6 * GeV, - F.CHI2DOF < 6, + F.CHI2DOF < 6.0, F.OWNPVVDZ > 1 * mm, - F.OWNPVDLS > 6, + F.OWNPVDLS > 6.0, F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVIPCHI2 < 9.0, ), ) @@ -497,7 +528,10 @@ def prompt_lc(): make_has_rich_long_protons(), F.FILTER( F.require_all( - F.PT > 500 * MeV, _MIPCHI2_MIN(6), F.PID_P > 10, F.PID_P - F.PID_K > 5 + F.PT > 500 * MeV, + F.OWNPVIPCHI2 > 6.0, + F.PID_P > 10.0, + F.PID_P - F.PID_K > 5.0, ) ), ) @@ -514,11 +548,11 @@ def prompt_lc(): CompositeCut=F.require_all( F.math.in_range(2130 * MeV, F.MASS, 2630 * MeV), F.PT > 1.9 * GeV, - F.CHI2DOF < 6, + F.CHI2DOF < 6.0, F.OWNPVVDZ > 1 * mm, - F.OWNPVDLS > 5, + F.OWNPVDLS > 5.0, F.OWNPVDIRA > 0.999, - F.OWNPVIPCHI2 < 9, + F.OWNPVIPCHI2 < 9.0, ), ) @@ -529,9 +563,9 @@ def prompt_jpsi_to_mumu(): F.FILTER( F.require_all( F.PT > 700 * MeV, - F.MINIP(make_pvs()) < 80 * um, - F.MINIPCHI2(make_pvs()) < 6, - F.PID_MU > -3, + F.OWNPVIP < 80 * um, + F.OWNPVIPCHI2 < 6.0, + F.PID_MU > -3.0, ) ), ) @@ -555,37 +589,32 @@ def prompt_jpsi_to_mumu(): def prompt_jpsi_to_ee(): - pvs = make_pvs() electrons = ParticleFilter( - make_long_electrons_no_brem(), + make_long_electrons_with_brem(), F.FILTER( F.require_all( - F.PT > 1 * GeV, - F.MINIP(pvs) < 80 * um, - F.MINIPCHI2(pvs) < 6, - F.PROBNN_E > 0.7, + F.PT > 800 * MeV, + F.OWNPVIP < 80 * um, + F.OWNPVIPCHI2 < 6.0, + F.PID_E > 0.0, + F.GHOSTPROB < 0.5, ) ), ) - - dielectrons = FunctionalDiElectronMaker( - InputParticles=electrons, - PrimaryVertices=pvs, - MinDiElecPT=2 * GeV, - MinDiElecMass=2.2 * GeV, - MaxDiElecMass=3.6 * GeV, - DiElecID="J/psi(1S)", - DistMaxpair=1 * mm, - ).Particles - return ParticleFilter( - dielectrons, - F.FILTER( - F.require_all( - F.math.in_range(2.3 * GeV, F.MASS, 3.5 * GeV), - F.MAXSDOCACUT(80 * um), - F.CHI2DOF < 6.0, - F.OWNPVIPCHI2 < 9.0, - F.OWNPVIP < 100 * um, - ) + return ParticleCombiner( + [electrons, electrons], + name="Monitoring_JpsiToEmEp", + DecayDescriptor="J/psi(1S) -> e+ e-", + CombinationCut=F.require_all( + F.math.in_range(2.0 * GeV, F.MASS, 3.5 * GeV), + F.PT > 1.8 * GeV, + F.MAXSDOCACUT(100 * um), + ), + CompositeCut=F.require_all( + F.math.in_range(2.2 * GeV, F.MASS, 3.4 * GeV), + F.PT > 2 * GeV, + F.CHI2DOF < 9.0, + F.OWNPVIPCHI2 < 6.0, + F.OWNPVIP < 100 * um, ), )