Integrand

class Integrand : public madspace::FunctionGenerator

The full single-channel integrand, from random numbers to a weighted event.

Chains all the pieces of a leading-order calculation into one FunctionGenerator. It draws the unit-hypercube numbers, optionally reshapes them with an adaptive VegasMapping or Flow, runs the PhaseSpaceMapping, evaluates the DifferentialCrossSection (matrix element, PDFs, scales), applies the Cuts and the multi-channel weights, and returns the event weight with the momenta and the sampled discrete quantities [1]. This is the object that is integrated and unweighted.

batch is the leading batch dimension.

Arguments

  • batch_size – the number of events to generate.

Returns (the common set; madnis_training selects a different set for the training loss)

  • weight – float, shape (batch,) – the event weight.

  • momenta – float, shape (batch, particle_count, 4) – the momenta.

  • color_index, helicity_index, diagram_index, flavor_index – int, shape (batch,) – the sampled discrete quantities.

  • ren_scale, alpha_qcd, x1, x2, fact_scale1, fact_scale2 – float, shape (batch,) – scales and momentum fractions.

  • random – float, shape (batch, mapping.random_dim()) – the underlying random numbers.

  • bias – float, shape (batch,) – the event bias, present only with a custom bias. weight then includes the bias factor.

References

Warning

For internal use within MadGraph. Its interface (in particular the long constructor and the argument / return layout) is not part of the stable public API and may change without notice.

Public Types

using AdaptiveMapping = std::variant<std::monostate, VegasMapping, Flow>

The optional adaptive reparametrization of the continuous latent space.

using AdaptiveDiscrete = std::variant<std::monostate, DiscreteSampler, DiscreteFlow>

The optional adaptive sampler for a set of discrete choices.

using PdfSource = std::variant<std::monostate, PdfGrid, CustomPdf>

The optional parton density: an LHAPDF grid or a user-supplied library.

Public Functions

Integrand(const PhaseSpaceMapping &mapping, const std::vector<DifferentialCrossSection> &diff_xs, const AdaptiveMapping &adaptive_map = std::monostate{}, const AdaptiveDiscrete &discrete_sym = std::monostate{}, const AdaptiveDiscrete &discrete_flavor = std::monostate{}, const nested_vector2<me_int_t> &pid_options = {}, const PdfSource &pdf_grid = std::monostate{}, const std::optional<RunningCoupling> &running_coupling = std::nullopt, const std::optional<EnergyScale> &energy_scale = std::nullopt, const std::optional<PropagatorChannelWeights> &prop_chan_weights = std::nullopt, const std::optional<SubchannelWeights> &subchan_weights = std::nullopt, const std::optional<ChannelWeightNetwork> &chan_weight_net = std::nullopt, const nested_vector2<me_int_t> &first_chan_weight_remap = {}, std::size_t first_remapped_chan_count = 0, const std::vector<me_int_t> &second_chan_weight_remap = {}, std::size_t second_remapped_chan_count = 0, bool madnis_training = false, bool drop_cuts_and_rescale = false, bool partial_weights = false, const std::vector<std::size_t> &channel_indices = {}, const nested_vector2<std::size_t> &active_flavors = {}, const std::vector<std::size_t> &flavor_remap = {}, const std::vector<double> &flavor_factors = {}, const std::vector<bool> &flavor_mirror = {}, const std::vector<std::size_t> &flavor_diff_xs_indices = {}, const std::vector<std::size_t> &flavor_subproc_indices = {}, const std::vector<std::size_t> &flavor_per_subproc_remap = {}, std::size_t compressed_channel_weight_count = 50, const std::optional<CustomFunction> &custom_bias = std::nullopt, const std::optional<PdfGrid> &pdf_grid2 = std::nullopt)
Parameters:
  • mapping – The phase-space mapping.

  • diff_xs – One differential cross section per active flavour.

  • adaptive_map – Optional continuous adaptive sampler (VegasMapping or Flow).

  • discrete_sym – Optional adaptive sampler for the permutation channel.

  • discrete_flavor – Optional adaptive sampler for the flavour choice.

  • pid_options – Allowed initial-parton flavour combinations.

  • pdf_grid – Optional shared PdfGrid or CustomPdf.

  • running_coupling – Optional shared RunningCoupling.

  • energy_scale – Optional shared EnergyScale.

  • prop_chan_weights – Optional PropagatorChannelWeights.

  • subchan_weights – Optional SubchannelWeights.

  • chan_weight_net – Optional ChannelWeightNetwork.

  • first_chan_weight_remap – Remap applied to the channel weights before the network.

  • first_remapped_chan_count – Channel count after that remap.

  • second_chan_weight_remap – Remap applied after the network.

  • second_remapped_chan_count – Channel count after that remap.

  • madnis_training – If true, return the quantities needed for the MadnisLoss instead of a finished event.

  • drop_cuts_and_rescale – If true, ignore the cut mask and rescale the weight accordingly.

  • partial_weights – If true, emit the per-factor weights for buffered unweighting.

  • channel_indices – Global indices of this integrand’s channels.

  • active_flavors – Flavour indices this integrand covers.

  • flavor_remap – Map from flavour index to diff_xs index.

  • flavor_factors – Per-flavour multiplicative weight factors.

  • flavor_mirror – Per-flavour beam-swap flags.

  • flavor_diff_xs_indices – Per-flavour diff_xs indices.

  • flavor_subproc_indices – Per-flavour sub-process indices.

  • flavor_per_subproc_remap – Per-sub-process flavour remap.

  • compressed_channel_weight_count – Channel-weight entries kept per event.

  • custom_bias – Optional user-supplied event bias of type CustomFunction::bias. Its PDG-id options must match pid_options.

  • pdf_grid2 – PDF of the second beam when it differs from pdf_grid (which is then the first beam’s). Its globals must be registered with the prefix pdf2_prefix. Not allowed with a CustomPdf, which receives the beam index.

