## Program Files

The code is subdivided into a set of files, mainly by physics task. Each file typically contains one main class, but often with a few related helper classes that are not used elsewhere in the program. Normally the files come in pairs.

- A header file, `.h` in the `include` subdirectory, where the public interface of the class is declared, and inline methods are defined.
- A source code file, `.cc` in the `src` subdirectory, where most of the methods are implemented.

During compilation, related dependency files, `.d`, and compiled code, `.o` are created in the `tmp` subdirectory.

In part the `.xml` documentation files in the `xmldoc` subdirectory have matching names, but the match is broken by the desire to group topics more by user interaction than internal operation. On these pages the function of the different code files is summarized. Currently, each `.xml` file is also translated into an `.html` one in the `htmldoc` subdirectory, to allow easy viewing of the contents in a web browser, and an `.php` one in `phpdoc`, for more sophisticated interactivity if that subdirectory is installed on a web server.

Here is the current list of files, ordered alphabetically, with a brief description of contents.

`file` Analysis
contains routines to analyze events. Currently it can do sphericity, thrust, Lund/Jade/Durham jet clustering, cone-jet finding, and the kT, anti-kT and Cambridge/Aachen algorithms for hadron colliders.

`file` Basics
contains some basic facilities of general use: a random number generator `Rndm`, a four-vector class `Vec4`, and a histogram class `Hist`.

`file` BeamParticle
contains information on all partons extracted from one of the two beams. Defines modified parton distributions accordingly during the showering and multiparton interactions processing, thereby extending on the one-particle-inclusive distributions defined by the previous class. Finds the internal structure for a beam remnant.

`file` BeamRemnants
adds primordial kT to the set of hard subsystems, and combines these subsystems with the two beam remnants to provide the overall energy-momentum picture. Also ties together all the colour lines into consistent singlets.

`file` BeamShape
generates momentum spread of beams, and spread of collision vertex position.

`file` BoseEinstein
provides a simple method to impose Bose-Einstein correlations on pairs of identical mesons.

`file` Event
contains the event record, which basically is a vector of particles. This file also contains the `Particle` class, used by `Event`. `Pythia` uses two `Event` objects, one for the process-level record (`process`) and one for the complete event (`event`).

`file` FragmentationFlavZpT
contains the classes for describing the fragmentation steps in flavour and in longitudinal and transverse momentum.

`file` FragmentationSystems
defines some containers of parton systems, for use in the fragmentation routines.

`file` HadronLevel
turns the parton-level event above into a set of outgoing particles, by applying string fragmentation (with special treatment for low-mass systems) and secondary decays, and optionally Bose-Einstein corrections.

`file` HelicityBasics
basic classes for the handling of helicities in tau lepton decays.

`file` HelicityMatrixElements
helicity-dependent decay matrix elements for the tau lepton.

`file` HepMCInterface
contains an interface to convert the PYTHIA 8 event record into the HepMC format. The `HepMCInterface.cc` file is located in the subdirectory `hepmcinterface` and is used to build a separate `libhepmcinterface` library.

`file` HiddenValleyFragmentation
hadronization in models with a hidden sector that contains an unbroken SU(N), which gives confinement. The model and code is largely derived from the normal fragmentation classes.

`file` History
methods to reconstruct the imagined shower history of a matrix-element-generated multiparton configuration, as part of the CKKW-L matrix element merging.

`file` Info
is a simple container that gives access to some information on the nature of the current process, such as Mandelstam variables. Also contains a small database for errors and warnings encountered during program execution.

`file` LesHouches
gives the possibility to feed in parton configurations for the subsequent event generation. One base class is defined, with containers for initialization and event information, that can be read from `Pythia`. Derived classes allow for a few different cases.

`file` LHAFortran
is a header file only, for a class derived from the above LesHouches one, to be used for runtime interfacing to Fortran programs, such as PYTHIA 6.

`file` LHAPDFInterface
is a header file only, with interfaces to the key LHAPDF routines, as needed for a runtime interface. There is a file `lhapdfdummy/LHAPDFdummy.cc` with matching dummy implementations, however. This file is used to build a separate `liblhapdfdummy` library, to be linked when the LHAPDF library is not used, so as to avoid problems with undefined references.

`file` MergingHooks
intercede in the normal shower evolution to construct the relevant Sudakov form factor suppressions as part of the CKKW-L matrix element merging.

`file` MiniStringFragmentation
performs string fragmentation in cases where the colour singlet subsystem mass is so small that one or at most two primary hadrons should be produced from it.

`file` MultipartonInteractions
performs multiparton interactions.

`file` ParticleData
contains a database of all necessary particle data (masses, names, ..) and decay channels.

`file` ParticleDecays
performs the decays of all normal unstable hadrons and leptons, i.e. in mass up to and including b bbar systems. It is not intended for decays of electroweak resonances, like Z^0.

`file` PartonDistributions
contains parton distribution functions for the proton and electron. Currently very simple, with only two p parametrizations and one e ditto available, but it is possible to link in external sets.

