-
showerpipe.generator.repeat_hadronize(gen: PythiaGenerator, reps: int | None =
None, copy: bool =True) Generator[PythiaEvent, None, None][source] Takes a PythiaGenerator instance with an unhadronised event already generated, and repeatedly hadronises the current event.
- Parameters:¶
- gen : PythiaGenerator¶
Instance of
PythiaGeneratorwhich has already generated at least one event, either by callingnext(gen), or iterating with a for-loop.- reps : int, optional¶
Number of repetitions to queue in the iterator. If
None, will produce an infinite iterator.- copy : bool¶
Whether to return copies of the events, orphaned from
gen, the passedPythiaGeneratorinstance.Setting this toFalsemay improve speed and reduce memory consumption, but will have side-effects ongen, such that its internal current event will be set to the most recent event yielded by this generator (until it terminates). Default isTrue.
- Yields:¶
event (PythiaEvent) – The current event with new hadronisation.
- Raises:¶
StopIteration – Either when the number of rehadronised events is equal to
reps, or if this generator is invalidated by iterating the underlyingPythiaGeneratorinstance passed to it.RuntimeError – If
genis passed without a current event to rehadronise.KeyError – If the cmnd file used to initialise
gencontains flags which conflict with each other.ValueError – If the cmnd file used to initialise
gendoes not set ‘HadronLevel:all = off’. See notes for more information.UserWarning – If Pythia fails to perform the hadronization process for a given event, this iterator will be empty.
Notes
This function wraps the first method of rehadronisation described in https://pythia.org/latest-manual/HadronLevelStandalone.html. In order to use it, ‘HadronLevel:all’ must be set to ‘off’ in the cmnd settings file that
genwas initialised with.If
repsis set so the generator has a finite length, the side-effects ongenwill be reversed when the generator yields its last element.If
repsis set toNoneandcopyis set toFalse, the side-effects ongenwill persist, untilgenis iterated either by passing it tonext()or implicit iteration within a for loop.
Last update:
Jun 27, 2025