1. IE browser is NOT supported anymore. Please use Chrome, Firefox or Edge instead.
2. If you are a new user, please register to get an IHEP SSO account through https://login.ihep.ac.cn/registlight.jsp Any questions, please email us at helpdesk@ihep.ac.cn or call 88236855.
3. If you need to create a conference in the "Conferences, Workshops and Events" zone, please email us at helpdesk@ihep.ac.cn.
4. The max file size allowed for upload is 100 Mb.
11–13 Apr 2021
Asia/Shanghai timezone

Tool installation

Please go through the following instructions to set up your laptop for the tutorial session on April 13th.

The tutorial will require using the Linux command line environment (bash).
Students are encouraged to familiarise themselves with some basic commands:
    pwd, mkdir, cd, cp, mv, rm, tar, less, more, ...

tip: Try the MadGraph5_aMC@NLO tutorial!

Navigate to installed mg5 folder, and run:

    bin/mg5_aMC

then type:

    tutorial

In the Docker container, it is located in /home/software but you can just type mg5_aMC from anywhere to run.

Recommended option: using Docker

Download Docker desktop from https://www.docker.com/products/docker-desktop

Check it has correctly installed by opening a terminal (command prompt in Windows) and running:

    docker info

which should print some information about your system.

Now you can download the pre-built image, based on ubuntu, containing all of the required software using:

    docker pull kmimasu/heptools:mg5_ma5

You run the image using `docker run` as follows:

    docker run -it --name=HEFT kmimasu/heptools:mg5_ma5

Which launches a container (virtual machine) in interactive mode (bash shell).

In order to be able to send files to and from the container you can use `docker cp` to copy files.

    docker cp container_name:source destination

where, in this example, `container_name` is `HEFT` and source refers to a path inside the container filesystem and destination is somewhere on your main filesystem.

Alternatively you can mount a shared folder between your container and your main filesystem as follows:

Create a directory on your main filesystem and add an extra option in the run command

    docker run -it --name=HEFT  --mount type=bind,source=main_folder,target=container_path kmimasu/heptools:mg5_ma5

where `main_folder` is the path to the directory you just created on the main filesystem and container_path is the desired path and folder name inside the container.

For example, on Unix systems, we could do

    mkdir portal
    docker run -it --name=HEFT  --mount type=bind,source="$(pwd)"/portal,target=/portal kmimasu/heptools:mg5_ma5

now the `/portal` directory in the container will be mounted to the `portal` folder in your current working directory and you can pass files between the container and your main filesystem through it.

Software is located in /home/software

Alternative option: manual installation (not guaranteed)
### Linux
Manual installation is *most* simple on linux systems. 
1) The pre-requisites obtainable via apt-get are:

build-essential
gfortran
ca-certificates
wget
ghostscript
vim
nano
less
rsync
python3-dev
python3-pip
bzr
gnuplot
texlive-latex-recommended
texlive-fonts-recommended
texlive-latex-extra

2) Install matplolib:

    pip3 install matplotlib

3) Pull the latest Madgraph version:

    bzr checkout --lightweight lp:mg5amcnlo/2.0

4) Go inside the downloaded folder, execute `bin/mg5_aMC` and install the following from inside the interactive prompt (can take a while):

    install lhapdf6
    install pythia8
    install looptools

5) Configure environment variables for lhapdf

    export PYTHONPATH=$PYTHONPATH:/MG5_DIRECTORY/HEPTools/lhapdf6_py3/lib/python3.8/site-packages

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/MG5_DIRECTORY/HEPTools/lhapdf6_py3/lib

    export PATH=$PATH:/MG5_DIRECTORY/HEPTools/lhapdf6_py3/bin

where `MG5_DIRECTORY` is the location of your MadGraph installation (wherever you were when you did `bzr checkout`....). Check that the python version number matches the actual path in the installation.

6) Install fastjet 3.3.4

    wget http://fastjet.fr/repo/fastjet-3.3.4.tar.gz
    tar zxf fastjet-3.3.4.tar.gz
    cd fastjet-3.3.4
    ./configure --prefix=FJPATH
    make
    make install

where FJPATH is the path to your desired location for the libaries.

Update your path to allow access to the fastjet-config

    export PATH=$PATH:FJPATH

7) Pull python 3 compatible MadAnalysis5 version:

    bzr checkout --lightweight lp:~ma5dev/madanalysis5/v1.9_py3

Run it once for setup:

    v1.9_py3/bin/ma5
  
It will ask you how many cores you want to compile on, put the maximum.
Ensure FastJet is automatically found and ma5 prints:

    MA5:      - FastJet                  [OK]

before compilation, and 

    MA5:      - Matplotlib               [OK]
    MA5:      - pdflatex                 [OK]
    MA5:      - latex                    [OK]

for the optional packages.

Create a special file required by MadGraph in the MadAnalysis5 directory

    echo "Date : 2021/03/27 Time : 00:00:00 MA5 version : 1.9 Bazaar rev      : 314 tarball created by fuks" > MA5PATH/version.txt

where `MA5PATH` is the path to `v1.9_py3`

Update MadGraph5 options to specify the location of MadAnalysis5 by Executing `bin/mg5_aMC` from the MadGraph5 folder again and typing the command:

    set madanalysis5_path MA5PATH
    save options

Optionaly update your environmet PATH with `MA5PATH`

    export PATH=$PATH:MA5PATH

### Mac OS X
Similar to previous instructions, but core dependencies are most easily installed using a package manager like Homewbrew or Macports.
XCode command-line tools are required, and gfortran can be installed from
http://hpc.sourceforge.net

### Windows
The only alternative solution is to install Windows Subsystem for Linux and follow the linux instructions