In the previous two sections, the physics processes and the event-generation schemes of PYTHIA have been presented. Here, finally, the event-generation routines and the common-block variables are described. However, routines and variables related to initial- and final-state showers, beam remnants and underlying events, and fragmentation and decay are relegated to subsequent sections on these topics.
In the presentation in this section, information less important for an efficient use of PYTHIA has been put closer to the end. We therefore begin with the main event generation routines, and follow this by the main common-block variables.
It is useful to distinguish three phases in a normal run with PYTHIA. In the first phase, the initialization, the general character of the run is determined. At a minimum, this requires the specification of the incoming hadrons and the energies involved. At the discretion of the user, it is also possible to select specific final states, and to make a number of decisions about details in the subsequent generation. This step is finished by a PYINIT call, at which time several variables are initialized in accordance with the values set. The second phase consists of the main loop over the number of events, with each new event being generated by a call to either PYEVNT or PYEVNW (depending on which underlying-event and parton-shower framework is desired; below we shall often not make the distinction explicit, referring to both routines by PYEVNT generically). This event may then be analysed, using information stored in some common blocks, and the statistics accumulated. In the final phase, results are presented. This may often be done without the invocation of any PYTHIA routines. From PYSTAT, however, it is possible to obtain a useful list of cross sections for the different subprocesses.