Example #1
0
                s.type1met = c.GetLeaf(c.GetAlias('met')).GetValue()
                nmuons = getVarValue(c, "nmuons")
                neles = getVarValue(c, "neles")
                if (chmode=="doubleMu" and nmuons>=2) or (chmode=="doubleEle" and neles>=2) or (chmode=="eleMu" and nmuons>=1 and neles>=1):
                  allGoodLeptons = getGoodLeptons(c, nmuons, neles, cmode)
                  goodJets , s.ht, s.nbtags = getGoodJets(c, allGoodLeptons["leptons"])
#                  print s.ht, c.GetLeaf(c.GetAlias('ht')).GetValue(), s.nbtags, c.GetLeaf(c.GetAlias('nbtags')).GetValue()
                  s.njets = len(goodJets)
#                  print s.njets, s.nbtags, s.ht
                  mhtpx, mhtpy = 0., 0.
                  for j,jet in enumerate(goodJets):
                    mhtpx -= jet["pt"]*cos(jet["phi"])
                    mhtpy -= jet["pt"]*sin(jet["phi"])
                    if j<4:
                      exec("s.jet"+str(j)+"pt="+str(jet["pt"]))
                  s.mht = sqrt(mhtpx**2 + mhtpy**2)
                  leptonPair = []
                  if chmode=="doubleMu":  leptonPair = getBestLeptonPair(allGoodLeptons["muons"], chmode) 
                  if chmode=="doubleEle": leptonPair = getBestLeptonPair(allGoodLeptons["electrons"], chmode)
                  if chmode=="eleMu":     leptonPair = getBestLeptonPair(allGoodLeptons["leptons"], chmode)
#                  if len(allGoodLeptons) >=2 and ((mode=="highMET" and allGoodLeptons[0]["pt"]>20.) or (mode=="lowMET" and allGoodLeptons[1]["pt"]>20.))\
                  if len(leptonPair) >=2 and ((mode=="highMET" and leptonPair[0]["pt"]>20. and leptonPair[1]["pt"]>10.) or (mode=="lowMET" and leptonPair[1]["pt"]>20.)):
                    l1 = leptonPair[0]; l2 = leptonPair[1];
                    s.nLep = len(allGoodLeptons["leptons"])
                    s.deltaRLL = deltaR(l1, l2)
                    px1 = l1["pt"]*cos(l1["phi"]);  px2 = l2["pt"]*cos(l2["phi"])
                    py1 = l1["pt"]*sin(l1["phi"]);  py2 = l2["pt"]*sin(l2["phi"])
                    pz1 = l1["pt"]*sinh(l1["eta"]); pz2 = l2["pt"]*sinh(l2["eta"])
                    px = px1+px2 
                    py = py1+py2
                    pz = pz1+pz2