Repository navigation
mg7 launch: translate madevent run_card names in "set" (cuts, beams, PDFs, scale codes) - #247
Open
oliviermattelaer wants to merge 4 commits into
Open
oliviermattelaer wants to merge 4 commits into
oliviermattelaer wants to merge 4 commits into
Conversation
MG7Selector.do_set translated the madevent scalar names (_LO_SCALAR_MAP) but not the cut names, so "set mmll 200" in a launch script printed "invalid set command" and the run went ahead without the cut. Cut names in RunCardMG7._LO_CUT_MAP now go through the new RunCardMG7.set_lo_cut, which writes the [cuts] entry that from_LO uses (never [histograms], which shares the key syntax). A minimum <= 0 or a negative maximum removes the bound, as in from_LO, which now shares the rule through _lo_cut_is_active. A cut on a _LO_CUT_GROUPS group (ihtmin, ptllmin, mmnl) also adds that group to [multiparticles] when the card lacks it; without it the launch fails with KeyError: 'parton'. Checked end to end: p p > e+ e- with set mmll 200 / mmllmax 1000 gives 1.455 pb (891.9 pb once both are reset to 0 / -1); p p > e+ e- j with mmll 60 goes from 226.3 pb to 13.88 pb with ihtmin 100 and ptllmin 50.
oliviermattelaer
force-pushed
the
claude/gifted-gagarin-2d3d24
branch
from
October 9, 2026 14:09
f798323 to
3f4b065
Compare
At the mg7 launch question, settings that the run_card.dat conversion
(from_LO) handles were still lost:
- "set ebeam1 6500", "set ebeam 6800", "set lpp1 0", "set pdlabel ...",
"set lhaid ...", "set fixed_fac_scale ...", "set maxjetflavor 5" and the
per-pdg cuts ("set pt_min_pdg {6: 100}") printed "invalid set command"
and the run went on with the mg7 default;
- "set dynamical_scale_choice 3" and "set sde_strategy 2" (madevent's
integer codes) went to the mg7 key of the same name, which only takes
names, and aborted a scripted launch with InvalidCardEdition.
RunCardMG7.set_lo_param now translates them as from_LO does: the integer
codes and the et/shat/ckkw shortcuts to the mg7 names (HT and HT/n stay
with the generic editor), maxjetflavor to the jet group, the {pdg: value}
cuts to a pdg<N> group plus its cut (mxx_only_part_antipart choosing
pair_mass or sfos_pair_mass, in either order), pdlabel/lhaid to beam.pdf
through the same tables. Values with no mg7 equivalent warn and keep the
current setting instead of aborting.
mg7 has one energy, one PDF and one lepton flag for both beams, so the
per-beam settings of one launch question are combined: ebeam1 and ebeam2
give e_cm = 2 sqrt(E1 E2), lpp1 and lpp2 give beam.leptonic. What still
differs per beam is reported once, when the question closes
(MG7Selector.check_card_consistency), so "set ebeam1 X" followed by
"set ebeam2 X" stays quiet. PR #154 (one energy and one PDF per beam)
routes the beam names to its per-beam keys through set_lo_beam_param;
whichever merges second hands them over to it.
from_LO now builds the jet and pdg groups with the same helpers.
A run_card.dat is read with string pdg keys (pt_min_pdg = {6: 100}
gives {'6': 100.0}), but from_LO only took integer keys, so the per-pdg
cuts (pt/e/eta_min/max_pdg, mxx_min_pdg with mxx_only_part_antipart) of
a real card were dropped without a report. The existing test set the
dicts with integer keys directly, which hid it.
_lo_pdg_dict turns the keys into integers (keeping 'default') before
from_LO reads them.
This branch has not been deployed
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.
Targets
main(it was stacked on #223, merged 2026-10-10). Three commits plus a merge ofmain.Summary
At the mg7 launch question, madevent
run_card.datnames that the run_card.dat -> run_card.toml conversion (RunCardMG7.from_LO) already handles were lost. They printedWARNING: invalid set command ...and the run went on with the mg7 default; seen on main 44b8e19, where ap p > e+ e-run integrated with no m_ll cut. Two of them aborted a scripted launch outright. This PR translates them the wayfrom_LOdoes.Commit 1: cut names (
set mmll 200,set ptj 30,set etaj -1,set ihtmin 100, ...)RunCardMG7.set_lo_cutwrites the[cuts]entryfrom_LOuses. It writes only to[cuts], never[histograms], which shares the key syntax (e.g.sqrt_s.min).from_LO(shared_lo_cut_is_active)._LO_CUT_GROUPSgroup (parton,alllepton) also adds that group, or the launch fails withKeyError: 'parton'.Commit 2: beam, PDF and scale settings
set dynamical_scale_choice 3/set sde_strategy 2: these used to abort a launch script withInvalidCardEdition("Please report this bug"). The integer codes and the madeventet/shat/ckkwnames now become the mg7 names. Codes with no mg7 equivalent (0 = user-defined, -1 = CKKW) warn and keep the current value.HTandHT/nstay with the generic editor, as before.ebeam1,ebeam2(and theset ebeamshortcut, with energy units) →beam.e_cmlpp1,lpp2(andset lpp) →beam.leptonicpdlabel,pdlabel1,pdlabel2,lhaid→beam.pdffixed_fac_scale(1/2)→beam.fixed_fact_scalemaxjetflavor→ thejetgroup{pdg: value}→ apdg<N>group plus its cut.mxx_only_part_antipartpickspair_massorsfos_pair_mass, whichever of the two is set first.beam.leptonic. What still differs per beam is reported once, when the question closes (MG7Selector.check_card_consistency), soset ebeam1 Xfollowed byset ebeam2 Xstays quiet.Commit 3: per-pdg cuts in the run_card.dat conversion
run_card.datis read with string pdg keys (pt_min_pdg = {6: 100}gives{'6': 100.0}), butfrom_LO(from Document the mg7 run card (run_card.toml) #223) only took integer keys. So the per-pdg cuts of a real card were dropped without a report. Document the mg7 run card (run_card.toml) #223's test set the dicts with integer keys directly, which hid it._lo_pdg_dictturns the keys into integers (keepingdefault) beforefrom_LOreads them. New testtest_from_LO_pdg_cuts_read_from_a_run_cardwrites and rereads a realrun_card.dat; without the fix it fails withKeyError: 'pdg6-pt'.Interplay with #154 (one energy and one PDF per beam)
#154 routes
ebeam*,lpp*,pdlabel*andlhaidto its per-beam keys throughRunCardMG7.set_lo_beam_param(lo_beam_params). Whichever PR merges second should makeset_lo_paramhand those names toset_lo_beam_paramand drop the "one value for both beams" warnings for them.fixed_fac_scale,maxjetflavor, the per-pdg cuts and the integer codes stay here.Testing
main(df50882):test_banner.py85 tests OK,test_mg7_launch.py93 OK (none skipped, madspace rebuilt),tests/unit_tests/madspin665 OK. A freshp p > e+ e-launch withset mmll 200,dynamical_scale_choice 3,sde_strategy 2,ebeam 6800,pt_min_pdg {11: 30}applies them all and gives 1.528 pb.tests/unit_tests/various/test_banner.py: 83 tests OK. New:test_set_lo_cut,test_set_lo_cut_composite,test_set_lo_param_value_translation,test_set_lo_param_beams_combine,test_set_lo_param_pdg_cuts, andtest_set_lo_param_matches_from_LO(setlands wherefrom_LOputs the same values).tests/unit_tests/interface/test_mg7_launch.py: 92 tests OK, none skipped (madspace built from this branch). The new tests stub the generic editor and assert it is never reached for these names, and that mg7 values (transverse_mass,denominators,HT/4) still are.tests/unit_tests/madspin: 665 tests OK.run_card.datparameters were run through the real launch question one by one, before and after this change.bin/madgraph:p p > e+ e-,set mmll 200,set mmllmax 1000mmll 0/mmllmax -1(cut removed)p p > e+ e- j,mmll 60ihtmin 100,ptllmin 50dynamical_scale_choice 3and0,sde_strategy 2,ebeam 6800,maxjetflavor 4,lpp1/2 1,fixed_fac_scale F,pt_min_pdg {11: 30},ebeam1 7000,ebeam2 4000denominators, the 4-flavour jet group andpdg11-pt.min = 30; one asymmetric-beam warning after the question; 503.0 pb.rstpage was checked with docutils (no warnings).