def find_n_decay_pairs_in_entry(entry, mu_type): """ Finds the number of muon/electron decay pairs with a time difference of greater than 50 ns """ # Get all the upstream muons and downstream electrons if mu_type=="mu-": res = {"f":0, "cu":0} mu_pid, e_pid = (13, 11) elif mu_type=="mu+": res = {"f":0, } mu_pid, e_pid = (-13, -11) muons = get_hits_with(entry, get_pid_counter_filter(mu_pid, 1),\ ("trkid", "tof")) electrons = get_hits_with(entry, get_pid_counter_filter(e_pid, 3),\ ("parentid", "vertex_vol", "tof")) for e_parent, e_mu_vertex, e_time in electrons: parent_muon = filter(lambda mu: mu[0]==e_parent, muons) if parent_muon and (e_time - parent_muon[0][1] > 50): key = get_decay_type(mu_type, e_mu_vertex) res[key] += 1 muons.remove(parent_muon[0]) return res
def get_mu_e_dt_for_entry(entry, mu_type): """ Returns the first hits by muon and an electron in the up and downstream counters respectively """ # Get all the upstream muons and downstream electrons if mu_type=="mu-": mu_pid, e_pid = (13, 11) elif mu_type=="mu+": mu_pid, e_pid = (-13, -11) muons = get_hits_with(entry, get_pid_counter_filter(mu_pid, 1),\ ("trkid", "tof")) electrons = get_hits_with(entry, get_pid_counter_filter(e_pid, 3),\ ("parentid", "tof")) res = [] for e_parent, e_time in electrons: parent_muon = filter(lambda mu: mu[0]==e_parent, muons) if parent_muon and (e_time - parent_muon[0][1] > 50): res.append(e_time - parent_muon[0][1]) muons.remove(parent_muon[0]) return res