Introduction to MaPyDe#

MaPyDe stands for MadGraph-Pythia-Delphes which is a utility that allows one to run all of the various HEP toolings or chain them together and perform a quick analysis with the results, such as running ATLAS SimpleAnalysis or pyhf.

Background#

This tool should be considered the proof-of-concept toolchain that ties together an entire workflow from end-to-end:

  • Event Generation (Madgraph + Pythia)

  • Detector Simulation and/or Reconstruction (Delphes, atlas/athena, or your favorite truth-smearing tool)

  • Event Selection (RECAST, Rivet, SimpleAnalysis, etc…)

  • Statistical Analysis (pyhf, etc…)

There are many reasons why one might want to be able to execute a defined workflow like this such as:

  • Reproduction of results (“good experiment”),

  • Reinterpretation of results (“good theory”),

  • <insert your favorite reason here>

All of these pieces requires some amount of input, either from experiment, or your friendly neighborhood phenomenologist, including (but not limited to!):

  • model parameters (e.g. using SLHA files)

  • detector acceptances and selection efficiencies (if you don’t have access to the experiment’s bread-and-butter reconstruction/simulation)

  • (full‽) probability models

All of this is not necessarily so obvious to chain together, especially for a newcomer to the field just trying to get a grasp on the past century of particle physics. mapyde should make this easier (but not trivial!)

Understanding data#

For this tutorial, we’ll simply use mapyde as a command-line utility as it is meant to be primarily user-facing. The python package is usable for others who want to develop on top of it, but that won’t be covered in this notebook.

import mapyde

print(mapyde.__version__)
0.5.0
!mapyde --help
                                                                                
 Usage: mapyde [OPTIONS] COMMAND [ARGS]...                                      
                                                                                
 Manage top-level options                                                       
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --version                                           Print the current        
                                                     version.                 
 --prefix                    [data|cards|likelihood  Print the path prefix    
                             s|scripts|templates]    for data files.          
                                                     [default: None]          
 --tui                                               Open Textual TUI.        
 --install-completion                                Install completion for   
                                                     the current shell.       
 --show-completion                                   Show completion for the  
                                                     current shell, to copy   
                                                     it or customize the      
                                                     installation.            
 --help                                              Show this message and    
                                                     exit.                    
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
 config                                                                       
 run                                                                          
╰──────────────────────────────────────────────────────────────────────────────╯

The first thing to notice is that mapyde has a --prefix option where we ship a handful of useful files (including cards) for getting started. We don’t intend for this to be a complete or exhaustive list of configuration files, but it should get you started quickly.

!mapyde --prefix data
/opt/hostedtoolcache/Python/3.10.14/x64/share/mapyde
!ls -lavh `mapyde --prefix cards`
total 36K
drwxrwxrwx+ 9 runner docker 4.0K Jul  4 00:14 .
drwxrwxrwx+ 6 runner docker 4.0K Jul  4 00:14 ..
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 delphes
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 madspin
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 param
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 process
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 pythia
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 run
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 sherpa
!ls -lavh `mapyde --prefix likelihoods`
total 3.4M
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 .
drwxrwxrwx+ 6 runner docker 4.0K Jul  4 00:14 ..
-rw-rw-rw-+ 1 runner docker 1.2M Jul  4 00:14 Higgsino_2L_bkgonly.json
-rw-rw-rw-+ 1 runner docker 1.2M Jul  4 00:14 Slepton_bkgonly.json
-rw-rw-rw-+ 1 runner docker 1.2M Jul  4 00:14 WinoBino_noWeight_2L_bkgonly.json

Templates#

The first of the files we’ll discuss is about templates. Templates are wildly important since oftentimes, when we write a configuration to run a pipeline in mapyde, you often have some defaults you’d like to use. This is what we use templates for.

!ls -lavh `mapyde --prefix templates`
total 20K
drwxrwxrwx+ 2 runner docker 4.0K Jul  4 00:14 .
drwxrwxrwx+ 6 runner docker 4.0K Jul  4 00:14 ..
-rw-rw-rw-+ 1 runner docker 1.8K Jul  4 00:14 defaults.toml
-rw-rw-rw-+ 1 runner docker 1.9K Jul  4 00:14 ewkinos.toml
-rw-rw-rw-+ 1 runner docker 1.7K Jul  4 00:14 sleptons.toml

Here, you can see a few current templates we have right now, such as a defaults.toml and one for ewkinos.toml. These templates are written in toml which is plaintext format for configuration files. It has some nice features that make it much more useful for variable injection, but also can look cleaner when you deal with deeply nested dictionaries as part of your configuration. Let’s look at the sleptons template:

