Tutorials on Monte Carlo Integration
with BASES
Junichi Kanzaki (Kavli IPMU)
Iwate Collider School 2024
@ ANA Crowne Plaza Resort Appi Kogen
February 27, 2024

Purpose of this tutorial• We already have a great tool,

MadGraph5_aMC@NLO, which provides- the computations of cross-sections,- the event generations, and- the use of tools for data manipulation andanalysis.

You only need to specify physical process
information and a few parameters.
-> This tutorial aims to help you understandwhat MG5 is doing internally by experiencing crosssection calculations by yourselves.
Presented by J. Kanzaki at Iwate Collider School in February 27, 20242

"bsexamples.tar.gz" on Slack#tutorial• Required PC environment:- Essential: Development with gfortran, make, ...,
for installing "BASES."- Optional (recommended): Python3 with matplotlib
for data visualization.

• "bsexamples" includes five examples.
- Ex.1-3: 1-dimensional and multi-dimensional
integrations of simple functions.

- Ex.4-5: calculation of cross-section of physics
process (e-e+ > Z H).

- Both include examples of plotting with matplotlib.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

3

Numerical Integration• Computation of physics quantities is often reduced
to calculating multivariable functions.

- Cross-sections:<latexit sha1_base64="ADFPrVv3B99euDZhMIkwp4fzqWc=">AAACm3icSyrIySwuMTC4ycjEzMLKxs7BycXNw8vHLyAoFFacX1qUnBqanJ+TXxSRlFicmpOZlxpaklmSkxpRUJSamJuUkxqelO0Mkg8vSy0qzszPCympLEiNzU1Mz8tMy0xOLAEKxQuYxaSkFSUmV6fEFGem5ybWVqdUxFdn1dYq2CqkKWjEFBcWlVQX1+rE6BTEV2eC6AwQrRkvoGygZwAGCpgMQyhD2UHl67bDZdzfAvIFljPEMKQw5DMkM5Qy5DKkMuQxlADZOQyJDMVAGM1gyGDAUAAUi2WoBooVAVmZYPlUhloGLqDeUqCqVKCKRKBoNpBMB/KioaJ5QD7IzGKw7mSgLTlAXATUqcCganDVYKXBZ4MTBqsNXhr8wWlWNdgMkFsqgXQSRG9qQTx/l0Twd4K6coF0CUMGQhdeN5cwpDFYgN2aCXR7AVgE5ItkiP6yqumfg62CVKvVDBYZvAa6f6HBTYPDQB/klX1JXhqYGjSbgQsYAYbowY3JCDPSMzTTMw0ExoQTAwRwMEgzKDFoAMPbnMGBwYMhgCEUaO8chkMMpxnOMMkyOTN5MflAlDIxQvUIM6AAplAA922jcg==</latexit>pd= f ( s, pi , hi )dxj

- If you want to observe some quantities,
xj,j=1~n (pT of lepton or jet), you must
integrate other unobserved variables.

• Monte Carlo integration using random numbers isparticularly useful for higher-dimensional integrals.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

4

Monte Carlo Integration (ref.)•We had a good lecture by Olivier this morning.
•VEGAS: G.P. Lepage, J. Comput. Phys. 27(1978) 192–203.

•BASES: S. Kawabata, Comput. Phys. Commun.

88, 309 (1995) - Integration/Event generation•MG5: J. Alwall, M. Herquet, F. Maltoni, O.

Mattelaer, T. Stelzer, JHEP06 (2011) 128 Integration/Event generation

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

5

BASES/SPRING•BASES/SPRING is the Monte Carlo integrationand event generation package developed at KEK
based on the VEGAS algorithm.

•BASES, the MC integration program, includes
histograming utilities, which are helpful for
instantly checking distributions.

•SPRING is the unweighted event generation
package using BASES integration results.

-> I will focus on the usage of BASES today.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

6

