def process(self, event): run = event.input.eventAuxiliary().id().run() lumi = event.input.eventAuxiliary().id().luminosityBlock() eventId = event.input.eventAuxiliary().id().event() self.readCollections( event.input ) # Will need who for jet calibration later rho = self.handles["rho"].product()[0] ######## # AK8 Jets from MiniAOD + Subjet btags ######## setattr(event, "ak08", map(PhysicsObject, self.handles["ak08"].product())) setattr(event, "ak0softdropsubjets", map(PhysicsObject, self.handles["ak08softdropsubjets"].product())) # bb-tag Output newtags = self.handles['ak08bbtag'].product() # Loop over jets for ij, jet in enumerate(getattr(event, "ak08")): # Fill bb-tag for i in xrange(len(newtags)) : if jet.physObj == newtags.key(i).get(): jet.bbtag = newtags.value(i) # bb-tag Inputs muonTagInfos = self.handles['ak08muonTagInfos'].product()[ij] elecTagInfos = self.handles['ak08elecTagInfos'].product()[ij] ipTagInfo = self.handles['ak08ipTagInfos'].product()[ij] svTagInfo = self.handles['ak08svTagInfos'].product()[ij] calcBBTagVariables(jet, muonTagInfos, elecTagInfos, ipTagInfo, svTagInfo, njettiness_08, maxSVDeltaRToJet = 0.7,) # end of loop over jets ######## # Ungroomed Fatjets + NSubjettiness + Hbb Tagging ######## for prefix in ["ca15"]: if self.skip_ca15 and ("ca15" in prefix): continue # N-Subjettiness tau1 = self.handles[prefix+'tau1'].product() tau2 = self.handles[prefix+'tau2'].product() tau3 = self.handles[prefix+'tau3'].product() # bb-tag Output newtags = self.handles[prefix+'bbtag'].product() # Four Vector setattr(event, prefix+"ungroomed", map(PhysicsObject, self.handles[prefix+'ungroomed'].product())) # Loop over jets for ij, jet in enumerate(getattr(event, prefix+"ungroomed")): # Fill N-Subjettiness jet.tau1 = tau1.get(ij) jet.tau2 = tau2.get(ij) jet.tau3 = tau3.get(ij) # Fill bb-tag for i in xrange(len(newtags)) : if jet.physObj == newtags.key(i).get(): jet.bbtag = newtags.value(i) # bb-tag Inputs muonTagInfos = self.handles['ca15muonTagInfos'].product()[ij] elecTagInfos = self.handles['ca15elecTagInfos'].product()[ij] ipTagInfo = self.handles['ca15ipTagInfos'].product()[ij] svTagInfo = self.handles['ca15svTagInfos'].product()[ij] calcBBTagVariables(jet, muonTagInfos, elecTagInfos, ipTagInfo, svTagInfo, njettiness_15, maxSVDeltaRToJet = 1.3) # end of loop over jets ######## # Softdrop Fatjets + NSubjettiness ######## for fj_name in ["ca15softdropz2b1"]: if self.skip_ca15 and ("ca15" in fj_name): continue # Set the four-vector setattr(event, fj_name, map(PhysicsObject, self.handles[fj_name].product())) # N-Subjettiness tau1 = self.handles[fj_name+'tau1'].product() tau2 = self.handles[fj_name+'tau2'].product() tau3 = self.handles[fj_name+'tau3'].product() # Loop over jets for ij, jet in enumerate(getattr(event, fj_name)): # Fill N-Subjettiness jet.tau1 = tau1.get(ij) jet.tau2 = tau2.get(ij) jet.tau3 = tau3.get(ij) # end of loop over jets ######## # Groomed Uncalibrated Fatjets ######## for fj_name in ['ak08pruned', 'ca15trimmed', 'ca15softdrop', 'ca15pruned']: if self.skip_ca15 and ("ca15" in fj_name): continue setattr(event, fj_name, map(PhysicsObject, self.handles[fj_name].product())) ######## # Groomed Fatjets to calibrate ######## pruned_cal_jets = [] for groomed_fj in self.handles['ak08pruned'].product(): # We need the closest ungroomed fatjet to get the JEC: # - Make a list of pairs: deltaR(ungroomed fj, groomed fj) for all ungroomed fatjets # - Sort by deltaR # - And take the minimum if len(getattr(event, "ak08")): closest_ung_fj_and_dr = sorted( [(ung_fj, deltaR2(ung_fj, groomed_fj)) for ung_fj in getattr(event, "ak08")], key=lambda x:x[1])[0] else: print "WARNING: No ungroomed fatjets found in event with groomed fatjet. Skipping" continue # Use the jet cone size for matching minimal_dr_groomed_ungroomed = 0.8 if closest_ung_fj_and_dr[1] > minimal_dr_groomed_ungroomed: print "WARNING: No ungroomed fatjet found close to groomed fatjet. Skipping" continue ungroomed_jet = Jet(closest_ung_fj_and_dr[0]) c = self.jetReCalibrator.getCorrection(ungroomed_jet, rho) # Need to do a deep-copy. Otherwise the original jet will be modified cal_groomed_fj = PhysicsObject(groomed_fj).__copy__() cal_groomed_fj.scaleEnergy(c) pruned_cal_jets.append(cal_groomed_fj) setattr(event, 'ak08prunedcal', pruned_cal_jets) ######## # AK08 Regression ####### self.regressionsAK08[0].evaluateRegressionAK08(event) ######## # Subjets ######## for fj_name in ['ak08pruned','ca15pruned']: if self.skip_ca15 and ("ca15" in fj_name): continue setattr(event, fj_name + "subjets", map(PhysicsObject, self.handles[fj_name+"subjets"].product())) newtags = self.handles[fj_name+'subjetbtag'].product() for i in xrange(0,len(newtags)) : for j in getattr(event, fj_name+"subjets"): if j.physObj == newtags.key(i).get(): j.btag = newtags.value(i) ######## # HEPTopTagger ######## if not self.skip_ca15: candJets = self.handles['httCandJets'].product() candInfos = self.handles['httCandInfos'].product() event.httCandidates = map(PhysicsObject, candJets) sjbtags = self.handles['httSubjetBtags'].product() for i in xrange(0, len(candJets)): event.httCandidates[i].fRec = candInfos[i].properties().fRec event.httCandidates[i].Ropt = candInfos[i].properties().Ropt event.httCandidates[i].RoptCalc = candInfos[i].properties().RoptCalc event.httCandidates[i].ptForRoptCalc = candInfos[i].properties().ptForRoptCalc # HTT return the subjet-pair closest to the W-mass as W-subjets # Could be improved by b-tagging if we run into a problem [sj_w1, sj_w2, sj_nonw] = [con.__deref__() for con in candJets[i].getJetConstituents() if not con.isNull()] event.httCandidates[i].sjW1pt = sj_w1.pt() event.httCandidates[i].sjW1eta = sj_w1.eta() event.httCandidates[i].sjW1phi = sj_w1.phi() event.httCandidates[i].sjW1mass = sj_w1.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_w1 == sjbtags.key(ib).get(): event.httCandidates[i].sjW1btag = sjbtags.value(ib) event.httCandidates[i].sjW2pt = sj_w2.pt() event.httCandidates[i].sjW2eta = sj_w2.eta() event.httCandidates[i].sjW2phi = sj_w2.phi() event.httCandidates[i].sjW2mass = sj_w2.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_w2 == sjbtags.key(ib).get(): event.httCandidates[i].sjW2btag = sjbtags.value(ib) event.httCandidates[i].sjNonWpt = sj_nonw.pt() event.httCandidates[i].sjNonWeta = sj_nonw.eta() event.httCandidates[i].sjNonWphi = sj_nonw.phi() event.httCandidates[i].sjNonWmass = sj_nonw.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_nonw == sjbtags.key(ib).get(): event.httCandidates[i].sjNonWbtag = sjbtags.value(ib) return True
def evaluateRegressionAK08(self, event): #self.readCollections( event.input ) reg_fj = [] for ung_fj in getattr(event, "ak08"): # We need the closest ungroomed fatjet to get the JEC: # - Make a list of pairs: deltaR(ungroomed fj, groomed fj) for all ungroomed fatjets # - Sort by deltaR # - And take the minimum if len(getattr(event, "ak08pruned")): closest_pr_fj_and_dr = sorted( [(pr_fj, deltaR2(ung_fj, pr_fj)) for pr_fj in getattr(event, "ak08pruned")], key=lambda x: x[1])[0] else: print "WARNING: No pruned fatjets found in event with ungroomed fatjet. Skipping" continue # Use the jet cone size for matching minimal_dr_groomed_ungroomed = 0.8 if closest_pr_fj_and_dr[1] > minimal_dr_groomed_ungroomed: print "WARNING: No pruned fatjet found close to ungroomed fatjet. Skipping" continue pr_jet = Jet(closest_pr_fj_and_dr[0]) if len(getattr(event, "ak08prunedcal")): closest_cal_fj_and_dr = sorted( [(cal_fj, deltaR2(ung_fj, cal_fj)) for cal_fj in getattr(event, "ak08prunedcal")], key=lambda x: x[1])[0] else: print "WARNING: No calib groomed fatjets found in event with ungroomed fatjet. Skipping" continue if closest_cal_fj_and_dr[1] > minimal_dr_groomed_ungroomed: print "WARNING: No calib fatjet found close to ungroomed fatjet. Skipping" continue cal_jet = Jet(closest_cal_fj_and_dr[0]) # now check the AK08 jet is not a lepton # if len(getattr(event, "selectedLeptons")): # closest_pr_lep_and_dr = sorted( [(lep, deltaR2(cal_jet,lep)) for lep in getattr(event, "vLeptons")], key=lambda x:x[1])[0] # if closest_pr_lep_and_dr[1] < (0.4 * 0.4): # print "WARNING: No groomed fatjet is overlapping with a vLepton. Skipping" # continue # Need to do a deep-copy. Otherwise the original jet will be modified reg_groomed_fj = PhysicsObject(closest_cal_fj_and_dr[0]).__copy__() # for j in event.FatjetAK08pruned: self.FatjetAK08ungroomed_pt[0] = ung_fj.pt() # print 'ung_fj.pt() ', ung_fj.pt() self.FatjetAK08pruned_pt[0] = pr_jet.pt() # print 'pr_jet.pt() ', pr_jet.pt() self.FatjetAK08prunedCal_pt[0] = cal_jet.pt() # print 'cal_jet.pt() ', cal_jet.pt() self.FatjetAK08prunedCal_eta[0] = cal_jet.eta() self.FatjetAK08ungroomed_vertexNTracks[0] = ung_fj.vertexNTracks self.FatjetAK08ungroomed_SV_mass_0[0] = ung_fj.SV_mass_0 self.FatjetAK08ungroomed_SV_EnergyRatio_0[ 0] = ung_fj.SV_EnergyRatio_0 self.FatjetAK08ungroomed_SV_EnergyRatio_1[ 0] = ung_fj.SV_EnergyRatio_1 self.FatjetAK08ungroomed_PFLepton_ptrel[0] = ung_fj.PFLepton_ptrel self.FatjetAK08ungroomed_nSL[0] = ung_fj.nSL # print 'ung_fj.nSL ', ung_fj.nSL reg_groomed_fj.scaleEnergy( self.reader.EvaluateRegression(self.name)[0]) reg_fj.append(reg_groomed_fj) # print 'reg_groomed_fj.pt() ', reg_groomed_fj.pt() setattr(event, 'ak08prunedreg', reg_fj)
def evaluateRegressionAK08(self, event): #self.readCollections( event.input ) reg_fj = [] for ung_fj in getattr(event, "ak08"): # We need the closest ungroomed fatjet to get the JEC: # - Make a list of pairs: deltaR(ungroomed fj, groomed fj) for all ungroomed fatjets # - Sort by deltaR # - And take the minimum if len(getattr(event, "ak08pruned")): closest_pr_fj_and_dr = sorted( [(pr_fj, deltaR2(ung_fj, pr_fj)) for pr_fj in getattr(event, "ak08pruned")], key=lambda x:x[1])[0] else: print "WARNING: No pruned fatjets found in event with ungroomed fatjet. Skipping" continue # Use the jet cone size for matching minimal_dr_groomed_ungroomed = 0.8 if closest_pr_fj_and_dr[1] > minimal_dr_groomed_ungroomed: print "WARNING: No pruned fatjet found close to ungroomed fatjet. Skipping" continue pr_jet = Jet(closest_pr_fj_and_dr[0]) if len(getattr(event, "ak08prunedcal")): closest_cal_fj_and_dr = sorted( [(cal_fj, deltaR2(ung_fj, cal_fj)) for cal_fj in getattr(event, "ak08prunedcal")], key=lambda x:x[1])[0] else: print "WARNING: No calib groomed fatjets found in event with ungroomed fatjet. Skipping" continue if closest_cal_fj_and_dr[1] > minimal_dr_groomed_ungroomed: print "WARNING: No calib fatjet found close to ungroomed fatjet. Skipping" continue cal_jet = Jet(closest_cal_fj_and_dr[0]) # now check the AK08 jet is not a lepton # if len(getattr(event, "selectedLeptons")): # closest_pr_lep_and_dr = sorted( [(lep, deltaR2(cal_jet,lep)) for lep in getattr(event, "vLeptons")], key=lambda x:x[1])[0] # if closest_pr_lep_and_dr[1] < (0.4 * 0.4): # print "WARNING: No groomed fatjet is overlapping with a vLepton. Skipping" # continue # Need to do a deep-copy. Otherwise the original jet will be modified reg_groomed_fj = PhysicsObject(closest_cal_fj_and_dr[0]).__copy__() # for j in event.FatjetAK08pruned: self.FatjetAK08ungroomed_pt[0] = ung_fj.pt() # print 'ung_fj.pt() ', ung_fj.pt() self.FatjetAK08pruned_pt[0] = pr_jet.pt() # print 'pr_jet.pt() ', pr_jet.pt() self.FatjetAK08prunedCal_pt[0] = cal_jet.pt() # print 'cal_jet.pt() ', cal_jet.pt() self.FatjetAK08prunedCal_eta[0] = cal_jet.eta() self.FatjetAK08ungroomed_vertexNTracks[0] = ung_fj.vertexNTracks self.FatjetAK08ungroomed_SV_mass_0[0] = ung_fj.SV_mass_0 self.FatjetAK08ungroomed_SV_EnergyRatio_0[0] = ung_fj.SV_EnergyRatio_0 self.FatjetAK08ungroomed_SV_EnergyRatio_1[0] = ung_fj.SV_EnergyRatio_1 self.FatjetAK08ungroomed_PFLepton_ptrel[0] = ung_fj.PFLepton_ptrel self.FatjetAK08ungroomed_nSL[0] = ung_fj.nSL # print 'ung_fj.nSL ', ung_fj.nSL reg_groomed_fj.scaleEnergy(self.reader.EvaluateRegression(self.name)[0]) reg_fj.append(reg_groomed_fj) # print 'reg_groomed_fj.pt() ', reg_groomed_fj.pt() setattr(event, 'ak08prunedreg', reg_fj )
def process(self, event): run = event.input.eventAuxiliary().id().run() lumi = event.input.eventAuxiliary().id().luminosityBlock() eventId = event.input.eventAuxiliary().id().event() self.readCollections( event.input ) # Will need who for jet calibration later rho = self.handles["rho"].product()[0] ######## # Softdrop Fatjets + NSubjettiness ######## for fj_name in ["ca15softdropz2b1"]: if self.skip_ca15 and ("ca15" in fj_name): continue # Set the four-vector setattr(event, fj_name, map(PhysicsObject, self.handles[fj_name].product())) # N-Subjettiness tau1 = self.handles[fj_name+'tau1'].product() tau2 = self.handles[fj_name+'tau2'].product() tau3 = self.handles[fj_name+'tau3'].product() # Loop over jets for ij, jet in enumerate(getattr(event, fj_name)): # Fill N-Subjettiness jet.tau1 = tau1.get(ij) jet.tau2 = tau2.get(ij) jet.tau3 = tau3.get(ij) # end of loop over jets ######## # Groomed Uncalibrated Fatjets ######## for fj_name in ['ca15trimmed', 'ca15softdrop', 'ca15pruned']: setattr(event, fj_name, map(PhysicsObject, self.handles[fj_name].product())) # # ######## # # Groomed Fatjets to calibrate # ######## # # pruned_cal_jets = [] # # for groomed_fj in self.handles['ak08pruned'].product(): # # # We need the closest ungroomed fatjet to get the JEC: # # - Make a list of pairs: deltaR(ungroomed fj, groomed fj) for all ungroomed fatjets # # - Sort by deltaR # # - And take the minimum # # if len(getattr(event, "ak08")): # closest_ung_fj_and_dr = sorted( # [(ung_fj, deltaR2(ung_fj, groomed_fj)) for ung_fj in getattr(event, "ak08")], # key=lambda x:x[1])[0] # else: # print "WARNING: No ungroomed fatjets found in event with groomed fatjet. Skipping" # continue # # # Use the jet cone size for matching # minimal_dr_groomed_ungroomed = 0.8 # if closest_ung_fj_and_dr[1] > minimal_dr_groomed_ungroomed: # print "WARNING: No ungroomed fatjet found close to groomed fatjet. Skipping" # continue # # ungroomed_jet = Jet(closest_ung_fj_and_dr[0]) # # c = self.jetReCalibratorAK8L2L3.getCorrection(ungroomed_jet, rho) # # # # Need to do a deep-copy. Otherwise the original jet will be modified # cal_groomed_fj = PhysicsObject(groomed_fj).__copy__() # cal_groomed_fj.scaleEnergy(c) # # pruned_cal_jets.append(cal_groomed_fj) # # setattr(event, 'ak08prunedcal', pruned_cal_jets) # ######## # Subjets ######## for fj_name in ['ca15pruned']: if self.skip_ca15 and ("ca15" in fj_name): continue setattr(event, fj_name + "subjets", map(PhysicsObject, self.handles[fj_name+"subjets"].product())) newtags = self.handles[fj_name+'subjetbtag'].product() for i in xrange(0,len(newtags)) : for j in getattr(event, fj_name+"subjets"): if j.physObj == newtags.key(i).get(): j.btag = newtags.value(i) ######## # HEPTopTagger ######## if not self.skip_ca15: candJets = self.handles['httCandJets'].product() candInfos = self.handles['httCandInfos'].product() event.httCandidates = map(PhysicsObject, candJets) sjbtags = self.handles['httSubjetBtags'].product() for i in xrange(0, len(candJets)): event.httCandidates[i].fRec = candInfos[i].properties().fRec event.httCandidates[i].Ropt = candInfos[i].properties().Ropt event.httCandidates[i].RoptCalc = candInfos[i].properties().RoptCalc event.httCandidates[i].ptForRoptCalc = candInfos[i].properties().ptForRoptCalc # HTT return the subjet-pair closest to the W-mass as W-subjets # Could be improved by b-tagging if we run into a problem [sj_w1, sj_w2, sj_nonw] = [con.__deref__() for con in candJets[i].getJetConstituents() if not con.isNull()] # Calibrate the subjets: W1 sj_w1_uncal = Jet(sj_w1) c = self.jetReCalibratorAK4.getCorrection(sj_w1_uncal, rho, isHttSubjet=True) sj_w1_cal = PhysicsObject(sj_w1).__copy__() sj_w1_cal.scaleEnergy(c) # Calibrate the subjets: W2 sj_w2_uncal = Jet(sj_w2) c = self.jetReCalibratorAK4.getCorrection(sj_w2_uncal, rho, isHttSubjet=True) sj_w2_cal = PhysicsObject(sj_w2).__copy__() sj_w2_cal.scaleEnergy(c) # Calibrate the subjets: NonW sj_nonw_uncal = Jet(sj_nonw) c = self.jetReCalibratorAK4.getCorrection(sj_nonw_uncal, rho, isHttSubjet=True) sj_nonw_cal = PhysicsObject(sj_nonw).__copy__() sj_nonw_cal.scaleEnergy(c) # Make TLVs so we can add them and get the top quark # candidate tlv_sj_w1_cal = ROOT.TLorentzVector() tlv_sj_w2_cal = ROOT.TLorentzVector() tlv_sj_nonw_cal = ROOT.TLorentzVector() tlv_sj_w1_cal.SetPtEtaPhiM(sj_w1_cal.pt(), sj_w1_cal.eta(), sj_w1_cal.phi(), sj_w1_cal.mass()) tlv_sj_w2_cal.SetPtEtaPhiM(sj_w2_cal.pt(), sj_w2_cal.eta(), sj_w2_cal.phi(), sj_w2_cal.mass()) tlv_sj_nonw_cal.SetPtEtaPhiM(sj_nonw_cal.pt(), sj_nonw_cal.eta(), sj_nonw_cal.phi(), sj_nonw_cal.mass()) tlv_top_cal = tlv_sj_w1_cal + tlv_sj_w2_cal + tlv_sj_nonw_cal # Store calibrated top candidate variables event.httCandidates[i].ptcal = tlv_top_cal.Pt() event.httCandidates[i].etacal = tlv_top_cal.Eta() event.httCandidates[i].phical = tlv_top_cal.Phi() event.httCandidates[i].masscal = tlv_top_cal.M() # Store SJ W1 Variables event.httCandidates[i].sjW1ptcal = sj_w1_cal.pt() event.httCandidates[i].sjW1masscal = sj_w1_cal.mass() event.httCandidates[i].sjW1pt = sj_w1.pt() event.httCandidates[i].sjW1eta = sj_w1.eta() event.httCandidates[i].sjW1phi = sj_w1.phi() event.httCandidates[i].sjW1mass = sj_w1.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_w1 == sjbtags.key(ib).get(): event.httCandidates[i].sjW1btag = sjbtags.value(ib) # Store SJ W2 Variables event.httCandidates[i].sjW2ptcal = sj_w2_cal.pt() event.httCandidates[i].sjW2masscal = sj_w2_cal.mass() event.httCandidates[i].sjW2pt = sj_w2.pt() event.httCandidates[i].sjW2eta = sj_w2.eta() event.httCandidates[i].sjW2phi = sj_w2.phi() event.httCandidates[i].sjW2mass = sj_w2.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_w2 == sjbtags.key(ib).get(): event.httCandidates[i].sjW2btag = sjbtags.value(ib) # Store SJ Non W Variables event.httCandidates[i].sjNonWptcal = sj_nonw_cal.pt() event.httCandidates[i].sjNonWmasscal = sj_nonw_cal.mass() event.httCandidates[i].sjNonWpt = sj_nonw.pt() event.httCandidates[i].sjNonWeta = sj_nonw.eta() event.httCandidates[i].sjNonWphi = sj_nonw.phi() event.httCandidates[i].sjNonWmass = sj_nonw.mass() # Get the correct b-tag for ib in xrange(0, len(sjbtags)) : if sj_nonw == sjbtags.key(ib).get(): event.httCandidates[i].sjNonWbtag = sjbtags.value(ib) ######## # AK8 Jets from MiniAOD + Subjet btags ######## setattr(event, "ak08", map(PhysicsObject, self.handles["ak08"].product())) setattr(event, "ak08softdropsubjets", map(PhysicsObject, self.handles["ak08softdropsubjets"].product())) do_calc_bb = False # Calc BB tag # -- if there is a HTT candidate and at least one lepton if len(event.selectedLeptons): for cand in event.httCandidates: if cand.fRec < 0.2 and cand.mass() > 100 and cand.mass() < 200: do_calc_bb = True # -- or if there are at least two fatjets with pT > 250 GeV and the scalar sum of the jet pTs is > 600 fj_pt250 = [j for j in event.ak08 if j.pt() > 250] if len(fj_pt250) >= 2 and sum([j.pt() for j in fj_pt250]) > 600: do_calc_bb = True # bb-tag Output newtags = self.handles['ak08bbtag'].product() # Loop over jets for ij, jet in enumerate(getattr(event, "ak08")): # Fill bb-tag for i in xrange(len(newtags)) : if jet.physObj == newtags.key(i).get(): jet.bbtag = newtags.value(i) corr = self.jetReCalibratorAK8L2L3.getCorrection(Jet(jet),rho) jet.mprunedcorr= jet.userFloat("ak8PFJetsCHSPrunedMass")*corr jet.JEC_L2L3 = corr jet.JEC_L1L2L3 = self.jetReCalibratorAK8L1L2L3.getCorrection(Jet(jet),rho) # bb-tag Inputs muonTagInfos = self.handles['ak08muonTagInfos'].product()[ij] elecTagInfos = self.handles['ak08elecTagInfos'].product()[ij] ipTagInfo = self.handles['ak08ipTagInfos'].product()[ij] svTagInfo = self.handles['ak08svTagInfos'].product()[ij] orig_jet = self.handles["ak08"].product()[ij] if do_calc_bb: calcBBTagVariables(jet, orig_jet, muonTagInfos, elecTagInfos, ipTagInfo, svTagInfo, njettiness_08, maxSVDeltaRToJet = 0.7,) else: calcBBTagVariables_dummy(jet) # end of loop over jets ######## # Ungroomed Fatjets + NSubjettiness + Hbb Tagging ######## for prefix in ["ca15"]: if self.skip_ca15 and ("ca15" in prefix): continue # N-Subjettiness tau1 = self.handles[prefix+'tau1'].product() tau2 = self.handles[prefix+'tau2'].product() tau3 = self.handles[prefix+'tau3'].product() # bb-tag Output newtags = self.handles[prefix+'bbtag'].product() # Four Vector setattr(event, prefix+"ungroomed", map(PhysicsObject, self.handles[prefix+'ungroomed'].product())) # Loop over jets for ij, jet in enumerate(getattr(event, prefix+"ungroomed")): # Fill N-Subjettiness jet.tau1 = tau1.get(ij) jet.tau2 = tau2.get(ij) jet.tau3 = tau3.get(ij) # Fill bb-tag for i in xrange(len(newtags)) : if jet.physObj == newtags.key(i).get(): jet.bbtag = newtags.value(i) # bb-tag Inputs muonTagInfos = self.handles['ca15muonTagInfos'].product()[ij] elecTagInfos = self.handles['ca15elecTagInfos'].product()[ij] ipTagInfo = self.handles['ca15ipTagInfos'].product()[ij] svTagInfo = self.handles['ca15svTagInfos'].product()[ij] orig_jet = self.handles[prefix+'ungroomed'].product()[ij] if do_calc_bb: calcBBTagVariables(jet, orig_jet, muonTagInfos, elecTagInfos, ipTagInfo, svTagInfo, njettiness_15, maxSVDeltaRToJet = 1.3) else: calcBBTagVariables_dummy(jet) # end of loop over jets return True