Skip to content

Instantly share code, notes, and snippets.

@restrepo restrepo/install.sh
Last active May 30, 2018

Embed
What would you like to do?
#!/usr/bin/env bash
# Based on: https://answers.launchpad.net/mg5amcnlo/+question/271396
# Also works with http://home.thep.lu.se/~torbjorn/pythia8/pythia8219.tgz which allows to install madevent
PYTHIA_VERSION=8219 #8212
echo "========= STEP 1: install MadGraph============"
wget https://launchpad.net/mg5amcnlo/2.0/2.6.x/+download/MG5_aMC_v2.6.2.tar.gz
tar zxf MG5_aMC_v2.6.2.tar.gz
echo "========= STEP 2: install hepmc with MadGraph============"
# Delphes is not yet possible to run automatically: https://answers.launchpad.net/mg5amcnlo/+question/244938
./MG5_aMC_v2_6_2/bin/mg5_aMC << EOF
install hepmc
install lhapdf6
install Delphes
EOF
echo "========= STEP 3: install PYTHIA ============"
main=$(pwd)
hepmcinstall=${main}/MG5_aMC_v2_6_2/HEPTools/hepmc
lhapdf6install=${main}/MG5_aMC_v2_6_2/HEPTools/lhapdf6
pythiainstall=${main}/pythia${PYTHIA_VERSION}
wget http://home.thep.lu.se/~torbjorn/pythia8/pythia${PYTHIA_VERSION}.tgz
tar zxf pythia${PYTHIA_VERSION}.tgz
cd pythia${PYTHIA_VERSION}
./configure --with-hepmc2=$hepmcinstall --with-lhapdf6=$lhapdf6install --cxx-common='-ldl -fPIC -lstdc++ -DHEPMC2HACK'
make
make install
echo "========= STEP 3.a: Check PYTHIA install ============"
chmod a+x bin/pythia8-config
./bin/pythia8-config --with-hepmc2 --with-lhapdf6
cd ..
echo "========= STEP 3.b: Configure PYTHIA install ============"
# uncomment and change pythia8_path with $pythiainstall dir in mg5_configuration.txt
sed -ri 's|\#\s+(pythia8_path\s+=\s+).*|\1'"$pythiainstall"'|' MG5_aMC_v2_6_2/input/mg5_configuration.txt
echo "========= STEP 4: Generate procesess and output ============"
# uncomment and change pythia8_path with $pythiainstall dir in mg5_configuration.txt
./MG5_aMC_v2_6_2/bin/mg5_aMC << EOF
generate p p > t t~ [QCD]
output /tmp/kk/ -f
EOF
echo "========= STEP 5: Add dl to shower card ============"
sed -ri 's/(EXTRALIBS\s+=\s+)/\1dl /' /tmp/kk/Cards/shower_card.dat
echo "========= STEP 5: launch and fingers crossed ============"
./MG5_aMC_v2_6_2/bin/mg5_aMC << EOF
launch /tmp/kk
3
3
3
3
set nevents=100
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.