Tutorials with BASES•All samples are written in Fortran 90•The BASES program is composed of threeparts:-initializations - call "bsinit" and "userin"‣parameters for integration and integrandfunctions-integration part-termination - "call usrout" and othersubroutines- integration results and histogram outputs
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

7

BASES parameters•Parameters of integrand function:•ndim - the number of dimensions of theintegrand function•xl(i), xu(i) - the ranges of integration
variables for i = 1 to ndim
ndim = 8
nwild = ndimxl(1:ndim) = 0.d0
xu(1:ndim) = 1.d0ig(1:ndim) = 1
call bssetd(ndim,nwild,xl,xu,ig)
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

8

BASES parameters•BASES has two integration phases.
- Optimizations of grids of variables- Data accumulations are based on optimized
grids.

- Both phases proceed iteratively, step by
step.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

9

BASES parameters•Parameters of integration:•ncall - the number of function calls per iteration
step•it1, it2 - the maximum iterations for each programphase (it1-optimization, it2-accumulation).

•acc1, acc2 - the accuracy to stop iterations (in %)ncall = 10000
itmx1 = 10
itmx2 = 10
acc1 = 0.01
acc2 = 0.01
call bssetp(ncall,itmx1,itmx2,acc1,acc2)
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

10

BASES parameters•Sample output of integration
Optimization phase

Iteration numbers

Convergency Behavior for the Grid Optimization Step-----------------------------------------------------------------------------<- Result of each iteration -> <Cumulative result-> < CPU time >IT Eff R_Neg
Estimate Acc % Estimate(+- Error )order Acc % ( h: m: sec )-----------------------------------------------------------------------------1 100 0.00 3.141E+00 0.042 3.141292(+-0.001308)e 00 0.042
0: 0: 0.00
2 100 0.00 3.142E+00 0.056 3.141694(+-0.001048)e 00 0.033
0: 0: 0.00
3 100 0.00 3.142E+00 0.064 3.141676(+-0.000931)e 00 0.030
0: 0: 0.00------------------------------------------------------------------------------

1

Accumulation phase

Results and errors at each iteration

date: 24/ 2/27 08:12
Convergency Behavior for the Integration Step-----------------------------------------------------------------------------<- Result of each iteration -> <Cumulative result-> < CPU time >IT Eff R_Neg
Estimate Acc % Estimate(+- Error )order Acc % ( h: m: sec )-----------------------------------------------------------------------------1 100 0.00 3.144E+00 0.068 3.143867(+-0.002139)e 00 0.068
0: 0: 0.00
2 100 0.00 3.140E+00 0.069 3.142203(+-0.001524)e 00 0.049
0: 0: 0.00
3 100 0.00 3.141E+00 0.066 3.141840(+-0.001230)e 00 0.039
0: 0: 0.00------------------------------------------------------------------------------

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

11

Integrand function•The integration part and the integrand function
are defined as follows:call bases(func, estim,error,ctime,it1,it2)•func - the integrand function•Integration results:-estim - integrated result-error - its error-ctime - calculation time
-it1, it2 - number of iterations in the
integration

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

12

Integrand function•Function definition
real(real64) function func(z)real(real64), intent(in) :: z(*)
func = 2.d0*sqrt((1.d0-z(1))*(1.d0+z(1)))•z(i), i=1,ndim: random numbers given to theintegrand function as integration variables.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

13

Histograming in BASES•Definition at initialization step:
call xhinit(1,-1.d0,1.d0,50,'costh')•xhinit(id,xlow,xhigh,nbins,'title')•Filling in the integrand function
call xhfill(1,costh,func)•xhfill(id,val,func)•Output at the termination step
call bhplot(6)•bhplot(lun)Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

14

Tutorial-0• We assume the development environment with
gfortran.

• Install python3 with "matplotlib" to experienceplotting.

• After downloading the example package,bsexamples.tar.gz, please make and install the
BASES library, located under the bases50 directory.

• Apology: the bases library, libbases50.a, compiled

under my environment, is erroneously included in theexample file. -> Please recompile and reinstall it
under your environment (see next slide).
Presented by J. Kanzaki at HOW2019 in March 19, 2023

