Example #1
0
    def fillGenLeptons(self, event, particle, isTau=False, recovered=False, sourceId=25):
        """Get the gen level light leptons (prompt and/or from tau decays)"""

        for i in xrange( particle.numberOfDaughters() ):
            dau = GenParticle(particle.daughter(i))
            dau.sourceId = sourceId
            dau.isTau = isTau
            id = abs(dau.pdgId())
            moid = abs(dau.mother().pdgId()) if dau.mother() else 2212 #if no mom, let say it is a proton (consistent with CMSSW < 74X)
            if id in [11,13]:
                if not recovered:
                    if isTau: event.gentauleps.append(dau)
                    else:     event.genleps.append(dau)
                else:
                    if isTau: event.gentaulepsRecovered.append(dau)
                    else:     event.genlepsRecovered.append(dau)
            elif id == 15:
                if not recovered:
                    if moid in [22,23,24]:
                        event.gentaus.append(dau)
                    self.fillGenLeptons(event, dau, True, sourceId)
                else:
                    if moid in [22,23,24]:
                        event.gentausRecovered.append(dau)
                    self.fillGenLeptons(event, dau, True, True, sourceId) 
            elif id in [22,23,24]:
                if not recovered: self.fillGenLeptons(event, dau, False,       sourceId)
                else:             self.fillGenLeptons(event, dau, False, True, sourceId)
Example #2
0
    def fillGenLeptons(self, event, particle, isTau=False, sourceId=25):
        """Get the gen level light leptons (prompt and/or from tau decays)"""

        for i in xrange(particle.numberOfDaughters()):
            dau = GenParticle(particle.daughter(i))
            dau.sourceId = sourceId
            dau.isTau = isTau
            id = abs(dau.pdgId())
            moid = abs(dau.mother().pdgId())
            if id in [11, 13]:
                if isTau: event.gentauleps.append(dau)
                else: event.genleps.append(dau)
            elif id == 15:
                if moid in [22, 23, 24]:
                    event.gentaus.append(dau)
                self.fillGenLeptons(event, dau, True, sourceId)
            elif id in [22, 23, 24]:
                self.fillGenLeptons(event, dau, False, sourceId)
    def fillGenLeptons(self,
                       event,
                       particle,
                       isTau=False,
                       recovered=False,
                       sourceId=25):
        """Get the gen level light leptons (prompt and/or from tau decays)"""

        for i in xrange(particle.numberOfDaughters()):
            dau = GenParticle(particle.daughter(i))
            dau.sourceId = sourceId
            dau.isTau = isTau
            id = abs(dau.pdgId())
            moid = abs(dau.mother().pdgId()) if dau.mother(
            ) else 2212  #if no mom, let say it is a proton (consistent with CMSSW < 74X)
            if id in [11, 13]:
                if not recovered:
                    if isTau: event.gentauleps.append(dau)
                    else: event.genleps.append(dau)
                else:
                    if isTau: event.gentaulepsRecovered.append(dau)
                    else: event.genlepsRecovered.append(dau)
            elif id == 15:
                if not recovered:
                    if moid in [22, 23, 24]:
                        event.gentaus.append(dau)
                    self.fillGenLeptons(event, dau, True, sourceId)
                else:
                    if moid in [22, 23, 24]:
                        event.gentausRecovered.append(dau)
                    self.fillGenLeptons(event, dau, True, True, sourceId)
            elif id in [22, 23, 24]:
                if not recovered:
                    self.fillGenLeptons(event, dau, False, sourceId)
                else:
                    self.fillGenLeptons(event, dau, False, True, sourceId)