def tth_hadronic_preselection(events, photons, electrons, muons, jets, options, debug): cut_diagnostics = utils.CutDiagnostics( events=events, debug=debug, cut_set="[analysis_selections.py : tth_hadronic_preselection]") # Get number of electrons, muons selected_electrons = electrons[lepton_selections.select_electrons( events, photons, electrons, options, debug)] selected_muons = muons[lepton_selections.select_muons( events, photons, muons, options, debug)] n_electrons = awkward.num(selected_electrons) n_muons = awkward.num(selected_muons) n_leptons = n_electrons + n_muons # Get number of jets selected_jets = jets[jet_selections.select_jets(events, photons, selected_electrons, selected_muons, None, jets, options, debug)] n_jets = awkward.num(selected_jets) # Get number of b-jets selected_bjets = selected_jets[jet_selections.select_bjets( selected_jets, options, debug)] n_bjets = awkward.num(selected_bjets) lep_cut = n_leptons == 0 jet_cut = n_jets >= 3 bjet_cut = n_bjets >= 1 all_cuts = lep_cut & jet_cut & bjet_cut cut_diagnostics.add_cuts( [lep_cut, jet_cut, bjet_cut, all_cuts], ["N_leptons == 0", "N_jets >= 3", "N_bjets >= 1", "all"]) # Keep only selected events selected_events = events[all_cuts] selected_photons = photons[all_cuts] selected_electrons = selected_electrons[all_cuts] selected_muons = selected_muons[all_cuts] selected_jets = selected_jets[all_cuts] # Calculate event-level variables selected_events = lepton_selections.set_electrons(selected_events, selected_electrons, debug) selected_events = lepton_selections.set_muons(selected_events, selected_muons, debug) selected_events = jet_selections.set_jets(selected_events, selected_jets, options, debug) return selected_events
def ggbb_preselection(events, photons, electrons, muons, jets, fatjets, options, debug): cut_diagnostics = utils.CutDiagnostics( events=events, debug=debug, cut_set="[analysis_selections.py : ggbb_preselection]") # Get number of electrons, muons selected_electrons = electrons[lepton_selections.select_electrons( events, photons, electrons, options, debug)] selected_muons = muons[lepton_selections.select_muons( events, photons, muons, options, debug)] n_electrons = awkward.num(selected_electrons) n_muons = awkward.num(selected_muons) n_leptons = n_electrons + n_muons # Get number of jets selected_jets = jets[jet_selections.select_jets(events, photons, selected_electrons, selected_muons, None, jets, options, debug)] n_jets = awkward.num(selected_jets) # Get number of b-jets selected_bjets = selected_jets[jet_selections.select_bjets( selected_jets, options, debug)] n_bjets = awkward.num(selected_bjets) # Get fat jets selected_fatjets = fatjets[jet_selections.select_fatjets( events, photons, fatjets, options, debug)] n_fatjets = awkward.num(selected_fatjets) lep_cut = n_leptons == 0 if options["boosted"]: jet_cut = n_bjets < 2 fatjet_cut = n_fatjets == 1 all_cuts = lep_cut & jet_cut & fatjet_cut cut_diagnostics.add_cuts( [lep_cut, jet_cut, fatjet_cut, all_cuts], ["N_leptons == 0", "N_b-jets < 2", "N_fatjets == 1", "all"]) else: jet_cut = n_bjets == 2 all_cuts = lep_cut & jet_cut cut_diagnostics.add_cuts([lep_cut, jet_cut, all_cuts], ["N_leptons == 0", "N_b-jets == 2", "all"]) # Keep only selected events selected_events = events[all_cuts] selected_photons = photons[all_cuts] selected_jets = selected_jets[all_cuts] selected_fatjets = selected_fatjets[all_cuts] # Calculate event-level variables selected_events = jet_selections.set_jets(selected_events, selected_jets, options, debug) selected_events = jet_selections.set_fatjets(selected_events, selected_fatjets, options, debug) return selected_events
def ggbb_preselection(events, photons, electrons, muons, jets, fatjets, genparts, options, debug): cut_diagnostics = utils.CutDiagnostics( events=events, debug=debug, cut_set="[analysis_selections.py : ggbb_preselection]") # Get number of electrons, muons selected_electrons = electrons[lepton_selections.select_electrons( events, photons, electrons, options, debug)] selected_muons = muons[lepton_selections.select_muons( events, photons, muons, options, debug)] n_electrons = awkward.num(selected_electrons) n_muons = awkward.num(selected_muons) n_leptons = n_electrons + n_muons # Get number of jets selected_jets = jets[jet_selections.select_jets(events, photons, selected_electrons, selected_muons, None, jets, options, debug)] n_jets = awkward.num(selected_jets) # Get number of b-jets selected_bjets = selected_jets[jet_selections.select_bjets( selected_jets, options, debug)] n_bjets = awkward.num(selected_bjets) # Get fat jets selected_fatjets = fatjets[jet_selections.select_fatjets( events, photons, fatjets, options, debug)] n_fatjets = awkward.num(selected_fatjets) lep_cut = n_leptons == 0 if options["boosted"]: # jet_cut = n_bjets < 2 # This is not wanted fatjet_cut = n_fatjets >= 1 all_cuts = lep_cut & fatjet_cut cut_diagnostics.add_cuts([lep_cut, fatjet_cut, all_cuts], ["N_leptons == 0", "N_fatjets >= 1", "all"]) else: jet_cut = n_bjets == 2 all_cuts = lep_cut & jet_cut cut_diagnostics.add_cuts([lep_cut, jet_cut, all_cuts], ["N_leptons == 0", "N_b-jets == 2", "all"]) # Keep only selected events selected_events = events[all_cuts] selected_photons = photons[all_cuts] selected_jets = selected_jets[all_cuts] selected_bjets = selected_bjets[all_cuts] selected_fatjets = selected_fatjets[all_cuts] # # Lead FatJet pt cut fatjet_pt_cut = selected_fatjets.pt[:, 0] >= 350 # # Keep only selected events II # selected_events = selected_events[fatjet_pt_cut] # selected_photons = selected_photons[fatjet_pt_cut] # selected_jets = selected_jets[fatjet_pt_cut] # selected_bjets = selected_bjets[fatjet_pt_cut] # selected_fatjets = selected_fatjets[fatjet_pt_cut] # cut_diagnostics.add_cuts([fatjet_pt_cut], ["Lead FatJet pt > 350 GeV"]) # Filter mjj #TODO Fix the "nearest" function # mjj_cut = mjj_selections.mjj_filter(events,selected_fatjets,selected_jets,[120,130],debug) # selected_events = events[mjj_cut] # selected_photons = photons[mjj_cut] # selected_jets = selected_jets[mjj_cut] # selected_bjets = selected_fatjets[mjj_cut] # selected_fatjets = selected_fatjets[mjj_cut] # Calculate event-level variables if genparts is not None: selected_genparts = genparts[all_cuts] # selected_genparts = selected_genparts[mjj_cut] # selected_genparts = selected_genparts[fatjet_pt_cut] # selected_events = selected_events[gen_selections.filter_genHbb(selected_events,selected_genparts,options,debug)] selected_events = gen_selections.set_genInfo(selected_events, selected_genparts, options, debug) selected_events = jet_selections.set_fatjets(selected_events, selected_fatjets, selected_genparts, options, debug) else: selected_events = jet_selections.set_fatjets( selected_events, selected_fatjets, genparts, options, debug) #FIXME genparts is None here selected_events = jet_selections.set_jets(selected_events, selected_jets, options, debug) selected_events = helicity_selections.set_helicity(selected_events, selected_photons, selected_fatjets, selected_bjets, options, debug) return selected_events