Skip to main content

A simple framework for plotting LHE files

Project description

Plot LHE Files

A lightweight framework for making plots from LHE files that are the output of many fixed order generators. It leverages the pylhe package for input.

Installation

The package can be installed using Pip.

pip install lheplot

Usage

The following will create two output files singletop.root and singleantitop.root following the plots defined in the example lheplot.Analysis.ExampleTopAnalysis analysis.

lheplot -a lheplot.Analysis.ExampleTopAnalysis singletop.lhe.gz singleantitop.lhe.gz

The LHE files can be compressed (.lhe.gz) or uncompressed (.lhe).

Converting to YODA files

The ROOT files are formatted in a way to make it possible to use the output with Rivet. Only caveat is to convert to the YODA format first. This is useful one does not have to reinvent the pretty plotting functionality.

root2yoda singletop.root
root2yoda singleantitop.root
rivet-mkhtml singletop.yoda singleantitop.yoda

Custom Plots

Custom plots can be created by making a custom class inheriting from the lheplot.Analysis.Analysis class. An examples is provided in the same module as ExampleTopAnalysis. It is

class ExampleTopAnalysis(Analysis):
    def __init__(self):
        super().__init__()

        self.h_top_pt = self.book("/top_pt",100,0,2000)

    def fill(self, events):
        particles=events['particles']

        top=particles[np.abs(particles['id'])==6]
        top_pt=np.sqrt(top['vector']['x']**2+top['vector']['y']**2)

        self.h_top_pt.fill(ak.flatten(top_pt))

The key parts are:

  • Use the book method to create a histogram in the class initializer. The three arguments are the path, number of bins and histogram range. The path is prepended by an "/ANALYSIS" string.
  • Implement the fill function that takes on argument: events. The events are the result of opening an LHE file using pylhe and converting to an awkward array.

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

lheplot-0.0.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lheplot-0.0.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file lheplot-0.0.1.tar.gz.

File metadata

  • Download URL: lheplot-0.0.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for lheplot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d4ee3d509795beb57f962da1c39be9068b0d8bff39643a731043263df7d83939
MD5 2e42d97c56bf97ab750510ea45dc7a26
BLAKE2b-256 e7ceaf808dbbbd76c5ebe64fa5362ab97db87c5010b3ade9232a4d4976642753

See more details on using hashes here.

File details

Details for the file lheplot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lheplot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for lheplot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3423efc61d6cd3f3c8e234b0105e7da28a42c4ff38763b5a8db4c64a25eb3667
MD5 23f5cb1a59c367edd76d8bb06daebd29
BLAKE2b-256 f5caed942cd9d6e5de204ee88e744b978be6cc8e8de409a429cb746adcff8f67

See more details on using hashes here.

Supported by

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