From EIC
Jump to navigation Jump to search

Overview of PYTHIA:

  • For e-p collisions only versions of PYTHIA 6.4 can be used, the absolute latest version 6.4.28 is installed and all improvements are integrated.
  • Over the years we have implemented many changes to PYTHIA to correct some problems we found and to integrate some eA physics. All is documented here in PYTHIAChanges

Pythia8 does not yet fully support e-p collisions.

Pythia processes important in e-p

Subprocess # Description
soft VMD
V N → V N 91 elastic VMD
V N → X N 92 single-diffractive VMD
V N → V X 93 single-diffractive VMD
V N → X X 94 double-diffractive VMD
V N → X 95 soft non-diffractive VMD low-pT
QCD 2→2
  96 semihard QCD 2→2
RESOLVED (hard VMD and anomalous)
qq → qq 11 QCD 2 → 2(q)
q qbar → q qbar 12  
q qbar → gg 13  
gq → gq 28  
qg → qg 28 QCD 2 → 2(g)
gg → q qbar 53  
gg → gg 68  
γ∗q → q 99 LO DIS
γ∗T q → qg 131 (transverse) QCDC
γ∗L q → qg 132 (longitudinal) QCDC
γ∗T g → q qbar 135 (transverse) PGF
γ∗L g → q qbar 136 (longitudinal) PGF

VMD: Vector Meson Dominance, describing the elastic diffractive production of Vector Mesons. QCDC: QCD-Compton, radiation of a gluon from incoming or outgoing quark lines. PGF: Photon Gluon Fusion.


pythiaeRHIC is the EIC science task force's programme for running PYTHIA. It is based on PYTHIA 6.4.28 and was modified to include radiative corrections using RADGEN. The main programme can be viewed here. Installations can be found under the EIC AFS directory, numbered by version. e.g. version 1.0.0 is located at


The code can also be checked out from the EIC Subversion repository. To check out a particular version e.g. 1.0.0, do:

svn checkout pythiaeRHIC

To check out the version with the latest updates, do:

svn checkout pythiaeRHIC

It is compiled using configure and make. Building the programme generates an executable named pythiaeRHIC, plus shared libraries for PYTHIA and RADGEN. Input is provided by a steer file, an example of which is included with the distribution (see below for the location of more examples). Output can be produced in a ROOT tree format, described here, or an ASCII file, described below. See the included README for further instructions on building and running.

Original version

The original version of the code supported ASCII output only, but is the same in physics content (e.g. supporting radiative corrections). An installation is located at


This directory contains several example steer files, named " XXXXX.eic", which also work with the new code. There are also generated RADGEN lookup tables. Here are example files for eAu and ep. The main program, named pyMaineRHIC.f, can be viewed here. Several other routines are needed, which are in the same directory.

ASCII output file structure

The output file text format has the following structure:

  • 1st line: "PYTHIA EVENT FILE"
  • 2nd line: "============================================"
  • 3rd line: Information on event wise variables stored in the file
I: 0 (line index)
ievent: eventnumber running from 1 to XXX
genevent: trials to generate this event
subprocess: pythia subprocess (MSTI(1)), for details see table above
nucleon: hadron beam type (MSTI(12))
targetparton: parton hit in the target (MSTI(16))
xtargparton: x of target parton (PARI(34))
beamparton: in case of resolved photon processes and soft VMD the virtual photon has a hadronic structure. This gives the info which parton interacted with the target parton (MSTI(15))
xbeamparton: x of beam parton (PARI(33))
thetabeamparton: theta of beam parton (PARI(53))
truey, trueQ2, truex, trueW2, trueNu: are the kinematic variables of the event.
If radiative corrections are turned on they are different from what is calculated from the scattered lepton.
If radiative corrections are turned off they are the same as what is calculated from the scattered lepton
leptonphi: phi of the lepton (VINT(313))
s_hat: shat of the process (PARI(14))
t_hat: Mandelstam t (PARI(15))
u_hat: Mandelstm u (PARI(16))
pt2_hat: pthat^2 of the hard scattering (PARI(18))
Q2_hat: Q2hat of the hard scattering (PARI(22)),
F2, F1, R, sigma_rad, SigRadCor: information used and needed in the radiative correction code
EBrems: energy of the radiative photon in the nuclear rest frame
photonflux: flux factor from PYTHIA (VINT(319))
nrTracks: number of tracks in this event, includes also virtual particles
  • 4th line: "============================================"
  • 5th line: Information on track wise variables stored in the file
