Skip to content
Snippets Groups Projects

Don't mark parent particle in setDescriptorTemplate

Merged Lex Greeven requested to merge legreeve-templatefix into run2-patches
1 unresolved thread
Files
2
@@ -222,7 +222,7 @@ def setDescriptorTemplate(self, template):
# To form the decay descriptor, we need to mark all the particles
# except for the top-level particle
mapping = {p: '^' for p in particles}
mapping = {p: '^' if particles.index(p) != 0 else '' for p in particles}
clean = dd.template.replace(' ', '')
for i, o in enumerate(re.findall("(\[\$|\$)", clean)):
if o == '[$': mapping[particles[i]] = ''
@@ -235,8 +235,10 @@ def setDescriptorTemplate(self, template):
branches = {}
for p in particles:
# Need a version of the descriptor where particle 'p' is marked but nothing else is.
mapping = {q: '^' if p == q else '' for q in particles}
branches[p] = dd.substitute(mapping)
# Use mapping to ensure the parent particle is never marked.
branches[p] = dd.substitute(
{q: mapping[p] if p == q else ''
for q in particles})
# Finally, add the branches to the DecayTreeTuple
return self.addBranches(branches)
Loading