## Examles by Keyword

The Pythia examples directory contains about 100 examples, each showcasing one or several features of the framework. The examples are ordered by keyword below, and cross referenced, allowing for exploration of the various features. A new user may want to start with examples presenting the Basic Usage before going on to explore more advanced topics. Below, the search box can be used to search for keywords which will be displayed the box. This is followed by an expandable list of keywords with links. Finally, a full list of keywords and the relevant examples for each keyword is provided. The code for the example can be accessed by clicking on the name of the example.

● aMC@NLO● Analysis● Angantyr● anti‑kT● arXiv:2108.03481 [hep‑ph]● Astroparticle● B decays● Basic usage● Beam gas● Beam momentum● Biasing● BSM● Centrality● Charged multiplicity● Charm● CKKW‑L● Colour reconnection● Command file● Command line option● Cosmic ray cascade● Cross sections● Cross sections.● Dark matter● Diffraction● Dire● DIS● Displaced vertex● DPS● E+e‑ events● Electron‑positron● Event display● Event filter● Event record● Event shapes● Event weights● EvtGen● Exclusive● External decays● External derived class● External resonance● Extra dimensions● Fastjet● Fixed target● Forward physics● FxFx● Glauber● Gnuplot● Hadron production● Hadron widths● Hadron‑ion collisions● Hadronic rescattering● Hadronization● Hard diffraction● HDF5 file● Heavy ions● Helaconia● Hepmc● Hidden Valley● Higgs● Histograms● Impact parameter● Jet finding● Jets● kT● Leading order● LHAPDF● LHE file● LHEH5● Low energy● Madgraph● MadGraph5_aMC@NLO● Matching● Matplotlib● MC@NLO● Merging● MESS● Minimum bias● MLM● MPI● Multi‑instance● Multiplicities● Ncoll● NL3● NLO● Npart● Onia● OpenMP● Optimization● P pbar● p‑Ne● Parallelism● Partial cross sections● Particle data● Parton distribution● PDFs● Performance● Photon beam● Photon‑photon● Photoproduction● Pileup● Plotting● Powheg● Process cross sections● Process selection● Process veto● Proton‑ion● pT bias● pT spectra● Pythia 6● Python● R‑hadron● R‑hadrons● Random number generator● Rescattering● Resonance decay● Resonances● reuse MPI initialization● Reweighting● Rivet● Root● Rope hadronization● Second interaction● Shower● Slowjet● Space‑time picture● String shoving● Subruns● Supersymmetry● Switch beam● Switch collision energy● Tevatron● Thermal model● Top● Top mass● Total cross section● Total cross sections● Tuning● Two‑body decay● UMEPS● Uncertainty bands● UNLOPS● UPC● User hook● Userhooks● Utility● Vertex spread● Vincia● Weak showers● Yoda● Z production

### aMC@NLO

- main151.cc: demonstrates MC@NLO matching with LHEF input from MadGraph5_aMC@NLO. Input is provided by the `main151.cmnd` file.
- main153.cc: demonstrates how Madgraph5_aMC@NLO can be run "from within" Pythia, making use of the `LHAupMadgraph` wrapper/interface of Madgraph5_aMC@NLO and the Pythia jet matching facilities.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main295.py: a Python interface equivalent to `main154.cc`, with interface to Madgraph.

### Analysis

- main143.cc: shows how ROOT can be used for histogramming in a program that for the rest is structured like a normal PYTHIA run.
- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main231.cc: put all user analysis code into a class of its own, separate from the main program, and provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main232.cc: shows how to write an event filter class, where you keep a vector of pointers to the subset of particles you want to study further. The event record itself remains unchanged.
- main233.cc: example how to create a tailor-made copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.
- main262.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.
- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### Angantyr

- main421.cc: simple pp collisions as in `main101.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.
- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main423.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.
- main427.cc: add a different impact parameter sampler to Angantyr, to output events with unit weights.

### anti‑kT

- main242.cc: illustration how `UserHooks` can be used interact directly with the event-generation process.
- main293.py: a Python interface equivalent to `main242.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.

### arXiv:2108.03481 [hep‑ph]

- main481.cc: plot PDFs for a large number of hadrons.
- main482.cc: test switching between hadron beams on an event-by-event basis. Compare running times for different scenarios.

### Astroparticle

- main241.cc: set up a fictitious production process to a generic resonance, where you easily can compose your own list of (two-body) decay modes to a variety of final states. Also traces decay chains down to truly stable particles: gamma, e^+-, p/pbar and neutrinos. Suitable for astroparticle applications, like neutralino pair annihilation, where cross sections are calculated separately in another program. Also shows how to plot histograms using the Pyplot solution.

### B decays

- main361.cc: loop over several tries, either to redo B decays only or to redo the complete hadronization chain of an event. This is a way to increase efficiency, since much of the generation process is only made once.
- main364.cc: demonstrates how to use the `EvtGenDecays` class provided by `include/Pythia8Plugins/EvtGen.h` to perform decays with the `EvtGen` package. The `main364.dec` header contains special instructions how to configure PYTHIA for use with `EvtGen`.

### Basic usage

