Skip to content
3 changes: 2 additions & 1 deletion docs/source/run_card.rst
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ VEGAS grids adapt the phase-space sampling during the survey.
``t_channel`` (``"propagator"``)
Parametrization of the t-channel part of the multichannel phase space. ``propagator``
follows the diagram as a chain of :math:`2 \to 2` steps. ``rambo`` applies RAMBO to the
t-channel particles and ``chili`` uses collider coordinates.
t-channel particles and ``chili`` uses collider coordinates. With lepton beams
(``leptonic``) ``chili`` generates the last two particles as a two-body decay.

``flat_mode`` (``"rambo"``)
The same choice for the flat channel.
Expand Down
4 changes: 2 additions & 2 deletions madgraph/mg7/madgraph_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,8 +1108,8 @@ def init_beam(self) -> None:
# Monochromatic beams of massive particles (W/Z without EVA, muons of
# a model with a muon mass): s and the rapidity of the beams are those
# of the massive beam momenta, as madevent's stot (genps.f, lpp = 0),
# not 4 E1 E2, for each subprocess (beam_kinematics). The incoming
# momenta are then put on their mass shell by the Integrand.
# not 4 E1 E2, for each subprocess (beam_kinematics). The phase-space
# mapping then puts the incoming momenta on their mass shells.
self.massive_beams = (
self.leptonic and not self.is_decay and not self.eva
and not self.upc_flux
Expand Down
4 changes: 4 additions & 0 deletions madgraph/mg7/subprocess_madmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,10 @@ def build_integrands(
),
eva=eva,
eva_helicities=eva_helicities,
# the flux of massive incoming particles, which the
# phase-space mapping puts on their mass shells
incoming_masses=(
[] if self.process.is_decay else self.incoming_masses),
)
)
partial_weights = self.process.systematics_enabled()
Expand Down
13 changes: 13 additions & 0 deletions madspace/include/madspace/phasespace/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ class Mapping {
NamedVector<Type> _condition_types;
};

/**
* The absolute masses of the two incoming particles if one of them is massive,
* else an empty vector: the form in which the mappings that build massive
* incoming momenta (@ref TPropagatorMapping, @ref ColorOrderedMapping) keep
* them.
*
* @param masses The incoming masses.
* @param mapping Name of the mapping, for the error raised when a mass is
* nonzero but there are not two of them.
*/
std::vector<double>
massive_incoming_masses(const std::vector<double>& masses, const std::string& mapping);

/**
* Base class for compute-graph functions that are not invertible mappings.
*
Expand Down
42 changes: 34 additions & 8 deletions madspace/include/madspace/phasespace/chili.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,28 @@ namespace madspace {
* [2, 3]). Chili does not guarantee physical configurations, so unphysical
* points are removed by a technical cut.
*
* With fixed beams (lepton colliders, `fixed_beams`) the incoming momenta add
* up to @f$P = (\sqrt{s}, 0, 0, 0)@f$, and the final state cannot fix them.
* The first @f$n-2@f$ momenta are generated as above, and the last two as the
* two-body decay of what is left, @f$Q = P - \sum_{i<n-1} p_i@f$, in the rest
* frame of @f$Q@f$, with
*
* @f[
* \mathrm{d}\Phi_n = \prod_{i=1}^{n-2} \frac{\mathrm{d}p_{\mathrm{T},i}^2\,
* \mathrm{d}y_i\,\mathrm{d}\phi_i}{4}\;
* \frac{|\vec p^{\,*}|}{4 M_Q}\,\mathrm{d}\Omega^*,
* @f]
*
* which takes @f$3n-4@f$ random numbers. A point with @f$Q@f$ below the
* threshold of the last two masses gets zero weight. @ref PhaseSpaceMapping
* also takes it for dressed-lepton beams, whose split samples
* @f$x_1, x_2@f$: chili then builds the final state for fixed beams at
* @f$\sqrt{\hat s}@f$ in their partonic frame.
*
* `batch` is the leading batch dimension.
*
* **Inputs**
* - `random_i` – `float`, shape `(batch,)` – the `3 * n_particles - 2` random
* - `random_i` – `float`, shape `(batch,)` – the `random_dim()` random
* numbers.
*
* **Conditions**
Expand All @@ -47,7 +65,8 @@ namespace madspace {
*
* **Outputs**
* - `momentum_i` – `float`, shape `(batch, 4)` – the `n_particles + 2` momenta
* (incoming beams first, then outgoing).
* (incoming beams first, then outgoing). With fixed beams the incoming ones
* are the massless beams in their centre-of-mass frame.
*
* In addition every mapping returns a `det` (`float`, shape `(batch,)`), the
* Jacobian of the transformation.
Expand All @@ -69,18 +88,24 @@ class ChiliMapping : public Mapping {
* @param y_max Per-outgoing-particle maximum rapidity, one entry per
* particle; infinity disables the cut. See @ref Cuts.
* @param pt_min Per-outgoing-particle minimum transverse momentum, one
* entry per particle (the last is unused); 0 disables
* the cut. See @ref Cuts.
* entry per particle (the last is unused, and with
* fixed beams the last two); 0 disables the cut. See
* @ref Cuts.
* @param fixed_beams If true, the beams have fixed momenta (see above);
* needs at least two outgoing particles.
*/
ChiliMapping(
std::size_t n_particles,
const std::vector<double>& y_max,
const std::vector<double>& pt_min
const std::vector<double>& pt_min,
bool fixed_beams = false
);

