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
bookmethod 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
fillfunction that takes on argument:events. The events are the result of opening an LHE file usingpylheand converting to an awkward array.
Metadata
Release files for lheplot 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lheplot-0.0.1.tar.gz | 15.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lheplot-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / lheplot-0.0.1.tar.gz
| Download URL | lheplot-0.0.1.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4ee3d509795beb57f962da1c39be9068b0d8bff39643a731043263df7d83939
|
|
BLAKE2b-256 checksum How to use checksums |
e7ceaf808dbbbd76c5ebe64fa5362ab97db87c5010b3ade9232a4d4976642753
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Release files / lheplot-0.0.1-py3-none-any.whl
| Download URL | lheplot-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3423efc61d6cd3f3c8e234b0105e7da28a42c4ff38763b5a8db4c64a25eb3667
|
|
BLAKE2b-256 checksum How to use checksums |
f5caed942cd9d6e5de204ee88e744b978be6cc8e8de409a429cb746adcff8f67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|