Skip to main content

General purpose particle physics Monte Carlo generator.

Project description

PYTHIA

PYTHIA is a program for the generation of high-energy physics collision events, i.e. for the description of collisions at high energies between electrons, protons, photons and heavy nuclei. It contains theory and models for a number of physics aspects, including hard and soft interactions, parton distributions, initial- and final-state parton showers, multiparton interactions, fragmentation and decay. It is largely based on original research, but also borrows many formulae and other knowledge from the literature. As such it is categorized as a general purpose Monte Carlo event generator.

Installation

The PYTHIA package is natively written in C++, which is the preferred interface. To work with PYTHIA via C++ go to the PYTHIA homepage and follow the instructions outlined there. The Python interface to PYTHIA can be installed directly via pip. Note that for this PyPI distribution of PYTHIA, the module name has been changed from pythia8 to pythia8mc as the pythia8 project name was unavailable. Outside of the PyPI distribution, the pythia8 module name is always used.

pip install pythia8mc

The interface is also available via conda.

conda install -c conda-forge pythia8

It is possible, and in many ways preferable, to build the Python interface directly from the PYTHIA C++ distribution (as well as update the Python bindings) using the configuration script.

wget https://pythia.org/download/pythia83/pythia8XXX.tgz
tar xvfz pythia8XXX.tgz
cd pythia8XXX
./configure --with-python
make

Usage

For a full description of usage, as well as examples, see the accompanying HTML manual for this version of PYTHIA.

The following imports the pythia8mc module and creates a Pythia instance.

import pythia8mc
pythia = pythia8mc.Pythia()

PYTHIA must then be configured and initialized, in this example to produce minimum bias events at the LHC.

pythia.readString("SoftQCD:all = on"
pythia.init()

Finally, we can produce an event, and explore the event record.

pythia.next()
for prt in pythia.event: print(prt.name())

Paths

PYTHIA requires the XML files which are used to build the HTML manual to define settings. Additionally, settings files for tunes are also distributed with PYTHIA. For the PyPI distribution, these files can be found along the relative path,

../../../share/Pythia8/xmldoc

with respect to the pythia8mc module library. By default, this path should be correctly set, but it can be printed as follows.

print(pythia8mc.__file__.rstrip("pythia8mc.so") + "../../../share/Pythia8/xmldoc")

The settings directory can be found in ../settings/ with respect to this folder. However, it is possible to overwrite the XML path by setting the environment variable PYTHIA8DATA,

export PYTHIA8DATA=<PYTHIA XML path> 

or by passing the XML path to the Pythia constructor.

pythia8mc.Pythia("<PYTHIA XML path>")

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

pythia8mc-8.310.1.tar.gz (20.2 MB view hashes)

Uploaded Source

Built Distributions

pythia8mc-8.310.1-pp310-pypy310_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (25.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pythia8mc-8.310.1-pp39-pypy39_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (25.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pythia8mc-8.310.1-pp38-pypy38_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (25.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pythia8mc-8.310.1-pp37-pypy37_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (25.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pythia8mc-8.310.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (103.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp39-cp39-macosx_10_9_x86_64.whl (24.4 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pythia8mc-8.310.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (103.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (103.2 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.9 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.5 MB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.5 MB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.5+ x86-64

pythia8mc-8.310.1-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.5 MB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.5+ x86-64

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