Select a PDFset for pythia6 inside Root

I am using Pythia6 inside Root to generate and analyse some physics events. I wanted to use external PDFSets from LHAPDF, that I also installed. The problem is that I do not know exactly how to link these together. When I run my program in Root, it always ends in the first event:

Event => 0
Error: you did not link PDFLIB correctly.
Dummy routine PDFSET in PYTHIA file called instead.
Execution stopped!

I also tried to use the initPDFSet() function, as I saw in some examples, but it failed compilation.
This is how I did it:



#include </[mypath]/LHAPDF_5.4.1/include/LHAPDF/LHAPDF.h>

int makeEventSample(Int_t nEvents, Int_t code){

// Create an instance of the Pythia event generator …
TPythia6* pythia = new TPythia6;

LHAPDF::initPDFByName("/[mypath]/LHAPDF_5.4.1/share/lhapdf/PDFsets/GRV98lo.LHgrid", 0);

Is there something obviously wrong?
Is there a good example somewhere of how to use this all together?
Thank you for your help,


the simple way of building PYTHIA6, that you can find in the “Installing ROOT from Source” web page, produces a misbehaving library, I believe.

You should compile PYTHIA6 using Robert Hatcher’s “” script (note that, in order to replace dummy PDFSET, STRUCTM and STRUCTP routines, you should have CERNLIB “pdflib[804]”, “mathlib” and “kernlib” libraries installed and set the “CERNLIB” or “CERNLIBS” or “CERN_DIR” or “CERN_ROOT” environment variable in advance):

It is also described here (see “PYTHIA6 and ROOT/PYTHIA thin wrapper library” and “ROOT Class Libraries” in the bottom of the following page): … n_ext.html

Note however that, the default PYTHIA6 version set in the “” script is 6.4.22 or 6.4.12, while the newest code is 6.4.24 (don’t forget to call the script with an appropriate “6.4.24” parameter, then):

One final note. If you get an error saying …

[…] > sh 6.4.24
version 6.4.24 major 6 minor 4 tiny 24
fsplit.c: In function ‘main’:
fsplit.c:144: error: too few arguments to function ‘getline’
fsplit.c: In function ‘getline’:
fsplit.c:234: error: number of arguments doesn’t match prototype
/usr/include/stdio.h:651: error: prototype declaration

… just edit the file “v6_424/src/fsplit.c” and replace two occurrences of “getline” with “get_line” and then re-run the “sh 6.4.24” command.

I am stupid. No?
Pepe Le Pew.

Hi All,
A third party directed me towards this thread. I have fixed the “fsplit.c” issue and bumped the default pythia6 version to v6_424.

To clarify about the dummy routines (PDFSET, STRUCTM and STRUCTP), these are the interfaces that CERNLIB’s pdflib[804] supplies. The same interface (PDFSET, STRUCTM and STRUCTP) is supplied by LHAPDF which for GENIE neutrino MC generator is now the preferred parton distribution function library. If you build pythia6 without removing these dummies then they’ll hide those found in pdflib/LHAPDF and you end up with the dreaded:

Now when I wrote LHAPDF wasn’t in the picture, so it only auto-tests for the existence of CERNLIB’s pdflib when deciding how to handle the dummy routines. If you are exclusively using LHAPDF (and don’t have CERNLIB) then you should supply the argument:

to force their removal. There are other command options described in the header comments to the script.
At the time the script is run the environment variable $ROOTSYS should exist.

I believe there is one more thing that should be said explicitly.

If you want to use PDFLIB interface routines from LHAPDF (instead of these coming from CERNLIB “pdflib[804]”), you should make sure that the “” script will NOT find CERNLIB libraries.
In order to achieve it, make sure that you do NOT define any of “CERNLIB”, “CERNLIBS”, “CERN_DIR”, “CERN_ROOT” environment variables.
Observe the screen output from this shell script, around the 5th line in the beginning (when you run “sh --dummies=remove”).
If you see “### unable to locate library: pdflib[804] mathlib kernlib”, it means that dummy routines have been completely removed (and the next line should NOT say “### revert to keeping dummy PDFSET, STRUCTM and STRUCTP”, of course).
If you see “will attempt to resolve removed dummies with CERNLINK =”, it means that the dummy routines are being replaced with non-dummy routines using found libraries (“pdflib[804]”, “mathlib” and “kernlib”) listed in the next screen output line.

A pitiful case, am I not?
Pepe Le Pew.


I have made as said above and installed pythia6.4.28 and it works fine with root, but when I use a tune that needs an external PDF (like tune 343) I get the following message:

/sampa/soft/HEPUtils/root/v5-30-00/bin/root.exe: symbol lookup error: /sampa/soft/HEPUtils/pythia/pythia6.4/v6_428/lib/ undefined symbol: pdfset_

Could someone please give me any help?