`file` PartonLevel
turns the (hard) process above into a complete set of partons, by adding initial- and final-state radiation, multiparton interactions, and beam remnants.

`file` PartonSystems
keeps track of which partons belong to which partonic subsystem, i.e. one of the multiparton (semi)hard interactions with associated showers.

`file` PhaseSpace
selects a point in phase space for the hard-process generation, optimized separately for each process to give improved Monte Carlo efficiency.

`file` ProcessContainer
packages the information on a given subprocess, combining the phase-space selection and cross-section evaluation machineries with some statistics information. Also sets up the list of processes to be studied in a run.

`file` ProcessLevel
handles the generation of the (hard) process that sets the character of the event. This involves either using internally implemented processes or linking to Les Houches information. The latter can be by runtime interfaces or by reading in a file. This step also includes resonance decays.

`file` Pythia
is the main class, that administrates the whole event generation process by making use of all the others classes. Objects of most other classes reside (directly or indirectly) inside `Pythia`, so only a `Pythia` object needs to be explicitly instantiated and addressed by the user.

`file` PythiaComplex
is only a `.h` file, containing a `typedef` for double precision complex numbers.

`file` PythiaStdlib
contains most of the `Stdlib` headers used in PYTHIA 8, with `using` directives. It defines `M_PI` if this is not already done. Also a few simple inline methods: `pow2(x)`, `pow3(x)`, `pow4(x)`, `pow5(x)` and `pow6(x)` for small integer powers, and `sqrtpos(x)` where a `max(0., x)` ensures that one does not take the square root of a negative number. Also non-inlined `GammaReal(x)` for the Gamma function value of a real argument.

`file` ResonanceDecays
decays resonances as part of the hard-process stage, in many cases (but not all) including angular correlations between the decay products.

`file` ResonanceWidths
encodes some properties of resonances, in particular the dynamic calculation of widths.

`file` RHadrons
handles the production and decay of hadrons formed by long-lived gluinos, stops or sbottoms.

`file` Settings
contains a database of all flags, modes, parameters and words that determine the performance of the generator. Initial values are obtained from the contents of the `.xml` files, but these values can then be changed by the user.

`file` SigmaCompositeness
contains the cross sections and matrix elements for production of some particles in compositeness scenarios, specifically excited fermions.

`file` SigmaEW
contains the cross sections and matrix elements for electroweak processes involving photons, Z^0's and W^+-'s.

`file` SigmaExtraDim
contains the cross sections and matrix elements for processes in scenarios involving extra dimensions.

`file` SigmaGeneric
contains the cross sections and matrix elements for some generic processes, to be used as building blocks for a few BSM scenarios.

`file` SigmaHiggs
contains the cross sections and matrix elements for Higgs production.

`file` SigmaLeftRightSym
contains the cross sections and matrix elements for particle production in left-right-symmetry scenarios, specifically righthanded Z and W bosons and doubly-charged Higgs bosons.

`file` SigmaLeptoquark
contains the cross sections and matrix elements for leptoquark production.

`file` SigmaNewGaugeBosons
contains the cross sections and matrix elements for a Z'^0, a W^+- and a horizontal gauge boson R^0.

`file` SigmaOnia
contains the cross sections and matrix elements for charmonium and bottomonium production.

`file` SigmaProcess
contains the base class and derived classes for the evaluation of different matrix elements. Also keeps track of allowed incoming parton configurations and their cross sections, including parton densities. In order to keep this file from becoming too big, actual cross sections are found in several separate files of derived classes: `SigmaQCD`, `SigmaEW`, `SigmaOnia`, `SigmaHiggs`, `SigmaSUSY`, `SigmaNewGaugeBosons`, `SigmaLeftRightSym`, `SigmaLeptoquark`, `SigmaCompositeness`, `SigmaExtraDim` and `SigmaGeneric`.

`file` SigmaQCD
contains the cross sections and matrix elements for soft and hard QCD processes.

`file` SigmaSUSY
contains the cross sections and matrix elements for Supersymmetric processes.

`file` SigmaTotal
contains parametrizations of total, elastic and diffractive hadronic cross sections.

`file` SpaceShower
performs spacelike initial-state transverse-momentum-ordered shower evolution.

`file` StandardModel
contains the running alpha_strong, with Lambda matching at flavour thresholds, the running alpha_em, CKM mixing matrices, and a few other parameters such as sin^2(theta_W).

`file` StringFragmentation
performs string fragmentation of a given set of partons.

`file` SusyCouplings
stores the various couplings used for SUSY cross sections and decays, as calculated from input e.g. based on the SUSY Les Houches Accord.

`file` SusyLesHouches
contains information on SUSY parameters and particle data as specified by the SUSY Les Houches Accord.

`file` TauDecays
the main routines for handling tau lepton decays with helicity information.

`file` TimeShower
performs timelike final-state transverse-momentum-ordered shower evolution.

`file` UserHooks
Provides a way for a user to study the event at a few intermediate stages of evolution, to reject the event as a whole or to modify its cross-section weight.