tutorial:madgraph

This is an old revision of the document!


You have to install MG5 in your home directory.

Initial setup - install CMSSW and MG5 from launchpad

mkdir -p ~/work/MG5
cd ~/work/MG5
wget https://launchpad.net/mg5amcnlo/2.0/2.6.x/+download/MG5_aMC_v2.6.0.tar.gz
tar xzf MG5_aMC_v2.6.0.tar.gz

Setup the devtoolset to use updated gcc and python.

# source /opt/rh/devtoolset-4/enable
# source /opt/rh/python27/enable
cd MG5_aMC_v2_6_0

Install missing tools.

bin/mg5_aMC
#MG5_aMC> install update
MG5_aMC> install zlib; install boost;
MG5_aMC> install lhapdf6; install hepmc;
MG5_aMC> install oneloop; install ninja;
MG5_aMC> install pythia8
MG5_aMC> install collier
MG5_aMC> quit

Open the fortran source code HEPTools/oneloop/OneLOop-3.6/src/avh_olo_print.f90 and modify the line 61, replace real(kindr2) to double precision (in the printr function). This is because of a gfortran bug. See https://bugs.launchpad.net/mg5amcnlo/+bug/1631604 and https://answers.launchpad.net/mg5amcnlo/+question/268548#16

  double precision :: xx     !|RCTYPE=intrinsic
!  real(kindr2) :: xx     !|RCTYPE=intrinsic

and compile the package

cd HEPTools/oneloop/OneLOop-3.6
./clean.sh
./create.py
\cp libavh_olo.a ../

First step is to build missing library boost-iostreams.

if [ ! -f HEPTools/lib/libboost_iostreams.so ]; then
  cd HEPTools/boost/boost_1_59_0
  ./bootstrap.sh --with-libraries=iostreams
  ./b2
  \cp stage/lib/* ../lib/
  cd ../..
  cd lib
  for i in ../boost/lib/libboost_iostreams*; do ln -s $i; done
  cd ../..
fi

Then add the following lines to fix build flags https://answers.launchpad.net/mg5amcnlo/+question/659847

sed -i "s;PYTHIA8_PATH=NotInstalled;PYTHIA8_PATH=`pwd`/HEPTools/pythia8;g" Template/LO/Source/make_opts
sed -i 's;OUT+=" -ld";OUT+=" --libs";g' HEPTools/bin/pythia8-config
sed -i 's;OUT+=" -ld";OUT+=" --libs";g' HEPTools/pythia8/bin/pythia8-config

enable lhapdf6 for all of your generation (download other PDFSets depending on your needs)

cd HEPTools/lhapdf6
bin/lhapdf get NNPDF23_lo_as_0130_qed

Then you will be able to start the generation.

./bin/mg5_aMC
MG5_aMC> generate p p > t t~ [QCD]
MG5_aMC> output ttNLO
MG5_aMC> launch

You can rerun the shower program.

cd ttNLO
bin/shower run_01

If you run the MG5 at the leading order, LHAPDF is required during the runtime, related on systematics. Set the environmental variables before running the mg5_aMC (or put into your .bashrc file) to prevent such a problem.

export PYTHONPATH=YOUR_MADGRAPH_PATH/HEPTools/lhapdf6/lib64/python2.7/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH=YOUR_MADGRAPH_PATH/HEPTools/lhapdf6/lib:$LD_LIBRARY_PATH

To speed up the parton shower step, you can set nsplit_jobs=10 in the shower_card.dat

The default setup is multicore-mode, but also you can use thecluster mode if you have to produce lots of events. Edit the madgraph/various/cluster.py file first (line 1286), since the default submission script is not fit with the HTOP cluster. (see https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/General-Scripts#no1)

        command = ['qsub','-o', stdout,
                     '-S', '/bin/bash',
                     '-N', me_dir,
                     '-e', stderr,
                     '-V']

and add the following lines to your configuration file, input/mg5_configuration.txt

cluster_type = sge
cluster_size = 96

and run with –cluster option

bin/generate_events --cluster

But in this case, you should not run delphes automatically because multiple delphes sessions will make a crash.

  • tutorial/madgraph.1544522704.txt.gz
  • Last modified: 2023/03/06 13:44
  • (external edit)