inline std::size_t particle_count() const

Total number of particles, incoming and outgoing.

inline bool madnis_training() const

Whether the integrand emits the MadnisLoss training quantities.

inline std::optional<std::string> vegas_grid_name() const

Global name of the VEGAS grid, if an adaptive VegasMapping is used.

inline std::size_t vegas_dimension() const

Dimension of the adaptive VegasMapping, or 0 if none.

inline std::size_t vegas_bin_count() const

Bin count of the adaptive VegasMapping, or 0 if none.

inline const PhaseSpaceMapping &mapping() const

The phase-space mapping.

inline const std::vector<DifferentialCrossSection> &diff_xs() const

The per-flavour differential cross sections.

inline const AdaptiveMapping &adaptive_map() const

The continuous adaptive sampler.

inline const AdaptiveDiscrete &discrete_sym() const

The permutation-channel adaptive sampler.

inline const AdaptiveDiscrete &discrete_flavor() const

The flavour-choice adaptive sampler.

inline const std::optional<EnergyScale> &energy_scale() const

The shared energy scale, if any.

inline const std::optional<PropagatorChannelWeights> &prop_chan_weights() const

The propagator-based channel weights, if any.

inline const std::optional<ChannelWeightNetwork> &chan_weight_net() const

The channel-weight network, if any.

inline const std::size_t random_dim() const

Number of continuous random numbers the integrand consumes.

std::tuple<std::vector<std::size_t>, std::vector<bool>> latent_dims() const

The continuous latent dimensions and, per dimension, whether it is discrete.

inline const std::vector<me_int_t> &channel_indices() const

Global indices of this integrand’s channels.

inline const std::vector<std::size_t> &active_flavors() const

Flavour indices this integrand covers.

Public Static Attributes

static const std::vector<MatrixElement::MatrixElementInput> matrix_element_inputs

The MatrixElement inputs an Integrand supplies.

static const std::vector<MatrixElement::MatrixElementOutput> matrix_element_outputs

The MatrixElement outputs an Integrand requests.

static const std::string pdf2_prefix

Globals prefix under which the second beam’s PDF grid is registered (PdfGrid::initialize_globals) when pdf_grid2 is given.