- main101.cc: a simple study of the charged multiplicity for jet events at the LHC.
- main102.cc: a simple study of the pT spectrum of Z bosons at the Tevatron.
- main103.cc: basic generation of e^+e^- events at LEP 1.
- main111.cc: basic generation of e^+e^- events at LEP 1, equivalent with `main103.cmnd`, but with settings delegated to the auxiliary `main111.cmnd` file.
- main112.cc: a simple study of the pT spectrum of Z bosons at the Tevatron, with Pyplot option for displaying the result, but otherwise equivalent with `main102.cc`.
- main113.cc: a simple study of several different kinds of events, with the choice to be made in the `main113.cmnd` "cards file". Also shows how to plot histograms using the Pyplot approach.
- main114.cc: demonstration of the simple interface to `YODA` histogramming.
- main121.cc: a study of top events, fed in from the Les Houches Event File `ttbar.lhe`, here generated by PYTHIA 6.4. This file currently only contains 100 events so as not to make the distributed PYTHIA package too big, and so serves mainly as a demonstration of the principles involved.
- main122.cc: a more sophisticated variant of `main121.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input. Also illustrating some other aspects, like the capability to mix in internally generated events.
- main123.cc: a streamlined version of `main122.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main123.cmnd` file.
- main124.cc: shows how PYTHIA 8 can write a Les Houches Event File, using facilities potentially useful also for other programs to write an LHEF. See also `main125.cc`.
- main125.cc: exemplifies how LHEF version 3 events can be written on an external file.
- main126.cc: shows how LHEF version 3.0 files can be read and used to fill several histograms of the same property, but with different event weights.
- main127.cc: an extended version of `main126.cc`, where additionally it is shown how to extract many different kinds of LHEF version 3.0 information.
- main131.cc: similar to `main101`, except that the event record is output in the HepMC event record format. Requires that HepMC3 is properly linked. Note that the `main131.hepmc` output file can become quite big; so no example is included in this distribution.
- main132.cc: a streamlined version for the generation of events that are then stored in HepMC format, without any event analysis. That is, all physics studies will have to be done afterwards. The name of the input "cards file" (e.g. `main132.cmnd`) and output HepMC event file (e.g. `main132.hepmc`) are to be provided as command-line arguments. Requires that HepMC3 is properly linked. Note that the HepMC output file can become quite big; so no example is included in this distribution.
- main135.cc: illustrates how the event record can be compressed to include e.g. only the final-state particles, in order to reduce the HepMC file size, but obviously at the expense of losing some history information.
- main211.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder.
- main213.cc: a comparison of `SlowJet` and `FastJet` jet finding, showing that they find the same jets if run under identical conditions, in this case for QCD jets.
- main214.cc: a comparison of jet properties on the parton and the hadron level, illustrating possibilities for larger control of which particles are used in the jet analyses.
- main216.cc: reconstruction of a hypothetical 1 TeV Z' mass by forming the invariant mass of the two jets with highest transverse momentum. Convenient starting point for student exercises.
- main231.cc: put all user analysis code into a class of its own, separate from the main program, and provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main291.py: a Python interface equivalent to `main101.cc`, i.e. a minimal example.
- main301.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main321.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main321.cmnd` to pick processes. For photoproduction one can use the alternative `main321photons.cmnd` input.
- main322.cc: generation of the QCD jet cross section biased towards higher pT values, by two different techniques. Firstly, by splitting the run into subruns, each in its own pT bin, and adding the results properly reweighted. Two suboptions, with limits set either in the main program or by subrun specification in the `main322.cmnd` file. Secondly, by a continuous reweighting with a pT^4 bias in the selection, compensated by a 1/pT^4 event weight. Also inclusion of soft processes is illustrated, with subruns and weighted events.
- main341.cc: demonstrates how to generate Deeply Inelastic Scattering events, e.g. in a HERA configuration.
- main501.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main501.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main502.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main502.lhe`, contains a sample events that illustrate how to arrange color tags in the presence of the color-space epsilon tensors that accompany baryon number violating event topologies.
- main508.cc: simple setup for Dark Matter production in several different scenarios, as specified in `main508.cmnd`, notably with long-lived particle signatures.

### Beam gas

- main324.cc: use several instances of Pythia, one for signal events and others for a variable number of pileup and "beam-gas" events, combined into one common event record. Illustrates how new Pythia instances can copy existing settings and particle data.

### Beam momentum

- main245.cc: shows how to write external classes, derived from PYTHIA base classes, that can be handed to PYTHIA for internal generation. The `MIXMAX` random number generator is this way compared with the default PYTHIA one. Explicit implementations are included for the generation of external beam momentum spread and vertex location, and for a simple scaling external parton distribution set.

### Biasing

- main261.cc: exemplifies how rare emissions can be enhanced in the shower.
- main322.cc: generation of the QCD jet cross section biased towards higher pT values, by two different techniques. Firstly, by splitting the run into subruns, each in its own pT bin, and adding the results properly reweighted. Two suboptions, with limits set either in the main program or by subrun specification in the `main322.cmnd` file. Secondly, by a continuous reweighting with a pT^4 bias in the selection, compensated by a 1/pT^4 event weight. Also inclusion of soft processes is illustrated, with subruns and weighted events.
- main323.cc: generation of two predetermined hard interactions in each event.

### BSM

- main501.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main501.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main503.cc: test program for processes in scenarios with large extra dimensions or unparticles.
- main504.cc: production of Kaluza-Klein gamma/Z states in TeV-sized extra dimensions.
- main505.cc: production of long-lived R-hadrons, that are forced to decay at separate vertices and possibly with changed momenta.
- main507.cc: setup (in `main507.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the `FastJet` package.
- main508.cc: simple setup for Dark Matter production in several different scenarios, as specified in `main508.cmnd`, notably with long-lived particle signatures.

### Centrality

- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main423.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### Charged multiplicity

- main101.cc: a simple study of the charged multiplicity for jet events at the LHC.
- main103.cc: basic generation of e^+e^- events at LEP 1.
- main222.cc: equivalent to `main221.cc`, but is much more heavily commented to give more in-depth explanations of how the code works.
- main291.py: a Python interface equivalent to `main101.cc`, i.e. a minimal example.
- main292.py: a Python interface equivalent to `main222.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main423.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### Charm

- main366.cc: calculates charm hadron asymmetries in fixed-target pi^- p collisions, and compares results with data at three reasonably nearby energies.A few options are available, e.g. the QCDCR model.

### CKKW‑L

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Colour reconnection

- main302.cc: colour reconnection rate in e^+e^- → W^+W^- → q_1 qbar_2 q_3 qbar_4 as a function of the collision energy.
- main362.cc: colour reconnection models studied for top production. Illustrates how to set up the user hooks in `include/Pythia8Plugins/ColourReconnectionHooks.h`, with several models not found in the standard PYTHIA library.
- main441.cc: shows how the string shoving mechanism, part of the rope hadronization framework, can be set up and used to generate ridge effects.
- main442.cc: shows how flavour production is changed in the rope hadronization framework.

### Command file

- main111.cc: basic generation of e^+e^- events at LEP 1, equivalent with `main103.cmnd`, but with settings delegated to the auxiliary `main111.cmnd` file.
- main113.cc: a simple study of several different kinds of events, with the choice to be made in the `main113.cmnd` "cards file". Also shows how to plot histograms using the Pyplot approach.
- main123.cc: a streamlined version of `main122.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main123.cmnd` file.
- main132.cc: a streamlined version for the generation of events that are then stored in HepMC format, without any event analysis. That is, all physics studies will have to be done afterwards. The name of the input "cards file" (e.g. `main132.cmnd`) and output HepMC event file (e.g. `main132.hepmc`) are to be provided as command-line arguments. Requires that HepMC3 is properly linked. Note that the HepMC output file can become quite big; so no example is included in this distribution.
- main133.cc: a further extension of `main132.cc`, where subruns are used to process several consecutive LHEF, as in `main123.cc`, with information stored e.g in `main133.cmnd`. Other comments as for `main132.cc`.
- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.
- main231.cc: put all user analysis code into a class of its own, separate from the main program, and provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main248.cc: shows how to use a filter to select a specific final state from resonance decays.
- main321.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main321.cmnd` to pick processes. For photoproduction one can use the alternative `main321photons.cmnd` input.
- main501.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main501.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.

### Command line option

- main132.cc: a streamlined version for the generation of events that are then stored in HepMC format, without any event analysis. That is, all physics studies will have to be done afterwards. The name of the input "cards file" (e.g. `main132.cmnd`) and output HepMC event file (e.g. `main132.hepmc`) are to be provided as command-line arguments. Requires that HepMC3 is properly linked. Note that the HepMC output file can become quite big; so no example is included in this distribution.
- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.
- main231.cc: put all user analysis code into a class of its own, separate from the main program, and provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.

### Cosmic ray cascade

- main483.cc: simple example of how Pythia can be used to simulate a basic hadronic cascade in a few simple atmospheres, either as a sequence of hadron-hadron collisions or making use of the Angantyr module.
- main484.cc: as `main483.cc`, but using the `PythiaCascade` class to perform the separate collisions or decays, while the bookkeeping of the cascade evolution remains in the main program.
- main485.cc: an even simpler example of one collision or decay at a time, as performed in `PythiaCascade`.
- main487.cc: direct comparison of a hadronic cascade simulated either with `PythiaCascade` or with Angantyr. Here the atmosphere is a realistic mix of nitrogen, oxygen and argon.

### Cross sections

- main321.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main321.cmnd` to pick processes. For photoproduction one can use the alternative `main321photons.cmnd` input.
- main464.cc: plot the energy dependence of the low-energy cross sections used in the hadronic rescattering framework.
- main465.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.

### Cross sections.

- main425.cc: calculates the proton-oxygen cross section at varying energies.

### Dark matter

- main407.cc: VINCIA electroweak showers off an LHEF file for dark-matter annihilation. The VINCIA EW shower requires hard-process partons with assigned helicities. In this example, these are read in from the LHEF file.
- main507.cc: setup (in `main507.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the `FastJet` package.

