Skip to content

mg7: EVA (pdlabel eva) beams, and massive incoming particles on their mass shell - #502

Open
oliviermattelaer wants to merge 8 commits into
mainfrom
claude/eva-mg7-helicity-density-50f744
Open

oliviermattelaer wants to merge 8 commits into
mainfrom
claude/eva-mg7-helicity-density-50f744

Conversation

@oliviermattelaer

Copy link
Copy Markdown
Contributor

Summary

EVA in mg7/madspace (pdlabel eva). The W, Z and photon content of e±/μ± beams now works in mg7, matching madevent.

  • Densities: a C++ port of ElectroweakFlux.f and the checks in ElectroweakFluxDriver.f: LLA, LP and NLP, q² or pT evolution, eva_xcut, the μ² floor, and the fLpol mix. They are in madspace/src/kernels/eva.hpp and EvaFlux / EvaLegTables (phasespace/eva.{hpp,cpp}).
  • Helicity factor: the matrix element picks a helicity row with probability ∝ |M_h|². DifferentialCrossSection then multiplies the helicity-averaged |M|² by n₁ f_λ₁ n₂ f_λ₂, using the new eva_leg_density kernel. This is an unbiased estimate of Σ f_λ₁ f_λ₂ |M_λ₁λ₂|², the same estimate as madevent's nhel = 1. The helicity-summed density is used only for flavour sampling and for pdf1/pdf2.
  • Run card: new hidden [beam] keys eva, lepton1/2, polarization1/2, eva_order, eva_evolution, eva_xcut. The set commands pdlabel eva, lpp ±3/±4, polbeam, evaorder, ievo_eva and eva_xcut translate to them, and so does from_LO. A process with incoming W/Z gets madevent's EVA setup as its default card.
  • Refusals: EVA is refused for incoming legs that are not vectors, a 2→1 process below threshold, merged subprocesses with different masses, the surrogate, summed interference helicities, MLM, and amplicol. A charge-violating W gets zero density where madevent stops with code 24.

Massive incoming particles on their mass shell (all processes, not only EVA). madspace's mappings build massless incoming momenta and used the flux 1/(2ŝ). madevent (genps.f) puts massive partons on shell and uses 1/(2√λ(ŝ, m₁², m₂²)).

  • The new incoming_on_shell kernel (kinematics.hpp) puts every massive incoming pair on shell with the same total momentum. The Integrand multiplies by ŝ/√λ, and points below threshold get zero weight.
  • MadgraphProcess._massive_beams gives monochromatic massive beams madevent's √s and beam rapidity. The lab momenta come out identical to madevent's.
  • Before this fix, w+ w- > t t~ with W beams was 10% low, and EVA W W was 13–15% low.

Validation: mg7 vs madevent (CPU, group_subprocesses false on the madevent side)

Process / setting mg7 [pb] madevent [pb]
EVA w+ w- > t t~, e+e- 2×15 TeV, LLA 1.1185(46)e-2 1.118182e-2
same, eva_xcut 0 2.1952(92)e-2 2.187245e-2
same, evaorder 1 3.840(15)e-3 3.837e-3
EVA w+ w- > h h, μ+μ− 2×5 TeV, LLA 3.2243(99)e-3 3.241(10)e-3
same, polbeam1 −80, NLP, pT evolution 1.9391(63)e-4 1.933(6)e-4
same LLA, with MadNIS (45% unweighting efficiency) 3.2419(54)e-3 3.241(10)e-3
EVA z/a z/a > t t~ 0.05476(18) 0.05489(15)
EVA w+ w- > h, M_H = 300 (2→1) 0.15636(32) 0.1563(2)
w+ w- > t t~, W beams 2×500 GeV 26.996(73) (was 24.228(61)) 26.99(7)
same, 400/600 GeV 27.650(73) (was 24.773(61)) 27.71(6)
mu+ mu- > t t~, sm-lepton_masses 0.16626(34) 0.1664(1)
b b~ > h, 13 TeV, μ = 125 0.6742(20) 0.6736(6)
  • Polarised sum rule: σ(w+{0} w−) + σ(w+{T} w−) = 1.1264(42)e-2, against an unpolarised 1.1185(46)e-2.
  • Distributions: x₁, x₂ and m_hh shapes agree (χ²/ndf ≈ 1), and so do the helicity fractions of the incoming W.
  • Densities: the C++ densities match the Fortran to 1e-12 over more than 10k points (test_eva_mg7).
  • Timing: 100k events of EVA w+ w- > t t~ take madevent 40 s wall on 18 cores and mg7 4 s on 8 threads, at the same precision (about 10× wall-clock).

