Skip to main content

A python module to read LHE files.

Project description

lhereader

PyPI version

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)}')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lhereader-1.0.8.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

lhereader-1.0.8-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file lhereader-1.0.8.tar.gz.

File metadata

  • Download URL: lhereader-1.0.8.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for lhereader-1.0.8.tar.gz
Algorithm Hash digest
SHA256 2b3f247c96ac045f2a6413d2ab88f6297b7748394d22a7a5c75fe27460192f0c
MD5 068ad72794bb545e9198bced8e16ecd8
BLAKE2b-256 d09d8fdfd8e2c5011f759d149a79a7e6bedf5d8b87d7b32c09d6d638c31cbd4b

See more details on using hashes here.

File details

Details for the file lhereader-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: lhereader-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for lhereader-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 39c2cdf57943b0fe364f5a4878c1a4dbdcf728e00b493b5d5f7af679a50e0c36
MD5 cc1878201518625d0babd08ad5f7a619
BLAKE2b-256 43f8a1c6568586a3715e905a4ff5ce24a57d5a850b5a2eb14a4d3d13966b913b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page