1 from __future__
import print_function
8 from builtins
import range
10 """Draws particle decay tree """
13 print(
"Init particleDecayDrawer")
17 if candidate
in skipList:
return False;
21 return candidate.status() == 3
24 nDaughters = candidate.numChildren()
25 for i
in range(nDaughters):
26 if self.
_select(candidate.listChildren()[i]):
return True
32 def _decay(self, candidate, skipList):
35 if candidate
in skipList:
37 skipList.append(candidate)
39 id = candidate.pdg_id()
44 nOfDaughters = candidate.numChildren()
45 for i
in range(nOfDaughters):
46 if self.
_accept(candidate.listChildren()[i], skipList): validDau+=1
47 if validDau == 0:
return out
51 for i
in range(nOfDaughters):
52 d = candidate.listChildren()[i]
54 decString = self.
_decay(d, skipList)
55 if (
"->" in decString): out +=
" ( %s ) " %decString
56 else: out +=
" %s" %decString
60 """ draw decay tree from list(HepMC.GenParticles)"""
64 for particle
in particles:
65 if particle.numParents() > 1:
67 skipList.append(particle)
68 nodesList.append(particle)
69 for j
in range(particle.numParents()):
70 mom = particle.listParents()[j]
79 for m
in range(len(momsList)):
80 decString = self.
_decay( momsList[m], skipList)
81 if len(decString) > 0:
82 print(
"{ %s } " %decString)
86 if len(nodesList) > 0:
88 if len(nodesList) > 1:
89 for node
in nodesList:
91 decString = self.
_decay(node, skipList)
92 if len(decString) > 0:
93 if "->" in decString:
print(
" ( %s ) " %decString)
94 else:
print(
" " + decString)
96 skipList.remove(nodesList[0])
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)