lhereader
A Python module to read LHE files. Originally by diptaparna, significantly rewritten by me. No dependency on ROOT, requires python version >= 3.6.
Usage example:
import numpy as np
from lhereader import LHEReader
reader = LHEReader('path/to/file.lhe')
# Mediator mass in each event
mmed = []
counter = 0
for iev, event in enumerate(reader):
# Find DM particles
dm = filter(lambda x: abs(x.pdgid)== 52, event.particles)
# Sum over all DM four-momenta in the event
combined_p4 = None
for p4 in map(lambda x: x.p4(), dm):
if combined_p4:
combined_p4 += p4
else:
combined_p4 = p4
mmed.append(combined_p4.mass)
print(f'Mean mediator mass: {np.mean(mmed)}')
print(f'Median mediator mass: {np.median(mmed)}')
Treatment of weights
The parser assumes that each weight XML element has an attribute called id that uniquely identifies the weight per event. In practical terms, each entry should look roughly like this:
<wgt id='some string'> 123456.7 </wgt>
Weights are read in one of two modes: list or dict, which can be set via the weight_mode argument to the LHEReader constructor. In the first case, weights are returned as an unlabelled list in the order of appearance. In the second case, weights are returned as a dictionary per event, which the id attribute serving as the key, and the weight as the value.
The weights can easily be filtered using the weight_regex argument. Only weights with an id matching this regular expression will be returned.
In case no id attribute can be found, the dict mode, as well as filtering are not supported
Metadata
Release files for lhereader 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lhereader-1.0.11.tar.gz | 3.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lhereader-1.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / lhereader-1.0.11.tar.gz
| Download URL | lhereader-1.0.11.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25e871ffad365a89605721642117c21b47e106bc3b079fb337419b1c668510af
|
|
BLAKE2b-256 checksum How to use checksums |
c9b5bde59547feed5f1241227b0f0ed66e1418bfb8193223abc103bb6e058e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / lhereader-1.0.11-py3-none-any.whl
| Download URL | lhereader-1.0.11-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fece3c62d2d21c7a1f17c4d1925943d8b418b90cb9f7d3579bfe4ace9d574d78
|
|
BLAKE2b-256 checksum How to use checksums |
3b1087a7238ddf5b5f070cfd72bc187993ce3db3ea3ed6f52386d83e6973c3d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Security for lhereader 1.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.