15

Installation of examples• After downloading the example package,bsexamples.tar.gz, please go to the bases50
directory and make and install the librarylibbases50.a.
kanzaki$ cd bsexamples
kanzaki$ ls
bases50/
example1/
example3/
dmp2array.py* example2/
example4/
kanzaki$ cd bases50
kanzaki$ make clean; make install....
Loading libbases50.a ...
done
Installing libbases50.a in ../lib
kanzaki$ cd ../kanzaki$ ls lib/
libbases50.a*

example5/lib/

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

16

Installation of examples (cont'd)• For each example, example1 - example5, go to thedirectory and execute "make."• The program, "examplex.f90", includes all necessary
program components.

• For example, in the case of "example1":
kanzaki$ cd example1/
kanzaki$ ls
Makefile__pycache__/ dmp2array.py@ example1.f90
kanzaki$ makegfortran -O -I./ -c example1.f90
gfortran example1.o -L../lib-lbases50 -o example1
kanzaki$kanzaki$ ls
Makefile
dmp2array.py@ example1.f90 plot.py*__pycache__/ example1*
example1.okanzaki$ ./example1

plot.py*• You can try plotting with "plot.py" if you have matplotlib.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

17

Tutorial-1
The integration of 1-dim. function:pf (x) = 2 (1 x2 )between -1 < x < 1.
<latexit sha1_base64="SICz/VzBHuP6BBDEbXCp9hFa16I=">AAACfnichVHLSsNAFD3Gd3206kZxEyxKXVgnRVQEoejGpa+q4KMkcVpD0yQm02INxb0/4MKVgogI+hFu/AEXfoK4VHDjwts0ICrqHWbmzJl77pyZ0RzT8ARjjw1SY1NzS2tbe6Sjs6s7GuvpXfPskqvzjG6btruhqR43DYtnhCFMvuG4XC1qJl/XCvO1/fUydz3DtlZFxeHbRTVvGTlDVwVR2dhALnEwKs/KKXnL23eFn1DGDnb8VHW0mo3FWZIFIf8ESgjiCGPRjl1iC7uwoaOEIjgsCMImVHjUNqGAwSFuGz5xLiEj2OeoIkLaEmVxylCJLdCYp9VmyFq0rtX0ArVOp5jUXVLKGGYP7Iq9sHt2zZ7Y+6+1/KBGzUuFZq2u5U42ety/8vavqkizwN6n6k/PAjlMB14N8u4ETO0Wel1fPjx5WZlZHvZH2Dl7Jv9n7JHd0Q2s8qt+scSXTxGhD1C+P/dPsJZKKpPJiaWJeHou/Io2DGIICXrvKaSxgEVk6NwjXOAGtxKkEWlMGq+nSg2hpg9fQpr+ANsHkXY=</latexit>

1. Make "example1" and execute it. Check theanswer
2. Increase "ncall" and check the accuracy.
You can also change it1, it2, and/or acc1,
acc2 and observe results.
3. You can obtain the same answer with 0 < x< 1 and f(x) = 4 x ...
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

18

Tutorial-1 (cont'd)
1. Learn how to define histograms in "userin."call xhinit(id,xmin,xmax,nbins,title)
2. Learn how to fill histograms in "bfunc":
call xhfill(id,val,func)
3. The program generates a histogram dump
file, "example.dump." If you have"matplotlib," execute the script "plot.py,"
which reads the file and generates a plot.
4. You can modify the script to get a betterlooking plot if you have experience.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

19

Tutorial-2•Another example of the integration of multidimensional function:<latexit sha1_base64="GmIVjI1MkcIvFJAQGDCB3ztaKdY=">AAACknicSyrIySwuMTC4ycjEzMLKxs7BycXNw8vHLyAoFFacX1qUnBqanJ+TXxSRlFicmpOZlxpaklmSkxpRUJSamJuUkxqelO0Mkg8vSy0qzszPCympLEiNzU1Mz8tMy0xOLAEKxQvopmlUaCrYKsQUFOWnxFdn2hrWxlXnxcfkJpZkFOVWp2Tm1tYqaBgpVADlajXjBZQN9AzAQAGTYQhlKDNAQUC+wHKGGIYUhnyGZIZShlyGVIY8hhIgO4chkaEYCKMZDBkMGAqAYrEM1UCxIiArEyyfylDLwAXUWwpUlQpUkQgUzQaS6UBeNFQ0D8gHmVkM1p0MtCUHiIuAOhUYVA2uGqw0+GxwwmC1wUuDPzjNqgabAXJLJZBOguhNLYjn75II/k5QVy6QLmHIQOjC6+YShjQGC7BbM4FuLwCLgHyRDNFfVjX9c7BVkGq1msEig9dA9y80uGlwGOiDvLIvyUsDU4NmM3ABI8AQPbgxGWFGeoZmeiaBJsoOTtCo4GCQZlBi0ACGtzmDA4MHQwBDKNDeyQw7GQ4xHGYSYbJicmRyhihlYoTqEWZAAUw+AHzkmpM=</latexit>

f (x) =

nY
dim

(2xi )

i=1•Try to change integration parameters.
•Try plotting "plot.py" for the dump file,"example2.dump."

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

20

Tutorial-3
2 次元正規分布

2 次元正規分布

次元正規分布(のうちY integration
が独立な簡単なケース
exampleof X,
theof a 2- )•2Anotherdimensional Gaussian function:
fXY (x, y) = !

(x−µX )2
−
2σ 2
X

1
2
2πσX

e

×!

1
2
2πσY

2
E[X]
=
µ
,
E[Y
]
=
µ
,
V[X]
=
σ
Check
resultsandhistograms.
X
Y
•
X,

e

(y−µY )2
−
2σ 2
Y

.

2
V[Y ] = σY,

母共分散
CXY =and(独立なので) = 0,
to define
fill 2-dimensional•Learn how

Cov[X, Y ]histograms.
"
母相関係数 rXY = "
V[X]

V[Y ]

=0

•Test "plot_1d.py" and "plot_2d.py."
2 変量データ

確率統計☆演習 I(2015)L04

同時分布

確率統計☆演習 I(201108Presented by J. Kanzaki at Iwate Collider School in February 27, 202421

2d histograms in BASES•Definition at initialization step:
call dhinit(1,-1.d0,1.d0,50, &0.d0,2.d0,50,'costh')•dhinit(id,xlow,xhigh,nxbins, &ylow,yhigh,nybin,'title')•Filling in the integrand function
call dhfill(1,xval,yval,func)•dhfill(id,valx,valy,func)•Output at the termination step is the same as 1d
histograms.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

22

Tutorial-4
Calculate cross-sections of the physics process:+<latexit sha1_base64="LEjF5+rdcBR16lebsXdorsZJuMA=">AAACgHichVHLLgRBFD3aa4zXYCOx6ZgQiRjVIsishI2l1yBek+5WMyp6ujvVNSNMZmHrByysSETEhm+w8QMWPkEsSWws3OnpRBDcSlWdOnXPrVNVlu+IQDH2WKfVNzQ2Ncda4q1t7R2dia7ulcArSptnbM/x5JplBtwRLs8ooRy+5ktuFiyHr1p7s9X91RKXgfDcZXXg862CmXdFTtimIiqb6OPb5ZGKTuNwRd+UIr+rTCm9fX1dn8smkizFwtB/AiMCSUQx7yUusYkdeLBRRAEcLhRhByYCahswwOATt4UycZKQCPc5KoiTtkhZnDJMYvdozNNqI2JdWldrBqHaplMc6pKUOgbYA7tiL+yeXbMn9v5rrXJYo+rlgGarpuV+tvO4d+ntX1WBZoXdT9WfnhVymAq9CvLuh0z1FnZNXzo8eVlKLw6UB9k5eyb/Z+yR3dEN3NKrfbHAF08Rpw8wvj/3T7AyljImUuML48npmegrYuhDP4bovScxjTnMI0PnHuESN7jVNG1IG9WMWqpWF2l68CW09Afi/pNU</latexit>e e ! ZH

See Olivier's lecture this morning for details.
<latexit sha1_base64="IlDXFoQUoMo+KBDU+NIjZ2aLdvE=">AAAD4HichVHPaxNBFH5J1Nb4o6leBC+DoUUEwyQUFUEoevEipK39Ad0aZicvydDd2XVnEpJu9y5exJOgJwUR8c/w4j/goUeP4rGCFw++3Y00tVZn2Zk333zfm2/ec0NPGcv5XqFYOnHy1NT06fKZs+fOz1RmL6yZoB9JXJWBF0QbrjDoKY2rVlkPN8IIhe96uO5u30vP1wcYGRXoh3YU4pYvulp1lBSWoNZsYcdxsat0jI+1iCIxupaUHaO6vmDz7A79TrsTCRnXk7hhiGpFMoEcjpW2zDF9vxU7Hjloi4Tt5nuVPEgntvuowdpOs6eY45Qd3w2GccfrD1lHSBtEybFXHtBNqDQT9CLRxb/wE8cqH80kkmlzP7/5WaYe1Uwqq9CwoMNwaDHSwmOhiKySHppMmNuelAmf2mL7bUxV6rrtMdkTWqOXX5S+bZIe9qg5zIRCIhUWdXui0K1Kldd4NtjRoD4OqjAezaDyDhxoQwAS+uADggZLsQcCDH2bUAcOIWFbEBMWUaSyc4QEyqTtEwuJIQjdprlLu80xqmmf5jSZWtItHv0RKRnM8c/8Pd/nn/gH/pX/PDZXnOVIvYxodXMthq2Zp5dWfvxX5dNqoXeg+qdnCx24lXlV5D3MkPQVMtcPdl7sr9xenovn+Rv+jfy/5nv8I71AD77Lt0u4/ArK1ID6n+U+Gqw1avUbtYWlRnXx7rgV03AZrsBVqvdNWIT70IRVkIUvxalipThbcktPSs9Kz3NqsTDWXIRDo/TyFycPEYk=</latexit>

=

=

1
2s
1 1
⇥
2 2
helicities of external particles=

amplitude of i-th channel=

phase space

flux factor=

spin average

=

Mi

Z X X
1 11
|
Mi | 2 d
2s 2 2iPresented by J. Kanzaki at Iwate Collider School in February 27, 2024

23

Tutorial-4•Integration of cross-sections of the physics
process:•|Mi|2: Helicity amplitude by MG5•d\Phi: Phase space-> Integrand function becomes, |Mi|2 x d\Phi•I prepared the helicity amplitude with MG5,
outputted with "standalone" mode. Then copy
"Cards," "lib," and some files under theprocess directory to example4 and example5.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

24

Tutorial-4• Directory structure:kanzaki$ cd example4
kanzaki$ ls
Cards/ lib/
src/

• Go to the directory, src/:
kanmac21:src kanzaki$ cd src/
kanmac21:src kanzaki$ ls
Makefile
example4.f90__pycache__/generate_phase_space.f90
coupl.inc
matrix.f
dmp2array.py@
nexternal.incngraphs.inc
plot_cosz.py*
pmass.inc
run_example4*• I copied "matrix.f" (amplitude program) andinclude files (coupl.inc, nexternal.inc, ngraphs.inc,
and pmass.inc) and made a few modifications(*).
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

25

Tutorial-4 (for reference)• (*) in the previous slide:• coupl.inc: Put "!" at the beginning of the first threelines due to the language difference of Fortran 90.

Add three"!"cat coupl.inc
kanzaki$!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc!cwritten by the UFO converter!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc• Copy the definition of "ncomb" from the top part ofmatrix.f to "nexternal.inc" to use the variable in
BASES. matrix.f
nexternal.inc
C
C
C

SUBROUTINE SMATRIXHEL(P,HEL,ANS)IMPLICIT NONECONSTANT

Copy two lines

INTEGERNEXTERNALPARAMETER (NEXTERNAL=4)
INTEGER
NCOMB
PARAMETER (NCOMB=12)

INTEGERNEXTERNALPARAMETER (NEXTERNAL=4)
INTEGERNINCOMINGPARAMETER (NINCOMING=2)
INTEGER
NCOMB
PARAMETER (NCOMB=12)

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

26

Generation of phase space
We have to generate phase space:total collision energy (input parameter) + random
numbers -> four-vectors of external particles
kanzaki$ cat generate_phase_space.f90
subroutine generate_phase_space(z, sqrts, pmass, &p, nexternal, phfact, ierr)

In this example:
The final state particles are Z and H.
Calculate four-vectors of external particles, pe-,
pe+, pZ, pH, from input random numbers.
* MG5 does it for you.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

27

Two-body phase space
Two-body phase space:
Z 2⇡2
2 Z +11
m1 m2
d cos ✓
d
d 2=
(
,
)
8⇡
s
s
2
2⇡
1
0
Total energy: W(=\sqrt{s}) -> P1(m1) + P2(m2)<latexit sha1_base64="YJLdOzN0ml27A7G+DEkxmtLkCEc=">AAAC93ichVFLaxRBEK4ZX3F9ZNWLIEhwia6oS83gIwhC0IvHTeImgXQyzPT2ZpvMi5nehbXpP+DRiwcPouALT/kNufgHPOQniMcIevBgzUNFg1pNd1d/9X1V1d1BGspcIe5a9oGDhw4fmTraOHb8xMnp5qnTy3kyyrjo8SRMstXAz0UoY9FTUoViNc2EHwWhWAm27hXxlbHIcpnED9QkFeuRvxnLgeS+IshrPu6z7lB67h3WH2Q+147RcyyVhiWkKpJqFgjlG23aNSPynA3X6Nxc/Qm4FXCZyVh5+ppjNvQVx9ThPuNJztSwzOKaioNEccs6P0jpUJoK8pot7GBpM/sdp3ZaUFs3ab4GBn1IgMMIIhAQgyI/BB9yGmvgAEJK2DpowjLyZBkXYKBB2hGxBDF8Qrdo3aTTWo3GdC5y5qWaU5WQZkbKGZjFD/gW9/A9vsOP+O2vuXSZo+hlQntQaUXqTT86u/Tlv6qIdgXDX6p/9qxgAHNlr5J6T0ukuAWv9OOHT/aWbi/O6ov4Aj9R/89xF3foBvH4M3+5IBafQoM+wPnzufc7y27Hudm5sXC9NX+3/oopOAcXoE3vfQvm4T50oUd1v1rnrUtW257Yz+xX9puKalu15gz8Zvb2d2tFxGI=</latexit>

1.Determine energies of P1 and P2 (E1 and E2)
from total energy, W
2. Determine directions (\theta and \phi) offinal particles with two random numbers andcalculate four momenta for P1 and P2.
\theta: -1 < cos(\theta) < +1
\phi: 0 < \phi < 2 \piPresented by J. Kanzaki at Iwate Collider School in February 27, 202428

(Three body phase space)
Then go to three-body phase space:<latexit sha1_base64="uUlSytL0+NpRmPcPkb9sq90FTzo=">AAACznichVFNa9RAGH6a+lHXj656KXhZXCopxWWSVSvCQtGLx/Rj20LThiQ72w7Nx2wyu1BD6FX8Ax48KYiIP8OLN08e+hPEYyteRH2TDRQt6jvMzDPPvM8z78x4MhCpYuxwQps8c/bc+akLtYuXLl+Zrl+9tpbGw8TnXT8O4mTDc1MeiIh3lVAB35AJd0Mv4Ove3qNif33Ek1TE0aral3wrdHci0Re+q4hy6qJnW7vCaXdsESkn00PHmA8dc27bzLcz3U4HicrS/HbotAvK7vUT1896A8KZaUuRF7LG2MPUrc5gXrbnTjhTH3Qk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

0

W(=\sqrt{s}) -> p1(m1) + p2(m3) + p3(m3)-> Combination of two two-body phase space:PS(p3,q=p1+p2) + PS(p1,p2)
Presented by J. Kanzaki at Iwate Collider School in February 27, 202429

(Three body phase space) (cont'd)
1.Determine the invariant mass of the system of
p1+p2, q2, with a random number:
m1+m2 < q2 < W-m3
2. Generate four momenta of p3 and p1+p2 withtwo body phase space.
3. Then generate p10 and p20 at the rest frameof p1+p2 with q2.
4. Rotate&Boost generated p10 and p20 to thelab. Frame, p1 and p2.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

30

Tutorial-4 (cont'd)
Go to ./src, make executable, and use"run_example4.sh" to execute the program. This
script includes values collision energy and "ncall."Try plotting with "plot_cosz.py."
1. Learn how we can calculate cross-sections of
the physics process.
2. Learn about phase space generation.
3. If you wish, try other physics processes andcalculate cross-sections after learning more
about using "MG5." Of course, MG5
automatically does it for you.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

31

Tutorial-5
Calculate cross-sections of the Standard Model
physics processes with decays:

e e+ ! Z(! µ µ+ )H(! bb)<latexit sha1_base64="qYHdnPhZNAbm7kkP9N5EGB621e4=">AAACs3ichVFLLyxBFP60x3XHa7C5yd10TAgRkxq5HrESNlbiNYgZJt2tjIp+pbpmhIk/4A/cxV25iYjY+gc2/oAFWzZiSWJj4XRPJ17B6XTVd75zvnNOVZm+LQLF2GWNVltX3/Cj8WeiqbmltS3Z3rEYeCVp8azl2Z5cNo2A28LlWSWUzZd9yQ3HtPmSuTUZxpfKXAbCcxfUjs9XHaPoig1hGYqoQnKarw3ofK1fz0tR3FSGlN62vqL3vnbzTomSwrW/T596GzP1vEf1w/YVc6+vkEyxNItM/wgyMUghthkveYQ81uHBQgkOOFwowjYMBPTlkAGDT9wqKsRJQiKKc+whQdoSZXHKMIjdorVIXi5mXfLDmkGktqiLTb8kpY5udsGO2T07Zyfslj19WqsS1Qhn2aHdrGq5X2jb/zX/+K3KoV1h80X15cwKGxiNZhU0ux8x4Smsqr68+/d+fmyuu9LD/rM7mv+AXbIzOoFbfrAOZ/ncPyToATLvr/sjWBxMZ4bTQ7N/UuMT8VM04je60Ev3PYJxTGEGWep7iitc40Yb0nKaqa1XU7WaWNOJN6Y5z4iipxs=</latexit>

1. The procedure is almost the same as"Tutorial-4."
2. Try plotting with "plot.py," which generates
invariant mass distributions.
3. Try the four-body phase space with decays.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

32

Generation of phase space
Phase space generation for the decay of aresonance:-> See the detailed description and example
in Olivier's lecture.
All necessary functions and subroutines areincluded in "generate_phase_space.f90" in thesrc/directory. It is far more complicatedthan the two body cases in "example4." If
you are interested, please read it carefully.
Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

33

Summary•We already have many excellent software tools
for physics studies. They have much automaticfunctionality, which helps your analysis.
•Still, I want you to understand what
procedures/technologies such software uses, notjust using it.
•I hope my examples help you experience the MC
integration and the calculation of cross-sections
and understand the calculation processes.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

34

Summary•If possible, try to modify these codes and test
them by yourself:- check ncall dependence of integration
accuracies,- apply kinematical cuts to final state particles,- try other physics processes in which you havesome interest- etc.

Presented by J. Kanzaki at Iwate Collider School in February 27, 2024

35