!cat `mapyde --prefix templates`/sleptons.toml
[base]
path = "{{PWD}}"
output = "output"
logs = "logs"
data_path = "{{MAPYDE_DATA}}"
cards_path = "{{MAPYDE_CARDS}}"
scripts_path = "{{MAPYDE_SCRIPTS}}"
process_path = "{{MAPYDE_CARDS}}/process/"
param_path = "{{MAPYDE_CARDS}}/param/"
run_path = "{{MAPYDE_CARDS}}/run/"
pythia_path = "{{MAPYDE_CARDS}}/pythia/"
delphes_path = "{{MAPYDE_CARDS}}/delphes/"
madspin_path = "{{MAPYDE_CARDS}}/madspin/"
likelihoods_path = "{{MAPYDE_LIKELIHOODS}}"

[madgraph]
skip = false
params = "SleptonBino"
cores = 1
version = "madgraph:2.9.3"
batch = false
paramcard = "{{madgraph['params']}}.slha"
output = "run.mg5"

[madgraph.masses]
MSLEP = 250
MN1 = 240

[madgraph.run]
card = "default_LO.dat"
ecms = 13000
nevents = 50000
seed = 0

[madgraph.run.options]
mmjj = 0
mmjjmax = -1
deltaeta = 0
ktdurham = -1
xqcut = -1
ptj = 20
ptj1min = 50

[madgraph.proc]
name = "isrslep"
card = "{{madgraph['proc']['name']}}"

[madspin]
skip = true
card = ''

[pythia]
skip = false
card = "pythia8_card.dat"
additional_opts = ""

[delphes]
skip = false
additional_opts = ""
card = "delphes_card_ATLAS_lowptleptons_sleptons_notrackineffic.tcl"
version = "delphes"
output = "delphes/delphes.root"

[analysis]
script = "Delphes2SA.py"
XSoverride = -1
kfactor = 1.18
output = "analysis/Delphes2SA.root"
lumi = 139000

[simpleanalysis]
skip = false
additional_opts = ""
name = "EwkCompressed2018"
outputtag = ""
input = ""

[sa2json]
inputs = "{{simpleanalysis['name']}}{{simpleanalysis['outputtag']}}.root"
image = "pyplotting:latest"
output = "{{simpleanalysis['name']}}{{simpleanalysis['outputtag']}}_patch.json"
options = "-c"

[pyhf]
skip = false
likelihood = "Slepton_bkgonly.json"
image = "pyplotting:latest"
gpu-options = "-c -B jax"
other-options = ""

There are a couple of top-level options available here, each corresponding roughly to a different tool (with the exception of base):

  • base: controls all the global configurations such as location of inputs and outputs

  • madgraph: configuration for madgraph

  • madspin: configuration for madspin

  • pythia: configuration for pythia

  • delphes: configuration for delphes

  • analysis: configuration for running analysis (such as Delphes2SA.py)

  • simpleanalysis: configuration for running SA

  • sa2json: a special tool we have that converts the output of SA into a HiFa JSON patch (for use with pyhf)

  • pyhf: configuration for running pyhf

The big caveat here is that this configuration is in a beta-state, so it can change as we get more experience with how this works for us, and whether we want to make it easier or cleaner to configure. But for now, this isn’t the worst. You should be able to glance over and get a rough idea of what most of the options do. There are specific options that you will (currently) need to look in the code for, or ask us on GitHub. open a discussion

file an issue

There are some special variables available for interpolating into your configuration, which is done via {{VARIABLE}} double curly braces. You can see what’s currently used in the code but the following can be typically expected:

  • PWD

  • USER

  • MAPYDE_DATA

  • MAPYDE_CARDS

  • MAPYDE_LIKELIHOODS

  • MAPYDE_SCRIPTS

  • MAPYDE_TEMPLATES

In addition to this, there is dynamic variable substitution as well. That means a configuration block like

[simpleanalysis]
skip = false
additional_opts = ""
name = "EwkCompressed2018"
outputtag = ""

[sa2json]
inputs = "{{simpleanalysis['name']}}{{simpleanalysis['outputtag']}}.root"

will render as

{"sa2json": {"inputs": "EwkCompressed2018.root"}}

if you didn’t override anything in the [simpleanalysis] block.

Using a Template#

To make this template usable, you will first create a configuration file that can inherit or use this template as a base. Typically will look like this:

[base]
path = "/data/users/{{USER}}/SUSY"
output = "mytag"
template = "{{MAPYDE_TEMPLATES}}/defaults.toml"

[madgraph.proc]
name = "charginos"
card = "{{madgraph['proc']['name']}}"

[madgraph.masses]
MN2 = 500

Here, in this example user.toml config, we will use the defaults.toml template that is shipped with mapyde via {{MAPYDE_TEMPLATES}}/defaults.toml (however you could always make your own template and provide that instead!). mapyde will always parse your template out first, before parsing the rest of the file.

