ICS2023 Tutorial; requirements• Laptop PC (with internet connection)• Terminal (for shell operation)• Basic knowledge of shell commands;e.g. pwd, mkdir, cd, cp, mv, rm, tar, less, more, …

• python 2.7 or 3.7 (or higher)• gfortran/gcc 4.6 or higher• matplotlib (or ROOT) [for MadAnalysis5]• Mathematica [only for those who want to learn FeynRules]
ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

MadGraph5_aMC@NLO; start-up• Download MG5_aMC_X.Y.Z.tar.gz (LTS_2.9.14)
from the MadGraph5_aMC@NLO launchpad:
https://launchpad.net/mg5amcnlo• At your working directory in a terminal, untar:$ tar zxvf MG5_aMC_X.Y.Z.tar.gz• Go into the MG5aMC directory:$ cd MG5_aMC_vX_Y_Z/• Start MG5aMC:$ ./bin/mg5_aMC

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

MG5aMC; first try• After the MG5aMC logo, your terminal should have MG5_aMC>
prompt. Please try:

• MG5_aMC> generate p p > t t~
• MG5_aMC> output• MG5_aMC> launch• Please ignore a few questions from MG5aMC by just pushing the"Enter" key, then after a few minutes, you should get in yourbrowser (…/MG5_aMC_vX_Y_Z/PROC_sm_0/crossx.html) like• Now you are ready to do some simulations for the LHC and ILC!
ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

MG5aMC; install other tools

Please also try to install other tools as• For plots:

MG5_aMC> install MadAnalysis5• For parton-shower and hadronization:
MG5_aMC> install pythia8

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

MG5aMC; main 4 steps• MG5_aMC> import model MODEL (e.g. 2HDM)• MG5_aMC> generate PROCESS (e.g. p p > t t~)• MG5_aMC> output (myprocess)• MG5_aMC> launch• MG5_aMC> launch• MG5_aMC> ...
ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

MG5aMC; tips

• Use auto-completion by “tab (tab)”.
• MG5_aMC> help• MG5_aMC> help COMMAND (e.g. generate)• MG5_aMC> tutorial

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

One can directly communicate
with the developers via Launchpad(ask questions, report bugs, etc).

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

EX-1; change parameters• Semi-leptonic decays in top-pair production at the LHC:
MG5_aMC> generate p p > t t~, t > b l- vl~, t~ > b~ j j• How can we change?
•top mass•

top width•

W mass•beam energy•

pT cut on leptons

ICS2023 Tutorial - Appi - 2023.2.28-3.3

edit param_card.dat and/or run_card.dat in Cards/.
oruse the "set" command.

Kentarou Mawatari (Iwate U.)

Solution

EX-1; change parameters• Semi-leptonic decays in top-pair production at the LHC:
MG5_aMC> generate p p > t t~, t > b l- vl~, t~ > b~ j j• How can we change?
•top mass
edit Cards/param_card.dat•top width•

the default SM, the W mass cannot be changed
W mass Inbecause it is an internal parameter.

•beam energy•

pT cut on leptons

ICS2023 Tutorial - Appi - 2023.2.28-3.3

edit Cards/run_card.dat

Kentarou Mawatari (Iwate U.)

EX-2; process generation (coupling order)• What is the difference?
1. > generate p p > t t~

Check the Feynman diagrams !

2. > generate p p > t t~ QCD=0
3. > generate p p > t t~ QED=0
4. > generate p p > t t~ QED<=99• Compare the cross sections.
ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)Solution

EX-2; process generation (coupling order)

• QCD
QCD
onlyICS2023 Tutorial - Appi - 2023.2.28-3.3

QCD+QED
Kentarou Mawatari (Iwate U.)

EX-3; cross sections (param scan; root-S)• Reproduce the red curve.
Edit myprocess/Cards/run_card.dat,> launch -n rs200
Edit myprocess/Cards/run_card.dat,> launch -n rs250…

Write a MG5 script file.

Fig.3 in ILC250 [1710.07621]
ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

