def pass_lepton_RelIso(lid, ltightId): """Return True if lepton passes tightID. Args: lid (int): Lepton ID. ltightId (bool): Tight ID. """ if abs(lid) == 11: return ltightId elif abs(lid) == 13: if ltightId < return True if else: return False # We have 2 good (loose) leptons which MAY form a Z candidate. loose_lep_arr = [] # Do an OSSF check: if (lid1 + lid2) != 0: if verbose: print(f"Event {evt_num} failed OSSF check.") continue # Do we want tight Z1 leptons? if force_z1_leps_tightID: if (not ltightId1) or (not ltightId2): continue lorvec_lep1 = Math.PtEtaPhiMVector(lpt1, leta1, lphi1, lmass1) lorvec_lep2 = Math.PtEtaPhiMVector(lpt2, leta2, lphi2, lmass2) z_cand = lorvec_lep1 + lorvec_lep2 if (z_cand.M() < 12) or (z_cand.M() > 120): print(f"Event {evt_num} failed m(Z1) window.") continue # Good Z candidate! Save these lepton indices. z_cand_lep_ndcs.append((ndx1, ndx2)) # Need to check lepton kinematics (dxy, dz, SIP3D) # if make_valid_z1_candidate(lep1, lep2): # All Z1 candidates found! # my_lep_ls = # z1_cand_ls = get_all_z1_candidates() # If the event made it this far, the leptons are good! evt_info_d["n_evts_ge4_passing_leps"] += 1
def get_LorentzVector(self, include_FSR=True): """Return a Lorentz vector version of this lepton.""" if include_FSR: return Math.PtEtaPhiMVector( self.lpt, self.leta, self.lphi, self.lmass ) return Math.PtEtaPhiMVector( self.lpt_NoFSR, self.leta_NoFSR, self.lphi_NoFSR, self.lmass_NoFSR )
if tmpJetPTTwo > jetPTCut: #Counter if not ifTwoBool: ifTwoCount += 1 ifTwoBool = True #Getting the eta dif between the two jets tmpEtaDif = abs(ev.Jet_eta[i] - ev.Jet_eta[j]) #Checking if the eta dif passes the eta dif cut if tmpEtaDif > jetEtaDifCut: #Counter if not ifThreeBool: ifThreeCount += 1 ifThreeBool = True #Getting four vectors for the two jets, using pt, eta, phi, and mass tmpVecOne = Math.PtEtaPhiMVector( ev.Jet_pt[i], ev.Jet_eta[i], ev.Jet_phi[i], ev.Jet_mass[i]) tmpVecTwo = Math.PtEtaPhiMVector( ev.Jet_pt[j], ev.Jet_eta[j], ev.Jet_phi[j], ev.Jet_mass[j]) #Adding four vectors together and getting their invariant mass tmpDiJetVec = tmpVecOne + tmpVecTwo tmpInvMass = tmpDiJetVec.M() #Checking if their InvMass passes the InvMass cut if tmpInvMass > jetInvMassCut: #Counter if not ifFourBool: ifFourCount += 1 ifFourBool = True #Selecting by summed jet pt