phasespace#

Implementations of a DataGenerator for four-momentum samples.

Backend#

Computational backend used by the phase space generators.

alias of Literal[โ€˜numpyโ€™, โ€˜tensorflowโ€™, โ€˜jaxโ€™]

class PhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float], bunch_size: int = 50000, *, adaptive_max_weight: bool = False, backend: Backend = 'numpy')[source]#

Bases: DataGenerator

Implements a phase space generator on top of phasespace.

Parameters:
  • initial_state_mass โ€“ Mass of the decaying state.

  • final_state_masses โ€“ Masses keyed by final-state ID.

  • bunch_size โ€“ Number of candidates generated per hit-and-miss iteration.

  • adaptive_max_weight โ€“ Perform the hit-and-miss step against an estimate of the maximum weight instead of against the upper bound of the weights that phasespace guarantees. This bound is much larger than the weights that actually occur, especially for many final state particles, so the estimate accepts far more events per bunch. The maximum is estimated from the generated bunches with a margin of 5%. If a bunch contains a weight above the current estimate, the estimate is raised and the sample is generated anew, like in IntensityDistributionGenerator. The generated distribution stays the same, but the events differ from those that are generated without this option for the same seed. See Phase space generators.

  • backend โ€“ Computational backend used by WeightedPhaseSpaceGenerator.

generate(size: int, rng: RealNumberGenerator) โ†’ DataSample[source]#

Generate a DataSample of phase space four-momenta.

Returns:

A DataSample of four-momenta arrays of shape \(n \times 4\).

class WeightedPhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float], *, backend: Backend = 'numpy')[source]#

Bases: DataGenerator

Implements a phase space generator with weights on top of phasespace.

The weights are provided in the returned DataSample under the key "weights".

Parameters:
  • initial_state_mass โ€“ Mass of the decaying state.

  • final_state_masses โ€“ Masses keyed by final-state ID.

  • backend โ€“ Computational backend used to generate the sample. The tensorflow and jax backends require the tf and jax extras. Generated arrays are always NumPy arrays. Any RealNumberGenerator can be used. A foreign stream supplies a seed, keeping samples reproducible.

generate(size: int, rng: RealNumberGenerator) โ†’ DataSample[source]#

Generate a DataSample of phase space four-momenta with weights.

Returns:

A tuple of a DataSample (four-momenta) with an event-wise sequence of weights. The four-momenta are arrays of shape \(n \times 4\).