Tests

  • New: test_eva_mg7 (7 tests) and test_mg7_massive_incoming (2 tests).
  • These pass: test_banner (175 tests), test_mg7.* (323, 1 skipped) and test_eepdf_lhagrid (34).

Not validated

  • The GPU build: there is no CUDA/HIP toolchain here. The new kernels are non-vectorized and use only the existing GpuTensorView API.
  • Gridpacks with EVA.
  • The madspace pytest suite.
  • With EVA, systematics vary only μ_R.
  • Not supported: EVA on one beam only, and neutrino EVA (commented out in madevent too).

Known limitation

The phase-space mapping itself still builds massless incoming momenta. The t-channel inverse used for the channel weights sees the on-shell momenta, but the channel weights still sum to one at every point, so the result is not biased.

🤖 Generated with Claude Code

oliviermattelaer and others added 3 commits November 19, 2026 22:58
The W, Z and photon content of e/mu beams, madevent's pdlabel = eva, now in
mg7/madspace:

- madspace EvaFlux + eva_density / eva_leg_density kernels: a port of
  ElectroweakFlux.f and the checks of ElectroweakFluxDriver.f (LLA/LP/NLP,
  q2/pt evolution, eva_xcut, mu^2 floor, beam polarisation, no density for
  a charge-violating W). Checked against the compiled Fortran to 1e-12.
- The densities depend on the vector boson's helicity. The Integrand uses
  the helicity sums (flavour prior, pdf1/pdf2); DifferentialCrossSection
  takes the helicity row the matrix element picked, decodes the two incoming
  helicities per flavour, maps legs to beams with the mirror index and uses
  x n f_lambda(x, mu): an unbiased estimate of sum_h f f |M_h|^2.
- The incoming W/Z are put on their mass shell with the massive flux
  1/(2 sqrt(lambda)), as madevent's genps.f (the mapping hands out massless
  incoming momenta).
- mg7 wiring: [beam] eva, lepton1/2, polarization1/2, eva_order,
  eva_evolution, eva_xcut; x sampled, no PDF, alpha_s from the param card,
  M_W/M_Z/e^2 from the loaded library; lepton beams in the LHE <init>;
  2 -> 1 allowed; refusals (surrogate, summed interference helicities,
  MLM/CKKW-L, lepton_density/upc_flux, AmpliCol). The default card of a
  W/Z-initiated process now has EVA beams instead of monochromatic W/Z.
- Run card: set pdlabel eva, lpp +-3/+-4, polbeam1/2, ievo_eva, evaorder,
  eva_xcut translate, in set and in from_LO.

w+ w- > t t~ (e+ e- at 2x15 TeV, mu_F = 91.188) vs madevent:
1.1185(46)e-2 vs 1.118182e-2 pb, eva_xcut=0 2.1952(92)e-2 vs 2.187245e-2,
evaorder=1 3.840(15)e-3 vs 3.837e-3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- EVA beams by default whenever both beams carry a W or Z, photons next to
  them included (madevent's rule; the photon made the card take the
  proton-PDF branch before).
- from_LO: pdlabel = eva covers both beams before pdlabel1/2 follow it.
- Refuse an EVA 2 -> 1 below the threshold of its on-shell incoming W/Z
  (w+ w- > h: madevent fails with a NaN there) and merged subprocesses
  with different incoming masses.
- Unit tests for the default card, set translation, from_LO and the
  validity checks; docs/source/madevent_to_mg7.rst.

Validated against madevent (group_subprocesses false): w+ w- > h h at a
10 TeV muon collider 3.2243(99)e-3 vs 3.241(10)e-3 pb, polbeam1=-80 +
NLP + pt evolution 1.9391(63)e-4 vs 1.933(6)e-4; z/a z/a > t t~
0.05476(18) vs 0.05489(15); w+ w- > h at M_H = 300 0.15636(32) vs
0.1563(2); with MadNIS hh 3.2419(54)e-3 at 45% unweighting efficiency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
madspace's phase-space mappings build the incoming momenta massless and
diff_cross_section uses the massless flux 1/(2 s_hat); madevent (genps.f)
puts massive incoming particles on their mass shell (mom2cx) with the flux
1/(2 sqrt(lambda(s_hat, m1^2, m2^2))), and for monochromatic beams takes s
from the massive beam momenta (stot). w+ w- > t t~ with 2 x 500 GeV W beams
was 10% low in mg7.

