Sample Main Programs
Descriptions of available classes, methods and settings are all
very good and useful. Ultimately they are necessary for you to
be able to fine-tune your runs to the task at hand. To get going,
however, nothing helps like having explicit examples to study.
This is what is provided in the examples
subdirectory,
along with instructions how they should be run:
main00.cc
: does not exist, but it has been defined
in the Makefile
, so this name could be used for a simple
first test run.
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.
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.
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.
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.
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.
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.
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.
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.
main17.cc
: shows (a) how to use UserHooks to
regularize onium cross section for pT → 0, and (b) how decays
could be handled externally.
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.
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.
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
.
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.
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.
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.
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.
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.
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.
main30.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.
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.
main35.cc
: demonstrates how to generate quarkonia
events with the external HelacOnia package interfaced to Pythia, and
compare results with the internal implementation.
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.
main39.py
: standalone Python code that parses the XML
particle database and displays data for a requested particle.
main40.cc
: calculates the inclusive branching fractions
for the Standard Model Higgs into quarkonia using the LETO timelike parton
shower.
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.
main46.cc
: an example illustrating the generation of
HepMC events using the HDF5 LHA format (LHAHDF5).
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
.
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.
main61.cc
: exemplifies the generation of hard
diffractive processes.
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 rare emissions can be
enhanced in the shower.
main64.cc
: exemplifies how LHEF version 3 events can
be written on an external file.
main68.cc
: exemplifies hard diffraction in the
context of a photon-inside-lepton beam, like a HERA.
main69.cc
: exemplifies how to generate all relevant
contributions for charged particle spectra in photon-photon and
photon-proton collisions.
main70.cc
: exemplifies how to provide an external
photon flux for photo-production processes.
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.
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.
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.
main76.cc
: simple setup for Dark Matter production
in several different scenarios, as specified in
main76.cmnd
, notably with long-lived particle
signatures.
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.
main78.cc
: demonstrates how to generate different
types of photon-initiated dilepton events in proton-proton
collisions.
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.
main91.cc
: shows how ROOT can be used for
histogramming in a program that for the rest is structured like a
normal PYTHIA run.
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.
main94.cc
: use ROOT to visualize the particles
produced by Pythia in (y,phi)-space.
main95.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).
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.
main103.cc
: shows how to use a filter to select a
specific final state from resonance decays.
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.
main121.cc
: set up automatic uncertainty band
variations to PDFs and factorization and renormalization scales.
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.
main156.cc
: perform parameterization of hadron
widths and output the resulting tables.
main157.cc
: generate tetraquarks from the
rescattering of a D0 and Dbar*0 beam.
main158.cc
: generate tetraquarks from the
rescattering of D0 and Dbar*0 mesons produced in LHC
events.
main161.cc
: gives an example of
PythiaParallelism
usage. This program is equivalent to
main01.cc
, but does event generation in parallel.
main162.cc
: equivalent to main161.cc
,
but is much more heavily commented to give more in-depth explanations
of how the code works.
main162.py
: a Python interface equivalent of
main162.cc
.
main163.cc
: perform analyses in parallel using the
Parallelism:processAsync
setting.
main171.cc
: three scenarios for Hidden Valley particle
production, with a selection of further possible variations.
main181.cc
: plot PDFs for a large number of hadrons.
main182.cc
: test switching between hadron beams on an
event-by-event basis. Compare running times for different scenarios.
main183.cc
: simple example of how Pythia can be used to
simulate a basic hadronic cascade in the atmosphere.
main184.cc
: as main183.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.
main185.cc
: an even simpler example of one collision
or decay at a time, as performed in PythiaCascade
.
main200.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.
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.
main203.cc
: VINCIA setup for electroweak shower off
high-pT dijets at LHC. The VINCIA EW shower requires hard-process
partons with assigned helicities. This is done via Pythia's MG5
matrix-element interface, which this example also shows how to build
and link.
main204.cc
: demonstrates the example of
main201
using parallelism framework.
main280.cc
: do CKKW-L merging with the VINCIA sector
shower with HepMC2 output to use in RIVET analyses. Also redirects all
Pythia output to a log file to reduce terminal output.
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.
main333.cc
: illustrates the use of UserHooks to veto
events after hadronization, but before any subsequent processes such
as rescattering or Bose-Einstein.