# Difference between revisions of "PYTHIA"

## Documentation on PYTHIA:

#### Pythia processes important in ep

Subprocess # Description
soft VMD
V N → V N 91 elastic VMD
V N → V X 92 single-diffractive VMD
V N → XN 93 single-diffractive VMD
V N → XX 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
DIRECT
γ∗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

## Running PYTHIA

the code can be found on the afs directory for EIC at BNL

"/afs/rhic.bnl.gov/eic/PACKAGES/PYTHIA-RAD-CORR"


this is code is based on PYTHIA 6.4.13 and was modified to include radiative corrections using RadGen.
The main program is in the same directory and called pyMaineRHIC_v1.f, several other routines are needed which are in the same directory.
The executable is in the same directory and called pythiaeRHIC
There are several steer files (named: input.data. XXXXX.eic) provided in this directory to run PYTHIA and get reasonable output

### How to Run the Code

 pythiaeRHIC < input.data_noradcor.eic > XXX.log


input.data_noradcor.eic is one of the steer file examples in the directory to run PYTHIA 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"

• create a directory called radgen in the area you want to run the code
• you either need to generate the lookup table for your cuts and beam energy settings first
    pythiaeRHIC < input.data_make-radcor.eic

• or you can use one of the files already generated

the directories are in

  "/afs/rhic.bnl.gov/eic/PACKAGES/PYTHIA-RAD-CORR"


• to run the code than 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


### Output file structure

the output file is in a text format which has the following structure.

• 1st line: PYTHIA EVENT FILE
• 2nd line: "============================================"
• 3rd line: information which is valid for the event
 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: now start the track wise information.
 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

• Xth line "=============== Event finished ==============="

the information from line 3 to X repeats for each event.

### How to analyze events

• create a root tree

there are root macros available to convert the output txt-files into root trees.
Details how to run the macros can be found [here]

##### MC normalization

to normalize your counts to cross section you need two informations

• the total number of trials (NGEN(0,3)), it is printed to the screen/logfile if PYTHIA finishes
• the total integrated cross section (PARI(1)), the unit is microbarn (10^-6), it is printed to the screen/logfile if PYTHIA finishes
==> count * total integrated cross section /total number of trials


to calculate the corresponding luminosity

==> total number of trials/ total integrated cross section


the code implemented in PTHIA to calculate radiative corrections is called RADGEN
The writeup on it can be found here [hep-ph/9906408]
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