phasespace#

Implementations of a DataGenerator for four-momentum samples.

class PhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float], bunch_size: int = 50000, *, backend: Literal['numpy', 'tensorflow', 'jax'] = '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 – A mapping of final state IDs to the corresponding masses.

  • bunch_size – Size of a bunch that is generated during a hit-and-miss iteration.

  • backend – Computational backend that phasespace uses to generate the sample. See 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: Literal['numpy', 'tensorflow', 'jax'] = '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 – A mapping of final state IDs to the corresponding masses.

  • backend – Computational backend that phasespace uses to generate the sample. The "tensorflow" and "jax" backends require the tf and jax extras. The generated arrays are always numpy arrays. Any RealNumberGenerator can be used. If its stream cannot be used directly by the backend, a seed is drawn from it, so the sample stays reproducible, but differs from the sample of another backend.

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\).

class EvtGenPhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float])[source]#

Bases: DataGenerator

Implements a phase space generator using EvtGen through pyevtgen.

Events are unweighted, so no hit-and-miss step is needed and the sample contains no "weights". This generator works with any RealNumberGenerator. The rng only provides a seed for the random engine of EvtGen, so samples are reproducible but differ from those of other generators.

Generation becomes impractically slow beyond about nine final state particles, see pyevtgen.phase_space().

Parameters:
  • initial_state_mass – Mass of the decaying state.

  • final_state_masses – A mapping of final state IDs to the corresponding masses.

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\).

TFPhaseSpaceGenerator[source]#

Alias of PhaseSpaceGenerator for backward compatibility.

TFWeightedPhaseSpaceGenerator[source]#

Alias of WeightedPhaseSpaceGenerator for backward compatibility.