### Diffraction

- main321.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main321.cmnd` to pick processes. For photoproduction one can use the alternative `main321photons.cmnd` input.
- main325.cc: exemplifies the generation of hard diffractive processes.
- main342.cc: exemplifies hard diffraction in the context of a photon-inside-lepton beam, like at HERA.

### Dire

- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.
- main401.cc: simple example of the VINCIA (or DIRE) shower model(s), on Z decays at LEP I, with some basic event shapes, spectra, and multiplicity counts.
- main402.cc: comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP. See `main204.cc` for how to do this with the Parallelism framework.
- main403.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronization components on/off via command file.
- main404.cc: demonstrates the example of `main201` using the Parallelism framework.

### DIS

- main341.cc: demonstrates how to generate Deeply Inelastic Scattering events, e.g. in a HERA configuration.
- main342.cc: exemplifies hard diffraction in the context of a photon-inside-lepton beam, like at HERA.
- main344.cc: exemplifies how to provide an external photon flux for photo-production processes.

### Displaced vertex

- main505.cc: production of long-lived R-hadrons, that are forced to decay at separate vertices and possibly with changed momenta.

### DPS

- main326.cc: example on how double parton scattering events can be reweighted according to a different model than default in Pythia. Contributed by Boris Blok and Paolo Gunnellini.

### E+e‑ events

- main302.cc: colour reconnection rate in e^+e^- → W^+W^- → q_1 qbar_2 q_3 qbar_4 as a function of the collision energy.

### Electron‑positron

- main103.cc: basic generation of e^+e^- events at LEP 1.
- main111.cc: basic generation of e^+e^- events at LEP 1, equivalent with `main103.cmnd`, but with settings delegated to the auxiliary `main111.cmnd` file.
- main301.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main381.cc: Higgs production in an 500 GeV e^+e^- coillider, illustrating the composition of production channels and the charged multiplicity arising in each of them.
- main401.cc: simple example of the VINCIA (or DIRE) shower model(s), on Z decays at LEP I, with some basic event shapes, spectra, and multiplicity counts.

### Event display

- main141.cc: use ROOT to visualize the particles produced by Pythia in (y,phi) space.
- main142.cc: use ROOT to visualize different jet algoritms in (y,phi) space. The jet clustering is done with FastJet. The produced figure was used in the article "50 years of Quantum Chromodynamics" in celebration of the 50th anniversary of QCD (EPJC).

### Event filter

- main232.cc: shows how to write an event filter class, where you keep a vector of pointers to the subset of particles you want to study further. The event record itself remains unchanged.

### Event record

- main233.cc: example how to create a tailor-made copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.

### Event shapes

- main301.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.

### Event weights

- main427.cc: add a different impact parameter sampler to Angantyr, to output events with unit weights.

### EvtGen

- main364.cc: demonstrates how to use the `EvtGenDecays` class provided by `include/Pythia8Plugins/EvtGen.h` to perform decays with the `EvtGen` package. The `main364.dec` header contains special instructions how to configure PYTHIA for use with `EvtGen`.

### Exclusive

- main345.cc: demonstrates how to generate different types of photon-initiated dilepton events in proton-proton collisions.

### External decays

- main243.cc: shows (a) how to use `UserHooks` to regularize onium cross section for pT → 0, and (b) how decays could be handled externally.
- main364.cc: demonstrates how to use the `EvtGenDecays` class provided by `include/Pythia8Plugins/EvtGen.h` to perform decays with the `EvtGen` package. The `main364.dec` header contains special instructions how to configure PYTHIA for use with `EvtGen`.

### External derived class

- main245.cc: shows how to write external classes, derived from PYTHIA base classes, that can be handed to PYTHIA for internal generation. The `MIXMAX` random number generator is this way compared with the default PYTHIA one. Explicit implementations are included for the generation of external beam momentum spread and vertex location, and for a simple scaling external parton distribution set.

### External resonance

- main244.cc: shows how an external resonance can be implemented as a new class derived from a PYTHIA base class, and be used in an external process, both of them handed in for generation as with normal internal classes.
- main246.cc: illustrates how a user hook can be made to steer the angular distribution selection in resonance decays. The prime example would be if LHEF input, e.g. from Madgraph, contains undecayed resonances with helicity information. These would then be decayed isotropically by PYTHIA, but this example shows how one could do better. Some input in `main246.cmnd`.

### Extra dimensions

- main503.cc: test program for processes in scenarios with large extra dimensions or unparticles.
- main504.cc: production of Kaluza-Klein gamma/Z states in TeV-sized extra dimensions.

### Fastjet

- main161.cc: exemplifies CKKW-L merging with a user-defined merging scale. Input is provided by the `main161.cmnd` file.
- main212.cc: an example how the `FastJet` jet finding package can be linked to allow an analysis of the final state, in this case for a study of W + jet production.
- main213.cc: a comparison of `SlowJet` and `FastJet` jet finding, showing that they find the same jets if run under identical conditions, in this case for QCD jets.
- main215.cc: exemplifies how to use one of the contributed add-ons to the `FastJet` package. In this case the modified Mass Drop Tagger is used to improve the mass reconstruction of a boosted hadronically decaying Z^0.
- main507.cc: setup (in `main507.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the `FastJet` package.

### Fixed target

- main324.cc: use several instances of Pythia, one for signal events and others for a variable number of pileup and "beam-gas" events, combined into one common event record. Illustrates how new Pythia instances can copy existing settings and particle data.
- main366.cc: calculates charm hadron asymmetries in fixed-target pi^- p collisions, and compares results with data at three reasonably nearby energies.A few options are available, e.g. the QCDCR model.
- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### Forward physics

- main327.cc: study forward proton production in a 7 TeV sample of inelastic events, both diffractive and nondiffractive. Compare default, ditto without popcorn for remnant diquark, and the QCDCR model.

### FxFx

- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Glauber

- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### Gnuplot

- main262.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.

### Hadron production

- main327.cc: study forward proton production in a 7 TeV sample of inelastic events, both diffractive and nondiffractive. Compare default, ditto without popcorn for remnant diquark, and the QCDCR model.

### Hadron widths

- main466.cc: perform parameterization of hadron widths and output the resulting tables.

### Hadron‑ion collisions

- main424.cc: variable beam energy and types for hadron-ion collisions, where the initialization can be cached for later use.

### Hadronic rescattering

- main247.cc: illustrates the use of `UserHooks` to veto events after hadronization, but before any subsequent processes such as rescattering or Bose-Einstein.
- main469.cc: show as a function of time and distance, from 1 fm to 1 m, how particles are produced, decay and rescatter.

### Hadronization

