1 from builtins
import range
2 from PhysicsTools.Heppy.physicsobjects.PhysicsObjects
import printOut
3 from PhysicsTools.Heppy.physicsobjects.PhysicsObjects
import GenParticle
6 '''Returns status 1 e and mu among the particle daughters'''
8 for i
in range( particle.numberOfDaughters() ):
9 dau = particle.daughter(i)
11 if abs(dau.pdgId())==11
or abs(dau.pdgId())==13:
21 '''Fills daughters with all the daughters of particle.
22 Recursive function.'''
24 for i
in range( particle.numberOfDaughters() ):
27 daughters.append( dau )
33 bosons = [x
for x
in particles
if x.status()==3
and x.pdgId()==bosonType]
40 xDaus = [x
for x
in daus
if x.status()==3
and abs(x.pdgId())==xType]
45 if abs(pdgId)
in [11,12,13,14,15,16]:
46 return includeSMLeptons
47 i = (
abs(pdgId) % 1000)
48 return i > 10
and i != 21
and i < 100
50 def isPromptLepton(lepton, beforeFSR, includeMotherless=True, includeTauDecays=False):
51 if abs(lepton.pdgId())
not in [11,13,15]:
53 if lepton.numberOfMothers() == 0:
54 return includeMotherless;
56 if mom.pdgId() == lepton.pdgId():
57 if beforeFSR:
return False
58 return isPromptLepton(mom, beforeFSR, includeMotherless, includeTauDecays)
59 elif abs(mom.pdgId()) == 15:
60 if not includeTauDecays:
return False
61 return isPromptLepton(mom, beforeFSR, includeMotherless, includeTauDecays)
67 for x
in range(l.numberOfMothers()):
69 if mom.status() > 2:
return True
71 if id > 1000000:
return True
72 if id > 100:
return False
73 if id < 6:
return False
74 if id == 21:
return False
75 if id
in [11,12,13,14,15,16]:
76 if l.status() > 2:
return True
78 if id >= 22
and id <= 39:
return True
82 """Get the daughters of a particle, going through radiative X -> X' + a
83 decays, either including or excluding the radiation among the daughters
85 X -> X' + a, X' -> b c
86 realGenDaughters(X, excludeRadiation=True) = { b, c }
87 realGenDaughters(X, excludeRadiation=False) = { a, b, c }"""
89 for i
in range(gp.numberOfDaughters()):
91 if dau.pdgId() == gp.pdgId():
101 """Get the mothers of a particle X going through intermediate X -> X' chains.
102 e.g. if Y -> X, X -> X' realGenMothers(X') = Y"""
104 for i
in range(gp.numberOfMothers()):
106 if mom.pdgId() == gp.pdgId():
114 for i
in range(gp.numberOfDaughters()):
115 if gp.daughter(i).
pdgId() == me: