Esempio n. 1
0
def is_ptc_from_b(event, hadron, browser):
    ancestors = browser.ancestors(hadron)
    is_from_b = False 
    for ancestor in ancestors:
        if hasBottom(ancestor.pdgid() ):
            is_from_b = True
    return is_from_b
Esempio n. 2
0
 def process(self, event):
     '''event should contain:
     
     * gen_particles: list of all stable gen particles
     '''
     genptcs = event.gen_particles
     bquarks = []
     charged_hadrons = []
     event.hadrons_from_b = []
     for ptc in genptcs:
         if abs(ptc.pdgid()) == 5:
             bquarks.append(ptc)
         elif ptc.q() and ptc.status() == 1:
             charged_hadrons.append(ptc)
     if len(bquarks) == 0 or len(charged_hadrons) == 0:
         return
     event.genbrowser = GenBrowser(event.gen_particles, event.gen_vertices)
     event.hadrons_from_b = []
     event.hadrons_not_from_b = []
     for hadron in charged_hadrons:
         ancestors = event.genbrowser.ancestors(hadron)
         is_from_b = False
         for ancestor in ancestors:
             if hasBottom(ancestor.pdgid()):
                 is_from_b = True
         if is_from_b:
             event.hadrons_from_b.append(hadron)
         else:
             event.hadrons_not_from_b.append(hadron)
Esempio n. 3
0
 def process(self, event):
     genptcs = event.gen_particles
     bquarks = []
     charged_hadrons = []
     event.hadrons_from_b = []
     for ptc in genptcs:
         if abs(ptc.pdgid())==5:
             bquarks.append(ptc)
         elif ptc.q() and ptc.status()==1:
             charged_hadrons.append(ptc)
     if len(bquarks) == 0 or len(charged_hadrons) == 0:
         return
     event.genbrowser = GenBrowser(event.gen_particles,
                                   event.gen_vertices)
     event.hadrons_from_b = []
     event.hadrons_not_from_b = []
     for hadron in charged_hadrons:
         ancestors = event.genbrowser.ancestors(hadron)
         is_from_b = False 
         for ancestor in ancestors:
             if hasBottom(ancestor.pdgid() ):
                 is_from_b = True
         if is_from_b:
             event.hadrons_from_b.append(hadron)
         else:
             event.hadrons_not_from_b.append(hadron)
Esempio n. 4
0
def is_ptc_from_b(event, hadron, browser):
    ancestors = browser.ancestors(hadron)
    is_from_b = False
    for ancestor in ancestors:
        if hasBottom(ancestor.pdgid()):
            is_from_b = True
    return is_from_b
Esempio n. 5
0
 def process(self, event):
     genptcs = event.gen_particles
     charged_hadrons = [ptc for ptc in genptcs if ptc.q() and ptc.status()==1]
     event.genbrowser = GenBrowser(event.gen_particles,
                                   event.gen_vertices)
     event.hadrons_from_b = []
     for hadron in charged_hadrons:
         ancestors = event.genbrowser.ancestors(hadron)
         for ancestor in ancestors:
             if hasBottom(ancestor.pdgid() ):
                 event.hadrons_from_b.append(hadron)
                 break 
Esempio n. 6
0
 def process(self, event):
     genptcs = event.gen_particles
     charged_hadrons = [
         ptc for ptc in genptcs if ptc.q() and ptc.status() == 1
     ]
     event.genbrowser = GenBrowser(event.gen_particles, event.gen_vertices)
     event.hadrons_from_b = []
     for hadron in charged_hadrons:
         ancestors = event.genbrowser.ancestors(hadron)
         for ancestor in ancestors:
             if hasBottom(ancestor.pdgid()):
                 event.hadrons_from_b.append(hadron)
                 break