Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: LHE file writing examples #256

Merged
merged 17 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The visualization capabilities require the external dependency of [Graphviz](htt
The example below provides a simple overview.
Full functionality can be inspected from the functions provided in the `pylhe` module.

### Reading

```python
import itertools

Expand Down Expand Up @@ -59,6 +61,78 @@ event.graph.render(filename="test", format="png", cleanup=True)
event.graph.render(filename="test", format="pdf", cleanup=True)
```

### Writing

For a full example see [write](examples/write_monte_carlo_example.ipynb) or [filter](examples/filter_events_example.ipynb).
The values in the sketch below are intentionally left empty since they depend on the use-case.
The data structure of `pylhe` is:

```python
import pylhe

file=pylhe.LHEFile(
init=pylhe.LHEInit(
initInfo=pylhe.LHEInitInfo(
beamA=,
beamB=,
energyA=,
energyB=,
PDFgroupA=,
PDFgroupB=,
PDFsetA=,
PDFsetB=,
weightinStrategy=,
numProcesses=,
),
procInfo=pylhe.LHEProcInfo(
xSection=,
error=,
unitWeight=,
procId=,
),
),
events=[
pylhe.LHEEvent(
eventinfo=pylhe.LHEEventInfo(
nparticles=,
pid=,
weight=,
scale=,
aqed=,
aqcd=,
),
particles=[
pylhe.LHEParticle(
id=,
status=,
mother1=,
mother2=,
color1=,
color2=,
px=,
py=,
pz=,
e=,
m=,
lifetime=,
spin=,
),
...
],
weights=None,
attributes=None,
optional=None,
),
...
]
)

# write to file, compressed if gz/gzip suffix
write_lhe_file(file.init, file.events, "myevents.lhe.gz", rwgt=True, weights=False)

```


## Citation

The preferred BibTeX entry for citation of `pylhe` is
Expand Down
Loading