pylhe icon indicating copy to clipboard operation
pylhe copied to clipboard

docs: LHE file writing examples

Open APN-Pucky opened this issue 1 year ago • 3 comments

This adds two notebooks one showing how to write custom LHE files with a simple Monte Carlo event generator example and one filtering out events with a Z boson in the event record.

Further, the previously empty class LHEFile now contains two fields: info and events with a write function to a output stream. Contrary to the previous conversion to a string and then writing the string to the file, this approach allows us to write large filtered files directly per event to disk without consuming much memory.

One minor source for confusion might still remain: write_lhe_file takes a init and events while read_lhe_file returns a LHEFile. I'd change write_lhe_file, introduced in recent 0.9.0, to only require an LHEFile. The same then applies to write_lhe_string.

Closes: #251

APN-Pucky avatar Sep 22 '24 16:09 APN-Pucky