Fix stale flavortag on shared wavefunctions in HelasDiagram.check_flavor#18
Open
oliviermattelaer wants to merge 2 commits into
Open
Fix stale flavortag on shared wavefunctions in HelasDiagram.check_flavor#18oliviermattelaer wants to merge 2 commits into
oliviermattelaer wants to merge 2 commits into
Conversation
HelasDiagram.check_flavor only cleared the `flavortag` attribute on the wavefunctions *introduced* by the diagram (self['wavefunctions']). In a HELAS-optimised matrix element a diagram also reuses wavefunctions (and their sub-trees) introduced by earlier diagrams, which appear here only as mothers. Those shared mothers kept a stale flavortag computed for a different flavor, and propagate_flavor_tag silently reused it instead of recomputing it. This made check_flavor order-dependent: a diagram whose internal lines are all reused (e.g. the t-channel gluon diagrams of q q > q q g and q q~ > q q~ g where the external gluon is radiated off a final quark) was wrongly rejected for a valid same-flavor assignment when checked after another flavor. Clear the flavortag over the whole ancestor closure of every wavefunction and amplitude instead. External leaves are re-tagged as before; cleared internal shared mothers are recomputed by propagate_flavor_tag. This is the same bug class previously patched at the check_flavor_for_all_diagrams level; the fix here makes the lower-level HelasDiagram.check_flavor correct on its own. Add regression tests (TestDiagramFlavorCheck, TestDiagramFlavorCheckQQG, TestDiagramFlavorCheckQQbarG) covering d d~ > d d~, q q > q q g and q q~ > q q~ g; the latter two fail without this fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
@theoheimel do you want to do some test on this or we can merge it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HelasDiagram.check_flavor only cleared the
flavortagattribute on the wavefunctions introduced by the diagram (self['wavefunctions']). In a HELAS-optimised matrix element a diagram also reuses wavefunctions (and their sub-trees) introduced by earlier diagrams, which appear here only as mothers. Those shared mothers kept a stale flavortag computed for a different flavor, and propagate_flavor_tag silently reused it instead of recomputing it. This made check_flavor order-dependent: a diagram whose internal lines are all reused (e.g. the t-channel gluon diagrams of q q > q q g and q q~ > q q~ g where the external gluon is radiated off a final quark) was wrongly rejected for a valid same-flavor assignment when checked after another flavor.Clear the flavortag over the whole ancestor closure of every wavefunction and amplitude instead. External leaves are re-tagged as before; cleared internal shared mothers are recomputed by propagate_flavor_tag. This is the same bug class previously patched at the check_flavor_for_all_diagrams level; the fix here makes the lower-level HelasDiagram.check_flavor correct on its own.
Add regression tests (TestDiagramFlavorCheck, TestDiagramFlavorCheckQQG, TestDiagramFlavorCheckQQbarG) covering d d~ > d d~, q q > q q g and q q~ > q q~ g; the latter two fail without this fix.