A simple Python interface to run MadGraph
Requirements:
- Python 3.6+
- MadGraph 3.6+
- AND Python 2.7 (for MadDM compatibility)
- AND MadGraph 2.9 (for MadDM compatibility)
- ghostscript (on Ubuntu:
sudo apt-get install ghostscript)
python3 -m venv my_virtualenv
source my_virtualenv/bin/activatepip install madgrapy(optional) Install madgraph from its GitHub
If you don't have already madgraph installed, you can do it by the following:
git clone https://github.com/mg5amcnlo/mg5amcnlo.git
cd mg5amcnlo
git switch 3.x
rm -rf bin/*.pyTest it with
./mg5amcnlo/bin/mg5_aMC
You can find a example Jupyter notebook inside the notebooks folder.
To generate a simple script and run it, you can do
from madgrapy import madpy_generate_script, madpy_run
# Write the script
full_script_str, mg5_script_path, workdir_process = madpy_generate_script(process = "p p > t t~", models = "sm", process_name="my_first_mg5run")
# Run
mg5_script_complete_path = madpy_run(madgraph_path="/path/to/madgraph/folder", process_name = "my_first_mg5run", mg5_script_folder_path = f".")