Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/source/madevent_to_mg7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ and ``use_syst``. The shortcuts ``set lhc``, ``set lep``, ``set fixed_scale``,
``set no_parton_cut`` and ``set dynamical_scale_choice HT/n`` work as before, and so does
``set iseed``. MadEvent draws a random seed for ``iseed = 0``. MG7 does the same for
``seed = -1`` and treats ``0`` as an ordinary fixed seed, so ``set iseed 0`` is translated.

The cut names of the `Cuts`_ table are translated as well, so ``set mmll 200`` sets
``lepton-sfos_pair_mass.min`` and ``set ptj1min 50`` sets ``jet_1-pt.min``. As in
``run_card.dat``, a minimum of zero or a negative maximum removes that bound. A cut on the
``parton`` or ``alllepton`` group also adds the group to ``[multiparticles]`` if it is not
there yet. The per-pdg cuts are written as in ``run_card.dat``, for example
``set pt_min_pdg {6: 100}``, and put on a group ``pdg6 = [6, -6]``. ``ptheavy`` is not
translated, because it needs a group of your own.

The beam and PDF settings ``ebeam1``, ``ebeam2`` (and the shortcut ``set ebeam``),
``lpp1``, ``lpp2``, ``pdlabel``, ``pdlabel1``, ``pdlabel2``, ``lhaid``, ``fixed_fac_scale``,
``fixed_fac_scale1``, ``fixed_fac_scale2`` and ``maxjetflavor`` are translated as in the tables
below, and so are the numbers of ``dynamical_scale_choice`` (``set dynamical_scale_choice 3``)
and ``sde_strategy``. MG7 has one energy, one PDF and one lepton flag for both beams, so the
two values of a pair are combined: ``set ebeam1 7000`` followed by ``set ebeam2 4000`` runs at
the same :math:`\sqrt{s}` in the centre-of-mass frame. What cannot be represented this way is
reported once the launch question closes.

All other settings must use their new names.

Beams and PDFs
Expand Down
58 changes: 58 additions & 0 deletions madgraph/iolibs/template_files/mg7/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,15 @@ def init_run(self, cards):
self.run_card.allow_scan = True
return getattr(self, "run_set", out)

def check_card_consistency(self):
super().check_card_consistency()
# madevent settings given per beam ("set ebeam1 ...") that the
# one-energy, one-PDF mg7 card could not follow: said once, at
# the end, so "set ebeam1 X" then "set ebeam2 X" stays quiet
if isinstance(getattr(self, "run_card", None), RunCardMG7):
for text in self.run_card.lo_set_warnings():
logger.warning(text)

def do_set(self, line, *args, **kwargs):
# madevent-style shortcuts (lhc/lep/fixed_scale/no_parton_cut), cut
# editing, energy units and arithmetic/mass expressions on the TOML
Expand Down Expand Up @@ -3589,6 +3598,55 @@ def do_set(self, line, *args, **kwargs):
self.modified_card.add("run")
return

# legacy madevent cut names ("set ptj 20", "set mmll 200",
# "set etaj -1", ...) -> the [cuts] entry the LO->MG7
# run_card conversion maps them to (_LO_CUT_MAP), with the
# same "no cut" sentinels (minimum <= 0, maximum < 0).
if rest and nlow in run_card._LO_CUT_MAP:
try:
cut, bound, val = run_card.set_lo_cut(
nlow, run_card.evaluate(rest, masses))
except (_banner_mod.InvalidCmd, TypeError, ValueError):
logger.warning("ignoring 'set %s %s': not a number", nlow, rest)
return
if val is None:
logger.info("set %s (mg7 cut %s.%s) of the run_card.toml: "
"no cut", nlow, cut, bound)
else:
logger.info("set %s (mg7 cut %s.%s) of the run_card.toml to %s",
nlow, cut, bound, val)
self.modified_card.add("run")
return

# madevent parameters that are not a plain rename: the
# value is translated ("set dynamical_scale_choice 3") or
# several of them make one mg7 entry (ebeam1 + ebeam2 ->
# beam.e_cm). mg7 values ("set sde_strategy denominators")
# come back as None and go on to the generic editor.
if rest and nlow in run_card._LO_SET_PARAMS:
try:
done = run_card.set_lo_param(nlow, rest, masses)
except (_banner_mod.InvalidCmd, TypeError, ValueError) as error:
logger.warning("ignoring 'set %s %s': %s", nlow, rest, error)
return
if done is not None:
changes, warnings = done
for key, val in changes.items():
if val is None:
logger.info("set %s: removed %s from the run_card.toml",
nlow, key)
else:
logger.info("set %s (mg7 %s) of the run_card.toml to %s",
nlow, key, val)
for text in warnings:
logger.warning(text)
if changes:
self.modified_card.add("run")
elif not warnings:
logger.info("set %s %s: nothing to change in the run_card.toml",
nlow, rest)
return

# 'iseed' is the madevent spelling of the mg7 run.seed,
# but the two disagree on how to ask for a random seed:
# madevent uses 0, mg7 uses -1 (0 being a perfectly good
Expand Down
Loading
Loading