Integrand¶
- class madspace.Integrand(self: madspace._madspace_py.Integrand, mapping: madspace._madspace_py.PhaseSpaceMapping, diff_xs: collections.abc.Sequence[madspace._madspace_py.DifferentialCrossSection], adaptive_map: None | madspace._madspace_py.VegasMapping | madspace._madspace_py.Flow = None, discrete_sym: None | madspace._madspace_py.DiscreteSampler | madspace._madspace_py.DiscreteFlow = None, discrete_flavor: None | madspace._madspace_py.DiscreteSampler | madspace._madspace_py.DiscreteFlow = None, pid_options: collections.abc.Sequence[collections.abc.Sequence[SupportsInt]] = [], pdf_grid: None | madspace._madspace_py.PdfGrid | madspace._madspace_py.CustomPdf = None, running_coupling: madspace._madspace_py.RunningCoupling | None = None, energy_scale: madspace._madspace_py.EnergyScale | None = None, prop_chan_weights: madspace._madspace_py.PropagatorChannelWeights | None = None, subchan_weights: madspace._madspace_py.SubchannelWeights | None = None, chan_weight_net: madspace._madspace_py.ChannelWeightNetwork | None = None, first_chan_weight_remap: collections.abc.Sequence[collections.abc.Sequence[SupportsInt]] = [], first_remapped_chan_count: SupportsInt = 0, second_chan_weight_remap: collections.abc.Sequence[SupportsInt] = [], second_remapped_chan_count: SupportsInt = 0, madnis_training: bool = False, drop_cuts_and_rescale: bool = False, partial_weights: bool = False, channel_indices: collections.abc.Sequence[SupportsInt] = [], active_flavors: collections.abc.Sequence[collections.abc.Sequence[SupportsInt]] = [], flavor_remap: collections.abc.Sequence[SupportsInt] = [], flavor_factors: collections.abc.Sequence[SupportsFloat] = [], flavor_mirror: collections.abc.Sequence[bool] = [], flavor_diff_xs_indices: collections.abc.Sequence[SupportsInt] = [], flavor_subproc_indices: collections.abc.Sequence[SupportsInt] = [], flavor_per_subproc_remap: collections.abc.Sequence[SupportsInt] = [], compressed_channel_weight_count: SupportsInt = 50, custom_bias: madspace._madspace_py.CustomFunction | None = None, pdf_grid2: madspace._madspace_py.PdfGrid | None = None)¶
Bases:
FunctionGeneratorThe 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.
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.
batchis the leading batch dimension.Arguments
batch_size– the number of events to generate.
Returns (the common set;
madnis_trainingselects 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.weightthen includes the bias factor.
References
[1] T. Heimel, O. Mattelaer, R. Winterhalder, “MadSpace”, https://arxiv.org/abs/2602.06895
- 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_xsindex.flavor_factors – Per-flavour multiplicative weight factors.
flavor_mirror – Per-flavour beam-swap flags.
flavor_diff_xs_indices – Per-flavour
diff_xsindices.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.
- active_flavors(self: madspace._madspace_py.Integrand) list[int]¶
Flavour indices this integrand covers.
- adaptive_map(self: madspace._madspace_py.Integrand) None | madspace._madspace_py.VegasMapping | madspace._madspace_py.Flow¶
The continuous adaptive sampler.
- chan_weight_net(self: madspace._madspace_py.Integrand) madspace._madspace_py.ChannelWeightNetwork | None¶
The channel-weight network, if any.
- channel_indices(self: madspace._madspace_py.Integrand) list[int]¶
Global indices of this integrand’s channels.
- diff_xs(self: madspace._madspace_py.Integrand) list[madspace._madspace_py.DifferentialCrossSection]¶
The per-flavour differential cross sections.
- discrete_flavor(self: madspace._madspace_py.Integrand) None | madspace._madspace_py.DiscreteSampler | madspace._madspace_py.DiscreteFlow¶
The flavour-choice adaptive sampler.
- discrete_sym(self: madspace._madspace_py.Integrand) None | madspace._madspace_py.DiscreteSampler | madspace._madspace_py.DiscreteFlow¶
The permutation-channel adaptive sampler.
- energy_scale(self: madspace._madspace_py.Integrand) madspace._madspace_py.EnergyScale | None¶
The shared energy scale, if any.
- latent_dims(self: madspace._madspace_py.Integrand) tuple[list[int], list[bool]]¶
The continuous latent dimensions and, per dimension, whether it is discrete.
- madnis_training(self: madspace._madspace_py.Integrand) bool¶
Whether the integrand emits the MadnisLoss training quantities.
- mapping(self: madspace._madspace_py.Integrand) madspace._madspace_py.PhaseSpaceMapping¶
The phase-space mapping.
- matrix_element_inputs = [<MatrixElementInput.momenta_in: 0>, <MatrixElementInput.alpha_s_in: 1>, <MatrixElementInput.flavor_in: 2>, <MatrixElementInput.random_color_in: 3>, <MatrixElementInput.random_helicity_in: 4>, <MatrixElementInput.random_diagram_in: 5>]¶
- matrix_element_outputs = [<MatrixElementOutput.matrix_element_out: 0>, <MatrixElementOutput.diagram_amp2_out: 1>, <MatrixElementOutput.color_index_out: 2>, <MatrixElementOutput.helicity_index_out: 3>, <MatrixElementOutput.diagram_index_out: 4>]¶
- particle_count(self: madspace._madspace_py.Integrand) int¶
Total number of particles, incoming and outgoing.
- prop_chan_weights(self: madspace._madspace_py.Integrand) madspace._madspace_py.PropagatorChannelWeights | None¶
The propagator-based channel weights, if any.
- random_dim(self: madspace._madspace_py.Integrand) int¶
Number of continuous random numbers the integrand consumes.
- vegas_bin_count(self: madspace._madspace_py.Integrand) int¶
Bin count of the adaptive VegasMapping, or 0 if none.
- vegas_dimension(self: madspace._madspace_py.Integrand) int¶
Dimension of the adaptive VegasMapping, or 0 if none.
- vegas_grid_name(self: madspace._madspace_py.Integrand) str | None¶
Global name of the VEGAS grid, if an adaptive VegasMapping is used.