I: line index, runs from 1 to nrTracks
K(I,1): status code KS (1: stable particles 11: particles which decay 55; radiative photon)
K(I,2): particle KF code (211: pion, 2112:n, ....)
K(I,3): line number of parent particle
K(I,4): normally the line number of the first daughter; it is 0 for an undecayed particle or unfragmented parton
K(I,5): normally the line number of the last daughter; it is 0 for an undecayed particle or unfragmented parton.
P(I,1): px of particle
P(I,2): py of particle
P(I,3): pz of particle
P(I,4): Energy of particle
P(I,5): mass of particle
V(I,1): x vertex information
V(I,2): y vertex information
V(I,3): z vertex information
  • 6th line: "============================================"
  • 7th line: event information for first event
  • 8th line: "============================================"
  • 9th to X-1 line: trackwise info of 1st event
  • Xth line "=============== Event finished ==============="

The first six lines form the file header, while the information from line 7 to X repeats for each event. A ROOT file can be generated from the ASCII file using the BuildTree routine. The produced tree is equivalent to that produced directly by pythiaeRHIC.


ROOT supports an interface to PYTHIA via the class TPythia6. This allows PYTHIA to be configured, run and analysed from within a ROOT session, which can be a more convenient than using PYTHIA as a separate programme. The EIC installations of ROOT support TPythia6, but be aware that the version of PYTHIA interfaced with ROOT is the "vanilla" distribution, and hence lacks the EIC additions. If you require these for your analysis you should only use the standalone pythiaeRHIC program me.
This means you miss:

  • the possibility for radiative corrections
  • a correct treatment of the pt of the remnant
  • all the improvements to the VMD model in PYTHIA to describe the HERA exclusive VM data
  • the possibility to run with nuclear PDFs

Using pythiaeRHIC

How to Run the Code

1) without radiative corrections

Use redirection to input a steer file to configure pythiaeRHIC's behavior [and optionally direct messages to a log file]:

 pythiaeRHIC < input.data_noradcor.eic [ > XXX.log ]

The "input.data_noradcor.eic" steer file is one of the steer file examples, with settings tuned for Hermes, and/or H1 and ZEUS. If you want to run only elastic vector meson production the example steer file is "input.data_noradcor.VM.eic"

2) with radiative corrections

  • Create a directory called radgen in the area you want to run the code.
  • Either generate the lookup table for your cuts and beam energy settings first…
    pythiaeRHIC < input.data_make-radcor.eic
  • …or use one of the files already generated, located here:

Files are named "radgen(electron beam energy)x(proton beam energy)", for example "radgen10x100" or "radgen4x100".

  • To run the code with radiative corrections simply change the steer file to either input.data_radcor.eic or input.data_radcor.VM.eic and type
pythiaeRHIC < input.data_radcor.eic > XXX.log

Monte Carlo normalization

To normalize your counts to a cross section you need two pieces of information:

  1. the total number of event trials, NGEN(0,3), which is printed to the screen/logfile when PYTHIA finishes.
  2. the total integrated cross section, PARI(1), printed in microbarn (10-6) to the screen/logfile when PYTHIA finishes.

Both these values are also written to the output ROOT file as TObjStrings. Recall that

Counts = Integrated Luminosity x Cross Section. The cross section represented by some event count is

count * total integrated cross section / total number of trials

To calculate the corresponding luminosity represented by the generated events

Luminosity = total number of trials / total integrated cross section

Documentation on Radiative Corrections

The code implemented in PYTHIA to calculate radiative corrections is called RADGEN. The writeup on it can be found here. The following steps have been done to implement it in PYTHIA:

  • change the subroutine pygaga.f so it calls RADGEN after you have thrown y and Q2
  • get the true y and Q2 from RADGEN and the radiated photon
  • Pythia will continue to now generate an event based on this y and Q2
  • Pythia still operates under accept reject, the extra weigt from the radiative corrections is absorbed in the flux factor

Additional Info on radiative corrections

Webpages with codes:

Other references: M. Arneodo, (Turin U. & INFN, Cosenza) , A. Bialas, (Jagiellonian U.) , M.W. Krasny, (Paris U., VI-VII & Paris U., VI-VII) , T. Sloan, (Lancaster U.) , M. Strikman, (Penn State U.) . Sep 1996. 40pp. To be published in the proceedings of Workshop on Future Physics at HERA, Hamburg, Germany, 25-26 Sep 1995. In *Hamburg 1995/96, Future physics at HERA* 887-926. e-Print: hep-ph/9610423 and the references 5 and 6 in this article to find them check [here]