Repository navigation
Fix MLM clustering through flavour-forbidden merged graphs (apply_flavor_grouping) - #229
Merged
Merged
Conversation
With apply_flavor_grouping, cluster() filtered the candidate graphs of a leg pair by flavour (flavor_compatible) but never checked that any graph survived, so the filter had no effect: for the q q~ > q' q~' rows of q q~ > q q~ the clustering took the q-q' t-channel gluon of the merged graphs, which does not exist for those flavours, and skipped the alpha_s reweighting of the q' q~' > g clustering that the ungrouped P0_uux_ddx applies (+13% on the s-channel gluon channel at xqcut=20). - flavor_filter replaces flavor_compatible and works on the event's merged-flavour indices instead of the remapped PDG codes: a g/a/Z/h can only join two merged legs with the same index. Everything else (unmerged or internal legs, W, unmapped merged leptons) stays permissive, as it effectively was. It is applied to every candidate pair (first pass and recomputation) and to igraphs after a winner, and pairs whose graph list ends up empty are no longer clustered. - setclscales: a chcluster-forced clustering on a channel whose graph is forbidden for the event's flavours (s-channel config, u d~ > u d~ row) now returns .false. (zero weight, which the multichannel factor gives anyway) instead of stopping madevent. test_mlm_rewgt_auto_match_qq_to_qq compared the flavour-grouped channel (all 32 flavour rows) with a single ungrouped P directory (8 rows, the one with most channels), a factor ~3.8 by construction. It now compiles every P directory, matches channels by s- and t-channel propagators with flavours mapped onto the merged codes, compares each grouped channel with the sum of its ungrouped counterparts, and uses 50k points (5k left the +13% at 4.4 sigma). run_single_channel removes results.dat before a run, since a Fortran STOP exits with 0 and left the previous channel's result to be read.
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.
Fixes the pre-existing failure of
test_MLM_reweight.py::TestMLMReweightAutoMatch::test_mlm_rewgt_auto_match_qq_to_qq(39.1 sigma, reproduced onmainand at ce5ebc6). The failure had two causes: a wrong test, and a real MLM bug that the wrong test was hiding.1. The test compared different flavour content (factor ~3.8)
With
group_subprocesses=False,apply_flavor_grouping=Falsesplitsq q~ > q q~(q = u d s c) over three P-dirs:P0_uux_uuxP0_uux_ddxq q~ > q' q~')P0_udx_udxq q~' > q q~')The flavour-grouped
P0_QQx_QQxintegrates all 32 rows. The test compared it with only the P-dir that has the most channels (P0_uux_uux).2. Real bug:
cluster()used flavour-forbidden graphsAfter summing over P-dirs (50k points per channel):
With
ickkw=0the s-channel numbers agree (134610 vs 134065, 0.6 sigma), so the difference is in REWGT.mlevel=8traces show the cause. For theq q~ > q' q~'rows (flavour class1,1,2,2), fg=True clusters beam q with outgoing q' through the t-channel gluon of the merged graph. That vertex does not exist for those flavours, and the merge gives REWGT = 1. The ungroupedP0_uux_ddxonly has the s-channel graph: it clustersq' q~' -> gand applies alpha_s(ptij)/alpha_s(mtlast), about 0.85.cluster()already filtered candidate graphs withflavor_compatible, but never checked that any graph survived. The filteredicgswas a dead local, so the filter had no effect at all.Fix (
Template/LO/SubProcesses/cluster.f,reweight.f)flavor_filterreplacesflavor_compatible. It works on the event's merged-flavour indices, i.e. the class pattern fromGET_FLAVORthat reaches REWGT, where equal index means equal flavour, as incheck_flavor. It does not use the remapped PDG codes.igraphsafter a winner is chosen. Pairs whose graph list is empty are no longer clustered.W+ W- -> Z.flavor = 1,1,..., so the filter is a no-op there.setclscales: the first event of a channel, and the "jets fail, recluster" path, forcechcluster(this channel's graph only). For a flavour row that forbids that graph (s-channel config,u d~ > u d~row), clustering now returns.false., which the callers already turn into zero weight. Before, this case wouldstop. The event has zero multichannel weight there anyway (AMP2(config)=0for that flavour). Any other clustering failure still stops as before.Test (
tests/acceptance_tests/test_MLM_reweight.py)run_single_channeldeletesresults.datbefore each run. A FortranSTOPexits with 0 and otherwise leaves the previous channel's result to be read; this hid thechclusterstop above during development.Validation
-p tests/acceptance_tests '.*mlm_rewgt.*': Ran 5 tests, OK. This covers the manual qq, gg>tt~gg and DY+4j cases.test_flavor_grouping_consistency_mlm,test_madevent_dy3j_mlm,test_DY_onejet: Ran 3 tests, OK. No clustering errors in the logs.