MC production for the di-jet cross section measurements in pp collisions at 200 GeV


Originally, the MC samples generated for the inclusive jet analyses were used for the di-jet analyses. However it turns out that these samples were not sufficient for the di-jet analyses especially for unfolding the cross sections for the 2005 di-jets. To generate sufficient MC samples with available computing resources, MC generations were designed to generate events only in the region of the phase space where the di-jet events in the STAR acceptance come from.

Original MC sample

These are the distributions of pseudorapidity and scattering angle for the original MC samples. The left plots of each image is for all the generated events and the right plots are for the dijet events.

Significant portion of the dijet events come from only the regions inside the red boxes.

New MC sample

The new MC samples were generated only in those regions of the phase space from which most dijet events come.

How to run the patched PYTHIA 6 in starsim

The most of the MC production jobs that the spin PWG requested for the di-jet analysis didn't finish successfully
Patch for a bug in PYTHIA6
This page explains how to run the patched PYHIA 6 as the event generator for starsim. The starsim has a mechanism where a user can choose a specific version of Pythia to use at run time.This feature will be used.

Install shared objects for the patched PYTHIA for starsim

This tar ball contains the source files for the patched PYTHIA 6.205 and 6.4.10 in the form that fits to starsim.

Build the shared objects with the following commands.

tai@rcas6007% stardev
tai@rcas6007% tar xvfz patched_pythia_for_starsim.1.0.0.tar.gz
tai@rcas6007% cons

Two shared objects should be built in the directory $MINE_LIB.

These are loadable modules for starsim which contain the patched PYTHIA 6.205 and 6.4.10, respectively.

run starsim

This is a smple kumac file load the shared object and generated one hundred events.

tai@rcas6007% starsim
* Starting starsim NwGEANT= 20000000 NwPAW= 2000000 *
**********************pid= 22383**********************
* *
* W E L C O M E to starsim *
* *
* Version INITIAL 16 November 2006 *
* *
Workstation type (?=HELP) <CR>=1 : 0
Version 1.29/04 of HIGZ started
1***** GEANT Version 3.21/08 Released on 230697
0***** Correction Cradle Version 0.0800
***** RZMAKE. OLD RZ format selected for RZDOC
starsim > exec sample.kumac

You should be able to find the output my_pythia_file.fz if the MC production is successful.

If you have a question or comment, send email to or add comment to this page.

Patch for a bug in PYTHIA6

This patch is included in PYTHIA from PYTHIA 6.412. You don't need to apply this patch if you are using PYTHIA 6.412 or newer.

Download Patch

pythia-6.4.11-t.diff : patch for PYTHIA-6.4.11
pythia-6205-6205t.diff : patch for PYTHIA-6.205

If you need the patch for a different version of PYTHIA, email


At the end of the year 2006, The spin PWG requested the MC productions with uncommon kinematical cuts for the measurement of
the 2005 di-jet cross sections in pp collisions.

The most of the MC production jobs didn't finish successfully.
The failure is due to a bug in PYTHIA 6. This page provides a patch for the bug.

If you want to run the patched PYTHIA as the event generator for starsim, the instruction can be found at "How to run the patched PYTHIA 6 in starsim."

Bug description

PYTHIA 6 has options to generate events only a specific region of the phase space. You can specify the region in terms of various variables such as pT, y, cos(theta), s, t, u, x1, x2, and other kinematical variables. With some sets of the values for the cuts, PYTHIA 6 behaves improperly especially when cuts are applied on both pT and cos(theta) simultaneously. This is a main program that can reproduce the improper behavior.

main.f : A main program for PYTHIA 6 that reproduces the improper behavior

This main.f should be able to reproduce the bug for any version of PYTHIA between 6.2 and 6.4.11. From the version 6.4.12, this patch is included in PYTHIA.
You can compile and run for yourself with the following commands.

f77 main.f pythia-6.4.11.f

PYTHIA 6 can be found at the following websites.

With the main.f, PYTHIA will try to generate one thousand events of the pp collisions at 200 GeV in the following region of the phase space.

11.0 < pT < 15.0
-0.2 < y < 1.2
-0.6 < cos(theta) < -0.3

With the main.f, the cross section does not converge and sometime
becomes negative.
And you will also constantly get the warning like

Warning: negative cross-section fraction -2.262E+01 in event 140
ISUB = 28; Point of violation:
tau = 2.930E-02, y* = 3.735E-01, cthe = -0.5988706, tau' = 0.000E+00


Advisory warning: maximum violated by 1.505E+01 in event 243
XSEC(68,1) increased to 1.631E-01

Then, PYTHIA will gradually slow down in generating events and won't make
it to generate one thousand events within an hour on an average PC.

Patch for the bug

These are the patches for the bug for PYHIA 6.4.11 and 6.205.

pythia-6.4.11-t.diff : patch for PYTHIA-6.4.11
pythia-6205-6205t.diff : patch for PYTHIA-6.205

You can apply these patches, for example, in this way.

patch pythia-6.4.11.f < pythia-6.4.11-t.diff

Comments from the author of PYTHIA

I reported the bug and sent my patch to Torbjörn Sjöstrand, the author of PYTHIA. He responded "Thanks a lot for your input. Yes, you are right, this is a
possibility we missed so far. Will try to have your fix inserted for the next subversion. ... In retrospect the number of kinematics options grew to a level
where not all possible combinations were sufficiently tested".

In another email, I asked him if my patch is safe to use for serious physics study. Torbjörn Sjöstrand said
"So far as I can see the patch should be safe and not have any
undesirable consequences, but I could not give any 100%

The patch that I actually sent to the author is simpler than ones in the previous section.

pythia-6.4.11.diff : patch that I sent to the author of PYTHIA

In the patches in the previous section, I also modified the title logo such that it indicates that the program is modified.

Verification of the patch

I compared the cross sections computed with the original PYTHIA and the patched PYTHIA. I got a consistent result. I'll write the detail later.

How to implement the patch to Starsim

I figured out how to implement this patch in starsim.
How to run the patched PYTHIA 6 in starsim