Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
086a78b
init paper
APN-Pucky Nov 6, 2025
fbdfdd3
Copy strucutre from vector
APN-Pucky Nov 6, 2025
520bf1f
fix: mixup of files
APN-Pucky Nov 6, 2025
0126fc4
Some sentence
APN-Pucky Nov 6, 2025
56384fd
XML example explain
APN-Pucky Nov 6, 2025
91b303b
put me first
APN-Pucky Nov 10, 2025
274ee42
update tags
APN-Pucky Nov 10, 2025
aed69d6
add joss ci
APN-Pucky Nov 10, 2025
c17e32d
fix: loc
APN-Pucky Nov 10, 2025
cebf3c4
add xml example of format
APN-Pucky Nov 26, 2025
7d79a97
add parameter table
APN-Pucky Nov 26, 2025
9c757b4
separate unit
APN-Pucky Nov 26, 2025
01a89bc
reverse cite
APN-Pucky Nov 26, 2025
4ab8a13
Cite MCs
APN-Pucky Nov 26, 2025
7c4f22b
Statement of need done?
APN-Pucky Nov 26, 2025
70f559d
More text
APN-Pucky Nov 26, 2025
5846c5f
v2 and v3
APN-Pucky Nov 26, 2025
a32eb84
++TODO
APN-Pucky Nov 26, 2025
a4d15a3
say what we support
APN-Pucky Nov 26, 2025
05976e9
looks complete
APN-Pucky Nov 26, 2025
1eb10f0
review
APN-Pucky Nov 26, 2025
994e4f7
more
APN-Pucky Nov 26, 2025
64c3f2a
ok
APN-Pucky Nov 26, 2025
b062c93
rm empty newline
APN-Pucky Nov 26, 2025
7fd25d0
Move structure to sphinx
APN-Pucky Dec 1, 2025
d99f70f
link to own LHE format explanation
APN-Pucky Dec 1, 2025
8cdcea8
remvoed table and xml struct
APN-Pucky Dec 1, 2025
1e1dba7
sphinx bibtex
APN-Pucky Dec 1, 2025
1173e88
more sphinx bibtex
APN-Pucky Dec 1, 2025
0db0a14
Link classes
APN-Pucky Dec 1, 2025
67fd26f
clean
APN-Pucky Dec 1, 2025
87d31dc
rm header
APN-Pucky Dec 1, 2025
536c84d
my final
APN-Pucky Dec 5, 2025
1a76f34
Apply suggestions from code review
APN-Pucky Dec 5, 2025
f39958f
update readme title
APN-Pucky Dec 5, 2025
9129370
clean unused refs
APN-Pucky Dec 5, 2025
f783ed7
Merge branch 'main' into draft
APN-Pucky Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Draft PDF
on: [push]

