def findMatch_track_old_random(lepton, tracks): drmin = 10 idx = -1 if lepton.pt() > 0: leptonTlv = TLorentzVector() leptonTlv.SetPxPyPzE(lepton.px(), lepton.py(), lepton.pz(), lepton.energy()) for itrack, track in enumerate(tracks): if track.numberOfValidHits() == 0: continue if track.ndof() == 0: continue if track.charge() == 0: continue # if not passesPreselection_basic_track(track): continue if not track.charge() * lepton.charge() < 0: continue # if not abs(track.pt() - lepton.pt()) / lepton.pt() < 0.2: continue trackTlv = TLorentzVector() trackTlv.SetPxPyPzE(track.px(), track.py(), track.pz(), track.pt() * TMath.CosH(track.eta())) dr = trackTlv.DeltaR(leptonTlv) if dr < drmin: drmin = dr idx = itrack return idx, drmin
def RecoP4(self, regIdx): """ Sums the energy collected in a given signal region and returns the 4-vector. """ p4 = TLorentzVector(0, 0, 0, 0) en = np.sum(self.recEn[:regIdx], axis=None) pt = en / TMath.CosH(self.genP4.Eta()) p4.SetPtEtaPhiM(pt, self.genP4.Eta(), self.genP4.Phi(), 0) return p4