- main214.cc: a comparison of jet properties on the parton and the hadron level, illustrating possibilities for larger control of which particles are used in the jet analyses.
- main234.cc: an example how a single particle or various parton-level configurations can be input directly for hadronization, without being tied to the full process-generation machinery, e.g. to study the hadronization of junction topologies. Can also be used for single-resonance decays, with showers.
- main263.cc: demonstrates the use of in-situ hadronization reweighting for variations of both kinematic and flavor hadronization parameters. The output compares multiplicity distributions from the default parameters to the reweighted output with the varied parameters and the output using the varied parameters without reweighting.
- main264.cc: runs the same analysis as `main264.cc` but only for flavor hadronization parameters and demonstrates post-hoc reweighting rathern than in-situ.
- main329.cc: comparison of charged multiplicity distributions with data at 200 (UA5), 900 (UA5) and 1800 (E735) GeV.
- main361.cc: loop over several tries, either to redo B decays only or to redo the complete hadronization chain of an event. This is a way to increase efficiency, since much of the generation process is only made once.
- main362.cc: colour reconnection models studied for top production. Illustrates how to set up the user hooks in `include/Pythia8Plugins/ColourReconnectionHooks.h`, with several models not found in the standard PYTHIA library.
- main441.cc: shows how the string shoving mechanism, part of the rope hadronization framework, can be set up and used to generate ridge effects.
- main442.cc: shows how flavour production is changed in the rope hadronization framework.
- main502.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main502.lhe`, contains a sample events that illustrate how to arrange color tags in the presence of the color-space epsilon tensors that accompany baryon number violating event topologies.
- main511.cc: demonstrates consistency of the Hidden Valley fragmentation framework, by comparing a scaled-up HV version of two-flavour (u/d) QCD with its QCD original, for three different ways to set HV fragmentation parameters.

### Hard diffraction

- main342.cc: exemplifies hard diffraction in the context of a photon-inside-lepton beam, like at HERA.

### HDF5 file

- main136.cc: an example illustrating the generation of HepMC events using the HDF5 LHA format (LHAHDF5).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Heavy ions

- main344.cc: exemplifies how to provide an external photon flux for photo-production processes.
- main421.cc: simple pp collisions as in `main101.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.
- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main423.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main425.cc: calculates the proton-oxygen cross section at varying energies.
- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.
- main427.cc: add a different impact parameter sampler to Angantyr, to output events with unit weights.

### Helaconia

- main363.cc: demonstrates how to generate quarkonia events with the external `HelacOnia` package interfaced to Pythia, and compare results with the internal implementation.

### Hepmc

- main131.cc: similar to `main101`, except that the event record is output in the HepMC event record format. Requires that HepMC3 is properly linked. Note that the `main131.hepmc` output file can become quite big; so no example is included in this distribution.
- main132.cc: a streamlined version for the generation of events that are then stored in HepMC format, without any event analysis. That is, all physics studies will have to be done afterwards. The name of the input "cards file" (e.g. `main132.cmnd`) and output HepMC event file (e.g. `main132.hepmc`) are to be provided as command-line arguments. Requires that HepMC3 is properly linked. Note that the HepMC output file can become quite big; so no example is included in this distribution.
- main133.cc: a further extension of `main132.cc`, where subruns are used to process several consecutive LHEF, as in `main123.cc`, with information stored e.g in `main133.cmnd`. Other comments as for `main132.cc`.
- main134.cc:
- `main134.cc` (was `main44.cc` and a legacy HepMC2 example, alternatively HepMC3, where subruns are used to process several consecutive LHEF, with information stored e.g in `main134.cmnd`.
- main135.cc: illustrates how the event record can be compressed to include e.g. only the final-state particles, in order to reduce the HepMC file size, but obviously at the expense of losing some history information.
- main136.cc: an example illustrating the generation of HepMC events using the HDF5 LHA format (LHAHDF5).
- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.

### Hidden Valley

- main509.cc: three scenarios for Hidden Valley particle production at 13 TeV, with a selection of further possible variations.
- main510.cc: a related setup of a few different scenarios for Hidden Valley particle production at a 1 TeV e^+e^- collider.
- main511.cc: demonstrates consistency of the Hidden Valley fragmentation framework, by comparing a scaled-up HV version of two-flavour (u/d) QCD with its QCD original, for three different ways to set HV fragmentation parameters.

### Higgs

- main381.cc: Higgs production in an 500 GeV e^+e^- coillider, illustrating the composition of production channels and the charged multiplicity arising in each of them.

### Histograms

- main401.cc: simple example of the VINCIA (or DIRE) shower model(s), on Z decays at LEP I, with some basic event shapes, spectra, and multiplicity counts.

### Impact parameter

- main427.cc: add a different impact parameter sampler to Angantyr, to output events with unit weights.

### Jet finding

- main161.cc: exemplifies CKKW-L merging with a user-defined merging scale. Input is provided by the `main161.cmnd` file.
- main211.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder.
- main212.cc: an example how the `FastJet` jet finding package can be linked to allow an analysis of the final state, in this case for a study of W + jet production.
- main213.cc: a comparison of `SlowJet` and `FastJet` jet finding, showing that they find the same jets if run under identical conditions, in this case for QCD jets.
- main214.cc: a comparison of jet properties on the parton and the hadron level, illustrating possibilities for larger control of which particles are used in the jet analyses.
- main215.cc: exemplifies how to use one of the contributed add-ons to the `FastJet` package. In this case the modified Mass Drop Tagger is used to improve the mass reconstruction of a boosted hadronically decaying Z^0.
- main216.cc: reconstruction of a hypothetical 1 TeV Z' mass by forming the invariant mass of the two jets with highest transverse momentum. Convenient starting point for student exercises.
- main242.cc: illustration how `UserHooks` can be used interact directly with the event-generation process.
- main293.py: a Python interface equivalent to `main242.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.
- main301.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main507.cc: setup (in `main507.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the `FastJet` package.

### Jets

- main142.cc: use ROOT to visualize different jet algoritms in (y,phi) space. The jet clustering is done with FastJet. The produced figure was used in the article "50 years of Quantum Chromodynamics" in celebration of the 50th anniversary of QCD (EPJC).
- main247.cc: illustrates the use of `UserHooks` to veto events after hadronization, but before any subsequent processes such as rescattering or Bose-Einstein.
- main342.cc: exemplifies hard diffraction in the context of a photon-inside-lepton beam, like at HERA.

### kT

- main161.cc: exemplifies CKKW-L merging with a user-defined merging scale. Input is provided by the `main161.cmnd` file.

### Leading order

- main161.cc: exemplifies CKKW-L merging with a user-defined merging scale. Input is provided by the `main161.cmnd` file.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### LHAPDF

- main201.cc: a test of the shape of parton densities, as a check prior to using a given PDF set in a generator. Requires that LHAPDF is properly linked. Also shows how to plot histograms (with logarithmic x scale) using the Pyplot solution.
- main202.cc: compares the charged multiplicity distribution, and a few other minimum-bias physics aspects, between default PYTHIA PDF and another one. Requires that LHAPDF is properly linked.
- main203.cc: compares the internal and LHAPDF implementations of the NNPDF 2.3 QCD+QED sets, for results and for timing. Requires that LHAPDF is properly linked.
- main204.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Input in `main204.cmnd` and `photoninproton.lhe`. Requires that you link to a LHAPDF set that includes the photon PDF.

### LHE file

- main121.cc: a study of top events, fed in from the Les Houches Event File `ttbar.lhe`, here generated by PYTHIA 6.4. This file currently only contains 100 events so as not to make the distributed PYTHIA package too big, and so serves mainly as a demonstration of the principles involved.
- main122.cc: a more sophisticated variant of `main121.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input. Also illustrating some other aspects, like the capability to mix in internally generated events.
- main123.cc: a streamlined version of `main122.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main123.cmnd` file.
- main124.cc: shows how PYTHIA 8 can write a Les Houches Event File, using facilities potentially useful also for other programs to write an LHEF. See also `main125.cc`.
- main125.cc: exemplifies how LHEF version 3 events can be written on an external file.
- main126.cc: shows how LHEF version 3.0 files can be read and used to fill several histograms of the same property, but with different event weights.
- main127.cc: an extended version of `main126.cc`, where additionally it is shown how to extract many different kinds of LHEF version 3.0 information.
- main132.cc: a streamlined version for the generation of events that are then stored in HepMC format, without any event analysis. That is, all physics studies will have to be done afterwards. The name of the input "cards file" (e.g. `main132.cmnd`) and output HepMC event file (e.g. `main132.hepmc`) are to be provided as command-line arguments. Requires that HepMC3 is properly linked. Note that the HepMC output file can become quite big; so no example is included in this distribution.
- main133.cc: a further extension of `main132.cc`, where subruns are used to process several consecutive LHEF, as in `main123.cc`, with information stored e.g in `main133.cmnd`. Other comments as for `main132.cc`.
- main134.cc:
- `main134.cc` (was `main44.cc` and a legacy HepMC2 example, alternatively HepMC3, where subruns are used to process several consecutive LHEF, with information stored e.g in `main134.cmnd`.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main246.cc: illustrates how a user hook can be made to steer the angular distribution selection in resonance decays. The prime example would be if LHEF input, e.g. from Madgraph, contains undecayed resonances with helicity information. These would then be decayed isotropically by PYTHIA, but this example shows how one could do better. Some input in `main246.cmnd`.
- main407.cc: VINCIA electroweak showers off an LHEF file for dark-matter annihilation. The VINCIA EW shower requires hard-process partons with assigned helicities. In this example, these are read in from the LHEF file.
- main502.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main502.lhe`, contains a sample events that illustrate how to arrange color tags in the presence of the color-space epsilon tensors that accompany baryon number violating event topologies.

### LHEH5

- main136.cc: an example illustrating the generation of HepMC events using the HDF5 LHA format (LHAHDF5).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Low energy

- main461.cc: compare the energy dependence of the average charged multiplicity between the simple treatment in rescattering and the full framework.
- main462.cc: compare multiplicities and pT spectra with or without rescattering, the former with or without rescattering between nearest neighbours along the string.
- main463.cc: simple generation of low-energy events.
- main464.cc: plot the energy dependence of the low-energy cross sections used in the hadronic rescattering framework.
- main465.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.
- main467.cc: generate tetraquarks from the rescattering of a D0 and Dbar*0 beam.
- main468.cc: generate tetraquarks from the rescattering of D0 and Dbar*0 mesons produced in LHC events.

### Madgraph

- main153.cc: demonstrates how Madgraph5_aMC@NLO can be run "from within" Pythia, making use of the `LHAupMadgraph` wrapper/interface of Madgraph5_aMC@NLO and the Pythia jet matching facilities.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main295.py: a Python interface equivalent to `main154.cc`, with interface to Madgraph.
- main405.cc: VINCIA setup for electroweak shower off a fictitious process for Z decay to neutrinos at high mass. (In the absence of a weak shower, these would not shower at all.) The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).
- main406.cc: previously `main203.cc` VINCIA setup for electroweak shower off high-pT dijets at the LHC. The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).

