--- title: 'Installation for HEP Simulation Packages' disqus: hackmd --- Installation for HEP Simulation Packages === This is the note for installation for some HEP simulation packages, e.g. MadGraph5 @NLOv2.7.3, PYTHIA8303, Delphes, LHAPDF6, root(interface with python2), fastjet(interface with python3), Herwig-7.2.2 with minimal installation. All packages in this documnet can be found in this [Docker Image](https://hub.docker.com/repository/docker/alan200276/ubuntu): ``` docker pull alan200276/ubuntu:HEPtools ``` --- # Table of Contents [TOC] --- # Basic Enviornment ## Enviornment Setup (Docker) ### 1. Install Docker(https://www.docker.com) >Just tak Docker environment for example. If you have your own Linux system, you can treat this part for reference. ### 2. Install Relevent Linux Package (Take Ubuntu Docker Images for example) * Install Basic Tools ``` apt-get update apt-get install build-essential #add-apt-repository universe apt-get update apt-get install wget apt-get install gfortran apt-get install curl apt-get install vim apt-get install less apt-get install cmake apt-get install rsync apt-get install gnuplot apt-get install ghostscript apt-get install locate apt-get install htop apt-get install git ``` * Install Python Packages ``` apt-get install python3 apt-get install python3-pip pip3 install six apt-get install python2 curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py python2 get-pip.py ``` * FOR MG5 NLO ``` apt-get install bc ``` * For [ROOT](https://root.cern) [Dependencies](https://root.cern/install/dependencies/) ``` apt-get install libx11-dev apt-get install libxpm-dev apt-get install libxft-dev apt-get install libxext-dev apt-get install libssl-dev ``` --- ## ROOT > Online link: https://root.cern ### 1. Download ROOT >All Release: https://root.cern/install/all_releases/ You can choose what version you like. - In Linux * Recommendation: building ROOT from source. ``` wget https://root.cern/download/root_v6.22.00.source.tar.gz ``` - In Mac * Please go to "[All Release](https://root.cern/install/all_releases/)" website to download "pkg" file, and then you can install ROOT very easy. * Please install command line tools. Open Terminal and then type ``` xcode-select --install ``` ### 2. Build ROOT You can follow this website to build ROOT. >Official Method for Building from Source: https://root.cern.ch/building-root - In Linux After download and unpack the ROOT source, please open Terminal and create a directory for installation. ``` mkdir <install_directory> cd <install_directory> cmake -DCMAKE_INSTALL_PREFIX=/root/ROOT/ -DPython3_EXECUTABLE=/usr/bin/python3 -DPython2_EXECUTABLE=/usr/bin/python2 ../root-6.22.00 cmake --build . --target install ``` >In this way, you can use pyROOT in Python2 and Python3. ### 3. Source ROOT ``` source <install_directory>/bin/thisroot.sh ``` After that, we finish installation for ROOT. You can try type ``` root ``` in your Terminal. If you see a fashion picture popping up, you are successful!! --- ## LHAPDF6 ### 1. Download Package >Online link: https://lhapdf.hepforge.org >Here, we take LHAPDF-6.3.0 for example. >If you want to change version, please go to [lhapdf Downloads](https://lhapdf.hepforge.org/downloads/) ``` wget https://lhapdf.hepforge.org/downloads/LHAPDF-6.3.0.tar.gz ``` ### 2. Configure Go to the LHAPDF6 directory, and then ``` cd <where-is-LHAPDF6> ./configure --prefix=/<where you want to put the program>/<name of program> ``` ### 3. Make After configure, then type ``` make -j ``` ### 4. Make Install ``` make install ``` ### 5. Adding PDFset We can add [PDFset](https://lhapdf.hepforge.org/pdfsets.html) for $\bf\text{LHAPDF6}$ ``` wget http://lhapdfsets.web.cern.ch/lhapdfsets/current/<what_pdf_you_want>.tar.gz -O- | tar xz -C /<your_lhapdf_location>/share/LHAPDF ``` or just download the PDFset from https://lhapdf.hepforge.org/pdfsets.html and put it into ⁨`/<where you install the program>/LHAPDF6⁩/share⁩/LHAPDF` --- ## FASTJET3 ### 1. Download FASTJET3 Package >Online Link: http://fastjet.fr/quickstart.html ``` wget http://fastjet.fr/repo/fastjet-3.4.0.tar.gz ``` ### 2. Configure FASTJET3 Go to the FASTJET3 directory, and then ``` cd <where-is-FASTJET3> ./configure --prefix=/<where you want to put the program>/<name of program> --enable-pyext --enable-atlascone --enable-cmsinterativecone ``` >`--enable-pyext` is for python2 interface ### 3. Make After configure, then type ``` make -j ``` ### 4. Make Install ``` make install ``` ### 5. Download FASTJET-contrib Package >Online link: https://fastjet.hepforge.org/contrib/ ``` wget http://fastjet.fr/repo/fjcore-3.4.0.tar.gz ``` ### 6. Configure FASTJET-contrib Go to the FASTJET-contrib directory, and then ``` cd <where-is-FASTJET-contrib> ./configure --fastjet-config=/<where is your FASTJET>/bin/fastjet-config ``` ### 7. Make After configure, then type ``` make -j ``` ### 8. Make Install ``` make install ``` --- ## HEPMC2 >Online Link: http://th-www.if.uj.edu.pl/~erichter/TauAnalFrame/external/hepmc269-SRC/doc/HepMC2_user_manual.pdf ### 1. Download Package ``` wget http://hepmc.web.cern.ch/hepmc/releases/hepmc2.06.11.tgz ``` ### 2. Configure Go to the HEPMC2 directory, and then ``` cd <where-is-HEPMC2> ./configure --prefix=/<where you want to put the program>/<name of program> --with-momentum=GEV --with-length=MM ``` ### 3. Make After configure, then type ``` make -j ``` ### 4. Make Install ``` make install ``` --- ## HEPMC3 (TBA) ### 1. Download Package ``` wget ``` ### 2. Configure Go to the HEPMC2 directory, and then ``` cd <where-is-HEPMC2> ./configure --prefix=/<where you want to put the program>/<name of program> --with-momentum=GEV --with-length=MM ``` ### 3. Make After configure, then type ``` make -j ``` ### 4. Make Install ``` make install ``` --- ## Setup Environment's Variables In order to use those packages, you need to setup the path for them. Open Terminal, and using below comment to setup path ``` export LHAPDFSYS=/<where you put the LHAPDF> export PATH=${PATH}:${LHAPDFSYS}/bin/ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${LHAPDFSYS}/lib/ export PATH=${PATH}:/<where you put the FASTJET>/bin/ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/<where you put the FASTJET>/lib export PYTHONPATH=/<where you put the FASTJET>/lib/python3.8/site-packages/ ``` >Below is for Herwig7 ``` export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/<where you put the Herwig>/lib/ export PATH=${PATH}:/<where you put the Herwig>/bin/ ``` --- # Monte Carlo Generators and Simulation Tools ## PYTHIA8 > Pythia8: https://pythia.org/ > Pythia8 Documents: https://pythia.org/manuals/pythia8305/Welcome.html > Pythia8 releases: https://pythia.org/releases/ ### 1. Download Package ``` wget https://pythia.org/download/pythia83/pythia8303.tar ``` ### 2. Configure Go to the PYTHIA8 directory, and then ``` cd <where-is-PYTHIA8> ./configure --with-hepmc2=<where-is-your-HEPMC2> --with-lhapdf6=<where-is-your-LHAPDF6> --with-fastjet3=<where-is-your-FASTJET> --with-boost=<where-is-your-boost> ``` ### 3. Make After configure, then type ``` make -j ``` --- ## MadGraph5_aMC@NLO ### 1. Download Package: >Online link: https://launchpad.net/mg5amcnlo >All Releases: https://launchpad.net/mg5amcnlo/+download ``` wget https://launchpad.net/mg5amcnlo/2.0/2.7.x/+download/MG5_aMC_v2.7.3.tar.gz ``` ### 2. Setup MadGraph: In your terminal, go to the MadGraph5's directory. ``` cd /where-is-your-MadGraph/MG5_aMC_v2_7_3 ``` Then we need to install the packages for MadGraph. Use the following to execute MadGraph5_aMC@NLO ``` ./bin/mg5_aMC ``` Then we need: Delphes, zlib, boost, MadAnalysis4, MadAnalysis5, ExRootAnalysis, LHAPDF6, oneloop, hepmc, ninja, pythin8, collier, MG5aMC-PY8_interface ``` install PackageName e.g. install Delphes install pythia8 ``` * we only can install “Delphes” until “ROOT” is builded * if LHAPDF6 can not install via this method, please follow LHAPDF6 installation section to install LHAPDF6 * If you want to use "Build-by-yourself LHAPDF6", * Please type ``` ./bin/mg5_aMC set lhapdf </where you install LHAPDF6>/bin/lhapdf-config ``` Now we can run a process for test ex: p p -> e- e+ ``` cd /where-is-your-MadGraph/MG5_aMC_v2_7_3 ./bin/mg5_aMC generate p p > e- e+ output [the name what you want] launch [the name what you want] ``` --- ## DELPHES (with DelphesPythia8) > Online link: https://cp3.irmp.ucl.ac.be/projects/delphes > DelphesPythia8: https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8 > Note: Please source ROOT first and then compile Delphes! ### 1. Download Package ``` wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.5.0.tar.gz tar -xvf elphes-3.5.0.tar.gz ``` ### 2. Make Go to the DELPHES directory, and then ``` cd <where-is-DELPHES> export PYTHIA8=/<path_to_PYTHIA8_installation>/ make HAS_PYTHIA8=true ``` --- ## Herwig-7.2.2 >Online link: https://herwig.hepforge.org >Docker images: https://hub.docker.com/r/hepstore/rivet-herwig * Building Herwig from Source ### Minimal Dependencies #### I. GSL - GNU Scientific Library >Online link: https://www.gnu.org/software/gsl/ ##### 1. Download Package ``` wget https://mirror.ibcp.fr/pub/gnu/gsl/gsl-latest.tar.gz tar -xvf gsl-latest.tar.gz ``` ##### 2. Configure Go to the GSL directory, and then ``` cd <where-is-GSL> ./configure --prefix=/<where you want to put the program>/<name of program> ``` ##### 3. Make After configure, then type ``` make -j ``` ##### 4. Make Install ``` make install ``` #### II.ThePEG >Online link: http://home.thep.lu.se/ThePEG/ ##### 1. Download Package ``` wget https://thepeg.hepforge.org/downloads/ThePEG-2.2.2.tar.bz2 tar -xvf ThePEG-2.2.2.tar.bz2 ``` ##### 2. Configure Go to the ThePEG directory, and then ``` cd <where-is-ThePEG> ./configure --prefix=/<where you want to put the program>/<name of program> --with-gsl=<where-is-your-GSL> --with-hepmc=<where-is-your-HEPMC2> --with-lhapdf=<where-is-your-LHAPDF6> --with-fastjet=<where-is-your-FASTJET> --with-boost=<where-is-your-boost> ``` ##### 3. Make After configure, then type ``` make -j ``` ##### 4. Make Install ``` make install ``` ### Herwig #### 1. Download Package > Note: please check th new information in this wibsite: https://phab.hepforge.org/source/herwighg/repository/default/ ``` wget https://herwig.hepforge.org/downloads/Herwig-7.2.2.tar.bz2 tar -xvf Herwig-7.2.2.tar.bz2 ``` #### 2. Configure Go to the ThePEG directory, and then ``` cd Herwig-7.2.2 ./configure --prefix=/<where you want to put the program>/<name of program> --with-thepeg=<where-is-your-thepeg> --with-gsl=<where-is-your-GSL> --with-fastjet=<where-is-your-FASTJET> --with-boost=<where-is-your-boost> ``` #### 3. Make After configure, then type ``` make -j ``` #### 4. Make Install ``` make install ``` --- ## Sherpa 2.2.12 >Online link: https://sherpa-team.gitlab.io * Building Sherpa from Source ### Minimal Dependencies #### I. SQLite 3 ``` apt-get install sqlite3 apt-get install libsqlite3-dev ``` #### II. scons ``` apt-get install scons ``` #### III. swig ``` apt-get install swig ``` #### IV. OpenLoops >Online link: https://openloops.hepforge.org/download.html ``` git clone -b public_beta https://gitlab.com/openloops/OpenLoops.git cd OpenLoops ./scons ``` ### Sherpa #### 1. Download Package ``` wget https://sherpa.hepforge.org/downloads/SHERPA-MC-2.2.12.tar.gz tar -xvf SHERPA-MC-2.2.12.tar.gz ``` #### 2. Configure Go to the ThePEG directory, and then ``` cd SHERPA-MC-2.2.12 ./configure --prefix=/<where you want to put the program>/<name of program> --enable-pyext --enable-ufo --enable-pythia --enable-hepmc2=<where-is-your-HEPMC2> --enable-gzip --enable-lhapdf=<where-is-your-LHAPDF> --enable-fastjet=<where-is-your-fastjet> --enable-openloops=<where-is-your-OpenLoops> ``` #### 3. Make After configure, then type ``` make -j ``` #### 4. Make Install ``` make install ``` <!-- -------- # SSH Tips: 1. Creat ssh key: ``` ssh-keygen ``` 2. Put the key into server: ``` ssh-copy-id USER@HOST ``` # Conda Tips: 1. Creat an environment ``` conda create —name [name] python=2or3 ``` 2. Remove an environment ``` conda env remove -n [name] ``` 3. Activate/Deactivate an environment ``` conda activate [name] conda deactivate ``` 4. Install package in an environment ``` conda search [package] conda install [package] (conda uninstall [package] ) ``` 5. Check packages in an environment ``` conda list ``` 6. JupyterLab lab remote server - In the server terminal ``` jupyter lab --port=9000 --no-browser ``` - In the local terminal ``` ssh -N -f -L localhost:9000:localhost:9000 hostname@ip ``` --> ###### tags: `Installation`, `HEP Simulation Packages`