Madgraph NLO capable installation

This tutorial will help you with the installation and usage of Madgraph in the Lxplus machines at CERN. It was developed to be able to run NLO production with LHAPDF and PYTHIA8 interface.

Things you will need

Download and copy all of the following tools into a folder in Lxplus. For this tutorial it is assumed that your working folder is:

Whenever you see this folder path in the tutorial, you should replace it with your own working folder.

  • Madgraph source code, download available here. Version used for this tutorial: MG5_amc_v2.4.0
  • LHAPDF source code, download available here. Version used for this tutorial: LHAPDF-6.1.6
  • The PDF set of your choice, downloads available here. For this tutorial, PDF4LHC15_nlo_mc_pdfas was used.
  • PYTHIA8 source code, download available here. Version used for this tutorial: pythia8219

Global configuration

In order to be able to compile and run Madgraph a specific combination of compilers and tools have to be prepared. The combination that works with the program versions described in this tutorial are in the GLOBAL CONFIGURATION section in but this may change or become unavailable in the future. If such a combination doesn't work for you the rules to follow are :
  1. Same gcc and python version for every tool.
  2. Only python 2.6 and 2.7 versions are supported by current madgraph version.
  3. gfortran/gcc version has to be 4.6 or higher.
In order to prepare the configuration the easiest way is to source the script each time you intend to compile a tool or use madgraph. You may also copy the global configuration section into your .bash_profile but it may interfere whenever you configure other ATLAS environments, such as athena. For this tutorial, simply download and copy into your madgraph folder.

Madgraph installation

Log into Lxplus, cd into your madgraph folder, source the script and unpack madgraph
cd work/madgraph
tar -xvvf MG5_aMC_v2.4.0.tar.gz

At this point you will be able to run NLO production, without LHAPDF or PYTHIA8 interface. Launch Madgraph:

cd MG5_aMC_v2_4_0

Now, run a simple NLO production within madgraph (I've chosen t t ~ as an example).

MG5_aMC>generate p p > t t~ [QCD]
MG5_aMC>output tutorial_ttbar_nlo

After launch you will get two configuration prompts, write done and press enter to skip each of them. By default the order should be set to NLO and shower should be set to ON. This will run NLO production and shower the events with HERWIG6, which is available out of the box.

If everything was configured properly, madgraph will install several tools and launch the NLO production, it may take a while. After it has finished running, you may want to add the tools it has just installed to the configuration script (simply uncomment the 3 first lines in the local configuration section and substitute the path with your own). This is not mandatory in most cases but it will avoid issues if multiple madgraph installations are used in parallel.

LHAPDF installation

Start from a clean Lxplus login. Unpack, configure and install. For the configure step, replace your own path to the lhapdf_installed folder and, if you have changed the Boost version from the one recommended in this tutorial, replace it too.

cd work/madgraph
tar -xvvf LHAPDF-6.1.6.tar.gz
mkdir lhapdf_installed
cd LHAPDF-6.1.6

./configure --with-boost=/afs/ --prefix=/afs/

make -j8
make install

LHPDF is shiped without pre-installed pdf sets. You will need to copy and unpack each set into:

As an example, for the pdf set indicated previously in this tutorial do the following, starting within your madgraph folder.
cd /afs/
cp PDF4LHC15_nlo_mc_pdfas.tar.gz lhapdf_installed/share/LHAPDF/
cd lhapdf_installed/share/LHAPDF/
tar -xvvf PDF4LHC15_nlo_mc_pdfas.tar.gz

Now you'll need to add the LHAPDF installation to your configuration file. If you are using the script, simply uncomment the necessary lines, three last lines in the script, and replace your own working directory when necessary.

Testing LHAPDF

You will need to made a modification in the madgraph run_card.dat that was created in the madgraph installation step. This step created a folder from where you can re-run the same production without having to generate it again. Start again from a clean Lxplus login.
cd work/madgraph/
cd MG5_aMC_v2_4_0/tutorial_ttbar_nlo

Edit the file

Look for the lines
nn23nlo = pdlabel ! PDF set
 244600  = lhaid   ! If pdlabel=lhapdf, this is the lhapdf number. Only

And replace them with:
lhapdf = pdlabel ! PDF set
90000  = lhaid   ! If pdlabel=lhapdf, this is the lhapdf number. Only

The first line tells madgraph to use lhapdf and the second one specifies which pdf set to use. To know the correct lhaid to use for a specific pdf set, go here.

Finally, to re-run the generation:

You will get an error if LHAPDF is not properly installed or configured.

PYTHIA8 installation

Start from a clean Lxplus login. Unpack, configure and install. Replace the HepMC path for the proper one if you are using a different version that the one specified in this tutorial.
cd work/madgraph
tar -xvvf pythia8291.tgz
cd pythia8219
./configure --enable-shared --enable-64bit --with-hepmc2=/afs/
make -j8

It is necessary to modify the madgraph configuration file so that it knows where to find pythia:

cd ../MG5_aMC_v2_4_0

Edit the file

Look for the line containing

and replace it with
pythia8_path = /afs/

Testing PYTHIA8

Once again, you will need to make a modification into the run_card.dat. Follow the instructions here to edit the file.

Look for the line
HERWIG6   = parton_shower

And replace it with:
 PYTHIA8 = parton_shower 

Finally, to re-run the generation:

Make sure that shower is set to ON (Otherwise, no showering will be done and you won't test the pythia installation). You will get an error if PYTHIA8 is not properly installed or configured.

-- HectordelaTorre - 07 Jul 2016
Topic revision: r2 - 11 Jul 2016, HectordelaTorre

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback