Skip to content

Instantly share code, notes, and snippets.

@artlbv
Created July 21, 2016 11:28
Show Gist options
  • Save artlbv/0fd1300a16badf713a460b329a6597d1 to your computer and use it in GitHub Desktop.
Save artlbv/0fd1300a16badf713a460b329a6597d1 to your computer and use it in GitHub Desktop.
ISR jet counting
def countISR(jets, genParts):
nISR = 0
for jet in jets:
matched = False
for genPart in genParts: #use GenPart
if matched: break
#if genPart.status != 23 or abs(genPart.pdgId) > 5: continue
# check particle is quark
if abs(genPart.pdgId) > 5: continue
momId = genPart.motherId
momIdx = genPart.motherIndex
# check mother is top, Z, W or SUSY
if not (momId == 6 or momId == 23 or momId == 24 or momId > 100000): continue
# check mother status is 23
#if genParts[momIdx].status != 23: continue
#if genPart.status != 23: continue
# check deltaR
dR = jet.p4().DeltaR(genPart.p4())
if momId > 100000:
print dR, genPart.pdgId, momId
if dR < 0.3:
matched = True
#print genPart.pdgId, momId
break
if not matched:
nISR+=1
print jet.mcMatchId
print len(jets), nISR
return nISR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment