How to install Pythia 8 and Fastjet on Linux

on Sunday, June 12, 2011
This is a tutorial about how to install Pythia 8 and Fastjet. After that i have explained two methods to link pythia8 to fastjet. I have tried to keep it simple and easy so that first time linux users can also understand it.


First of all you need to install g++ if you don't have yet.
For Ubuntu, Debian, Mint :


sudo apt-get install g++


For Redhat, Scientific Linux, Fedora:


yum install g++ 


You can also install that using source file or rpm. 


Now we will install Pythia8 and Fastjet.


Pythia 8 :


1. Download the file pythia8150.tgz (or pythia81xx.tgz) to a suitable location from its website .
2. Now to extract it open your terminal. Move to the directory where you have placed the pythia81xx.tgz after downloading. If you have placed that in your "software" (/home/username/software/ ) folder, then you can do this by :


 cd software


After moving to that directory excract that file with


tar xvfz pythia8150.tgz

Then it will create a directory. Now move to the directory by the command


cd pythia8150


Now type these commands (and press enter) step by step:


 ./configure
 make  


You have installed Pythia8 !


Fastjet


At first visit Fastjet website and download the source file which looks like " fastjet-x.x.x.tar.gz " where x.x.x represents version number.  Now follow the earlier steps to like Pythia8 to extract the source file. Rename it as "fastjet". Now move into the folder fastjet. The type the following commands(and press enter) step by step.


./configure
make
make install


You have installed fastjet !


Linking Pythia 8 to Fastjet :


Open your holy terminal once again. Move to the Pythia directory as you did earlier. Now move to the directory " examples " with command " cd examples". Then type the command and hit enter:


./configure --with-fastjet=/your-fastjet-directory-path/


Generaly the directory path is like : /home/username/something-or-not/fastjet/


If its successful then in terminal you will see something like " found fastjet version 2.4.3 " .


Done ! Now, from you from your pythia directory open pythia worksheet (a pdf file ) and it will guide you to the compilation process. But if you follow this process you may have to keep your source file in the examples folder and in the terminal you need to move to the "examples" directory with "cd" command to run and compile those programs. But there is another way. Check out the method below.


MakeFile :


If you want to keep your cpp source files, compile and run from some other folders then you need a Makefile in the directory where you want to compile and run. Download the file below .


 Makefile


Then follow the three steps below.


1. Change the value of  PYTHIADIR and FASTJETDIR . Set your own directory path of pythia and fastjet.


2. At the end of the file you will find a code


g++  -o  jet  jet.cc  


Replace those red colored names with your source file's name.


3. In your source file instead of  " Pythia pythia; " you need to type
 Pythia pythia("/home/mushfiq/collider/pythia8150/xmldoc") ;
You need to change the red colored path as your own.


Now from the terminal move to the directory where you have placed the source file (say jet.cc) and the Makefile. Now type "make" and hit enter.  Done !  To get the output  of  jet.cc we can use :




./jet > jet.out 


Now output is saved in jet.out . You can click on the file to open or simply type in terminal "gedit jet.out " and hit enter. BTW, if you use this method with Makefile then you don't even need to link pythia to fastjet with ./configure --with-blah-blah ... !


Ahh! We are done ! 
N.B.  I am not an expert of these stuffs. There may be better ways. But this is just how i fixed mine.

8 comments:

Shomoita Alam said...

Hey...  Tagged you!  Check out, receive the award and write the post... :)

My Favourites

Mushfiq said...

Thanks a lot :D

Royer said...

very useful. Thanks

Mushfiq said...

You are welcome ! :)

namrata manglani said...

very useful thanks ....could u please help for linking root also ???

Mushfiq said...

hey, can't help with root, sorry! I haven't used it and in a different field now

namrata manglani said...

makefile part is not working could u help ?

Mushfiq said...

Make sure your directory paths and code name (g++ ...) are correct. Otherwise it should work. I did it 4 years ago. Can't remember much