- incoming_on_shell moves to the general kinematics kernels and the
  Integrand applies it to every massive incoming pair, not only EVA: same
  sum, directions kept in the pair rest frame, flux ratio s/sqrt(lambda)
  in the weight, zero below threshold.
- MadgraphProcess._massive_beams: e_cm and beam rapidity of monochromatic
  massive beams from E_i and p_i = sqrt(E_i^2 - m_i^2), so the beams come
  out exactly as madevent's.

mg7 vs madevent (group_subprocesses false): w+ w- > t t~ W beams 2x500 GeV
26.996(73) vs 26.99(7) pb (was 24.228(61)), 400/600 GeV 27.650(73) vs
27.71(6) (was 24.773(61)); mu+ mu- > t t~ (sm-lepton_masses) 0.16626(34)
vs 0.1664(1); b b~ > h (13 TeV, mu = 125) 0.6742(20) vs 0.6736(6); EVA
w+ w- > t t~ unchanged, 1.1159(47)e-2 vs 1.118182e-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oliviermattelaer oliviermattelaer added this to the Feature freeze milestone Nov 20, 2026
`set pdlabel <other>`, `set lpp 1` and now `set lpp 0` switch beam.eva
off through one helper, which also resets the EVA-only beam
polarisations (check_eva_validity refused the card otherwise) and warns
when the card stays leptonic: the beams are then monochromatic beams of
the incoming particles. `set pdlabel lhapdf` on an EVA card no longer
reports "unchanged", and an unknown PDF label no longer switches EVA off
before failing. `set polbeam` without EVA warns that the card is invalid
until pdlabel eva is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oliviermattelaer

Copy link
Copy Markdown
Contributor Author

@theoheimel , this is still under dev, but worth that you take a look early due to the helicity requirement on the PDF for this... (and we likely need this for tommorow anyway)

oliviermattelaer and others added 2 commits November 20, 2026 11:34
init_beam now calls _massive_beams for leptonic beams, which reads the
incoming masses from subprocess_data. A real MadgraphProcess loads it in
load_cards before init_beam; the stub built with object.__new__ did not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Monochromatic beams of massive particles with different incoming masses
  in different subprocesses: each subprocess gets the s and beam rapidity
  of its own massive beam momenta (MadgraphProcess.beam_kinematics), as
  madevent's stot per P directory, instead of the massless 4 E1 E2 for all.
* The monochromatic W/Z beam warning is issued once by _massive_beams, not
  as a side effect of eva_flux() with a flag on the process.
* _eva_ew_inputs falls back to the param card only for an unknown parameter
  name or a missing card entry; other library errors are raised.
* One comment for the pdlabel1/2 handling of from_LO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oliviermattelaer

Copy link
Copy Markdown
Contributor Author

So @ramonpeter, what do you think? we keep it like this for the moment, or go to massive mapping in madspace?

@ramonpeter

Copy link
Copy Markdown
Contributor

Given that we have feature deadline tomorrow, I will not make it. I started to look into it already
but I will not get it finished before ~Monday.

@oliviermattelaer

Copy link
Copy Markdown
Contributor Author

But do you agree on this PR or we do report it to v1.1 ?
(this is just mean to add a footnote in the paper, so not a big deal since the feature is MG5aMC available)

@oliviermattelaer oliviermattelaer removed this from the Feature freeze milestone Nov 20, 2026
@oliviermattelaer

Copy link
Copy Markdown
Contributor Author

let's pospone it

@richardphysics

Copy link
Copy Markdown
Contributor

hi @oliviermattelaer @ramonpeter @theoheimel, apologies for the slow reply! everything looks good on my end

