plots.append( Plot( texX='max(p_{T} (t,#bar{t})) (GeV)', texY="Events /10 GeV", variable=Variable.fromString("t_maxpt/F").addFiller( lambda data: max(data.t1_pt, data.t2_pt)), binning=[50, 0, 10 * 50], )) plots.append( Plot( texX='min(#Delta#phi(Z or #gamma, t/#bar{t})) (GeV)', texY="Events /5 GeV", variable=Variable.fromString( "deltaPhi_topBoson/F").addFiller(lambda data: min( deltaPhi(data.t1_phi, data.boson_genPhi), deltaPhi(data.t2_phi, data.boson_genPhi))), binning=[20, 0, 3.1415], )) plots.append( Plot( texX='min(#Delta R(Z or #gamma, t/#bar{t})) (GeV)', texY="Events /5 GeV", variable=Variable.fromString("deltaR_topBoson/F").addFiller( lambda data: min( sqrt( deltaPhi(data.t1_phi, data.boson_genPhi)**2 + (data.t1_eta - data.boson_genEta)**2), sqrt( deltaPhi(data.t2_phi, data.boson_genPhi)**2 +
if len(leptons[lep]['file'][0])==1 and len(leptons[lep]['file'][1])==1 and leptons[lep]['file'][0][0]['pdgId']*leptons[lep]['file'][1][0]['pdgId']<0: twoleptons = True l0pt, l0eta, l0phi = leptons[lep]['file'][0][0]['pt'], leptons[lep]['file'][0][0]['eta'], leptons[lep]['file'][0][0]['phi'] l1pt, l1eta, l1phi = leptons[lep]['file'][1][0]['pt'], leptons[lep]['file'][1][0]['eta'], leptons[lep]['file'][1][0]['phi'] if l1pt > l0pt : leadingleptonpt = l1pt subleadingleptonpt = l0pt else: leadingleptonpt = l0pt subleadingleptonpt = l1pt mll = sqrt(2.*l0pt*l1pt*(cosh(l0eta-l1eta)-cos(l0phi-l1phi))) zveto = False if (twoleptons and mll>20 and not zveto) or (twoleptons and mll > 20 and zveto and abs(mll-91.2)>15): jets = filter(lambda j:j['pt']>30 and abs(j['eta'])<2.4 and j['id'], getJets(chain)) ht = sum([j['pt'] for j in jets]) PhiMetJet1 = deltaPhi(metPhi,getVarValue(chain, "Jet_phi",0)) PhiMetJet2 = deltaPhi(metPhi,getVarValue(chain, "Jet_phi",1)) bjetspt = filter(lambda j:j['btagCSV']>0.814, jets) nobjets = filter(lambda j:j['btagCSV']<=0.814, jets) plots[leptons[lep]['name']]['nbjets']['histo'][s["name"]].Fill(len(bjetspt),weight) plots[leptons[lep]['name']]['njets']['histo'][s["name"]].Fill(len(jets),weight) del eList ####################################################### # Drawing done here # ####################################################### #Some coloring TTJets_50ns["color"]=7
def photonDeltaR(data, eta, phi): return sqrt(deltaPhi(data.photon_phi, phi)**2 + (data.photon_eta - eta)**2)
plots.append(Plot( texX = 'min(p_{T} (t,#bar{t})) (GeV)', texY = "Events /10 GeV", variable = Variable.fromString( "t_minpt/F" ).addFiller(lambda data: min(data.t1_pt, data.t2_pt)), binning = [50, 0, 10*50], )) plots.append(Plot( texX = 'max(p_{T} (t,#bar{t})) (GeV)', texY = "Events /10 GeV", variable = Variable.fromString( "t_maxpt/F" ).addFiller(lambda data: max(data.t1_pt, data.t2_pt)), binning = [50, 0, 10*50], )) plots.append(Plot( texX = 'min(#Delta#phi(Z or #gamma, t/#bar{t})) (GeV)', texY = "Events /5 GeV", variable = Variable.fromString( "deltaPhi_topBoson/F" ).addFiller(lambda data: min(deltaPhi(data.t1_phi, data.boson_genPhi), deltaPhi(data.t2_phi, data.boson_genPhi))), binning = [20, 0, 3.1415], )) plots.append(Plot( texX = 'min(#Delta R(Z or #gamma, t/#bar{t})) (GeV)', texY = "Events /5 GeV", variable = Variable.fromString( "deltaR_topBoson/F" ).addFiller(lambda data: min(sqrt(deltaPhi(data.t1_phi, data.boson_genPhi)**2 + (data.t1_eta - data.boson_genEta)**2), sqrt(deltaPhi(data.t2_phi, data.boson_genPhi)**2 + (data.t2_eta - data.boson_genEta)**2))), binning = [20, 0, 8], )) plots.append(Plot( texX = '#Delta#phi(#nu#nu, Z or #gamma) (#nu from W decays) (GeV)', texY = "Events /5 GeV", variable = Variable.fromString( "deltaPhi_nunuBoson/F" ).addFiller(lambda data: deltaPhi(data.nunu_phi, data.boson_genPhi)), binning = [20, 0, 3.1415], ))