### MadGraph5_aMC@NLO

- main151.cc: demonstrates MC@NLO matching with LHEF input from MadGraph5_aMC@NLO. Input is provided by the `main151.cmnd` file.

### Matching

- main152.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main152.cmnd` allows to switch between several different matching options. It also allows to select input process, in this case either for the POWHEG-hvq program applied to top pair production Cor10 or for QCD 2+3-jet events. The small samples of input events are stored in the `powheg-hvq.lhe` and `powheg-dijets.lhe` files, respectively.
- main153.cc: demonstrates how Madgraph5_aMC@NLO can be run "from within" Pythia, making use of the `LHAupMadgraph` wrapper/interface of Madgraph5_aMC@NLO and the Pythia jet matching facilities.
- main154.cc: demonstrates how to link the POWHEGBOX matrix element programs dynamically, bypassing the need for intermediate LHE files. Two special files are used in this option: `include/Pythia8Plugins/LHAPowheg.h` contains the LHAup class wrapper used to build the POWHEG plugin libraries, and `include/Pythia8Plugins/PowhegProcs.h` the simple class that facilitates loading the POWHEG plugins. In addition `main154.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main163.cc: exemplifies MLM merging, either in the ALPGEN variant or in the Madgraph one, and with input events either from ALPGEN or from Madgraph, with relevant control cards stored in `main163.cmnd`. See Jet Matching for further details. Traditionally the ALPGEN output is split into one file with events and another with parameters and cross sections (unlike in LHEF). Here a sample of W + 3 jets events is stored in `main163.unw` and the parameters to go with it in `main163_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main295.py: a Python interface equivalent to `main154.cc`, with interface to Madgraph.

### Matplotlib

- main112.cc: a simple study of the pT spectrum of Z bosons at the Tevatron, with Pyplot option for displaying the result, but otherwise equivalent with `main102.cc`.
- main113.cc: a simple study of several different kinds of events, with the choice to be made in the `main113.cmnd` "cards file". Also shows how to plot histograms using the Pyplot approach.
- main122.cc: a more sophisticated variant of `main121.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input. Also illustrating some other aspects, like the capability to mix in internally generated events.
- main126.cc: shows how LHEF version 3.0 files can be read and used to fill several histograms of the same property, but with different event weights.
- main241.cc: set up a fictitious production process to a generic resonance, where you easily can compose your own list of (two-body) decay modes to a variety of final states. Also traces decay chains down to truly stable particles: gamma, e^+-, p/pbar and neutrinos. Suitable for astroparticle applications, like neutralino pair annihilation, where cross sections are calculated separately in another program. Also shows how to plot histograms using the Pyplot solution.
- main263.cc: demonstrates the use of in-situ hadronization reweighting for variations of both kinematic and flavor hadronization parameters. The output compares multiplicity distributions from the default parameters to the reweighted output with the varied parameters and the output using the varied parameters without reweighting.

### MC@NLO

- main151.cc: demonstrates MC@NLO matching with LHEF input from MadGraph5_aMC@NLO. Input is provided by the `main151.cmnd` file.

### Merging

- main152.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main152.cmnd` allows to switch between several different matching options. It also allows to select input process, in this case either for the POWHEG-hvq program applied to top pair production Cor10 or for QCD 2+3-jet events. The small samples of input events are stored in the `powheg-hvq.lhe` and `powheg-dijets.lhe` files, respectively.
- main154.cc: demonstrates how to link the POWHEGBOX matrix element programs dynamically, bypassing the need for intermediate LHE files. Two special files are used in this option: `include/Pythia8Plugins/LHAPowheg.h` contains the LHAup class wrapper used to build the POWHEG plugin libraries, and `include/Pythia8Plugins/PowhegProcs.h` the simple class that facilitates loading the POWHEG plugins. In addition `main154.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main161.cc: exemplifies CKKW-L merging with a user-defined merging scale. Input is provided by the `main161.cmnd` file.
- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main163.cc: exemplifies MLM merging, either in the ALPGEN variant or in the Madgraph one, and with input events either from ALPGEN or from Madgraph, with relevant control cards stored in `main163.cmnd`. See Jet Matching for further details. Traditionally the ALPGEN output is split into one file with events and another with parameters and cross sections (unlike in LHEF). Here a sample of W + 3 jets events is stored in `main163.unw` and the parameters to go with it in `main163_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### MESS

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).

### Minimum bias

- main202.cc: compares the charged multiplicity distribution, and a few other minimum-bias physics aspects, between default PYTHIA PDF and another one. Requires that LHAPDF is properly linked.
- main321.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main321.cmnd` to pick processes. For photoproduction one can use the alternative `main321photons.cmnd` input.

### MLM