Solution

EX-3; cross sections (param scan; root-S)
test_eehz.mg5

Run MG5aMC with a script file;$ ./bin/mg5_aMC test_eehz.mg5
Make a data file;$ cd Proc_eehz$ ./bin/madevent
Proc_eehz> print_results --format=short --path=xsec.dat
xsec.dat# run_name tag cross error Nb_event cross_after_matching nb_event_after matching
230 tag_1 0.32727 0.00010604 1
240 tag_1 0.3559 0.00013049 1
250 tag_1 0.35566 0.00017036 1
260 tag_1 0.34348 0.00018299 1
270 tag_1 0.32577 0.00020246 1
280 tag_1 0.30622 0.0002151 1
290 tag_1 0.28693 0.00021947 1
300 tag_1 0.26736 0.00024268 1
350 tag_1 0.19108 0.00023025 1
400 tag_1 0.14076 0.0002094 1
450 tag_1 0.10777 0.00018119 1
500 tag_1 0.084641 0.00027909 1

ICS2023 Tutorial - Appi - 2023.2.28-3.3

generate e+ e- > h z
output Proc_eehz#
launch -n 230
analysis = OFF0
set polbeam1 30
set polbeam2 -80
set nevents 1
set ebeam 115
0#
launch -n 240
0
set ebeam 1200#
launch -n 250
0
set ebeam 125
0#…

Kentarou Mawatari (Iwate U.)

Solution

EX-3; cross sections (param scan; root-S)
xsec.py

Make a plot (e.g. by matplotlib);$ python xsec.py

import numpy as np
import matplotlib.pyplot as plt## import data files
data = np.loadtxt('xsec.dat', skiprows=1, usecols=(0,2))## define the variables for the x and y axes
roots=data[:,0]xsec=data[:,1]## setup a plot
plt.plot(roots,xsec*1000,'-or',label='$P(e^+,e^-)=(0.3,-0.8)$')xlab=r'$\sqrt{s}$ [GeV]'
ylab=r'$\sigma(e^+e^-\to hZ)$ (fb)'xlimrange=[200,500]
ylimrange=[0,400]
savepdf='xsec.pdf'## setup the details
plt.xlim(xlimrange)
plt.ylim(ylimrange)
plt.title("Higgs production (Fig.3 in 1710.07621)")
plt.xlabel(xlab, fontsize=16)
plt.ylabel(ylab, fontsize=16)
plt.legend()
plt.grid()
plt.gca().xaxis.set_tick_params(which='both', direction='in',bottom=True, top=True, left=True, right=True)
plt.gca().yaxis.set_tick_params(which='both', direction='in',bottom=True, top=True, left=True, right=True)## output
plt.savefig(savepdf, format='pdf', bbox_inches='tight')
plt.show()

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

EX-4; cross sections (param scan; masses)• Reproduce the black curves.
Edit myprocess/Cards/param_card.dat,> launch -n m1000
Edit myprocess/Cards/param_card.dat,> launch -n m2000…

Use a scan command in param_card.dat.
Fig.2.1(left) in HL-LHC/HE-LHC [1812.07831]

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

Solution

EX-4; cross sections (param scan; masses)$ ./bin/mg5_aMC> import model MSSM_SLHA2> generate p p > go go> output Proc_gluinopair> launch -n mgo27TeV> analysis = OFF>0> set nevents 1> set ebeam 13500> set mgo scan:[1000*i for i in range (1,8)]>0ICS2023 Tutorial - Appi - 2023.2.28-3.3

Check the scan results;$ cd Proc_gluinopair/Events/$ more scan_mgo27TeV[-_scan_07].txt#run_namemass#1000021
mgo27TeV
1.000000e+03
mgo27TeV_scan_02 2.000000e+03
mgo27TeV_scan_03 3.000000e+03
mgo27TeV_scan_04 4.000000e+03
mgo27TeV_scan_05 5.000000e+03
mgo27TeV_scan_06 6.000000e+03
mgo27TeV_scan_07 7.000000e+03