ramonpeter pushed a commit that referenced this pull request Nov 23, 2026
Conflicts with gamma-UPC (#503) and the AmpliCol flavour levels, resolved as
their union:
- run card: beam.eva and beam.upc_flux side by side. A gamma-UPC pdlabel or
  lpp = 2 switches EVA off, as any other pdlabel does, and check_eva_validity
  already refuses the two together.
- MadgraphProcess: EVA, then gamma-UPC, then the monochromatic massive beams,
  which a gamma-UPC run (per-nucleon s) is not.
- MadgraphSubprocess, AmpliCol: both beam types, each refused by AmpliCol.
- Integrand: the EVA checks next to parton_density_output, EvaFlux next to
  DiscreteFlavorLevels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1
ramonpeter added a commit that referenced this pull request Nov 23, 2026
…#506)

PhaseSpaceMapping returns massive incoming particles (W and Z beams, muons
with a mass, massive partons) on their mass shells, as madevent's genps.f
builds them (mom2cx), with an inverse that takes the massive momenta, and
DifferentialCrossSection takes the matching flux. This replaces the step of
#502 in the Integrand (incoming_on_shell after the mapping, with the flux
ratio in the weight), which is removed here.

Mapping
- Without a t-channel chain (s-channel, rambo, 2 -> 1) and in the chain of
  the propagator mode the beams are built massive in the partonic frame
  (com_p_in_massive). The chain scatters off them with massive versions of
  its 2 -> 2 blocks, chosen when the graph is built so that the massless
  kernels stay as they are.
  - t_inv_min_max_massive (and its value and cut variants) does not clamp
    the |t| range at 0, since t > 0 is reached near the forward direction
    off a massive beam.
  - The Invariant samples |t| - min(|t|_min, 0), which is |t| wherever the
    range stays at or above 0.
  - t_rapidity_clamp_massive has the rapidity bounds with the kinematics of
    massive beams in their rest frame, written without cancellations.
  - The ETmin bound of a massive beam keeps its lower end only, from
    2 pa.p1 >= pa_+ p1_-, which never cuts into the phase space.
- Chili and the color-ordered chain build the final state against the
  massless pair with the same sum and put it on its mass shells afterwards
  (incoming_on_shell, now with light-cone components and an above_threshold
  output in place of the flux ratio). For chili, whose final state fixes the
  incoming momenta, that is its construction. The color-ordered chain has no
  massive versions of its double-t and 2 -> 3 blocks yet. The Jacobian is
  that of the massless pair, since dPhi_n depends on the sum only.
- s_hat is sampled from (m1 + m2)^2 on. A 2 -> 1 process or fixed beams below
  that give an empty mapping, chili points below it no weight.

Cross section
- DifferentialCrossSection(incoming_masses=...) uses the flux
  1/(2 sqrt(lambda(s_hat, m1^2, m2^2))) (diff_cross_section_massive), and
  Integrand checks that the cross sections have the masses of the mapping.

Checks
- Massless beams give forward and inverse bitwise identical to the parent
  commit for rambo, propagator, chili and color-ordered, leptonic and
  hadronic, with and without cuts.
- madspace/tests/test_massive_incoming.py (30 tests) covers momenta on shell
  with the same sum, the inverse, the phase-space volume of massless beams
  with and without cuts, every |t| that passes the cuts inside the massive
  rapidity and ETmin ranges, the massless limit of the massive kernels and
  the flux. The rest of the suite fails as on the parent commit.
- mg7 against madevent and against the parent commit (#502 with its
  Integrand step)
    w+ w- > t t~, W beams 2 x 500 GeV   26.98(4) pb   madevent 26.99(7)   parent 27.01(4)
    w+ w- > t t~, W beams 400/600 GeV   27.66(4) pb   madevent 27.71(6)   parent 27.73(4)
    mu+ mu- > t t~ (sm-lepton_masses)   0.16615(20)   madevent 0.1664(1)  parent 0.16655(20)
    EVA w+ w- > t t~, 2 x 15 TeV        0.011207(32)                      parent 0.011197(31)
    w+ w- > z z, W beams 2 x 500 GeV    312.6(8)                          parent 312.2(7)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1
