1 from __future__
import print_function
9 """Draws particle decay tree """ 12 print(
"Init particleDecayDrawer")
16 if candidate
in skipList:
return False;
20 return candidate.status() == 3
23 nDaughters = candidate.numChildren()
24 for i
in xrange(nDaughters):
25 if self.
_select(candidate.listChildren()[i]):
return True 31 def _decay(self, candidate, skipList):
34 if candidate
in skipList:
36 skipList.append(candidate)
38 id = candidate.pdg_id()
43 nOfDaughters = candidate.numChildren()
44 for i
in xrange(nOfDaughters):
45 if self.
_accept(candidate.listChildren()[i], skipList): validDau+=1
46 if validDau == 0:
return out
50 for i
in xrange(nOfDaughters):
51 d = candidate.listChildren()[i]
53 decString = self.
_decay(d, skipList)
54 if (
"->" in decString): out +=
" ( %s ) " %decString
55 else: out +=
" %s" %decString
59 """ draw decay tree from list(HepMC.GenParticles)""" 63 for particle
in particles:
64 if particle.numParents() > 1:
66 skipList.append(particle)
67 nodesList.append(particle)
68 for j
in xrange(particle.numParents()):
69 mom = particle.listParents()[j]
78 for m
in xrange(len(momsList)):
79 decString = self.
_decay( momsList[m], skipList)
80 if len(decString) > 0:
81 print(
"{ %s } " %decString)
85 if len(nodesList) > 0:
87 if len(nodesList) > 1:
88 for node
in nodesList:
90 decString = self.
_decay(node, skipList)
91 if len(decString) > 0:
92 if "->" in decString:
print(
" ( %s ) " %decString)
93 else:
print(
" " + decString)
95 skipList.remove(nodesList[0])
def _accept(self, candidate, skipList)
def draw(self, particles)
def _select(self, candidate)
S & print(S &os, JobReport::InputFile const &f)
def _hasValidDaughters(self, candidate)
def _decay(self, candidate, skipList)
def _printP4(self, candidate)