cross
3.404119e+00
4.243611e-02
1.852129e-03
1.246744e-04
1.017567e-05
9.133868e-07
9.263558e-08

Kentarou Mawatari (Iwate U.)

Solution

EX-4; cross sections (param scan; masses)
xsec_gluinopair.py
import numpy as np
import matplotlib.pyplot as plt

Make a plot (e.g. by matplotlib);$ python xsec.py•## import data files
data1 = np.loadtxt('scan_mgo27TeV[-_scan_07].txt', skiprows=1, usecols=(1,2))
data2 = np.loadtxt('scan_mgo14TeV[-_scan_07].txt', skiprows=1, usecols=(1,2))## define the variables for the x and y axes
mgo=data1[:,0]xsec1=data1[:,1]
xsec2=data2[:,1]## setup a plot
plt.plot(mgo,xsec1*10**6,'-or',label='$\sqrt{s}=27$TeV')
plt.plot(mgo,xsec2*10**6,'--or',label='$\sqrt{s}=14$TeV')
xlab=r'$m_{\tilde g}$ [GeV]'
ylab=r'$\sigma(pp\to \tilde g\tilde g)$ (ab)'xlimrange=[1000,7000]
ylimrange=[10**-1,10**7]
savepdf='xsec_gluinopair.pdf'## setup the details
plt.yscale('log')
plt.xlim(xlimrange)
plt.ylim(ylimrange)
plt.title("Gluino pair production (Fig.2 in 1812.07831)")
plt.xlabel(xlab, fontsize=16)
plt.ylabel(ylab, fontsize=16)
plt.legend()
plt.grid()
plt.gca().xaxis.set_tick_params(which='both', direction='in',bottom=True, top=True, left=True, right=True)
plt.gca().yaxis.set_tick_params(which='both', direction='in',bottom=True, top=True, left=True, right=True)## output
plt.savefig(savepdf, format='pdf', bbox_inches='tight')
plt.show()

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

EX-5; process generation (syntax)• What is the difference?
1. > generate p p > e+ e2. > generate p p > z > e+ e-

Edit myprocess/Cards/
madanalysis5_parton_card.dat
to refine bins of plots.

3. > generate p p > z, z > e+ e4. > generate p p > e+ e- $ z
5. > generate p p > e+ e- $$ z
6. > generate p p > e+ e- / z

Run MA5 later;$ cd myprocess/$ ./bin/madevent
myprocess> madanalysis5_parton• Compare the distributions of the lepton-pair invariant mass.
Run MA5 standalone;$ MG5_aMC_vX_Y_Z/HEPTools/madanalysis5/madanalysis5/bin/ma5

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)

SolutionEX-5; process generation (syntax)
Run MA5 standalone;$ …HEPTools/madanalysis5/madanalysis5/bin/ma5 test.ma5

Check cut_decays in run_card.dat.

test.ma5
import ProcDY1/Events/run_02/unweighted_events.lhe.gz as DY1
import ProcDY2/Events/run_02/unweighted_events.lhe.gz as DY2
import ProcDY3/Events/run_02/unweighted_events.lhe.gz as DY3
import ProcDY3/Events/run_03/unweighted_events.lhe.gz as DY3_cutdecayT
import ProcDY4/Events/run_02/unweighted_events.lhe.gz as DY4
import ProcDY5/Events/run_02/unweighted_events.lhe.gz as DY5#import ProcDY6/Events/run_02/unweighted_events.lhe.gz as DY6#
set main.stacking_method = superimpose
set main.lumi = 100
set DY1.linecolor = blackset DY1.linewidth = 2
set DY3.linecolor = blue
set DY3.linestyle = dashedset DY3_cutdecayT.linecolor = blue
#plot M(e+ e-) 50 0 200 [logY]
set selection[1].ymin = 1000
submit MA5plot

ICS2023 Tutorial - Appi - 2023.2.28-3.3

Kentarou Mawatari (Iwate U.)