Additionally, [madgraph.masses will be overriden from the default template to specify that {{MN2}} in the corresponding param card is substituted with the value 500. The reason for using {{VAR}} pattern here is that it allows us to use jinja as a templating engine. This not only makes it much easier to maintain the same style of substitution across multiple files, but also allows us to use the concept of templates in an “inheritance” pattern.

Your First Config#

Making It#

Let’s go ahead and create our first config (tutorial.toml) and learn about configuration parsing.

from pathlib import Path

import toml

data = {
    "base": {
        "path": "{{PWD}}",
        "output": "tutorial",
        "template": "{{MAPYDE_TEMPLATES}}/sleptons.toml",
    },
    "madgraph": {
        "nevents": 1000,
        "proc": {"name": "charginos", "card": "{{madgraph['proc']['name']}}"},
        "masses": {"MN1": 200},
    },
}

with Path().joinpath("tutorial.toml").open("w") as fp:
    toml.dump(data, fp)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[8], line 3
      1 from pathlib import Path
----> 3 import toml
      5 data = {
      6     "base": {
      7         "path": "{{PWD}}",
   (...)
     15     },
     16 }
     18 with Path().joinpath("tutorial.toml").open("w") as fp:

ModuleNotFoundError: No module named 'toml'
!cat tutorial.toml | pygmentize -l toml
[base]
path = "{{PWD}}"
output = "tutorial"
template = "{{MAPYDE_TEMPLATES}}/sleptons.toml"

[madgraph]
nevents = 1000

[madgraph.proc]
name = "charginos"
card = "{{madgraph['proc']['name']}}"

[madgraph.masses]
MN1 = 200

Now from this, you can see we are setting MN1 = 200 instead of the default MN1 = 240 from the template.

In addition, we set the path to the current directory via {{PWD}} and the output for this config will be stored under {{base['path']}}/tutorial.

What does mapyde parse it as? We can run mapyde config parse:

!mapyde config parse tutorial.toml
{
    "base": {
        "path": "/Users/kratsg/mapyde-tutorial/book",
        "output": "tutorial",
        "logs": "logs",
        "data_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde",
        "cards_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards",
        "scripts_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/scripts",
        "process_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/process/",
        "param_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/param/",
        "run_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/run/",
        "pythia_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/pythia/",
        "delphes_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/delphes/",
        "madspin_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/cards/madspin/",
        "likelihoods_path": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/likelihoods",
        "template": "/Users/kratsg/mapyde-tutorial/venv/share/mapyde/templates/sleptons.toml"
    },
    "madgraph": {
        "skip": false,
        "params": "SleptonBino",
        "ecms": 13000,
        "cores": 1,
        "nevents": 1000,
        "seed": 0,
        "version": "madgraph:2.9.3",
        "batch": false,
        "paramcard": "SleptonBino.slha",
        "generator": {
            "output": "run.mg5"
        },
        "masses": {
            "MSLEP": 250,
            "MN1": 200
        },
        "run": {
            "card": "default_LO.dat",
            "options": {
                "mmjj": 0,
                "mmjjmax": -1,
                "deltaeta": 0,
                "ktdurham": -1,
                "xqcut": -1,
                "ptj": 20,
                "ptj1min": 50
            }
        },
        "proc": {
            "name": "charginos",
            "card": "charginos"
        }
    },
    "madspin": {
        "skip": true,
        "card": ""
    },
    "pythia": {
        "skip": false,
        "card": "pythia8_card.dat",
        "additional_opts": ""
    },
    "delphes": {
        "skip": false,
        "additional_opts": "",
        "card": "delphes_card_ATLAS_lowptleptons_sleptons_notrackineffic.tcl",
        "version": "delphes",
        "output": "delphes/delphes.root"
    },
    "analysis": {
        "script": "Delphes2SA.py",
        "XSoverride": -1,
        "kfactor": 1.18,
        "output": "analysis/Delphes2SA.root",
        "lumi": 139000
    },
    "simpleanalysis": {
        "skip": false,
        "additional_opts": "",
        "name": "EwkCompressed2018",
        "outputtag": ""
    },
    "sa2json": {
        "inputs": "EwkCompressed2018.root",
        "image": "pyplotting:latest",
        "output": "EwkCompressed2018_patch.json",
        "options": "-c"
    },
    "pyhf": {
        "skip": false,
        "likelihood": "Slepton_bkgonly.json",
        "image": "pyplotting:latest",
        "gpu-options": "-c -B jax"
    }
}

Notice that for example, in madgraph.masses we now have

        "masses": {
            "MSLEP": 250,
            "MN1": 200
        },

which merged the template with our configuration, rather than completely overriding. This is the default behavior in mapyde for nested dictionaries (and might be revisited later if this is not helpful). One nice thing about this parse functionality is that it effectively provides a “frozen” configuration that can be hashed and passed around / uniquely identified.

This mass gets substituted into the param card which, in this example is SleptonBino.slha under the base['param_path'] (using the mapyde default paths):

!head -n78 `mapyde --prefix cards`/param/SleptonBino.slha | sed 1,37d
###################################
## INFORMATION FOR MASS
###################################
Block mass
    5 4.889917e+00 # MB
    6 1.750000e+02 # MT
   15 1.777000e+00 # Mta
   23 9.118760e+01 # MZ
   24 7.982901e+01 # MW
   25 1.108991e+02 # MH01
   35    4.5E9  # MH02
   36    4.5E9  # MA0
   37    4.5E9  # MH
   1000001    4.5E9  # set of param :1*Msd1, 1*Msd2
   1000002    4.5E9  # set of param :1*Msu1, 1*Msu2
   1000005    4.5E9  # Msd3
   1000006    4.5E9  # Msu3
   1000011    {{MSLEP}}  # Msl1
   1000012    4.5E9  # Msn1
   1000013    {{MSLEP}}  # Msl2
   1000014    4.5E9  # Msn2
   1000015    {{MSLEP}}  # Msl3
   1000016    4.5E9  # Msn3
   1000021    4.5E9  # Mgo
   1000022    {{MN1}} # Mneu1
   1000023    4.5E9  # Mneu2
   1000024    4.5E9  # Mch1
   1000025    4.5E9  # Mneu3
   1000035    4.5E9  # Mneu4
   1000037    4.5E9  # Mch2
   2000001    4.5E9  # set of param :1*Msd4, 1*Msd5
   2000002    4.5E9  # set of param :1*Msu4, 1*Msu5
   2000005    4.5E9  # Msd6
   2000006    4.5E9  # Msu6
   2000011    {{MSLEP}}  # set of param :1*Msl4, 1*Msl5
   2000013    {{MSLEP}}  # set of param :1*Msl4, 1*Msl5
   2000015    {{MSLEP}}  # Msl6
## Dependent parameters, given by model restrictions.
## Those values should be edited following the
## analytical expression. MG5 ignores those values
## but they are important for interfacing the output of MG5

Running It#

Now, let’s go ahead and demonstrate what can be done. As mentioned above, mapyde is a user-facing CLI so let’s see what is available to run:

!mapyde run --help
Usage: mapyde run [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  all             Run madgraph, delphes, analysis, and pyhf.
  analysis        Run analysis.
  delphes         Run delphes.
  madgraph        Run madgraph.
  pyhf            Run pyhf.
  root2hdf5       Transform from .root to .hdf5 format.
  sa2json         Run sa2json.
  sherpa          Run Sherpa.
  simpleanalysis  Run simpleanalysis (ATLAS tool)

We have the ability to just run all which will run anything defined in the config, that’s not specified as skip = true. We can also run individual steps/pieces as well. Let’s try running madgraph and generating the 1000 events we configured.

This will pull the docker image associated for madgraph (that we built at scipp-atlas/mapyde), create an instance, and pass both input files and commands into it.

!mapyde run madgraph tutorial.toml
Hide code cell output
2d13c8c920ccd7042956d7f0e67c001781b7f0cbbcc4b2165271ee1c48de8844
************************************************************
*                                                          *
*                     W E L C O M E to                     *
*              M A D G R A P H 5 _ a M C @ N L O           *
*                                                          *
*                                                          *
*                 *                       *                *
*                   *        * *        *                  *
*                     * * * * 5 * * * *                    *
*                   *        * *        *                  *
*                 *                       *                *
*                                                          *
*         VERSION 2.9.3                 2021-03-25         *
*                                                          *
*    The MadGraph5_aMC@NLO Development Team - Find us at   *
*    https://server06.fynu.ucl.ac.be/projects/madgraph     *
*                            and                           *
*            http://amcatnlo.web.cern.ch/amcatnlo/         *
*                                                          *
*               Type 'help' for in-line help.              *
*           Type 'tutorial' to learn how MG5 works         *
*    Type 'tutorial aMCatNLO' to learn how aMC@NLO works   *
*    Type 'tutorial MadLoop' to learn how MadLoop works    *
*                                                          *
************************************************************
load MG5 configuration from ../../usr/local/MG5_aMC_v2_9_3/input/mg5_configuration.txt 
fastjet-config does not seem to correspond to a valid fastjet-config executable (v3+). We will use fjcore instead.
 Please set the 'fastjet'variable to the full (absolute) /PATH/TO/fastjet-config (including fastjet-config).
 MG5_aMC> set fastjet /PATH/TO/fastjet-config

set lhapdf to lhapdf-config
set lhapdf to lhapdf-config
Using default text editor "vi". Set another one in ./input/mg5_configuration.txt
No valid eps viewer found. Please set in ./input/mg5_configuration.txt
No valid web browser found. Please set in ./input/mg5_configuration.txt
import /data/run.mg5
The import format was not given, so we guess it as command
set default_unset_couplings 99
set group_subprocesses Auto
Set group_subprocesses to Auto
Note that you need to regenerate all processes
set ignore_six_quark_processes False
set loop_optimized_output True
set loop optimized output to True
set loop_color_flows False
set loop color flows to False
set gauge unitary
Passing to gauge unitary.
set complex_mass_scheme False
Complex mass already desactivated.
set max_npoint_for_channel 0
import model MSSM_SLHA2
INFO: load particles 
INFO: load vertices 
INFO: Restrict model MSSM_SLHA2 with file ../../usr/local/MG5_aMC_v2_9_3/models/MSSM_SLHA2/restrict_default.dat . 
INFO: Run "set stdout_level DEBUG" before import for more information. 
INFO: Detect SLHA2 format. keeping restricted parameter in the param_card 
INFO: Change particles name to pass to MG5 convention 
Defined multiparticle p = g u c d s u~ c~ d~ s~
Defined multiparticle j = g u c d s u~ c~ d~ s~
Defined multiparticle l+ = e+ mu+
Defined multiparticle l- = e- mu-
Defined multiparticle vl = ve vm vt
Defined multiparticle vl~ = ve~ vm~ vt~
Defined multiparticle all = g u c d s u~ c~ d~ s~ a ve vm vt e- mu- ve~ vm~ vt~ e+ mu+ go ul cl t1 ur cr t2 dl sl b1 dr sr b2 ul~ cl~ t1~ ur~ cr~ t2~ dl~ sl~ b1~ dr~ sr~ b2~ t b t~ b~ z w+ h01 h2 h3 h+ sve svm svt el- mul- ta1- er- mur- ta2- w- h- sve~ svm~ svt~ el+ mul+ ta1+ er+ mur+ ta2+ n1 n2 n3 n4 x1+ x2+ ta- x1- x2- ta+
define j = g u c d s u~ c~ d~ s~
Defined multiparticle j = g u c d s u~ c~ d~ s~
define pb = g u c d s b u~ c~ d~ s~ b~
Defined multiparticle pb = g u c d s u~ c~ d~ s~ b b~
define jb = g u c d s b u~ c~ d~ s~ b~
Defined multiparticle jb = g u c d s u~ c~ d~ s~ b b~
define l+ = e+ mu+
Defined multiparticle l+ = e+ mu+
define l- = e- mu-
Defined multiparticle l- = e- mu-
define vl = ve vm vt
Defined multiparticle vl = ve vm vt
define vl~ = ve~ vm~ vt~
Defined multiparticle vl~ = ve~ vm~ vt~
define fu = u c e+ mu+ ta+
Defined multiparticle fu = u c e+ mu+ ta+
define fu~ = u~ c~ e- mu- ta-
Defined multiparticle fu~ = u~ c~ e- mu- ta-
define fd = d s ve~ vm~ vt~
Defined multiparticle fd = d s ve~ vm~ vt~
define fd~ = d~ s~ ve vm vt
Defined multiparticle fd~ = d~ s~ ve vm vt
define susystrong = go ul ur dl dr cl cr sl sr t1 t2 b1 b2 ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
Defined multiparticle susystrong = go ul ur dl dr cl cr sl sr t1 t2 b1 b2 ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
define susyweak = el- el+ er- er+ mul- mul+ mur- mur+ ta1- ta1+ ta2- ta2+ n1 n2 n3 n4 x1- x1+ x2- x2+ sve sve~ svm svm~ svt svt~
Defined multiparticle susyweak = el- er- mul- mur- ta1- ta2- sve svm svt el+ er+ mul+ mur+ ta1+ ta2+ sve~ svm~ svt~ n1 n2 n3 n4 x1+ x2+ x1- x2-
define susylq = ul ur dl dr cl cr sl sr
Defined multiparticle susylq = ul ur dl dr cl cr sl sr
define susylq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~
Defined multiparticle susylq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~
define susysq = ul ur dl dr cl cr sl sr t1 t2 b1 b2
Defined multiparticle susysq = ul ur dl dr cl cr sl sr t1 t2 b1 b2
define susysq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
Defined multiparticle susysq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
define susysl = el- el+ er- er+ mul- mul+ mur- mur+ ta1- ta1+ ta2- ta2+
Defined multiparticle susysl = el- er- mul- mur- ta1- ta2- el+ er+ mul+ mur+ ta1+ ta2+
define susyv = sve svm svt
Defined multiparticle susyv = sve svm svt
define susyv~ = sve~ svm~ svt~
Defined multiparticle susyv~ = sve~ svm~ svt~
define p = g u c d s u~ c~ d~ s~
Defined multiparticle p = g u c d s u~ c~ d~ s~
define f = e+ mu+ ta+ e- mu- ta- ve vm vt ve~ vm~ vt~ u u~ d d~ c c~ s s~ b b~ g
Defined multiparticle f = g u d c s u~ d~ c~ s~ e- mu- ve vm vt e+ mu+ ve~ vm~ vt~ b b~ ta- ta+
generate     p p > x1- x1+
INFO: Checking for minimal orders which gives processes. 
INFO: Please specify coupling orders to bypass this step. 
INFO: Trying process: g g > x1- x1+ WEIGHTED<=4 @1  
INFO: Trying process: u u~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Process has 3 diagrams 
INFO: Trying process: u c~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Trying process: c u~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Trying process: c c~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Process has 3 diagrams 
INFO: Trying process: d d~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Process has 3 diagrams 
INFO: Trying process: d s~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Trying process: s d~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Trying process: s s~ > x1- x1+ WEIGHTED<=4 @1  
INFO: Process has 3 diagrams 
INFO: Process u~ u > x1- x1+ added to mirror process u u~ > x1- x1+ 
INFO: Process c~ c > x1- x1+ added to mirror process c c~ > x1- x1+ 
INFO: Process d~ d > x1- x1+ added to mirror process d d~ > x1- x1+ 
INFO: Process s~ s > x1- x1+ added to mirror process s s~ > x1- x1+ 
4 processes with 12 diagrams generated in 0.158 s
Total: 4 processes with 12 diagrams
output PROC_madgraph
INFO: initialize a new directory: PROC_madgraph 
INFO: remove old information in PROC_madgraph 
INFO: Organizing processes into subprocess groups 
INFO: Generating Helas calls for process: u u~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Processing color information for process: u u~ > x1- x1+ @1 
INFO: Generating Helas calls for process: c c~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Reusing existing color information for process: c c~ > x1- x1+ @1 
INFO: Generating Helas calls for process: d d~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Reusing existing color information for process: d d~ > x1- x1+ @1 
INFO: Generating Helas calls for process: s s~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Reusing existing color information for process: s s~ > x1- x1+ @1 
INFO: Creating files in directory P1_qq_x1mx1p 
INFO: Some T-channel width have been set to zero [new since 2.8.0]
 if you want to keep this width please set "zerowidth_tchannel" to False 
INFO: Generating Feynman diagrams for Process: u u~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Generating Feynman diagrams for Process: c c~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Generating Feynman diagrams for Process: d d~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Generating Feynman diagrams for Process: s s~ > x1- x1+ WEIGHTED<=4 @1 
INFO: Finding symmetric diagrams for subprocess group qq_x1mx1p 
Generated helas calls for 4 subprocesses (12 diagrams) in 0.022 s
Wrote files for 44 helas calls in 0.139 s
ALOHA: aloha creates FFS1 routines
ALOHA: aloha creates FFV2 routines
ALOHA: aloha creates FFV5 routines
ALOHA: aloha creates FFS2 routines
ALOHA: aloha creates FFV3 routines
ALOHA: aloha creates FFV1 set of routines with options: P0
save configuration file to /tmp/tmp.GqSC5y7MdF/PROC_madgraph/Cards/me5_configuration.txt
INFO: Use Fortran compiler gfortran 
INFO: Use c++ compiler g++ 
INFO: Generate web pages 
Output to directory /tmp/tmp.GqSC5y7MdF/PROC_madgraph done.
Type "launch" to generate events from this process, or see
/tmp/tmp.GqSC5y7MdF/PROC_madgraph/README
Run "open index.html" to see more information about this process.
set run_mode 2
This option will be the default in any output that you are going to create in this session.
In order to keep this changes permanent please run 'save options'
set nb_core 1
This option will be the default in any output that you are going to create in this session.
In order to keep this changes permanent please run 'save options'
launch PROC_madgraph
************************************************************
*                                                          *
*                      W E L C O M E to                    *
*             M A D G R A P H 5 _ a M C @ N L O            *
*                      M A D E V E N T                     *
*                                                          *
*                 *                       *                *
*                   *        * *        *                  *
*                     * * * * 5 * * * *                    *
*                   *        * *        *                  *
*                 *                       *                *
*                                                          *
*         VERSION 2.9.3                 2021-03-25         *
*                                                          *
*    The MadGraph5_aMC@NLO Development Team - Find us at   *
*    https://server06.fynu.ucl.ac.be/projects/madgraph     *
*                                                          *
*               Type 'help' for in-line help.              *
*                                                          *
************************************************************
INFO: load configuration from /tmp/tmp.GqSC5y7MdF/PROC_madgraph/Cards/me5_configuration.txt  
INFO: load configuration from /usr/local/MG5_aMC_v2_9_3/input/mg5_configuration.txt  
INFO: load configuration from /tmp/tmp.GqSC5y7MdF/PROC_madgraph/Cards/me5_configuration.txt  
Using default text editor "vi". Set another one in ./input/mg5_configuration.txt
No valid eps viewer found. Please set in ./input/mg5_configuration.txt
No valid web browser found. Please set in ./input/mg5_configuration.txt
generate_events run_01
stty: 'standard input': Inappropriate ioctl for device
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program     shower = OFF               |
| 2. Choose the detector simulation program    detector = Not Avail.        |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail.        |
| 4. Decay onshell particles                    madspin = OFF               |
| 5. Add weights to events for new hypp.       reweight = OFF               |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program     shower = OFF               |
| 2. Choose the detector simulation program    detector = Not Avail.        |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail.        |
| 4. Decay onshell particles                    madspin = OFF               |
| 5. Add weights to events for new hypp.       reweight = OFF               |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program     shower = OFF               |
| 2. Choose the detector simulation program    detector = Not Avail.        |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail.        |
| 4. Decay onshell particles                    madspin = OFF               |
| 5. Add weights to events for new hypp.       reweight = OFF               |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/===========================================================================\
| 1. Choose the shower/hadronization program     shower = OFF               |
| 2. Choose the detector simulation program    detector = Not Avail.        |
| 3. Choose an analysis package (plot/convert) analysis = Not Avail.        |
| 4. Decay onshell particles                    madspin = OFF               |
| 5. Add weights to events for new hypp.       reweight = OFF               |
\===========================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
found line : /data/SleptonBino.slha
This answer is not valid for current question. Keep it for next question and use here default: EOF
INFO: copy /data/SleptonBino.slha as param_card.dat 
Do you want to edit a card (press enter to bypass editing)?
/------------------------------------------------------------\
|  1. param   : param_card.dat                               |
|  2. run     : run_card.dat                                 |
|  3. pythia8 : pythia8_card.dat                             |
\------------------------------------------------------------/
 you can also
   - enter the path to a valid card or banner.
   - use the 'set' command to modify a parameter directly.
     The set option works only for param_card and run_card.
     Type 'help set' for more information on this command.
   - call an external program (ASperGE/MadWidth/...).
     Type 'help' for the list of available command
 [0, done, 1, param, 2, run, 3, pythia8, enter path]
INFO: copy /data/default_LO.dat as run_card.dat 
Do you want to edit a card (press enter to bypass editing)?
/------------------------------------------------------------\
|  1. param   : param_card.dat                               |
|  2. run     : run_card.dat                                 |
|  3. pythia8 : pythia8_card.dat                             |
\------------------------------------------------------------/
 you can also
   - enter the path to a valid card or banner.
   - use the 'set' command to modify a parameter directly.
     The set option works only for param_card and run_card.
     Type 'help set' for more information on this command.
   - call an external program (ASperGE/MadWidth/...).
     Type 'help' for the list of available command
 [0, done, 1, param, 2, run, 3, pythia8, enter path]
INFO: copy /data/pythia_card.dat as pythia8_card.dat 
Do you want to edit a card (press enter to bypass editing)?
/------------------------------------------------------------\
|  1. param   : param_card.dat                               |
|  2. run     : run_card.dat                                 |
|  3. pythia8 : pythia8_card.dat                             |
\------------------------------------------------------------/
 you can also
   - enter the path to a valid card or banner.
   - use the 'set' command to modify a parameter directly.
     The set option works only for param_card and run_card.
     Type 'help set' for more information on this command.
   - call an external program (ASperGE/MadWidth/...).
     Type 'help' for the list of available command
 [0, done, 1, param, 2, run, 3, pythia8, enter path]
set iseed 0
INFO: modify parameter iseed of the run_card.dat to 0 
WARNING: Particle 35 with small width detected (0.5748014): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 36 with small width detected (0.6321785): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 37 with small width detected (0.5469628): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000001 with small width detected (5.312788): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000002 with small width detected (5.477195): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000003 with small width detected (5.312788): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000004 with small width detected (5.477195): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000005 with small width detected (3.736276): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000006 with small width detected (2.021596): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000012 with small width detected (0.1498816): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000014 with small width detected (0.1498816): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000016 with small width detected (0.147519): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000021 with small width detected (5.506754): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000023 with small width detected (0.000937327589): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000024 with small width detected (0.00700367294): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000025 with small width detected (1.915985): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000035 with small width detected (2.585851): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 1000037 with small width detected (2.486895): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000001 with small width detected (0.2858123): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000002 with small width detected (1.152973): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000003 with small width detected (0.2858123): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000004 with small width detected (1.152973): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000005 with small width detected (0.8015663): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
WARNING: Particle 2000006 with small width detected (7.373133): See https://answers.launchpad.net/mg5amcnlo/+faq/3053 to learn the special handling of that case 
INFO: Update the dependent parameter of the param_card.dat 
WARNING: Unknow type of information in the card: snumix,vckm,upmns 
Generating 1000 events with run name run_01
survey  run_01 
INFO: compile directory 
Not able to open file /tmp/tmp.GqSC5y7MdF/PROC_madgraph/crossx.html since no program configured.Please set one in ./input/mg5_configuration.txt
INFO: Using LHAPDF v6.3.0 interface for PDFs 
INFO: Trying to download NNPDF30_nlo_as_0118 
Unable to download /cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current/NNPDF30_nlo_as_0118.tar.gz
NNPDF30_nlo_as_0118.tar.gz:    25.9 MB [100.0%] 118.tar.gz:    16.2 MB [62.4%] 
INFO: NNPDF30_nlo_as_0118 successfully downloaded and stored in /usr/local/share/LHAPDF 
compile Source Directory
Using random number seed offset = 21
INFO: Running Survey 
Creating Jobs
Working on SubProcesses
INFO: Compiling for process 1/1. 
INFO:     P1_qq_x1mx1p  
INFO:     P1_qq_x1mx1p  
Zero result detected:  No Phase Space. Please check particle masses.

INFO:  
quit
INFO:  
Generation failed (no results.dat file found)
quit

Of course, this doesn’t actually give you any physics (which wasn’t really the point of this portion of the tutorial). In the next section, we’re going to walk through a real-world usage of mapyde.

To finish up this section however, remember that the base['path'] and base['output'] meant that outputs would be stored in our current working directory under tutorial/ so let’s see what got created:

!ls -lavh tutorial/
total 120
drwxr-xr-x   9 kratsg  staff   288B Dec 13 19:01 .
drwxr-xr-x  14 kratsg  staff   448B Dec 13 18:50 ..
-rw-r--r--   1 kratsg  staff    21K Dec 13 19:01 SleptonBino.slha
-rw-r--r--   1 kratsg  staff   1.3K Dec 13 19:01 charginos
-rw-r--r--   1 kratsg  staff    17K Dec 13 19:01 default_LO.dat
drwxr-xr-x   3 kratsg  staff    96B Dec 13 18:20 logs
drwxr-xr-x   3 kratsg  staff    96B Dec 13 18:20 madgraph
-rw-r--r--   1 kratsg  staff   4.1K Dec 13 19:01 pythia_card.dat
-rw-r--r--   1 kratsg  staff   1.4K Dec 13 19:01 run.mg5

We can confirm, for example, that our masses were substituted in correctly:

!head -n78 tutorial/SleptonBino.slha | sed 1,37d
###################################
## INFORMATION FOR MASS
###################################
Block mass
    5 4.889917e+00 # MB
    6 1.750000e+02 # MT
   15 1.777000e+00 # Mta
   23 9.118760e+01 # MZ
   24 7.982901e+01 # MW
   25 1.108991e+02 # MH01
   35    4.5E9  # MH02
   36    4.5E9  # MA0
   37    4.5E9  # MH
   1000001    4.5E9  # set of param :1*Msd1, 1*Msd2
   1000002    4.5E9  # set of param :1*Msu1, 1*Msu2
   1000005    4.5E9  # Msd3
   1000006    4.5E9  # Msu3
   1000011    250  # Msl1
   1000012    4.5E9  # Msn1
   1000013    250  # Msl2
   1000014    4.5E9  # Msn2
   1000015    250  # Msl3
   1000016    4.5E9  # Msn3
   1000021    4.5E9  # Mgo
   1000022    200 # Mneu1
   1000023    4.5E9  # Mneu2
   1000024    4.5E9  # Mch1
   1000025    4.5E9  # Mneu3
   1000035    4.5E9  # Mneu4
   1000037    4.5E9  # Mch2
   2000001    4.5E9  # set of param :1*Msd4, 1*Msd5
   2000002    4.5E9  # set of param :1*Msu4, 1*Msu5
   2000005    4.5E9  # Msd6
   2000006    4.5E9  # Msu6
   2000011    250  # set of param :1*Msl4, 1*Msl5
   2000013    250  # set of param :1*Msl4, 1*Msl5
   2000015    250  # Msl6
## Dependent parameters, given by model restrictions.
## Those values should be edited following the
## analytical expression. MG5 ignores those values
## but they are important for interfacing the output of MG5

Or what the madgraph run card looks like:

!cat tutorial/run.mg5
set default_unset_couplings 99
set group_subprocesses Auto
set ignore_six_quark_processes False
set loop_optimized_output True
set loop_color_flows False
set gauge unitary
set complex_mass_scheme False
set max_npoint_for_channel 0
import model MSSM_SLHA2
define j = g u c d s u~ c~ d~ s~
define pb = g u c d s b u~ c~ d~ s~ b~
define jb = g u c d s b u~ c~ d~ s~ b~
define l+ = e+ mu+
define l- = e- mu-
define vl = ve vm vt
define vl~ = ve~ vm~ vt~
define fu = u c e+ mu+ ta+
define fu~ = u~ c~ e- mu- ta-
define fd = d s ve~ vm~ vt~
define fd~ = d~ s~ ve vm vt
define susystrong = go ul ur dl dr cl cr sl sr t1 t2 b1 b2 ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
define susyweak = el- el+ er- er+ mul- mul+ mur- mur+ ta1- ta1+ ta2- ta2+ n1 n2 n3 n4 x1- x1+ x2- x2+ sve sve~ svm svm~ svt svt~
define susylq = ul ur dl dr cl cr sl sr
define susylq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~
define susysq = ul ur dl dr cl cr sl sr t1 t2 b1 b2
define susysq~ = ul~ ur~ dl~ dr~ cl~ cr~ sl~ sr~ t1~ t2~ b1~ b2~
define susysl = el- el+ er- er+ mul- mul+ mur- mur+ ta1- ta1+ ta2- ta2+
define susyv = sve svm svt
define susyv~ = sve~ svm~ svt~
define p = g u c d s u~ c~ d~ s~
define f = e+ mu+ ta+ e- mu- ta- ve vm vt ve~ vm~ vt~ u u~ d d~ c c~ s s~ b b~ g
generate     p p > x1- x1+
output PROC_madgraph

set run_mode 2
set nb_core 1
launch PROC_madgraph
madspin=OFF
shower=Pythia8
reweight=OFF

/data/SleptonBino.slha
/data/default_LO.dat
/data/pythia_card.dat
set iseed 0
done