jobs:
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ docs/source/_autosummary
docs/source/examples/*.lhe
docs/source/examples/*.lhe.gz
docs/source/examples/*.parquet

paper/paper.pdf
paper/jats
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Small and thin Python interface to read [Les Houches Event (LHE)](https://inspir
| [Whizard](https://whizard.hepforge.org/) | 3.1.4 |

Note: test files are provided via the [scikit-hep-testdata](https://github.com/scikit-hep/scikit-hep-testdata) package. Please open an issue of create directly a PR for the inclusion of new files for testing.

## Install

To install `pylhe` from PyPI you can just do
Expand All @@ -49,6 +50,7 @@ The visualization capabilities require the external dependency of [Graphviz](htt

The example below provides a simple overview.
Full functionality can be inspected from the functions provided in the `pylhe` module.
For more information about the LHE format, see the [LHE format documentation](https://pylhe.readthedocs.io/en/latest/lhe.html).

### Reading

Expand Down
4 changes: 4 additions & 0 deletions docs/source/bibliography.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bibliography
============

.. bibliography::
6 changes: 6 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
"sphinx_math_dollar",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinxcontrib.bibtex",
]
nb_execution_mode = "off"
templates_path = ["_templates"]
exclude_patterns = []
bibtex_bibfiles = ["references.bib"]
bibtex_default_style = "unsrt"
# Configure bibtex to ignore missing fields
bibtex_reference_style = "label"


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
Expand Down
8 changes: 8 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
:parser: myst_parser.sphinx_


.. toctree::
:glob:
:maxdepth: 3
:caption: Format Reference:

lhe.rst
bibliography.rst

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
Expand Down
111 changes: 111 additions & 0 deletions docs/source/lhe.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Les Houches Event Format
========================

The Les Houches Event (LHE) format uses an XML-like structure, but the content within the ``<init>` and ``<event>`` blocks consists of whitespace-separated values designed for straightforward parsing in Fortran.
It's first version was defined in :cite:`Alwall:2006yp`.
The ``<header>`` block can contain arbitrary XML content, usually metadata or comments explaining how the events were generated.
The following skeleton example illustrates the overall structure of an LHE file using the ``pylhe`` naming of the attributes

.. code-block:: xml

<LesHouchesEvents version="1.0">
<header></header>
<init>
beamA beamB energyA energyB PDFgroupA PDFgroupB PDFsetA PDFsetB weightingStrategy numProcesses
xSection error unitWeight procId
...
# additional hash-commented information can go here
</init>
<event>
nparticles pid weight scale aqed aqcd
id status mother1 mother2 color1 color2 px py pz e m lifetime spin
...
# additional hash-commented information can go here
</event>
...
</LesHouchesEvents>

The table below summarizes the main parameters found in LHE files grouped by their ``dataclass`` representation in ``pylhe``.

+-------------------+-------+--------------------------------------+------+
| Parameter | Type | Description | Unit |
+===================+=======+======================================+======+
| :py:class:`pylhe.LHEInitInfo` |
+-------------------+-------+--------------------------------------+------+
| beamA | int | PDG ID of first beam particle | - |
+-------------------+-------+--------------------------------------+------+
| beamB | int | PDG ID of second beam particle | - |
+-------------------+-------+--------------------------------------+------+
| energyA | float | Energy of first beam particle | GeV |
+-------------------+-------+--------------------------------------+------+
| energyB | float | Energy of second beam particle | GeV |
+-------------------+-------+--------------------------------------+------+
| PDFgroupA | int | PDF group ID for first beam | - |
+-------------------+-------+--------------------------------------+------+
| PDFgroupB | int | PDF group ID for second beam | - |
+-------------------+-------+--------------------------------------+------+
| PDFsetA | int | PDF set ID for first beam | - |
+-------------------+-------+--------------------------------------+------+
| PDFsetB | int | PDF set ID for second beam | - |
+-------------------+-------+--------------------------------------+------+
| weightingStrategy | int | Weighting strategy | - |
+-------------------+-------+--------------------------------------+------+
| numProcesses | int | Number of processes | - |
+-------------------+-------+--------------------------------------+------+
| :py:class:`pylhe.LHEProcInfo` |
+-------------------+-------+--------------------------------------+------+
| xSection | float | Cross section | pb |
+-------------------+-------+--------------------------------------+------+
| error | float | Cross section uncertainty | pb |
+-------------------+-------+--------------------------------------+------+
| unitWeight | float | Maximum cross section. | pb |
+-------------------+-------+--------------------------------------+------+
| procId | int | Process ID | - |
+-------------------+-------+--------------------------------------+------+
| :py:class:`pylhe.LHEEventInfo` |
+-------------------+-------+--------------------------------------+------+
| nparticles | int | Number of particles in event | - |
+-------------------+-------+--------------------------------------+------+
| pid | int | Process ID for this event | - |
+-------------------+-------+--------------------------------------+------+
| weight | float | Event weight | - |
+-------------------+-------+--------------------------------------+------+
| scale | float | Factorization/renormalization scale | GeV |
+-------------------+-------+--------------------------------------+------+
| aqed | float | QED coupling constant | - |
+-------------------+-------+--------------------------------------+------+
| aqcd | float | QCD coupling constant | - |
+-------------------+-------+--------------------------------------+------+
| :py:class:`pylhe.LHEParticle` |
+-------------------+-------+--------------------------------------+------+
| id | int | PDG particle ID | - |
+-------------------+-------+--------------------------------------+------+
| status | int | Particle status code | - |
+-------------------+-------+--------------------------------------+------+
| mother1 | int | Index of first mother particle | - |
+-------------------+-------+--------------------------------------+------+
| mother2 | int | Index of second mother particle | - |
+-------------------+-------+--------------------------------------+------+
| color1 | int | First color line index | - |
+-------------------+-------+--------------------------------------+------+
| color2 | int | Second color line index | - |
+-------------------+-------+--------------------------------------+------+
| px | float | x-component of momentum | GeV |
+-------------------+-------+--------------------------------------+------+
| py | float | y-component of momentum | GeV |
+-------------------+-------+--------------------------------------+------+
| pz | float | z-component of momentum | GeV |
+-------------------+-------+--------------------------------------+------+
| e | float | Energy | GeV |
+-------------------+-------+--------------------------------------+------+
| m | float | Mass | GeV |
+-------------------+-------+--------------------------------------+------+
| lifetime | float | Proper lifetime | mm |
+-------------------+-------+--------------------------------------+------+
| spin | float | Spin information. 9.0 for unpolarized| - |
+-------------------+-------+--------------------------------------+------+

Further details can be found in the original definition of the Les Houches Event file standard.
Besides the original publication there were two extensions to the LHE format, version 2.0 in 2009 :cite:`Butterworth:2010ym` and version 3.0 in 2013 :cite:`Andersen:2014efa`.
However, ``pylhe`` currently only implements the widely adopted extension from version 1.0, that is the addition of multiple weights via ``<initrwgt>``, ``<rwgt>``, ``<weight>``, ``<weights>``, ``<wgt>``, and ``<weightgroup>``.
If in the future there is a demand for ``<scales>``, ``<generator>``, ``<pdfinfo>``, or ``<clustering>`` support these can be added as well.
Loading