- main163.cc: exemplifies MLM merging, either in the ALPGEN variant or in the Madgraph one, and with input events either from ALPGEN or from Madgraph, with relevant control cards stored in `main163.cmnd`. See Jet Matching for further details. Traditionally the ALPGEN output is split into one file with events and another with parameters and cross sections (unlike in LHEF). Here a sample of W + 3 jets events is stored in `main163.unw` and the parameters to go with it in `main163_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### MPI

- main326.cc: example on how double parton scattering events can be reweighted according to a different model than default in Pythia. Contributed by Boris Blok and Paolo Gunnellini.

### Multi‑instance

- main324.cc: use several instances of Pythia, one for signal events and others for a variable number of pileup and "beam-gas" events, combined into one common event record. Illustrates how new Pythia instances can copy existing settings and particle data.

### Multiplicities

- main461.cc: compare the energy dependence of the average charged multiplicity between the simple treatment in rescattering and the full framework.

### Ncoll

- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### NL3

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### NLO

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Npart

- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### Onia

- main243.cc: shows (a) how to use `UserHooks` to regularize onium cross section for pT → 0, and (b) how decays could be handled externally.
- main363.cc: demonstrates how to generate quarkonia events with the external `HelacOnia` package interfaced to Pythia, and compare results with the internal implementation.
- main365.cc: calculates the inclusive branching fractions for the Standard Model Higgs into quarkonia using the LETO timelike parton shower.

### OpenMP

- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.
- main402.cc: comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP. See `main204.cc` for how to do this with the Parallelism framework.

### Optimization

- main424.cc: variable beam energy and types for hadron-ion collisions, where the initialization can be cached for later use.

### P pbar

- main329.cc: comparison of charged multiplicity distributions with data at 200 (UA5), 900 (UA5) and 1800 (E735) GeV.

### p‑Ne

- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### Parallelism

- main221.cc: gives an example of `PythiaParallelism` usage. This program is equivalent to `main101.cc`, but does event generation in parallel.
- main222.cc: equivalent to `main221.cc`, but is much more heavily commented to give more in-depth explanations of how the code works.
- main223.cc: perform analyses in parallel using the `Parallelism:processAsync` setting.
- main263.cc: demonstrates the use of in-situ hadronization reweighting for variations of both kinematic and flavor hadronization parameters. The output compares multiplicity distributions from the default parameters to the reweighted output with the varied parameters and the output using the varied parameters without reweighting.
- main292.py: a Python interface equivalent to `main222.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main297.py: generates batches of events via an interface with Awkward array.
- main404.cc: demonstrates the example of `main201` using the Parallelism framework.

### Partial cross sections

- main296.py: Python script studying total cross sections that accesses Pythia via the simple C++ Pythia wrapper class `main296Lib.cc`. This wrapper module must be compiled with `make libmain296Lib.so`.
- main328.cc: study total, elastic and diffractive cross sections in several models (SaS/DL; MBR, ABMST, RPP2016) as a function of collision energy.
- main486.cc: study total and inelastic cross section for various beam combinations, using the public methods in the `Pythia` class. These methods are intended for fast switching, and only provide the SaS/DL ansats at high energies.

### Particle data

- main294.py: standalone Python code that parses the XML particle database and displays data for a requested particle.

### Parton distribution

- main201.cc: a test of the shape of parton densities, as a check prior to using a given PDF set in a generator. Requires that LHAPDF is properly linked. Also shows how to plot histograms (with logarithmic x scale) using the Pyplot solution.
- main202.cc: compares the charged multiplicity distribution, and a few other minimum-bias physics aspects, between default PYTHIA PDF and another one. Requires that LHAPDF is properly linked.
- main203.cc: compares the internal and LHAPDF implementations of the NNPDF 2.3 QCD+QED sets, for results and for timing. Requires that LHAPDF is properly linked.
- main204.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Input in `main204.cmnd` and `photoninproton.lhe`. Requires that you link to a LHAPDF set that includes the photon PDF.
- main245.cc: shows how to write external classes, derived from PYTHIA base classes, that can be handed to PYTHIA for internal generation. The `MIXMAX` random number generator is this way compared with the default PYTHIA one. Explicit implementations are included for the generation of external beam momentum spread and vertex location, and for a simple scaling external parton distribution set.
- main506.cc: exemplifies how you can use the internal implementation of interpolation in an `lhagrid1.dat file`, without linking LHAPDF6. Also illustrates the topical issue of associated event properties for an intermediate spinless resonance in γ + γ → γ + γ at 750 GeV.

### PDFs

- main481.cc: plot PDFs for a large number of hadrons.

### Performance

- main247.cc: illustrates the use of `UserHooks` to veto events after hadronization, but before any subsequent processes such as rescattering or Bose-Einstein.

### Photon beam

- main204.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Input in `main204.cmnd` and `photoninproton.lhe`. Requires that you link to a LHAPDF set that includes the photon PDF.
- main343.cc: exemplifies how to generate all relevant contributions for charged particle spectra in photon-photon and photon-proton collisions.
- main344.cc: exemplifies how to provide an external photon flux for photo-production processes.
- main345.cc: demonstrates how to generate different types of photon-initiated dilepton events in proton-proton collisions.
- main506.cc: exemplifies how you can use the internal implementation of interpolation in an `lhagrid1.dat file`, without linking LHAPDF6. Also illustrates the topical issue of associated event properties for an intermediate spinless resonance in γ + γ → γ + γ at 750 GeV.

### Photon‑photon

- main343.cc: exemplifies how to generate all relevant contributions for charged particle spectra in photon-photon and photon-proton collisions.

### Photoproduction

- main342.cc: exemplifies hard diffraction in the context of a photon-inside-lepton beam, like at HERA.
- main343.cc: exemplifies how to generate all relevant contributions for charged particle spectra in photon-photon and photon-proton collisions.
- main344.cc: exemplifies how to provide an external photon flux for photo-production processes.
- main345.cc: demonstrates how to generate different types of photon-initiated dilepton events in proton-proton collisions.

### Pileup

- main324.cc: use several instances of Pythia, one for signal events and others for a variable number of pileup and "beam-gas" events, combined into one common event record. Illustrates how new Pythia instances can copy existing settings and particle data.

### Plotting

- main114.cc: demonstration of the simple interface to `YODA` histogramming.

### Powheg

- main152.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main152.cmnd` allows to switch between several different matching options. It also allows to select input process, in this case either for the POWHEG-hvq program applied to top pair production Cor10 or for QCD 2+3-jet events. The small samples of input events are stored in the `powheg-hvq.lhe` and `powheg-dijets.lhe` files, respectively.
- main154.cc: demonstrates how to link the POWHEGBOX matrix element programs dynamically, bypassing the need for intermediate LHE files. Two special files are used in this option: `include/Pythia8Plugins/LHAPowheg.h` contains the LHAup class wrapper used to build the POWHEG plugin libraries, and `include/Pythia8Plugins/PowhegProcs.h` the simple class that facilitates loading the POWHEG plugins. In addition `main154.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Process cross sections

- main282.cc: a systematic comparison of several cross section values with their corresponding values in PYTHIA 6.4, the latter available as a table in the code.

### Process selection

- main113.cc: a simple study of several different kinds of events, with the choice to be made in the `main113.cmnd` "cards file". Also shows how to plot histograms using the Pyplot approach.

### Process veto

