List of all members.
Detailed Description
Draws particle decay tree
Definition at line 7 of file ParticleDecayDrawer.py.
Constructor & Destructor Documentation
def python::ParticleDecayDrawer::ParticleDecayDrawer::__init__ |
( |
|
self | ) |
|
Member Function Documentation
def python::ParticleDecayDrawer::ParticleDecayDrawer::_accept |
( |
|
self, |
|
|
|
candidate, |
|
|
|
skipList |
|
) |
| [private] |
Definition at line 14 of file ParticleDecayDrawer.py.
00015 :
00016 if candidate in skipList: return False;
00017 return self._select(candidate)
def python::ParticleDecayDrawer::ParticleDecayDrawer::_decay |
( |
|
self, |
|
|
|
candidate, |
|
|
|
skipList |
|
) |
| [private] |
Definition at line 30 of file ParticleDecayDrawer.py.
00031 :
00032
00033 out = str()
00034 if candidate in skipList:
00035 return ""
00036 skipList.append(candidate)
00037
00038 id = candidate.pdg_id()
00039
00040 out += str(id) + self._printP4(candidate)
00041
00042 validDau = 0
00043 nOfDaughters = candidate.numChildren()
00044 for i in xrange(nOfDaughters):
00045 if self._accept(candidate.listChildren()[i], skipList): validDau+=1
00046 if validDau == 0: return out
00047
00048 out += " ->"
00049
00050 for i in xrange(nOfDaughters):
00051 d = candidate.listChildren()[i]
00052 if self._accept(d, skipList):
00053 decString = self._decay(d, skipList)
00054 if ("->" in decString): out += " ( %s ) " %decString
00055 else: out += " %s" %decString
00056 return out
def python::ParticleDecayDrawer::ParticleDecayDrawer::_hasValidDaughters |
( |
|
self, |
|
|
|
candidate |
|
) |
| [private] |
Definition at line 21 of file ParticleDecayDrawer.py.
00022 :
00023 nDaughters = candidate.numChildren()
00024 for i in xrange(nDaughters):
00025 if self._select(candidate.listChildren()[i]): return True
00026 return False
def python::ParticleDecayDrawer::ParticleDecayDrawer::_printP4 |
( |
|
self, |
|
|
|
candidate |
|
) |
| [private] |
def python::ParticleDecayDrawer::ParticleDecayDrawer::_select |
( |
|
self, |
|
|
|
candidate |
|
) |
| [private] |
def python::ParticleDecayDrawer::ParticleDecayDrawer::draw |
( |
|
self, |
|
|
|
particles |
|
) |
| |
draw decay tree from list(HepMC.GenParticles)
Definition at line 57 of file ParticleDecayDrawer.py.
00057 :
00058 """ draw decay tree from list(HepMC.GenParticles)"""
00059 skipList = []
00060 nodesList = []
00061 momsList = []
00062 for particle in particles:
00063 if particle.numParents() > 1:
00064 if self._select(particle):
00065 skipList.append(particle)
00066 nodesList.append(particle)
00067 for j in xrange(particle.numParents()):
00068 mom = particle.listParents()[j]
00069 while (mom.mother()):
00070 mom = mom.mother()
00071 if self._select(mom):
00072 momsList.append(mom)
00073
00074 print "-- decay --"
00075 if len(momsList) > 0:
00076 if len(momsList) > 1:
00077 for m in xrange(len(momsList)):
00078 decString = self._decay( momsList[m], skipList)
00079 if len(decString) > 0:
00080 print "{ %s } " %decString
00081 else:
00082 print self._decay(momsList[0], skipList)
00083
00084 if len(nodesList) > 0:
00085 print "-> "
00086 if len(nodesList) > 1:
00087 for node in nodesList:
00088 skipList.remove(node)
00089 decString = self._decay(node, skipList)
00090 if len(decString) > 0:
00091 if "->" in decString: print " ( %s ) " %decString
00092 else: print " " + decString
00093 else:
00094 skipList.remove(nodesList[0])
00095 print self._decay(nodesList[0], skipList)
00096
00097 print
00098
00099