def fillTopQuarks(self, event):
        """Get the b quarks from top decays into event.genbquarks"""

        event.gentopquarks = [ p for p in event.genParticles if (p.status() == 3 and abs(p.pdgId()) == 6) ]
        #if len(event.gentopquarks) != 2:
        #    print "Not two top quarks? \n%s\n" % event.gentopquarks

        for tq in event.gentopquarks:
            for i in xrange( tq.numberOfDaughters() ):
                dau = GenParticle(tq.daughter(i))
                if abs(dau.pdgId()) == 5:
                    dau.sourceId = 6
                    event.genbquarks.append( dau )
                elif abs(dau.pdgId()) == 24:
                    self.fillGenLeptons( event, dau, sourceId=6 )
                    self.fillWZQuarks(   event, dau, True, sourceId=6 )
Example #2
0
    def fillTopQuarks(self, event):
        """Get the b quarks from top decays into event.genbquarks"""

        event.gentopquarks = [ p for p in event.genParticles if (p.status() == 3 and abs(p.pdgId()) == 6) ]
        #if len(event.gentopquarks) != 2:
        #    print "Not two top quarks? \n%s\n" % event.gentopquarks

        for tq in event.gentopquarks:
            for i in xrange( tq.numberOfDaughters() ):
                dau = GenParticle(tq.daughter(i))
                if abs(dau.pdgId()) == 5:
                    dau.sourceId = 6
                    event.genbquarks.append( dau )
                elif abs(dau.pdgId()) == 24:
                    self.fillGenLeptons( event, dau, sourceId=6 )
                    self.fillWZQuarks(   event, dau, True, sourceId=6 )
Example #3
0
    def fillWZQuarks(self, event, particle, isWZ=False, sourceId=25):
        """Descend daughters of 'particle', and add quarks from W,Z to event.genwzquarks
           isWZ is set to True if already processing daughters of W,Z's, to False before it"""

        for i in xrange( particle.numberOfDaughters() ):
            dau = GenParticle(particle.daughter(i))
            dau.sourceId = sourceId
            id = abs(dau.pdgId())
            if id <= 5 and isWZ:
                event.genwzquarks.append(dau)
            elif id in [22,23,24]:
                self.fillWZQuarks(event, dau, True, sourceId)
    def fillWZQuarks(self, event, particle, isWZ=False, sourceId=25):
        """Descend daughters of 'particle', and add quarks from W,Z to event.genwzquarks
           isWZ is set to True if already processing daughters of W,Z's, to False before it"""

        for i in xrange(particle.numberOfDaughters()):
            dau = GenParticle(particle.daughter(i))
            dau.sourceId = sourceId
            id = abs(dau.pdgId())
            if id <= 5 and isWZ:
                event.genwzquarks.append(dau)
            elif id in [22, 23, 24]:
                self.fillWZQuarks(event, dau, True, sourceId)
Example #5
0
def DecayTracer(particle, e, mu, visible, rank):
    
    '''Check the tau decay'''

    rank += 1

    for i in range( particle.numberOfDaughters() ):
        dau = GenParticle(particle.daughter(i))
#        print "   "*rank, dau.pdgId(), dau.status(), dau.p4().pt()
        if(abs(dau.pdgId()) == 11 and abs(particle.pdgId())==15):
#            print 'electron !', particle.pdgId()
            e.append(dau)
        elif(abs(dau.pdgId()) == 13 and abs(particle.pdgId())==15):
#            print 'muon !', particle.pdgId()
            mu.append(dau)

        if(dau.status()==1):
            if(abs(dau.pdgId()) in [12,14,16]):
                pass
            else:
                visible.append(dau)

        DecayTracer(dau, e, mu, visible, rank)
Example #6
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())
            if id in [11,13]:
                if isTau: event.gentauleps.append(dau)
                else:     event.genleps.append(dau)
            elif id == 15:
                self.fillGenLeptons(event, dau, True, sourceId)
            elif id in [22,23,24]:
                self.fillGenLeptons(event, dau, False, sourceId)
Example #7
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())
            if id in [11, 13]:
                if isTau: event.gentauleps.append(dau)
                else: event.genleps.append(dau)
            elif id == 15:
                self.fillGenLeptons(event, dau, True, sourceId)
            elif id in [22, 23, 24]:
                self.fillGenLeptons(event, dau, False, sourceId)