- main242.cc: illustration how `UserHooks` can be used interact directly with the event-generation process.
- main293.py: a Python interface equivalent to `main242.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.

### Proton‑ion

- main422.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### pT bias

- main322.cc: generation of the QCD jet cross section biased towards higher pT values, by two different techniques. Firstly, by splitting the run into subruns, each in its own pT bin, and adding the results properly reweighted. Two suboptions, with limits set either in the main program or by subrun specification in the `main322.cmnd` file. Secondly, by a continuous reweighting with a pT^4 bias in the selection, compensated by a 1/pT^4 event weight. Also inclusion of soft processes is illustrated, with subruns and weighted events.

### pT spectra

- main462.cc: compare multiplicities and pT spectra with or without rescattering, the former with or without rescattering between nearest neighbours along the string.

### Pythia 6

- main233.cc: example how to create a tailor-made copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.
- main282.cc: a systematic comparison of several cross section values with their corresponding values in PYTHIA 6.4, the latter available as a table in the code.

### Python

- main241.cc: set up a fictitious production process to a generic resonance, where you easily can compose your own list of (two-body) decay modes to a variety of final states. Also traces decay chains down to truly stable particles: gamma, e^+-, p/pbar and neutrinos. Suitable for astroparticle applications, like neutralino pair annihilation, where cross sections are calculated separately in another program. Also shows how to plot histograms using the Pyplot solution.
- main291.py: a Python interface equivalent to `main101.cc`, i.e. a minimal example.
- main292.py: a Python interface equivalent to `main222.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main293.py: a Python interface equivalent to `main242.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.
- main294.py: standalone Python code that parses the XML particle database and displays data for a requested particle.
- main295.py: a Python interface equivalent to `main154.cc`, with interface to Madgraph.
- main296.py: Python script studying total cross sections that accesses Pythia via the simple C++ Pythia wrapper class `main296Lib.cc`. This wrapper module must be compiled with `make libmain296Lib.so`.
- main297.py: generates batches of events via an interface with Awkward array.
- main298.py: further examples on how to work with events via the Awkward array interface.

### R‑hadron

- main505.cc: production of long-lived R-hadrons, that are forced to decay at separate vertices and possibly with changed momenta.

### R‑hadrons

- main367.cc: presents a fictitious scenario where the top is long-lived enough to hadronize. This is studied using the R-hadron machinery, in e^+e^- or pp collisions.

### Random number generator

- main245.cc: shows how to write external classes, derived from PYTHIA base classes, that can be handed to PYTHIA for internal generation. The `MIXMAX` random number generator is this way compared with the default PYTHIA one. Explicit implementations are included for the generation of external beam momentum spread and vertex location, and for a simple scaling external parton distribution set.

### Rescattering

- main461.cc: compare the energy dependence of the average charged multiplicity between the simple treatment in rescattering and the full framework.
- main462.cc: compare multiplicities and pT spectra with or without rescattering, the former with or without rescattering between nearest neighbours along the string.
- main464.cc: plot the energy dependence of the low-energy cross sections used in the hadronic rescattering framework.
- main465.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.

### Resonance decay

- main244.cc: shows how an external resonance can be implemented as a new class derived from a PYTHIA base class, and be used in an external process, both of them handed in for generation as with normal internal classes.
- main246.cc: illustrates how a user hook can be made to steer the angular distribution selection in resonance decays. The prime example would be if LHEF input, e.g. from Madgraph, contains undecayed resonances with helicity information. These would then be decayed isotropically by PYTHIA, but this example shows how one could do better. Some input in `main246.cmnd`.

### Resonances

- main465.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.
- main467.cc: generate tetraquarks from the rescattering of a D0 and Dbar*0 beam.
- main468.cc: generate tetraquarks from the rescattering of D0 and Dbar*0 mesons produced in LHC events.

### reuse MPI initialization

- main482.cc: test switching between hadron beams on an event-by-event basis. Compare running times for different scenarios.

### Reweighting

- main263.cc: demonstrates the use of in-situ hadronization reweighting for variations of both kinematic and flavor hadronization parameters. The output compares multiplicity distributions from the default parameters to the reweighted output with the varied parameters and the output using the varied parameters without reweighting.
- main264.cc: runs the same analysis as `main264.cc` but only for flavor hadronization parameters and demonstrates post-hoc reweighting rathern than in-situ.
- main427.cc: add a different impact parameter sampler to Angantyr, to output events with unit weights.

### Rivet

- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main421.cc: simple pp collisions as in `main101.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.

### Root

- main141.cc: use ROOT to visualize the particles produced by Pythia in (y,phi) space.
- main142.cc: use ROOT to visualize different jet algoritms in (y,phi) space. The jet clustering is done with FastJet. The produced figure was used in the article "50 years of Quantum Chromodynamics" in celebration of the 50th anniversary of QCD (EPJC).
- main143.cc: shows how ROOT can be used for histogramming in a program that for the rest is structured like a normal PYTHIA run.
- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.

### Rope hadronization

- main442.cc: shows how flavour production is changed in the rope hadronization framework.

### Second interaction

- main323.cc: generation of two predetermined hard interactions in each event.

### Shower

- main511.cc: demonstrates consistency of the Hidden Valley fragmentation framework, by comparing a scaled-up HV version of two-flavour (u/d) QCD with its QCD original, for three different ways to set HV fragmentation parameters.

### Slowjet

- main211.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder.
- main213.cc: a comparison of `SlowJet` and `FastJet` jet finding, showing that they find the same jets if run under identical conditions, in this case for QCD jets.
- main214.cc: a comparison of jet properties on the parton and the hadron level, illustrating possibilities for larger control of which particles are used in the jet analyses.

### Space‑time picture

- main469.cc: show as a function of time and distance, from 1 fm to 1 m, how particles are produced, decay and rescatter.

### String shoving

- main441.cc: shows how the string shoving mechanism, part of the rope hadronization framework, can be set up and used to generate ridge effects.

### Subruns

- main123.cc: a streamlined version of `main122.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main123.cmnd` file.

### Supersymmetry

- main233.cc: example how to create a tailor-made copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.
- main501.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main501.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main508.cc: simple setup for Dark Matter production in several different scenarios, as specified in `main508.cmnd`, notably with long-lived particle signatures.

### Switch beam

- main482.cc: test switching between hadron beams on an event-by-event basis. Compare running times for different scenarios.
- main483.cc: simple example of how Pythia can be used to simulate a basic hadronic cascade in a few simple atmospheres, either as a sequence of hadron-hadron collisions or making use of the Angantyr module.
- main484.cc: as `main483.cc`, but using the `PythiaCascade` class to perform the separate collisions or decays, while the bookkeeping of the cascade evolution remains in the main program.
- main485.cc: an even simpler example of one collision or decay at a time, as performed in `PythiaCascade`.
- main487.cc: direct comparison of a hadronic cascade simulated either with `PythiaCascade` or with Angantyr. Here the atmosphere is a realistic mix of nitrogen, oxygen and argon.

### Switch collision energy

- main482.cc: test switching between hadron beams on an event-by-event basis. Compare running times for different scenarios.
- main483.cc: simple example of how Pythia can be used to simulate a basic hadronic cascade in a few simple atmospheres, either as a sequence of hadron-hadron collisions or making use of the Angantyr module.
- main484.cc: as `main483.cc`, but using the `PythiaCascade` class to perform the separate collisions or decays, while the bookkeeping of the cascade evolution remains in the main program.
- main485.cc: an even simpler example of one collision or decay at a time, as performed in `PythiaCascade`.
- main487.cc: direct comparison of a hadronic cascade simulated either with `PythiaCascade` or with Angantyr. Here the atmosphere is a realistic mix of nitrogen, oxygen and argon.

### Tevatron

- main102.cc: a simple study of the pT spectrum of Z bosons at the Tevatron.
- main112.cc: a simple study of the pT spectrum of Z bosons at the Tevatron, with Pyplot option for displaying the result, but otherwise equivalent with `main102.cc`.

### Thermal model

- main443.cc: study particle composition in the thermal/exponential model for flavour production, compared with the standard tunneling/Gaussian ansatz.

### Top

- main367.cc: presents a fictitious scenario where the top is long-lived enough to hadronize. This is studied using the R-hadron machinery, in e^+e^- or pp collisions.
- main403.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronization components on/off via command file.

### Top mass

- main362.cc: colour reconnection models studied for top production. Illustrates how to set up the user hooks in `include/Pythia8Plugins/ColourReconnectionHooks.h`, with several models not found in the standard PYTHIA library.

### Total cross section

- main296.py: Python script studying total cross sections that accesses Pythia via the simple C++ Pythia wrapper class `main296Lib.cc`. This wrapper module must be compiled with `make libmain296Lib.so`.
- main328.cc: study total, elastic and diffractive cross sections in several models (SaS/DL; MBR, ABMST, RPP2016) as a function of collision energy.
- main486.cc: study total and inelastic cross section for various beam combinations, using the public methods in the `Pythia` class. These methods are intended for fast switching, and only provide the SaS/DL ansats at high energies.

### Total cross sections

- main426.cc: exemplifies adding new nuclei and extracting various cross sections and Glauber statistics from Angantyr.

### Tuning

- main144.cc: streamlined event generation with possibility to output ROOT files, output HepMC files and run RIVET analyses, all by specifying output modes in a cmnd file, where also the event generator settings are specified. The example is run with command line options, run `./main144 -h` to see a full list. See ROOT Usage for information about ROOT output, RIVET Usage for information about RIVET and HepMC Interface for information about HepMC.
- main202.cc: compares the charged multiplicity distribution, and a few other minimum-bias physics aspects, between default PYTHIA PDF and another one. Requires that LHAPDF is properly linked.
- main262.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.
- main263.cc: demonstrates the use of in-situ hadronization reweighting for variations of both kinematic and flavor hadronization parameters. The output compares multiplicity distributions from the default parameters to the reweighted output with the varied parameters and the output using the varied parameters without reweighting.
- main264.cc: runs the same analysis as `main264.cc` but only for flavor hadronization parameters and demonstrates post-hoc reweighting rathern than in-situ.

### Two‑body decay

- main241.cc: set up a fictitious production process to a generic resonance, where you easily can compose your own list of (two-body) decay modes to a variety of final states. Also traces decay chains down to truly stable particles: gamma, e^+-, p/pbar and neutrinos. Suitable for astroparticle applications, like neutralino pair annihilation, where cross sections are calculated separately in another program. Also shows how to plot histograms using the Pyplot solution.

### UMEPS

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### Uncertainty bands

- main262.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.

### UNLOPS

- main162.cc:
- `main162.cc` exemplifies various multi-jet merging schemes in Pythia, depending on the `.cmnd` input file: `main162ckkwl.cmnd` for CKKW-L, `main162umeps.cmnd` for UMEPS, `main162nl3.cmnd` for NL3, `main162unlops.cmnd` for UNLOPS, `main162mess.cmnd` for Vincia's CKKW-L sector merging (MESS).
- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.

### UPC

- main344.cc: exemplifies how to provide an external photon flux for photo-production processes.
- main345.cc: demonstrates how to generate different types of photon-initiated dilepton events in proton-proton collisions.

### User hook

- main248.cc: shows how to use a filter to select a specific final state from resonance decays.

### Userhooks

- main164.cc: general main program to use Pythia's matching and merging schemes. Which method is used is specified by the `.cmnd` input file: `main164mcatnlo.cmnd` for MC@NLO matching with Madgraph5_aMC@NLO, `main164powheg.cmnd` for POWHEG matching with POWHEG-BOX, `main164ckkwl.cmnd` for CKKW-L merging, `main164mess.cmnd` for Vincia's CKKW-L sector merging (MESS), `main164umeps.cmnd` for UMEPS merging, `main164unlops.cmnd` for UNLOPS merging, `main164mlm.cmnd` for MLM jet matching, `main164fxfx.cmnd` for FxFx merging.
- main242.cc: illustration how `UserHooks` can be used interact directly with the event-generation process.
- main243.cc: shows (a) how to use `UserHooks` to regularize onium cross section for pT → 0, and (b) how decays could be handled externally.
- main246.cc: illustrates how a user hook can be made to steer the angular distribution selection in resonance decays. The prime example would be if LHEF input, e.g. from Madgraph, contains undecayed resonances with helicity information. These would then be decayed isotropically by PYTHIA, but this example shows how one could do better. Some input in `main246.cmnd`.
- main247.cc: illustrates the use of `UserHooks` to veto events after hadronization, but before any subsequent processes such as rescattering or Bose-Einstein.
- main261.cc: exemplifies how rare emissions can be enhanced in the shower.
- main293.py: a Python interface equivalent to `main242.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.

### Utility

- main281.cc: shows different ways to print out and read back in settings and particle data. Useful notably for permanent updates of the latter.

### Vertex spread

- main245.cc: shows how to write external classes, derived from PYTHIA base classes, that can be handed to PYTHIA for internal generation. The `MIXMAX` random number generator is this way compared with the default PYTHIA one. Explicit implementations are included for the generation of external beam momentum spread and vertex location, and for a simple scaling external parton distribution set.

### Vincia

- main224.cc: allows to steer Pythia from the command line, can produce HepMC files, and allows for OpenMP parallelization. More documentation can be obtained by executing `./main224 --help`. The input file `main224.cmnd` further illustrates the use of DIRE.
- main401.cc: simple example of the VINCIA (or DIRE) shower model(s), on Z decays at LEP I, with some basic event shapes, spectra, and multiplicity counts.
- main402.cc: comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP. See `main204.cc` for how to do this with the Parallelism framework.
- main403.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronization components on/off via command file.
- main404.cc: demonstrates the example of `main201` using the Parallelism framework.
- main405.cc: VINCIA setup for electroweak shower off a fictitious process for Z decay to neutrinos at high mass. (In the absence of a weak shower, these would not shower at all.) The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).
- main406.cc: previously `main203.cc` VINCIA setup for electroweak shower off high-pT dijets at the LHC. The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).
- main407.cc: VINCIA electroweak showers off an LHEF file for dark-matter annihilation. The VINCIA EW shower requires hard-process partons with assigned helicities. In this example, these are read in from the LHEF file.

### Weak showers

- main405.cc: VINCIA setup for electroweak shower off a fictitious process for Z decay to neutrinos at high mass. (In the absence of a weak shower, these would not shower at all.) The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).
- main406.cc: previously `main203.cc` VINCIA setup for electroweak shower off high-pT dijets at the LHC. The VINCIA EW shower requires hard-process partons with assigned helicities. This is done via Pythia's MG5 matrix-element interface, which must be compiled and linked (using `configure --with-mg5mes`).
- main407.cc: VINCIA electroweak showers off an LHEF file for dark-matter annihilation. The VINCIA EW shower requires hard-process partons with assigned helicities. In this example, these are read in from the LHEF file.

### Yoda

- main114.cc: demonstration of the simple interface to `YODA` histogramming.

### Z production

- main102.cc: a simple study of the pT spectrum of Z bosons at the Tevatron.
- main112.cc: a simple study of the pT spectrum of Z bosons at the Tevatron, with Pyplot option for displaying the result, but otherwise equivalent with `main102.cc`.
- main325.cc: exemplifies the generation of hard diffractive processes.