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.7.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

lhereader-1.0.7-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lhereader-1.0.7.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for lhereader-1.0.7.tar.gz
Algorithm Hash digest
SHA256 993d4a38954871ecef3d3fe867a82f4300a0925ee2328a2155265576eb25a43a
MD5 da19b63805dd5962dd6108ad44721b84
BLAKE2b-256 74fd180c1a0c0a6e11841f571529d827f3a27bf8db1c5d1f3bc596b2db7d96ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lhereader-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for lhereader-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bbde3faa58496abc0a8a5966d08ea98292e0be88d8097c9ce9934f07caed7dc6
MD5 3931baeff19897abbafb26491e4ccd8f
BLAKE2b-256 e047074b58bced57b4809fec7e313dac85211d039eb61a189e150885c6008075

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