ramonpeter added a commit that referenced this pull request Nov 23, 2026
Each subprocess passes its incoming masses to DifferentialCrossSection, for
the flux 1/(2 sqrt(lambda(s_hat, m1^2, m2^2))) of the massive incoming
particles the phase-space mapping builds. The test of #502 for the on-shell
kernel checks its above_threshold output in place of the flux ratio, and the
comment in madgraph_process.py now says that the mapping puts the incoming
momenta on their mass shells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1
Conflicts with gamma-UPC (#503) and the AmpliCol flavour levels, resolved as
their union:
- run card: beam.eva and beam.upc_flux side by side. A gamma-UPC pdlabel or
  lpp = 2 switches EVA off, as any other pdlabel does, and check_eva_validity
  already refuses the two together.
- MadgraphProcess: EVA, then gamma-UPC, then the monochromatic massive beams,
  which a gamma-UPC run (per-nucleon s) is not.
- MadgraphSubprocess, AmpliCol: both beam types, each refused by AmpliCol.
- Integrand: the EVA checks next to parton_density_output, EvaFlux next to
  DiscreteFlavorLevels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1
@ramonpeter
ramonpeter force-pushed the claude/eva-mg7-helicity-density-50f744 branch from bb38f67 to 8832d20 Compare November 23, 2026 06:40
ramonpeter added a commit that referenced this pull request Nov 23, 2026
…#506)

PhaseSpaceMapping returns massive incoming particles (W and Z beams, muons
with a mass, massive partons) on their mass shells, as madevent's genps.f
builds them (mom2cx), with an inverse that takes the massive momenta, and
DifferentialCrossSection takes the matching flux. This replaces the step of
#502 in the Integrand (incoming_on_shell after the mapping, with the flux
ratio in the weight), which is removed here.

Mapping
- Without a t-channel chain (s-channel, rambo, 2 -> 1) and in the chain of
  the propagator mode the beams are built massive in the partonic frame
  (com_p_in_massive). The chain scatters off them with massive versions of
  its 2 -> 2 blocks, chosen when the graph is built so that the massless
  kernels stay as they are.
  - t_inv_min_max_massive (and its value and cut variants) does not clamp
    the |t| range at 0, since t > 0 is reached near the forward direction
    off a massive beam.
  - The Invariant samples |t| - min(|t|_min, 0), which is |t| wherever the
    range stays at or above 0.
  - t_rapidity_clamp_massive has the rapidity bounds with the kinematics of
    massive beams in their rest frame, written without cancellations.
  - The ETmin bound of a massive beam keeps its lower end only, from
    2 pa.p1 >= pa_+ p1_-, which never cuts into the phase space.
- Chili and the color-ordered chain build the final state against the
  massless pair with the same sum and put it on its mass shells afterwards
  (incoming_on_shell, now with light-cone components and an above_threshold
  output in place of the flux ratio). For chili, whose final state fixes the
  incoming momenta, that is its construction. The color-ordered chain has no
  massive versions of its double-t and 2 -> 3 blocks yet. The Jacobian is
  that of the massless pair, since dPhi_n depends on the sum only.
- s_hat is sampled from (m1 + m2)^2 on. A 2 -> 1 process or fixed beams below
  that give an empty mapping, chili points below it no weight.

Cross section
- DifferentialCrossSection(incoming_masses=...) uses the flux
  1/(2 sqrt(lambda(s_hat, m1^2, m2^2))) (diff_cross_section_massive), and
  Integrand checks that the cross sections have the masses of the mapping.

Checks
- Massless beams give forward and inverse bitwise identical to the parent
  commit for rambo, propagator, chili and color-ordered, leptonic and
  hadronic, with and without cuts.
- madspace/tests/test_massive_incoming.py (30 tests) covers momenta on shell
  with the same sum, the inverse, the phase-space volume of massless beams
  with and without cuts, every |t| that passes the cuts inside the massive
  rapidity and ETmin ranges, the massless limit of the massive kernels and
  the flux. The rest of the suite fails as on the parent commit.
- mg7 against madevent and against the parent commit (#502 with its
  Integrand step)
    w+ w- > t t~, W beams 2 x 500 GeV   26.98(4) pb   madevent 26.99(7)   parent 27.01(4)
    w+ w- > t t~, W beams 400/600 GeV   27.66(4) pb   madevent 27.71(6)   parent 27.73(4)
    mu+ mu- > t t~ (sm-lepton_masses)   0.16615(20)   madevent 0.1664(1)  parent 0.16655(20)
    EVA w+ w- > t t~, 2 x 15 TeV        0.011207(32)                      parent 0.011197(31)
    w+ w- > z z, W beams 2 x 500 GeV    312.6(8)                          parent 312.2(7)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1
ramonpeter added a commit that referenced this pull request Nov 23, 2026
Each subprocess passes its incoming masses to DifferentialCrossSection, for
the flux 1/(2 sqrt(lambda(s_hat, m1^2, m2^2))) of the massive incoming
particles the phase-space mapping builds. The test of #502 for the on-shell
kernel checks its above_threshold output in place of the flux ratio, and the
comment in madgraph_process.py now says that the mapping puts the incoming
momenta on their mass shells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ud6YhkZXK3uDs1Z3nwdTi1

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants