## 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● Astroparticle● B decays● Basic usage● Beam gas● Beam momentum● Biasing● BSM● Celljet● Centrality● Charged multiplicity● CKKW‑L● Colour reconnection● Command file● Command line option● Cross sections● Dark matter● Diffraction● Dire● DIS● Displaced vertex● DPS● Electron‑positron● Event filter● Event record● Event shapes● EvtGen● Exclusive● External decays● External derived class● External resonance● Extra dimensions● Fastjet● Fixed target● FxFx● Hadron widths● Hadronization● Hard diffraction● Heavy ion● Heavy ions● Helaconia● Hepmc● Jet finding● Jets● kT● Leading order● LHAPDF● LHE file● Low energy● Madgraph● Matching● Matplotlib● Merging● Minimum bias● MLM● MPI● Multi‑instance● Multiplicities● NL3● NLO● Onia● OpenMP● Parton distribution● Photon beam● Photon‑photon● Photoproduction● Pileup● Powheg● Process cross sections● Process selection● Process veto● Proton‑ion● pT bias● pT spectra● Pythia 6● Python● R‑hadron● Random number generator● Rescattering● Resonance decay● Resonances● Rivet● Root● Rope hadronization● Second interaction● Slowjet● String shoving● Supersymmetry● Tevatron● Top● Top mass● Tuning● Two‑body decay● UMEPS● Uncertainty bands● UNLOPS● UPC● Userhooks● Vertex spread● Vincia● Z production

### aMC@NLO

- main34.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.
- main34.py: a Python interface equivalent of `main34.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Analysis

- main112.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main121.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.
- main16.cc: put all user analysis code into a class of its own, separate from the main program; provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main18.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.
- main30.cc: example how to create a tailormade copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.
- main91.cc: shows how ROOT can be used for histogramming in a program that for the rest is structured like a normal PYTHIA run.
- main92.cc: shows how PYTHIA events can be stored as ROOT trees.
- main93.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 `./main93 -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.

### Angantyr

- main111.cc: simple pp collisions as in `main01.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.
- main112.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main113.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### anti‑kT

- main10.cc: illustration how userHooks can be used interact directly with the event-generation process.
- main10.py: a Python interface equivalent of `main10.cc`. Provides an example of how to derive PYTHIA classes in Python.

### Astroparticle

- main07.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 Python/Matplotlib/Pyplot solution.

### B decays

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

### Basic usage

- main01.cc: a simple study of the charged multiplicity for jet events at the LHC. (Brief example fitting on one slide.)
- main01.py: a Python interface equivalent of `main01.cc`.
- main02.cc: a simple study of the pT spectrum of Z bosons at the Tevatron. (Brief example fitting on one slide.)
- main03.cc: a simple study of several different kinds of events, with the choice to be made in the `main03.cmnd` "cards file". Also shows how to plot histograms using the Python/Matplotlib/Pyplot solution.
- main04.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main04.cmnd` to pick processes. For photoproduction one can use the alternative `main04_photons.cmnd` input.
- main05.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder and the `CellJet` cone-jet finder.
- main06.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main08.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 `main08.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.
- main11.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.
- main12.cc: a more sophisticated variant of `main11.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.
- main13.cc: a streamlined version of `main12.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main13.cmnd` file.
- main16.cc: put all user analysis code into a class of its own, separate from the main program; provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main20.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 `main64.cc`.
- main24.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main24.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main25.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main25.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.
- main36.cc: demonstrates how to generate Deeply Inelastic Scattering events, e.g. in a HERA configuration.
- main37.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.
- main38.cc: an extended version of `main37.cc`, where additionally it is shown how to extract many different kinds of LHEF version 3.0 information.
- main41.cc: similar to `main01`, except that the event record is output in the HepMC event record format. Requires that HepMC3 is properly linked. Note that the `hepmcout41.dat` output file can become quite big; so no example is included in this distribution.
- main42.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. `main42.cmnd`) and output HepMC event file (e.g. `hepmcout42.dat`) 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.
- main64.cc: examplifies how LHEF version 3 events can be written on an external file.
- main72.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.
- main73.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.
- main76.cc: simple setup for Dark Matter production in several different scenarios, as specified in `main76.cmnd`, notably with long-lived particle signatures.

### Beam gas

- main19.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

- main23.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

- main08.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 `main08.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.
- main09.cc: generation of two predetermined hard interactions in each event.
- main63.cc: exemplifies how a user hook can be used to enhance the rate of rare emissions in the shower.

### BSM

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

### Celljet

- main05.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder and the `CellJet` cone-jet finder.

### Centrality

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

### Charged multiplicity

- main01.cc: a simple study of the charged multiplicity for jet events at the LHC. (Brief example fitting on one slide.)
- main01.py: a Python interface equivalent of `main01.cc`.
- main112.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main113.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### CKKW‑L

- main84.cc: do CKKW-L merging with output in such a way that it can be used in subsequent RIVET analyses. Input is provided by the `main84.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main85.cc: do CKKW-L merging, with HepMC event output. Input settings are provided by the `main85.cmnd` file. This example program allows the use of input Les Houches events that are regularised with only very minimal cuts, and on which Pythia itself should enforce the more restrictive merging scale cut. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Colour reconnection

- main101.cc: shows how the string shoving mechanism, part of the rope hadronization framework, can be set up and used to generate ridge effects.
- main102.cc: shows how flavour production is changed in the rope hadronization framework.
- main29.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.

### Command file

- main03.cc: a simple study of several different kinds of events, with the choice to be made in the `main03.cmnd` "cards file". Also shows how to plot histograms using the Python/Matplotlib/Pyplot solution.
- main04.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main04.cmnd` to pick processes. For photoproduction one can use the alternative `main04_photons.cmnd` input.
- main13.cc: a streamlined version of `main12.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main13.cmnd` file.
- main16.cc: put all user analysis code into a class of its own, separate from the main program; provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main24.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main24.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.
- main42.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. `main42.cmnd`) and output HepMC event file (e.g. `hepmcout42.dat`) 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.
- main43.cc: a further extension of `main42.cc`, where subruns are used to process several consecutive LHEF, as in `main13.cc`, with information stored e.g in `main43.cmnd`. Other comments as for `main42.cc`.
- main93.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 `./main93 -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.

### Command line option

- main16.cc: put all user analysis code into a class of its own, separate from the main program; provide the "cards file" name as a command-line argument. Also exemplifies how Higgs mass, width and branching ratios can be set by hand.
- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.
- main42.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. `main42.cmnd`) and output HepMC event file (e.g. `hepmcout42.dat`) 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.
- main93.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 `./main93 -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.

### Cross sections

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

### Dark matter

- main75.cc: setup (in `main75.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the FastJet package.

### Diffraction

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

### Dire

- main200.cc: Basic VINCIA example program for hadronic Z decays at LEP.
- main201.cc: Comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP.
- main202.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronisation components on/off via command file.
- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.

### DIS

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

### Displaced vertex

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

### DPS

- main77.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.

### Electron‑positron

- main06.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main200.cc: Basic VINCIA example program for hadronic Z decays at LEP.

### Event filter

- main18.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

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

### Event shapes

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

### EvtGen

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

### Exclusive

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

### External decays

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

### External derived class

- main23.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

- main22.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.
- main62.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 `main62.cmnd`.

### Extra dimensions

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

### Fastjet

- main71.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.
- main72.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.
- main74.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.
- main75.cc: setup (in `main75.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the FastJet package.
- main82.cc: do CKKW-L merging with a user-defined merging scale function. Input is provided by the `main82.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.

### Fixed target

- main19.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.

### FxFx

- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Hadron widths

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

### Hadronization

- main101.cc: shows how the string shoving mechanism, part of the rope hadronization framework, can be set up and used to generate ridge effects.
- main102.cc: shows how flavour production is changed in the rope hadronization framework.
- main15.cc: loop over several tries, either to redo B decays only or to redo the complete hadronization chain of an event. Since much of the generation process is only made once this is a way to increase efficiency.
- main21.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.
- main25.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main25.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.
- main29.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.
- main73.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.

### Hard diffraction

- main68.cc: examplifies hard diffraction in the context of a photon-inside-lepton beam, like a HERA.

### Heavy ion

- main70.cc: examplifies how to provide an external photon flux for photo-production processes.

### Heavy ions

- main111.cc: simple pp collisions as in `main01.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.
- main112.cc: p-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.
- main113.cc: Pb-Pb collisions at LHC energies, using the Angantyr model for Heavy Ion collisions, and analyzing events by centrality bins.

### Helaconia

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

### Hepmc

- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.
- main41.cc: similar to `main01`, except that the event record is output in the HepMC event record format. Requires that HepMC3 is properly linked. Note that the `hepmcout41.dat` output file can become quite big; so no example is included in this distribution.
- main42.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. `main42.cmnd`) and output HepMC event file (e.g. `hepmcout42.dat`) 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.
- main43.cc: a further extension of `main42.cc`, where subruns are used to process several consecutive LHEF, as in `main13.cc`, with information stored e.g in `main43.cmnd`. Other comments as for `main42.cc`.
- main44.cc: a legacy HepMC2 example, where subruns are used to process several consecutive LHEF, with information stored e.g in `main44.cmnd`. This example mainly serves as comparison to `main45.cc` which uses HepMC3.
- main45.cc: an example illustrating the generation of HepMC events using HepMC3, where subruns are used to process several consecutive LHEF. Input settings can e.g be stored in `main44.cmnd`. For users unfamiliar with HepMC3, note that `main44.cc` is basically a carbon copy, but uses HepMC2 instead, for comparison.
- main84.cc: do CKKW-L merging with output in such a way that it can be used in subsequent RIVET analyses. Input is provided by the `main84.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main85.cc: do CKKW-L merging, with HepMC event output. Input settings are provided by the `main85.cmnd` file. This example program allows the use of input Les Houches events that are regularised with only very minimal cuts, and on which Pythia itself should enforce the more restrictive merging scale cut. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`.
- main86.cc: do unitarised ME+PS (UMEPS) merging, with HepMC event output. Input settings are provided by the `main86.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`. The program will produce positively and negatively weighted events. See UMEPS Merging for further details.
- main87.cc: do NL3 NLO merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main87.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (NL3 section) for further details.
- main88.cc: do unitarised NLO+PS (UNLOPS) merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main88.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (UNLOPS section) for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.
- main93.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 `./main93 -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.

### Jet finding

- main05.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder and the `CellJet` cone-jet finder.
- main06.cc: generation of LEP1 hadronic events, i.e. e^+e^- → gamma*/Z^0 → q qbar, with charged multiplicity, sphericity, thrust and jet analysis.
- main10.cc: illustration how userHooks can be used interact directly with the event-generation process.
- main10.py: a Python interface equivalent of `main10.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main71.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.
- main72.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.
- main74.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.
- main75.cc: setup (in `main75.cmnd`) for Dark Matter production via an s-channel mediator, where a mono-jet pT spectrum is found with the FastJet package.
- main82.cc: do CKKW-L merging with a user-defined merging scale function. Input is provided by the `main82.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.

### Jets

- main68.cc: examplifies hard diffraction in the context of a photon-inside-lepton beam, like a HERA.

### kT

- main82.cc: do CKKW-L merging with a user-defined merging scale function. Input is provided by the `main82.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.

### Leading order

- main80.cc: do CKKW-L merging with a merging scale defined in kT. Input is provided by the `main80.cmnd` file and input LHE files. Very basic and pedagogical setup, suitable for tutorials.
- main81.cc: do CKKW-L merging with a merging scale defined in kT. Input is provided by the `main81.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main82.cc: do CKKW-L merging with a user-defined merging scale function. Input is provided by the `main82.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main83.cc: as `main82.cc` but with an additional cut on the lowest multiplicity allowed for the reclustered state. The same input as for `main82.cc` can be used.
- main84.cc: do CKKW-L merging with output in such a way that it can be used in subsequent RIVET analyses. Input is provided by the `main84.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main85.cc: do CKKW-L merging, with HepMC event output. Input settings are provided by the `main85.cmnd` file. This example program allows the use of input Les Houches events that are regularised with only very minimal cuts, and on which Pythia itself should enforce the more restrictive merging scale cut. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`.
- main86.cc: do unitarised ME+PS (UMEPS) merging, with HepMC event output. Input settings are provided by the `main86.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`. The program will produce positively and negatively weighted events. See UMEPS Merging for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### LHAPDF

- main51.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 Python/Matplotlib/Pyplot solution.
- main52.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.
- main53.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Requires that you link to a LHAPDF set that includes the photon PDF.
- main54.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.

### LHE file

- main11.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.
- main12.cc: a more sophisticated variant of `main11.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.
- main13.cc: a streamlined version of `main12.cc`, where two Les Houches Event Files (`ttbar.lhe` and `ttbar2.lhe`) successively are used as input in `main13.cmnd` file.
- main20.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 `main64.cc`.
- main25.cc: input RPV-SUSY events from an LHEF file that contains an SLHA spectrum inside its header. The event file, `main25.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.
- main37.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.
- main38.cc: an extended version of `main37.cc`, where additionally it is shown how to extract many different kinds of LHEF version 3.0 information.
- main42.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. `main42.cmnd`) and output HepMC event file (e.g. `hepmcout42.dat`) 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.
- main43.cc: a further extension of `main42.cc`, where subruns are used to process several consecutive LHEF, as in `main13.cc`, with information stored e.g in `main43.cmnd`. Other comments as for `main42.cc`.
- main44.cc: a legacy HepMC2 example, where subruns are used to process several consecutive LHEF, with information stored e.g in `main44.cmnd`. This example mainly serves as comparison to `main45.cc` which uses HepMC3.
- main45.cc: an example illustrating the generation of HepMC events using HepMC3, where subruns are used to process several consecutive LHEF. Input settings can e.g be stored in `main44.cmnd`. For users unfamiliar with HepMC3, note that `main44.cc` is basically a carbon copy, but uses HepMC2 instead, for comparison.
- main62.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 `main62.cmnd`.
- main64.cc: examplifies how LHEF version 3 events can be written on an external file.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Low energy

- main151.cc: compare the energy dependence of the average charged multiplicity between the simple treatment in rescattering and the full framework.
- main152.cc: compare multiplicities and pT spectra with or without rescattering, the former with or without rescattering between nearest neighbours along the string.
- main153.cc: simple generation of low-energy events.
- main154.cc: plot the energy dependence of the low-energy cross sections used in the hadronic rescattering framework.
- main155.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.

### Madgraph

- main34.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.
- main34.py: a Python interface equivalent of `main34.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Matching

- main31.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main31.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.
- main32.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 `main32.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 `main32.unw` and the parameters to go with it in `main32_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main33.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 `main33.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main34.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.
- main34.py: a Python interface equivalent of `main34.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Matplotlib

- main03.cc: a simple study of several different kinds of events, with the choice to be made in the `main03.cmnd` "cards file". Also shows how to plot histograms using the Python/Matplotlib/Pyplot solution.
- main07.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 Python/Matplotlib/Pyplot solution.

### Merging

- main31.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main31.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.
- main32.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 `main32.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 `main32.unw` and the parameters to go with it in `main32_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main33.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 `main33.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main80.cc: do CKKW-L merging with a merging scale defined in kT. Input is provided by the `main80.cmnd` file and input LHE files. Very basic and pedagogical setup, suitable for tutorials.
- main81.cc: do CKKW-L merging with a merging scale defined in kT. Input is provided by the `main81.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main82.cc: do CKKW-L merging with a user-defined merging scale function. Input is provided by the `main82.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main83.cc: as `main82.cc` but with an additional cut on the lowest multiplicity allowed for the reclustered state. The same input as for `main82.cc` can be used.
- main84.cc: do CKKW-L merging with output in such a way that it can be used in subsequent RIVET analyses. Input is provided by the `main84.cmnd` file and the three data files `w+_production_lhc_0.lhe`, `w+_production_lhc_1.lhe` and `w+_production_lhc_2.lhe`.
- main85.cc: do CKKW-L merging, with HepMC event output. Input settings are provided by the `main85.cmnd` file. This example program allows the use of input Les Houches events that are regularised with only very minimal cuts, and on which Pythia itself should enforce the more restrictive merging scale cut. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`.
- main86.cc: do unitarised ME+PS (UMEPS) merging, with HepMC event output. Input settings are provided by the `main86.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`. The program will produce positively and negatively weighted events. See UMEPS Merging for further details.
- main87.cc: do NL3 NLO merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main87.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (NL3 section) for further details.
- main88.cc: do unitarised NLO+PS (UNLOPS) merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main88.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (UNLOPS section) for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Minimum bias

- main04.cc: tests of cross sections, multiplicities and average transverse momenta for elastic, diffractive and nondiffractive topologies, using `main04.cmnd` to pick processes. For photoproduction one can use the alternative `main04_photons.cmnd` input.
- main52.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.

### MLM

- main32.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 `main32.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 `main32.unw` and the parameters to go with it in `main32_unw.par`. Madgraph events are taken from the `w+_production_lhc_2.lhe` file in this case.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### MPI

- main77.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

- main19.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

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

### NL3

- main87.cc: do NL3 NLO merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main87.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (NL3 section) for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### NLO

- main87.cc: do NL3 NLO merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main87.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (NL3 section) for further details.
- main88.cc: do unitarised NLO+PS (UNLOPS) merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main88.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (UNLOPS section) for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Onia

- main17.cc: shows (a) how to use UserHooks to regularize onium cross section for pT → 0, and (b) how decays could be handled externally.
- main35.cc: demonstrates how to generate quarkonia events with the external HelacOnia package interfaced to Pythia, and compare results with the internal implementation.

### OpenMP

- main201.cc: Comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP.
- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.

### Parton distribution

- main23.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.
- main51.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 Python/Matplotlib/Pyplot solution.
- main52.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.
- main53.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Requires that you link to a LHAPDF set that includes the photon PDF.
- main54.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.
- main55.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 beam

- main53.cc: tests the possibility to do backwards evolution from an incoming photon at the hard interaction. Requires that you link to a LHAPDF set that includes the photon PDF.
- main55.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.
- main69.cc: examplifies how to generate all relevant contributions for charged particle spectra in photon-photon and photon-proton collisions.
- main70.cc: examplifies how to provide an external photon flux for photo-production processes.
- main78.cc: demonstrates how to generate different types of photon-initiated dilepton events in proton-proton collisions.

### Photon‑photon

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

### Photoproduction

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

### Pileup

- main19.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.

### Powheg

- main31.cc: exemplifies an improved matching of parton showers to LHEF-style input based on the POWHEG approach. The `main31.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.
- main33.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 `main33.cmnd` contains the commands needed for POWHEGBOX to run the example.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Process cross sections

- main14.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

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

### Process veto

- main10.cc: illustration how userHooks can be used interact directly with the event-generation process.
- main10.py: a Python interface equivalent of `main10.cc`. Provides an example of how to derive PYTHIA classes in Python.

### Proton‑ion

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

### pT bias

- main08.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 `main08.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

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

### Pythia 6

- main14.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.
- main30.cc: example how to create a tailormade copy of the ordinary event record, here with hard-process history tracing closer to the PYTHIA 6 conventions.

### Python

- main01.py: a Python interface equivalent of `main01.cc`.
- main03.cc: a simple study of several different kinds of events, with the choice to be made in the `main03.cmnd` "cards file". Also shows how to plot histograms using the Python/Matplotlib/Pyplot solution.
- main07.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 Python/Matplotlib/Pyplot solution.
- main10.py: a Python interface equivalent of `main10.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main34.py: a Python interface equivalent of `main34.cc`. Demonstrates usage of a PYTHIA plugin within the Python interface.

### R‑hadron

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

### Random number generator

- main23.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

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

### Resonance decay

- main22.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.
- main62.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 `main62.cmnd`.

### Resonances

- main155.cc: plot the energy dependence of the low-energy cross sections, specifically the contribution from resonances.

### Rivet

- main111.cc: simple pp collisions as in `main01.cc`, but using the Angantyr model for Heavy Ion collisions. Also shows how Rivet analyses can be set up easily using a special interface.
- main93.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 `./main93 -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.

### Root

- main91.cc: shows how ROOT can be used for histogramming in a program that for the rest is structured like a normal PYTHIA run.
- main92.cc: shows how PYTHIA events can be stored as ROOT trees.
- main93.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 `./main93 -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

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

### Second interaction

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

### Slowjet

- main05.cc: generation of QCD jet events at the LHC, with jet analysis using the `SlowJet` inclusive anti-kT sequential-recombination finder and the `CellJet` cone-jet finder.
- main72.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.

### String shoving

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

### Supersymmetry

- main24.cc: tests of internally implemented cross sections for Supersymmetric particle production, with SUSY spectrum defined in `slha2-example.spc` and settings in `main24.cmnd`. For illustration, an alternative example spectrum is also available, `sps1aWithDecays.spc`, which contains a decay table in SLHA format.
- main76.cc: simple setup for Dark Matter production in several different scenarios, as specified in `main76.cmnd`, notably with long-lived particle signatures.

### Tevatron

- main02.cc: a simple study of the pT spectrum of Z bosons at the Tevatron. (Brief example fitting on one slide.)

### Top

- main202.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronisation components on/off via command file.

### Top mass

- main29.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.

### Tuning

- main121.cc: set up automatic uncertainty band variations to PDFs and factorization and renormalization scales.
- main52.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.
- main93.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 `./main93 -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.

### Two‑body decay

- main07.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 Python/Matplotlib/Pyplot solution.

### UMEPS

- main86.cc: do unitarised ME+PS (UMEPS) merging, with HepMC event output. Input settings are provided by the `main86.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe` and `w_production_tree_2.lhe`. The program will produce positively and negatively weighted events. See UMEPS Merging for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Uncertainty bands

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

### UNLOPS

- main88.cc: do unitarised NLO+PS (UNLOPS) merging, with inclusive NLO input, and with HepMC event output. Input settings are provided by the `main88.cmnd` file. This example program allows the consistent use of input Les Houches events that are regularised with only very minimal cuts, similar to `main85.cc`. The example program can be used with the tree-level input files `w_production_tree_0.lhe`, `w_production_tree_1.lhe`, `w_production_tree_2.lhe` and the inclusive POWHEG input files `w_production_powheg_0.lhe`, `w_production_powheg_1.lhe`. The program will produce positively and negatively weighted events. See NLO Merging (UNLOPS section) for further details.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### UPC

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

### Userhooks

- main10.cc: illustration how userHooks can be used interact directly with the event-generation process.
- main10.py: a Python interface equivalent of `main10.cc`. Provides an example of how to derive PYTHIA classes in Python.
- main17.cc: shows (a) how to use UserHooks to regularize onium cross section for pT → 0, and (b) how decays could be handled externally.
- main62.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 `main62.cmnd`.
- main63.cc: exemplifies how a user hook can be used to enhance the rate of rare emissions in the shower.
- main89.cc: do matching/merging according to five alternative methods, simply by choosing which `.cmnd` file to read: `main89ckkwl.cmnd` for CKKW-L, `main89fxfx.cmnd` for FxFx, `main89mlm.cmnd` for MLM, `main89umeps.cmnd` for UMEPS, and `main89unlops.cmnd` for UNLOPS.

### Vertex spread

- main23.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

- main200.cc: Basic VINCIA example program for hadronic Z decays at LEP.
- main201.cc: Comparison of VINCIA and Pythia on inclusive jets at LHC, with option to run the two generators in parallel using OpenMP.
- main202.cc: VINCIA setup for ttbar production at LHC, with measurement of run time and options to switch various shower and MPI/hadronisation components on/off via command file.
- main300.cc: Allows to steer Pythia from the command line and can produce HepMC files and allows for OpenMP parallelization. More documentation can be obtained by executing `./main300 --help`. The input file main300.cmnd further illustrates the use of DIRE.

### Z production

- main02.cc: a simple study of the pT spectrum of Z bosons at the Tevatron. (Brief example fitting on one slide.)
- main61.cc: exemplifies the generation of hard diffractive processes.