/// Number of uniform random inputs consumed by the forward mapping,
/// equal to `3 * n_particles - 2`.
std::size_t random_dim() const { return 3 * _n_particles - 2; }
/// Number of uniform random inputs consumed by the forward mapping:
/// `3 * n_particles - 2`, or `3 * n_particles - 4` with fixed beams.
std::size_t random_dim() const { return 3 * _n_particles - (_fixed_beams ? 4 : 2); }
/// Whether the beams have fixed momenta.
bool fixed_beams() const { return _fixed_beams; }

private:
Result build_forward_impl(
Expand All @@ -97,6 +122,7 @@ class ChiliMapping : public Mapping {
std::size_t _n_particles;
std::vector<double> _y_max;
std::vector<double> _pt_min;
bool _fixed_beams;
};

} // namespace madspace
23 changes: 20 additions & 3 deletions madspace/include/madspace/phasespace/color_ordered_mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ namespace madspace {
* In addition every mapping returns a `det` (`float`, shape `(batch,)`), the
* Jacobian of the transformation.
*
* With massive incoming particles (see the constructor) the beams are built on
* their mass shells in the partonic centre-of-mass frame, and the blocks of
* the chain, which scatter off them, use their massive kernels
* (@ref TwoToTwoParticleScattering, @ref DoubleT and
* @ref TwoToThreeParticleScattering with `massive_beams`).
*
* **References**
* - [1] T. Heimel, O. Mattelaer, R. Winterhalder, "MadSpace",
* https://arxiv.org/abs/2602.06895 (Sec. 2.2.5)
Expand Down Expand Up @@ -104,13 +110,18 @@ class ColorOrderedMapping : public Mapping {
* takes the beam momentum fractions `x1`, `x2`
* (`float`, shape `(batch,)`) as two further
* conditions.
* @param incoming_masses Masses of the two incoming particles, empty (or
* all zero) for massless ones. With a massive
* one, `momentum0` and `momentum1` are on their
* mass shells.
*/
ColorOrderedMapping(
const Options& options,
const std::vector<double>& pt_min = {},
const std::vector<std::vector<double>>& m_inv_min = {},
const std::vector<std::vector<double>>& dr_min = {},
const std::vector<double>& y_max = {}
const std::vector<double>& y_max = {},
const std::vector<double>& incoming_masses = {}
);

/// Number of continuous unit-hypercube inputs consumed by the forward map.
Expand All @@ -120,6 +131,9 @@ class ColorOrderedMapping : public Mapping {
/// Whether rapidity bounds narrow a block (and the mapping therefore takes
/// `x1`, `x2` as conditions).
bool has_rapidity_window() const { return _rapidity_window; }
/// The absolute masses of the incoming particles, empty if both are
/// massless.
const std::vector<double>& incoming_masses() const { return _incoming_masses; }

private:
// Rapidity bounds of the blocks that scatter the two beams (negative:
Expand All @@ -138,13 +152,15 @@ class ColorOrderedMapping : public Mapping {
static RapidityBounds rapidity_bounds(
const std::vector<std::size_t>& color_order, const std::vector<double>& y_max
);
// The public constructor with the rapidity bounds worked out once.
// The public constructor with the rapidity bounds worked out once and the
// incoming masses as massive_incoming_masses gives them.
ColorOrderedMapping(
const RapidityBounds& bounds,
const Options& options,
const std::vector<double>& pt_min,
const std::vector<std::vector<double>>& m_inv_min,
const std::vector<std::vector<double>>& dr_min
const std::vector<std::vector<double>>& dr_min,
const std::vector<double>& incoming_masses
);

Result build_forward_impl(
Expand Down Expand Up @@ -206,6 +222,7 @@ class ColorOrderedMapping : public Mapping {
std::vector<std::vector<double>> _dr_min;
bool _has_cut;
bool _rapidity_window;
std::vector<double> _incoming_masses;

Invariant _mass_invariant;
TwoToTwoParticleScattering _com_scattering;
Expand Down
17 changes: 16 additions & 1 deletion madspace/include/madspace/phasespace/cross_section.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ namespace madspace {
* @f$\sum_h f_{\lambda_1(h)} f_{\lambda_2(h)} |M_h|^2@f$. Leg @f$i@f$
* comes from beam @f$i@f$, or from the other one for `mirror_index` 1.
*
* With massive @p incoming_masses (those of the @ref PhaseSpaceMapping, which
* puts the incoming particles on their mass shells) the flux is
* @f$1 / (2 \sqrt{\lambda(\hat s, m_1^2, m_2^2)})@f$ with
* @f$\hat s = x_1 x_2 s@f$ instead of @f$1 / (2 \hat s)@f$, as in madevent,
* and zero at and below the threshold @f$(m_1 + m_2)^2@f$.
*
* `batch` is the leading batch dimension.
*
* **Arguments**
Expand Down Expand Up @@ -91,6 +97,10 @@ class DifferentialCrossSection : public FunctionGenerator {
* helicity table of the matrix element
* (rows of the particles' helicities,
* indexed by its helicity index).
* @param incoming_masses Masses of the two incoming particles of a
* collision, for the flux, empty or zero
* for massless ones. Needs
* @p input_momentum_fraction.
*/
DifferentialCrossSection(
const MatrixElement& matrix_element,
Expand All @@ -105,7 +115,8 @@ class DifferentialCrossSection : public FunctionGenerator {
bool decay = false,
bool return_matrix_element = false,
const std::optional<EvaFlux>& eva = std::nullopt,
const nested_vector3<me_int_t>& eva_helicities = {}
const nested_vector3<me_int_t>& eva_helicities = {},
const std::vector<double>& incoming_masses = {}
);

/// The allowed initial-parton flavour combinations.
Expand All @@ -123,6 +134,9 @@ class DifferentialCrossSection : public FunctionGenerator {
/// Whether the beams are effective vector bosons (then the arguments end
/// with `fact_scale1`, `fact_scale2` and `mirror_index`).
bool eva() const { return _eva_tables.has_value(); }
/// Masses of the incoming particles the flux is computed with (absolute
/// values): two for a collision with a massive one, empty otherwise.
const std::vector<double>& incoming_masses() const { return _incoming_masses; }

private:
NamedVector<Value> build_function_impl(
Expand All @@ -140,6 +154,7 @@ class DifferentialCrossSection : public FunctionGenerator {
bool _decay;
bool _return_matrix_element;
std::optional<EvaLegTables> _eva_tables;
std::vector<double> _incoming_masses;
};

} // namespace madspace
29 changes: 29 additions & 0 deletions madspace/include/madspace/phasespace/invariants.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <array>

#include "madspace/phasespace/base.hpp"

namespace madspace {
Expand Down Expand Up @@ -76,6 +78,33 @@ class Invariant : public Mapping {
double power = 0, double mass = 0, double width = 0, double flat_window = 0
);

/**
* The forward map for a variable @f$x@f$ whose range can reach below 0,
* such as a momentum transfer off a massive beam. It samples
* @f$x - 2 \min(x_\text{min}, 0)@f$ on the range shifted alike, which is
* @f$x@f$ itself wherever the range stays at or above 0. Below 0 the
* sampled range starts at @f$|x_\text{min}|@f$, so that a power law keeps
* the density of about @f$|x_\text{min}|^{-\nu}@f$ that it has at a lower
* end above 0, rather than its pole, at the lower end.
*
* @param r The random number, `float`, shape `(batch,)`.
* @param x_min Lower end of the range of @f$x@f$.
* @param x_max Upper end of the range of @f$x@f$.
* @return @f$x@f$ and the Jacobian.
*/
std::array<Value, 2>
build_forward_shifted(FunctionBuilder& fb, Value r, Value x_min, Value x_max) const;
/**
* The inverse of build_forward_shifted().
*
* @param x The value, `float`, shape `(batch,)`.
* @param x_min Lower end of the range of @f$x@f$.
* @param x_max Upper end of the range of @f$x@f$.
* @return The random number and the Jacobian.
*/
std::array<Value, 2>
build_inverse_shifted(FunctionBuilder& fb, Value x, Value x_min, Value x_max) const;

private:
Result build_forward_impl(
FunctionBuilder& fb,
Expand Down
35 changes: 31 additions & 4 deletions madspace/include/madspace/phasespace/phasespace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ namespace madspace {
* @ref Topology and is used for the topology-free @ref TChannelMode::rambo and
* @ref TChannelMode::chili modes.
*
* Massive incoming particles of a collision (the incoming masses of the
* topology: W and Z beams, muons of a model with a muon mass, massive partons)
* are built on their mass shells in the partonic centre-of-mass frame
* (`com_p_in_massive`), as madevent's genps.f builds them (mom2cx). The
* t-channel chains of @ref TChannelMode::propagator and
* @ref TChannelMode::color_ordered scatter off them with the massive versions
* of their blocks, chosen when the graph is built. Chili, whose final state
* fixes the incoming momenta, is written for massless beams: it generates the
* final state against the massless pair with the same sum, which then goes on
* its mass shells (`incoming_on_shell`). With fixed beams (leptonic) and
* with dressed-lepton beams, whose split samples x1 and x2, chili builds the
* final state for fixed beams in the partonic frame (see @ref ChiliMapping),
* and massive ones are built directly. The n-body phase space depends on the
* incoming momenta only through their sum, so that leaves the Jacobian
* unchanged, and the inverse takes the massless pair back from the sum.
* Sampled s_hat starts at the threshold @f$(m_1 + m_2)^2@f$, and a weight
* below it (chili) is zero. The flux @f$1 / (2 \sqrt{\lambda(\hat s, m_1^2,
* m_2^2)})@f$ belongs to the cross section: see the `incoming_masses` of
* @ref DifferentialCrossSection.
*
* `batch` is the leading batch dimension. `n_out` is the number of outgoing
* particles.
*
Expand All @@ -55,7 +75,7 @@ namespace madspace {
*
* **Outputs**
* - `momenta` – `float`, shape `(batch, n_out + 2, 4)` – all momenta (incoming
* beams first, then outgoing).
* beams first, on their mass shells, then outgoing).
* - `x1` – `float`, shape `(batch,)` – first parton momentum fraction (1 for
* every event if `leptonic` and for a decay).
* - `x2` – `float`, shape `(batch,)` – second parton momentum fraction (1 for
Expand Down Expand Up @@ -259,12 +279,14 @@ class PhaseSpaceMapping : public Mapping {
double beam_rapidity() const { return _beam_rapidity; }
/// Whether the mapping takes the `mirror_index` condition.
bool mirror_beams() const { return _mirror_beams; }
/// Masses of the incoming particles. The mapping hands them out massless
/// (along the beams, at the sampled s_hat); @ref Integrand puts massive
/// ones on their mass shell, with the massive flux.
/// Masses of the incoming particles, on whose mass shells the mapping puts
/// them. A @ref DifferentialCrossSection of a collision with massive ones
/// needs the same `incoming_masses` for its flux.
const std::vector<double>& incoming_masses() const {
return _topology.incoming_masses();
}
/// Whether this is a collision with a massive incoming particle.
bool massive_incoming() const { return _massive_incoming; }
/// The cuts, applied to the lab-frame momenta.
const Cuts& cuts() const { return _cuts; }
/// True when the cuts exclude the whole region this mapping samples: a
Expand Down Expand Up @@ -316,6 +338,11 @@ class PhaseSpaceMapping : public Mapping {
bool _map_luminosity;
double _lepton_power;
bool _two_to_one;
// a collision with a massive incoming particle (see the class documentation)
bool _massive_incoming;
// massive incoming particles put on their mass shells after chili that
// reads x1 and x2 off its final state, which is written for massless beams
bool _project_incoming;
// bound on the absolute rapidity of the partonic system, log(x1 / x2) / 2,
// implied by the cuts; negative when they imply none
double _y_max_lab = -1.;
Expand Down
Loading
Loading