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 sakuma@bnl.gov.

Introduction

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
./a.out

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

and

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%
guarantees".

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