leptons = filter(lambda l: looseMuID(l) or looseEleID(l), allLeptons) #LepGood_mcMatchId Match to source from hard scatter (pdgId of heaviest particle in chain, 25 for H, 6 for t, 23/24 for W/Z), zero if non-prompt or fake for Leptons after the preselection #LepGood_mcMatchAny Match to any final state leptons: 0 if unmatched, 1 if light flavour (including prompt), 4 if charm, 5 if bottom for Leptons after the preselection #LepGood_mcMatchTau True if the leptons comes from a tau for Leptons after the preselection # for l in leptons: # if (l['mcMatchAny']==0 and (not (l['mcMatchId']==0))) or ( (not l['mcMatchAny']==0) and (l['mcMatchId']==0)): # print "Match?",l #RECO looseMu = filter(lambda l: abs(l['pdgId'])==13 and l['miniRelIso']<0.4 and l['pt']>15, allLeptons) looseEle= filter(lambda l: abs(l['pdgId'])==11 and l['miniRelIso']<0.4 and l['pt']>15, allLeptons) mu = filter(lambda l: abs(l['pdgId'])==13, leptons) ele = filter(lambda l: abs(l['pdgId'])==11, leptons) tau = getGoodTaus(chain) #RECO mathes muMatched = filter(lambda l: abs(l['mcMatchAny'])==1, mu) eleMatched = filter(lambda l: abs(l['mcMatchAny'])==1, ele) tauMatched = filter(lambda l: abs(l['mcMatchId'])>=1, tau) #GEN genParts = getGenPartsAll(chain) status1MuEle = filter(lambda p: abs(p['pdgId']) in [11,13] and p['status']==1 and p['pt']>10, genParts) genLeptons = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [24] and abs(p['pdgId']) in lepPdgs, genParts)] genLeptonsFromTau = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [15] and abs(p['pdgId']) in lepPdgs, genParts)] genNeutrinosFromW = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) ==24 and abs(p['pdgId']) in nuPdgs, genParts)] genNeutrinosFromTau = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) ==15 and abs(p['pdgId']) in nuPdgs, genParts)] otherNeutrinos = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['pdgId']) in nuPdgs, genParts) if not descendDecay(q, genParts) in genNeutrinosFromW+genNeutrinosFromTau] genEle = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [24] and abs(p['pdgId'])==11 , genParts)] genMu= [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [24] and abs(p['pdgId'])==13 , genParts)]
#LepGood_mcMatchTau True if the leptons comes from a tau for Leptons after the preselection # for l in leptons: # if (l['mcMatchAny']==0 and (not (l['mcMatchId']==0))) or ( (not l['mcMatchAny']==0) and (l['mcMatchId']==0)): # print "Match?",l #RECO looseMu = filter( lambda l: abs(l['pdgId']) == 13 and l['miniRelIso'] < 0.4 and l[ 'pt'] > 15, allLeptons) looseEle = filter( lambda l: abs(l['pdgId']) == 11 and l['miniRelIso'] < 0.4 and l[ 'pt'] > 15, allLeptons) mu = filter(lambda l: abs(l['pdgId']) == 13, leptons) ele = filter(lambda l: abs(l['pdgId']) == 11, leptons) tau = getGoodTaus(chain) #RECO mathes muMatched = filter(lambda l: abs(l['mcMatchAny']) == 1, mu) eleMatched = filter(lambda l: abs(l['mcMatchAny']) == 1, ele) tauMatched = filter(lambda l: abs(l['mcMatchId']) >= 1, tau) #GEN genParts = getGenPartsAll(chain) status1MuEle = filter( lambda p: abs(p['pdgId']) in [11, 13] and p['status'] == 1 and p[ 'pt'] > 10, genParts) genLeptons = [ descendDecay(q, genParts) for q in filter( lambda p: abs(p['motherId']) in [24] and abs(p['pdgId']) in lepPdgs, genParts) ]
deltaMet = sqrt((met*cos(metPhi)-genMet*cos(genMetPhi))**2+(met*sin(metPhi)-genMet*sin(genMetPhi))**2) jets = filter(lambda j:j['pt']>30 and abs(j['eta'])<2.4 and j['id'], getJets(s.chain, jetColl="JetGood")) allLeptons = getLeptons(s.chain, collVars=leptonVars+['mcMatchId','mcMatchAny','mcMatchTau','mcPt','ip3d', 'relIso03', 'relIso04', 'jetPtRatiov1', 'jetPtRelv1', 'jetPtRelv2', 'jetPtRatiov2', 'jetBTagCSV', 'jetDR']) leptons = filter(lambda l: looseMuID(l) or looseEleID(l), allLeptons) #LepGood_mcMatchId Match to source from hard scatter (pdgId of heaviest particle in s.chain, 25 for H, 6 for t, 23/24 for W/Z), zero if non-prompt or fake for Leptons after the preselection #LepGood_mcMatchAny Match to any final state leptons: 0 if unmatched, 1 if light flavour (including prompt), 4 if charm, 5 if bottom for Leptons after the preselection #LepGood_mcMatchTau True if the leptons comes from a tau for Leptons after the preselection #RECO looseMu = filter(lambda l: abs(l['pdgId'])==13 and l['miniRelIso']<0.4 and l['pt']>15, allLeptons) looseEle= filter(lambda l: abs(l['pdgId'])==11 and l['miniRelIso']<0.4 and l['pt']>15, allLeptons) mu = filter(lambda l: abs(l['pdgId'])==13, leptons) ele = filter(lambda l: abs(l['pdgId'])==11, leptons) tau = getGoodTaus(s.chain) #multi-iso minValues min_jetPtRatiov2 = min(l['jetPtRatiov2'] for l in leptons) min_jetPtRelv2 = min(l['jetPtRelv2'] for l in leptons) #RECO matches muMatched = filter(lambda l: abs(l['mcMatchAny'])==1, mu) eleMatched = filter(lambda l: abs(l['mcMatchAny'])==1, ele) tauMatched = filter(lambda l: abs(l['mcMatchId'])>=1, tau) #GEN genParts = getGenPartsAll(s.chain) status1MuEle = filter(lambda p: abs(p['pdgId']) in [11,13] and p['status']==1 and p['pt']>10, genParts) genLeptons = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [24] and abs(p['pdgId']) in lepPdgs, genParts)] genLeptonsFromTau = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) in [15] and abs(p['pdgId']) in lepPdgs, genParts)] genNeutrinosFromW = [descendDecay(q, genParts) for q in filter(lambda p: abs(p['motherId']) ==24 and abs(p['pdgId']) in nuPdgs, genParts)]