class heparchy.write.HdfProcessWriter(heparchy.write.base.ProcessWriterBase)[source]

Context manager interface to create and write processes.

Attributes (write-only)

process_stringstr

String representing the hard process (eg. MadGraph format).

signal_pdgsnumpy.ndarray[int]

PDG codes within the hard process considered as “signal”.

com_energytuple[float, str]

A tuple whose first element is the centre-of-mass collision energy for the hard process, and the second element is the unit that this energy is given in.

custom_metaMapWriter

Write-only dictionary-like interface to set custom metadata to the process.

Examples

Wrap iterator with event_iter to obtain HdfEventWriter object, which stores pdg and pmu data to each event.

>>> import heparchy
>>> from showerpipe.generators import PythiaGenerator
>>>
>>> gen = PythiaGenerator("pythia-card.cmnd", "higgs.lhe.gz")
>>> with heparchy.write.HdfWriter("showers.hdf5") as hep_file:
>>>     with hep_file.new_process("higgs") as proc:
>>>         for event_out, event_in in proc.event_iter(gen):
>>>             # event_in is generated from Pythia
>>>             event_out.pdg = event_in.pdg
>>>             event_out.pmu = event_in.pmu

Public members

HdfProcessWriter(file_obj: HdfWriter, key: str)[source]

Initialize self. See help(type(self)) for accurate signature.

property process_string : str[source]
property signal_pdgs : ndarray[Any, dtype[int32]][source]
property com_energy : tuple[float, str][source]
new_event() HdfEventWriter[source]

hepwrite

set_string(proc_str: str) None[source]

Writes the string formatted underlying event to the process metadata.

set_decay(in_pcls: Sequence[int], out_pcls: Sequence[int]) None[source]

Writes the pdgids of incoming and outgoing particles to process metadata.

set_com_energy(energy: float, unit: str) None[source]

Writes the CoM energy and unit for the collision to process metadata.

set_custom_meta(name: str, metadata: Any) None[source]

Store custom metadata to the process.

event_iter(iterable) Iterator[tuple[HdfEventWriter, IterItem]][source]

Wraps an iteratable object, returning a new iterator which yields a new writeable event object followed by the value obtained from the passed iterator.


Last update: Nov 16, 2022