owned this note
owned this note
Published
Linked with GitHub
---
title: 'MadGraph5 Tutorial-SVJ v.2'
disqus: hackmd
---
MadGraph5 Tutorial-SVJ v.2
===
- There is another way to generate samples. Instead of using MadGraph5 chain process, we will introduce ```DelphesPythia8``` method for sample's generating.
Reference:
[](https://arxiv.org/abs/1503.00009)
[](https://arxiv.org/abs/1707.05326)
## Table of Contents
[TOC]
## Workflow
---
```sequence
Note left of Madgraph5: Inupt SVJ's Model
Madgraph5->DelphesPythia8: create .lhe files
Note right of Madgraph5:output .lhe files
Madgraph5->DelphesPythia8: change PID in .lhe files
Note right of Madgraph5:Analyze .lhe files
DelphesPythia8->Analysis: for showering
DelphesPythia8->Analysis: for hadronization
DelphesPythia8->Analysis: for fast detector simulation
Note right of DelphesPythia8:output .root files
Note right of Analysis:Analyze .root files
```
___
# Package's Setting
---
## For Docker User:
### Step 0 (Something About Docker Image)
1. Install Docker(https://www.docker.com)
2. Pull the "HEPtools" image from https://hub.docker.com/r/alan200276/ubuntu
<!-- 2. Pull the "SVJsimulation" image from https://hub.docker.com/repository/docker/alan200276/centos/general -->
```
docker pull alan200276/ubuntu:HEPtools
```
3. Create a docker container
```
docker run --name GIVECONTAINERNAME --net=host -v /home/<USERNAME>:/docker_workplace -it alan200276/ubuntu:HEPtools
```
<!-- 4. After login into the container, please type ```source ~/.bash_profile ``` -->
4. The MadGraph5_aMC@NLO is in the ```~/MG5_aMC_v2_7_3```
5. This Docker image contains:
python2
python3
root_6_20 with python2 (default)
root_6_20 with python3
jupyter lab(python3)
6. Some useful comments
- Open jupyter lab-Method 1(Remote Server)
```
gotojupyter
```
and then open port in local
```
ssh -N -f -L localhost:<port number>:localhost:<port number> <username>@server-ip
```
- Open jupyter lab-Method 2(Local Server)
Please add a flag for port `-p 8899:8888`
```
docker run --name GIVECONTAINERNAME -p 8899:8888 -v /home/<USERNAME>:/docker_workplace -it alan200276/ubuntu:HEPtools
```
and then
```
jupyter lab --ip 0.0.0.0 --allow-root
```
You will see something like that
```
To access the notebook, open this file in a browser:
file:///root/.local/share/jupyter/runtime/nbserver-16-open.html
Or copy and paste one of these URLs:
http://19e55e5dd285:8899/?token=0ffa469704b66110f6be08a81366dfa7fe80cead6ba90c74
or http://127.0.0.1:8899/?token=0ffa469704b66110f6be08a81366dfa7fe80cead6ba90c74
```
Open your browser and type
```
localhost:8899
```
Copy the `token` and paste into the website
- Using root_6_20 with python2
```
root_py2
```
*this comment is like `source <path-to-root>/bin/thisroot.sh`.
- Using root_6_20 with python3
```
root_py3
```
*this comment is like `source <path-to-root>/bin/thisroot.sh`
---
### Step 1 (Install Relevent Packages)
In your home directory```~/```, we will install ```Delphes``` and ```Pythia8```.
First, download ```Delphes``` and the upzip it.
```
cd ~/
wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.2.tar.gz
tar -xvf Delphes-3.4.2.tar.gz
```
Then go to ```Delphes-3.4.2``` directory
```
cd Delphes-3.4.2
```
Then install ```Pythia8``` in this directroy and unzip, compile.
```
wget https://pythia.org/download/pythia82/pythia8235.tgz
tar -xzvf pythia8235.tgz
cd pythia8235
./configure --prefix=/root/Delphes-3.4.2/PYTHIA8
make install
```
Don't forget to setup environment's path.
```
export PYTHIA8=/root/Delphes-3.4.2/PYTHIA8
```
Then go back to ```Delphes-3.4.2``` directory and compile Delphes.
```
cd /root/Delphes-3.4.2/
make HAS_PYTHIA8=true
```
---
## For Built-By-Yourself User:
---
### Step 0 (Download Relevent Packages)
Please download and compile the following packages in the Linux environment!
1. ROOT(https://root.cern.ch)
You could just download the binary root and unzip it, so no need to compile it at all. After this , add the `source <path-to-root>/bin/thisroot.sh` to your `~/.bashrc`. This will help Delphes find ROOT.
3. MadGraph5_aMC@NLO(https://launchpad.net/mg5amcnlo)
---
### Step 1 (Download Model)
In your terminal, go to the MadGraph5's directory.
```
cd /where-is-your-MadGraph/MG5_aMC_v2_7_3
```
And go to `./models` and download the relevent model(http://feynrules.irmp.ucl.ac.be/wiki/DMsimp).
```
cd ./models
wget http://feynrules.irmp.ucl.ac.be/raw-attachment/wiki/DMsimp/DMsimp_s_spin1_v2.1.zip
unzip DMsimp_s_spin1_v2.1.zip
```
---
### Step 2 (Install Relevent Packages)
Now, we will install ```Delphes``` and ```Pythia8```.
First, download ```Delphes``` in where you want and the upzip it.
```
cd <the-path-you-want-to-install-Delphes>
wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.2.tar.gz
tar -xvf Delphes-3.4.2.tar.gz
```
Then go to ```Delphes-3.4.2``` directory
```
cd Delphes-3.4.2
```
Then install ```Pythia8``` in this directroy and unzip, compile.
```
wget https://pythia.org/download/pythia82/pythia8235.tgz
tar -xzvf pythia8235.tgz
cd pythia8235
./configure --prefix=/<where-is-Delphes>/Delphes-3.4.2/PYTHIA8
make install
```
Don't forget to setup environment's path.
```
export PYTHIA8=/<where-is-Delphes>/Delphes-3.4.2/PYTHIA8
```
Then go back to ```Delphes-3.4.2``` directory and compile Delphes.
```
cd <where-is-Delphes>/Delphes-3.4.2
make HAS_PYTHIA8=true
```
---
# Prepare Sample's Directory, and Launch, and then Generate Samples
---
### Step 1
- Method 1:
In your terminal, go to the MadGraph5's directory.
```
cd /where-is-your-MadGraph/MG5_aMC_v2_7_3
```
Use the following to execute MadGraph5_aMC@NLO
```
./bin/mg5_aMC
```
Then type the following comment line by line.
```
import model DMsimp_s_spin1
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
output sig_schannel
```
Please don't leave MadGraph5, but you can quick check there is a folder called ```sig_schannel``` in your MadGraph directory.
Then keep typing the follows for generating events line by line
```
launch sig_schannel
set run_card nevents 10000
set run_card ebeam1 7000.0
set run_card ebeam2 7000.0
set run_card pdlabel lhapdf
set run_card lhaid 247000
set MXd 10
set MY1 1500
set gvd11 1.000000e-01
set gvu11 1.000000e-01
set gvd22 1.000000e-01
set gvu22 1.000000e-01
set gvd33 1.000000e-01
set gvu33 1.000000e-01
```
```set MY1 1500``` is used to set Z' mass. Z' is the mediator of this process.
After running, you will see ```run_01``` in ```<where-is-your>/sig_schannel/Events/```. Moreover, there is ```unweighted_events.lhe.gz``` in ```run_01``` directory.
- Method 2:
You can creat a text file, and let MG5 to read it.
Example:
Create a text file, here, we call it ```sig_schannel.txt```, and then copy the content below and paste into ```sig_schannel.txt```.
```
import model DMsimp_s_spin1
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
output sig_schannel
launch sig_schannel
set run_card nevents 10000
set run_card ebeam1 7000.0
set run_card ebeam2 7000.0
set run_card pdlabel lhapdf
set run_card lhaid 247000 #NNPDF23_lo_as_0130_qed
set MXd 10
set MY1 1500
set gvd11 1.000000e-01
set gvu11 1.000000e-01
set gvd22 1.000000e-01
set gvu22 1.000000e-01
set gvd33 1.000000e-01
set gvu33 1.000000e-01
```
```set MY1 1500``` is used to set Z' mass. Z' is the mediator of this process.
Then, go to the MadGraph5's directory
```
cd /where-is-your-MadGraph/MG5_aMC_v2_7_3
```
Use the following to execute MadGraph5_aMC@NLO and read ```sig_schannel.txt```
```
./bin/mg5_aMC <where-is-your-text file>/sig_schannel.txt
```
After running, ```sig_schannel``` will be in your MadGraph directory. You can check ```run_01``` in ```<where-is-your>/sig_schannel/Events/```. Moreover, there is ```unweighted_events.lhe.gz``` in ```run_01``` directory.
More Information:
[](https://pythia.org/manuals/pythia8305/LHEF.html)
[](https://arxiv.org/pdf/1405.1067.pdf)
[](https://arxiv.org/pdf/hep-ph/0609017.pdf)
[](http://home.thep.lu.se/~torbjorn/talks/fnal04lha.pdf)
[](https://lhapdf.hepforge.org/pdfsets.html)
---
### Step 2 (Change PID)
Another important thing to do is to change Particle Date Group(PDG) IDs of the dark particles in the LHE files for PYTHIA to be able to recognize and shower these properly.
Please unzip ```unweighted_events.lhe.gz```
```
gzip -d unweighted_events.lhe.gz
```
Then
```
sed -i 's/5000521/4900101/g' unweighted_events.lhe
```
For Mac user, the command above may occur some problem.
Please instead use
```
sed -i'' -e 's/5000521/4900101/g' unweighted_events.lhe
```
To check if changing works, using
```
grep 4900101 unweighted_events.lhe
```
`grep` will help you look for segment in `unweighted_events.lhe`
---
### Step 3 (Showering and Detector Simulation)
Please go to the ```Delphes-3.4.2``` directory.
Download the following ```.cmnd``` file in this github https://github.com/ja2006203966/SVJ_ and put it in the ```Delphes-3.4.2/examples/Pythia8/```
There are three ```.cmnd``` files, ```SVJ_LHE_rinv_0.cmnd``` is ```r_inv = 0.0```, ```SVJ_LHE_rinv_03.cmnd``` is ```r_inv = 0.3```, ```SVJ_LHE_rinv_05.cmnd``` is ```r_inv = 0.5``` and ```SVJ_LHE_rinv_1.cmnd``` is ```r_inv = 1.0```
<!-- wget
cd <where-is-your-Delphes>/Delphes-3.4.2/examples/Pythia8
https://github.com/ja2006203966/SVJ_/blob/master/SVJ_LHE_rinv_0.cmnd
wget https://github.com/ja2006203966/SVJ_/blob/master/SVJ_LHE_rinv_03.cmnd
wget https://github.com/ja2006203966/SVJ_/blob/master/SVJ_LHE_rinv_05.cmnd
wget https://github.com/ja2006203966/SVJ_/blob/master/SVJ_LHE_rinv_1.cmnd -->
In each ```.cmnd```, you may find```Beams:LHEF = <path>/unweighted_events.lhe```.
Please modify for your correct LHE file path.
Download https://github.com/ja2006203966/SVJ_/blob/master/delphes_card_ATLAS_jpt200.tcl
And put this ```delphes_card``` for ATLAS in ```Delphes-3.4.2/cards```
<!-- cd <where-is-your-Delphes>/Delphes-3.4.2/cards/
wget https://github.com/ja2006203966/SVJ_/blob/master/delphes_card_ATLAS_jpt200.tcl
-->
Then, go back to to ```Delphes-3.4.2``` directory. We can do event's shower and detector simulation.
This description of syntax is that
./DelphesPythia8 <detector-card> <pythia-cmnd-for-showering> <output-root-file>
```
cd <where-is-your-Delphes>/Delphes-3.4.2/
./DelphesPythia8 cards/delphes_card_ATLAS_jpt200.tcl examples/Pythia8/SVJ_LHE_rinv_03.cmnd output.root
```
Finally, we get ```output.root``` in our ```Delphes-3.4.2``` directory.
Now, we can move to Analysis step.
Further Information for DelphesPythia8:
[](https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/Pythia8)
___
# Analysis
---
## Step 1 (Analyze Parton-Level Information[.lhe])
>pylhe: https://github.com/scikit-hep/pylhe/blob/master/examples/zpeak.ipynb
>.lhe description:
https://pythia.org/manuals/pythia8305/LHEF.html
<!-- http://home.thep.lu.se/~torbjorn/pythia82html/LesHouchesAccord.html -->
>PID: http://pdg.lbl.gov/2013/reviews/rpp2012-rev-monte-carlo-numbering.pdf
In order to make sure what you are doing:
1. Extract your LHE file in Madgraph
```
cd <path to Madgraph>/sig_channel/Events/run_01
gzip -d unweighted_events.lhe.gz
```
2. Plot final state invariant mass in Parton level
>Example: https://github.com/alan200276/SVJ/blob/master/Instruction/LHE_Record.ipynb
* ```python
import pylhe
import ROOT
import math
def invariant_mass(p1,p2):
return math.sqrt(sum((1 if index=='e' else -1
)*(getattr(p1,index)+getattr(p2,index))**2 for index in [
'e','px','py','pz']))
##fill invariant mass
process = 'sig_channel'
m = []
for event in pylhe.readLHE('<where-is-your-lhe>/unweighted_events.lhe'):
m.append(invariant_mass(event.particles[-1],event.particles[-2]))
##plot
import matplotlib.pyplot as plt
import numpy as np
bins = 100
fs=18 # front size
tagsize = 18 # label tag size
plt.figure(figsize=(8,8)) # plotsize
x1, x2 = 0, 400 # x region
plt.hist(m ,bins=bins, histtype='step', range=[x1, x2], label='mean: %f' %np.average(m))
plt.legend(prop={'size': tagsize}) # plot label tag
plt.yscale('log')
plt.xlabel('mass' , fontsize=fs) # plot x-axis label
plt.ylabel("dN/dx", fontsize=fs) # plot y-axis label
plt.xticks(fontsize=fs) # set x-ticks size
plt.yticks(fontsize=fs) # set y-ticks size
plt.show()
```
---
## Step 2 (Analyze Information of Truth Record[.root])
### ⅰ. Print out the truth particle list of one event.
- open ROOT, and create a TBrowser by `new TBrowser`, navigate to the output .root file, double click it and have a look at the Branches and histograms.
- check your parameter in root file output from Delphes
```
$ cd <path_to_your_root_file>
$ root XXX.root
[root] _file0->ls()
[root] Delphes->MakeClass()
```
- We will use `uproot` to show structure in `root` file.
``` python
#Import package
import os
import pandas as pd
import uproot
import numpy as np
#Load root file
root_file = "/home/james/SVJ_pythia/Nowidth/Z1500/delphes_nolhe_Z1500_rinv_0.root"
file = uproot.open(root_file)
#show the branch in Delphes;1
file["Delphes;1"].show()
event = [file["Delphes;1"]["Particle.Status"].array(),
file["Delphes;1"]["Particle.M1"].array(),
file["Delphes;1"]["Particle.M2"].array(),
file["Delphes;1"]["Particle.D1"].array(),
file["Delphes;1"]["Particle.D2"].array(),
file["Delphes;1"]["Particle.PID"].array(),
file["Delphes;1"]["Particle.PT"].array(),
file["Delphes;1"]["Particle.Eta"].array(),
file["Delphes;1"]["Particle.Phi"].array(),
file["Delphes;1"]["Particle.Mass"].array(),
]
#Reshape the datastructure
event = np.expand_dims(event, axis=-1)
event = event.transpose((1,0,2))
event = np.squeeze(event,axis=(2,))
_Status, _M1, _M2, _D1, _D2, _PID, _PT, _Eta, _Phi, _Mass = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Labels = ["Status", "M1", "M2", "D1", "D2", "PID", "PT", "Eta", "Phi", "Mass"]
#Show truth record
print("Index", "\t","Status", "\t","M1"
"\t","M2" ,"\t","D1", "\t","D2", "\t","PID",
"\t\t","PT" "\t","Eta", "\t\t","Phi",
"\t\t","Mass")
for j in range(len(event[0][0])):
print(j, "\t", event[0][_Status][j],"\t\t",
event[0][_M1][j], "\t", event[0][_M2][j],
"\t", event[0][_D1][j], "\t", event[0][_D2][j],
"\t", str(event[0][_PID][j]).ljust(12, ' '), "\t", round(event[0][_PT][j],0), "\t",
str(round(event[0][_Eta][j],2)).ljust(12, ' ') , "\t",
str(round(event[0][_Phi][j],3)).ljust(12, ' '), "\t",
round(event[0][_Mass][j],3))
```
Inspect the contents printed on the screen, try to answer:
- How many particles in this event?
- What are they in each line?
- Where is the dark quark?
### ⅱ. Trace the Xd in hardest subprocess
We keep going.
Define function to trace particle decay
```python
def find_decayratio(event,n, mode = 'daughter'):
d1, d2 = -1, -1
d0 = -1
ID = 4900101 #PID of Dark quark Xd
for j in range(len(event[n][0])):
if(event[n][5][j]==ID)&(event[n][0][j]==23): #23 : hardest outgoing particles
d1 = event[n][_D1][j]
d2 = event[n][_D2][j]
while((event[n][_PID][d1]==ID)or(event[n][5][d2]==ID) ):
if(event[n][_PID][d1]==ID):
d0 = d1
d1 = event[n][_D1][d0]
d2 = event[n][_D2][d0]
if(event[n][_PID][d2]==ID):
d0 = d2
d1 = event[n][_D1][d0]
d2 = event[n][_D2][d0]
if mode=='daughter':
return d1, d2
if mode=='id':
return event[n][5][d1], event[n][5][d2]
def find_subdecayratio(event, n, j, ID=4900111):
d1, d2 = -1, -1
d0 = -1
d1 = event[n][_D1][j]
d2 = event[n][_D2][j]
if((abs(event[n][_PID][d1])!=ID)&(abs(event[n][_PID][d2])!=ID)):
d1=0
d2=0
return d1, d2
else:
while((abs(event[n][_PID][d1])==ID)or(abs(event[n][_PID][d2])==ID) ):
if(abs(event[n][_PID][d1])==ID):
d0 = d1
d1 = event[n][_D1][d0]
d2 = event[n][_D2][d0]
if(abs(event[n][_PID][d2])==ID):
d0 = d2
d1 = event[n][_D1][d0]
d2 = event[n][_D2][d0]
return event[n][_PID][d1], event[n][_PID][d2]
def find_daughterid(event, n, j, ID=4900111):
sid = event[n][_PID][j]
if(sid!=ID):
return 0, 0
else:
d1 = event[n][_D1][j]
d2 = event[n][_D2][j]
return event[n][_PID][d1], event[n][_PID][d2]
```
Trace certain particle ID untill it "decay" (daughter1!=daughter2)
```python
n=0
ID=4900113
N = []
for j in range(len(event[n][0])):
if(event[n][_PID][j]==ID): #23 : hardest outgoing particles
print("Self index in event",j)
m1 = event[n][_M1][j]
m2 = event[n][_M2][j]
print("Mother:",m1,m2)
if (m1==m2):
print("Mother_id:", event[n][_PID][m1], "nan\n")
else:
print("Mother_id:", event[n][_PID][m1], event[n][_PID][m2],"\n")
d1 = event[n][_D1][j]
d2 = event[n][_D2][j]
prevent = 0
while(d1==d2):
d0 = d1
if(d1==-1):
print("stable particles\n\n")
break
if(prevent >= 100):
print("infinite loop!")
prevent=0
break
d1 = event[n][_D1][d1]
d2 = event[n][_D2][d2]
if(d1!=d2):
N.append(d0)
prevent= prevent+1
if(d1!=-1):
print("Daughter", d1, d2)
print("Daughter_id", event[n][_PID][d1], event[n][_PID][d2])
m1, m2 = event[n][_M1][d1], event[n][_M2][d1]
print("Daughter1_parents", m1, m2)
if(m1==m2):
print("Daughter1_parents_id", event[n][_PID][m1], "nan")
else:
print("Daughter1_parents_id", event[n][_PID][m1], event[n][_PID][m2])
m1, m2 = event[n][_M1][d2], event[n][_M2][d2]
print("Daughter2_parents", m1, m2)
if(m1==m2):
print("Daughter2_parents_id", event[n][_PID][m1], "nan","\n")
else:
print("Daughter2_parents_id", event[n][_PID][m1], event[n][5][m2],"\n")
```
Trace outgoing Xd (4900101) in hardest subprocess
And then record the dark meson decay
```python
# 4900111 and 4900113 is unstable dark meson
a113 = []
a111 = []
for n in range(1000):
a1, a2 = find_decayratio(event,n) # find Xd -> a1 a2
d1a1 = find_daughterid(event, n, a1, ID=4900111) # check whether a1 is 4900111 and find it's daughter
d2a1 = find_daughterid(event, n, a2, ID=4900111) # check whether a2 is 4900111 and find it's daughter
d1a2 = find_daughterid(event, n, a1, ID=4900113) # check whether a1 is 4900113 and find it's daughter
d2a2 = find_daughterid(event, n, a2, ID=4900113) # check whether a2 is 4900113 and find it's daughter
a111.append(d1a1)
a111.append(d2a1)
a113.append(d1a2)
a113.append(d2a2)
```
Calculate the ratio of stable dark meson in above record
```python
#find 4900211 in 4900111 decay record (Note 4900211 is stable dark meson)
r = [sum([1 for i in a111 for j in i if (abs(j)== 4900211)]), sum([1 for i in a111 for j in i if (abs(j)!= 4900211)&(j!=0)])]
print("The number_4900211/number_others in 4900111 decay particles : ", r[0]/sum(r))
#find 4900213 in 4900113 decay record (Note 4900211 is stable dark meson)
r = [sum([1 for i in a113 for j in i if (abs(j)== 4900213)]), sum([1 for i in a113 for j in i if (abs(j)!= 4900213)&(j!=0)])]
print("The number_4900213/number_others in 4900113 decay particles :", r[0]/sum(r))
```
Examples:
>uproot:
https://github.com/scikit-hep/uproot
>example for truth record: https://github.com/ja2006203966/SVJ_/blob/master/SVJ_UPROOT_Demo.ipynb
>another example:
https://github.com/ja2006203966/SVJ_/blob/master/QCD_Dijet_uproot.ipynb
---
## Step 3 (Analyze Information of After Detector Simulation[.root])
TBA
>examples: https://github.com/taylorFaucett/semi-visible-jets-ml/blob/master/jet_data_processing/tools/root_2_jets.py#L109
<!-- >root_numpy: http://scikit-hep.org/root_numpy/ -->
>uproot: https://github.com/scikit-hep/uproot
---
# Assignment
---
## Week 1
- 1.Try to compare Xection between the following j's definition:
```
define j = g u c d s u~ c~ d~ s~
```
and
```
define j = g u c t d b s u~ c~ t~ d~ b~ s~
```
- 2.Compare the Feynman diagrams and Xection between:
```
generate p p > xd xd~ -> Leading Order calculation
```
and
```
generate p p > xd xd~ @0
add process p p > xd xd~ j @1
```
and
```
generate p p > xd xd~ @0
add process p p > xd xd~ j @1
add process p p > xd xd~ j j @2
```
Please put your results in this Google Slide.
For Feynman diagrams, it will be ~1000 diagrams, you don't need to put everyone.
Just pick up what you want to compare.
>https://docs.google.com/presentation/d/1Acuu5A4HI2uBi6QU_h99zevjasdm5JaUo5sOFEDQENU/edit?usp=sharing
---
## Week 2
- 1.Please set Z' mass to ```2000```, ```1500``` and ```1000```:
And record the cross section.
Here we only consider this process
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
And set center of mass energy is 13 TeV
- 2.Plot the invariant mass M(xd xd~) for each Z' mass.
Please put your results in this Google Slide.
>https://docs.google.com/presentation/d/1_ohstYu7D-kbJu97Zbry_4sXDlk16ngA4e2dBb8I58Q/edit?usp=sharing
---
## Week 3
- 1.Please set Z' mass to ```1500``` and set center of mass energy is 13 TeV:
These time we will consider these three processes
-- Process 1
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
-- Process 2
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~ @0
add process p p > xd xd~ j @1
```
-- Process 3
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~ @0
add process p p > xd xd~ j @1
add process p p > xd xd~ j j @2
```
Pleas recoed the cross section for these three processes.
- 2. After generate 10000 events for each process,
Plot the invariant mass M(xd xd~) for each process. (hint: PID)
Plot the transeverse mass MT(xd xd~) for each process.
(Please find the definition for MT online)
Please put your results and key part of your code for finding xd(xd~) in this Google Slide.
>https://docs.google.com/presentation/d/13WdcA-z_KQlnz9y5Ngm4ZEIS_ZxkHOw27fudpzMRHus/edit?usp=sharing
---
## Week 4
- 1.Please set Z' mass to ```1500``` and set center of mass energy is 13 TeV. Other setting is the same as `Prepare Sample's Directory, and Launch, and then Generate Samples` Step 1.
-- Process
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
- 2.After passing `DelphesPythia8`, please use `uproot` to read your `root` file. Follow the example link(Po-Jen's github), print an event's total information list. Like
```
Index Status M1 M2 D1 D2 PID PT Eta Phi Mass
0 4 -1 -1 312 -1 2212 0.0 999.9 0.0 0.938
1 4 -1 -1 313 -1 2212 0.0 -999.9 0.0 0.938
2 21 5 5 4 -1 2 0.0 999.9 0.0 0.0
3 21 6 -1 4 -1 -2 0.0 -999.9 0.0 0.0
4 22 2 3 7 7 5000001 0.0 999.9 0.0 1996.878
5 42 9 9 2 2 2 0.0 999.9 2.488 0.0
6 41 10 -1 8 3 -2 0.0 -999.9 -0.654 0.0
7 44 4 4 11 11 5000001 8.0 5.31 2.488 1996.878
..........
```
- 3. Find the four momentum of the two dark quarks(PID=4900101) before they showering and hardronic into unstable dark meson. And then, plot these two dark quarks' invariant mass M(xd, xd~).
Is this plot the same as M(xd, xd~) from LHE?
Please put your results and key part of your code for finding two dark quarks(xd, xd~) in this Google Slide.
>https://docs.google.com/presentation/d/13MV6c-NjkTgkCDJUmC-xVemhVQGe8ZYeatP_8V68f90/edit?usp=sharing
## Week 7
- 1.Please set `Z' mass to 1500 GeV` and set `center of mass energy is 13 TeV`. Other setting is the same as `Prepare Sample's Directory, and Launch, and then Generate Samples` Step 1.
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
- 2. Find the four momentum of the two dark quarks(PID=4900101) before they showering and hardronic into unstable dark meson.
And then, plot these two dark quarks' invariant mass M(xd, xd~).
Make distribution of M(xd xd~) in three types.
eamples: https://github.com/alan200276/SVJ_Study/blob/master/Truth_Record_Plots.ipynb
Type 1:
Let the area of the distribution to be the number of event with luminosity 37 $\mathrm{fb}^{-1}$.
Type 2:
Let the area of the distribution to be one.
Type 3:
Let the area of the distribution to be total cross section.
(y-axis is differential cross section)
Please put your results in
>https://docs.google.com/presentation/d/1iroJkU5B25HfvCuGAfEzSrAF10l2OiFfbPBSjLnvMSQ/edit#slide=id.p
## Week 8
- 0. Please install `pyjet` package:
>https://github.com/scikit-hep/pyjet
```
pip3 install pyjet
```
or
```
pip2 install pyjet
```
- 1.Please set `Z' mass to 1500 GeV` and set `center of mass energy is 13 TeV`. Other setting is the same as `Prepare Sample's Directory, and Launch, and then Generate Samples` Step 1.
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
- 2. Please follow the examples to do jet's clustering.
[](https://github.com/ja2006203966/SVJ_/blob/master/Pyjet_Demo.ipynb) [](https://github.com/alan200276/SVJ_Study/blob/master/Jet_Clustering.ipynb)
The work flow of this assignment is that
ⅰ. Inupt Root File
ⅱ. Find the final state particles (status =1)
ⅲ. Put the final state particles in an event list which contains $p_T$, $\eta$, $\phi$ and mass.
ⅳ. Setup the data type for the event list.
ⅴ. Use `pyjet`'s function: `cluster` and `inclusive_jets` to do jet clustering.
ⅵ. Pick up leading jet and sub-leading jets to calculate $M_{jj}$ and compare the distribution with M(xd xd~). Please put $M_{jj}$ and M(xd xd~) distributions together.
>leading jet: The jet has greatest $p_T$ in an event.
>sub-leading jet: the second jet in the $p_T$ ordering
- 3. Compare the following setting:
>jet's minimum $p_T$ = 20 GeV
>jet's cone size: 0.4, 0.8, 1.2
>jet's algorithm: anti-kt, C/A, kt
Therefore we will have 9 figures.
Please put your results in
>https://docs.google.com/presentation/d/1cf8cAIbO1Kh_IvP6VO47KvCShwH0VL1UTSk9kYOUBl4/edit#slide=id.g8b9d5790a2_0_3
## Week 11
- 1.Please set `Z' mass to 1500 GeV` and set `center of mass energy is 13 TeV`. Other setting is the same as `Prepare Sample's Directory, and Launch, and then Generate Samples` Step 1.
```
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~
```
- 2. Take the information in branch of `Jet` for $M^{detector}_{jj}$ distribution. Here, you should have a selection which there are at least 2 jets in an event and use leading and subleading jet for $M^{detector}_{jj}$ calculation.
- 3. Put $M^{detector}_{jj}$, M(xd xd~) and the previous assignment $M^{truth}_{jj}$ results with `R=0.6, anti-kt and pt_min = 200 GeV` together and compare the difference.
[](https://github.com/alan200276/SVJ_Study/blob/master/Jet_Clustering.ipynb)
Please put your results in
>https://docs.google.com/presentation/d/1aDWShR-OTuGdAnnDOv5Fw0yk9c3ZJuLHLkfXrHEjymw/edit?usp=sharing
## Week 13
- 0. The precedure will close to paper [](https://arxiv.org/abs/1707.05326)
- 1. Please follow the syntax below to prepare parton level samples and change PID as previous.
```
import model DMsimp_s_spin1
define j = g u c d b s t u~ c~ d~ b~ s~ t~
generate p p > xd xd~ @0
add process p p > xd xd~ j @1
add process p p > xd xd~ j j @2
output /<path>/sig_schannel_up2jets_wz_auto_md10
launch /<path>/sig_schannel_up2jets_wz_auto_md10
shower=OFF
detector=OFF
analysis=OFF
set run_card nevents 20000
set run_card ebeam1 6500.0
set run_card ebeam2 6500.0
set run_card pdlabel lhapdf
set run_card lhaid 247000
set MXd 10
set MY1 scan:[1000,1500,2000,100000] #this syntax can change M(Z'), automatically.
set ickkw 1
set xqcut 100
#set ptj 50
set gVXd 1
set gvd11 0.1
set gvu11 0.1
set gvd22 0.1
set gvu22 0.1
set gvd33 0.1
set gvu33 0.1
set decay wy1 auto
```
- 3. Please download `SVJ_0_5.cmnd`, `SVJ_3_5.cmnd`, and `delphes_card_ATLAS.tcl` form [](https://github.com/alan200276/SVJ_Study/tree/master/Cards).
- 4. This step is the same as previous exercise(`./DelphesPythia8 ......`), but we will apply different setting(cards). Please pick up the parton level samples with `M(Z')=1500 GeV` and then use `SVJ_0_5.cmnd` and `SVJ_3_5.cmnd`for showering and hadronization. `delphes_card_ATLAS.tcl` is used for detector simulation card.
- 5. Please draw $M^{detector}_{jj}$, M(xd xd~) and the $M^{truth}_{jj}$ results with `R=0.5, anti-kt and pt_min = 20 GeV` together and compare the difference.
(Only consider at least 2-jet event for $M^{detector}_{jj}$ and $M^{truth}_{jj}$)
Please put your results in
>https://docs.google.com/presentation/d/1FvUdwt9sotskgwBBdLh-KL-p8297F7JdiSi5MJr0i7Y/edit#slide=id.p
---
# Mini-Lecture
[](https://docs.google.com/presentation/d/1jY0aLNTtlLzWCa7egCzGmDU1I872MRE2Q4-SmymP14I/edit?usp=sharing) [](https://docs.google.com/presentation/d/1oPje3z4EwLupwmy7p6nvPn8WcjZcNJOzeIz1Tnp4CIs/edit?usp=sharing) [](https://docs.google.com/presentation/d/1SjfjHyzdHkk5ZO4qIOG5umkj9IVmHRuzerS8pNjnbHY/edit#slide=id.p) [](https://docs.google.com/presentation/d/1Q3mzvT47pCiRDulbYWRJFQ6oSyWchh21Vwub1pbCMLY/edit#slide=id.p)
[](https://docs.google.com/presentation/d/1gbpGA6enVGJJ5sr851EkkpfyZ1059q0Sd0D6TMl_jtM/edit#slide=id.p) [](https://docs.google.com/presentation/d/15Gd2NOtnP_1vlAmIaXjDGkAbac5c5zuycMj2A5INUho/edit#slide=id.p)
[](https://docs.google.com/presentation/d/1t2KvBjjm2SkdDgbboAUd6cELTfojyN-dks9hwdhCIbM/edit?fbclid=IwAR0GaXdXVM0zZvwaIs_VGD-cQySJ0clS1qnx-SR70xYAezpIMCwIyxS6iNU#slide=id.g912a72f59a_0_0)
[](https://docs.google.com/presentation/d/1HsPHA4P6xAUbbrTe-VEkkzwnOuUPMPW5iC3XIgc-YT0/edit?usp=sharing)
[](https://docs.google.com/presentation/d/1f5hFIJcOK2HnGq7hd2Fpr2ik1KhPAAeEjho0X02rBkg/edit#slide=id.p)
[](https://docs.google.com/presentation/d/19JNG2nrfv4bJrUsne2_rVZuT5A48-eJhmLMH4gVQo2A/edit#slide=id.g980a256d82_0_133)
[](https://docs.google.com/presentation/d/15qswj1iZJRhmg0Yzi9ofjUSy7fxs0GgtQ5dG0ud7omo/edit?usp=sharing)
[](https://docs.google.com/presentation/d/1OB7M-ht3XqPNmh3UZFQDzCyBWx27a9L8mFLw-zoEw4s/edit#slide=id.p)
---
# Appendix and FAQ
---
[](https://github.com/hrzhao76/SVJ/blob/master/Instruction/S_channel_production.ipynb)
[](https://indico.cern.ch/event/555228/sessions/203428/attachments/1315471/1970459/tutorial-CMSandATLAS-2016.pdf)
[](https://cp3.irmp.ucl.ac.be/projects/madgraph/attachment/wiki/Pavia2015/tutorial-pavia-2015.pdf)
[](https://github.com/scikit-hep?page=1)
:::info
**Find anything is not clear or you have any queastion?** Leave a comment!
:::
###### tags: `SVJ` `MadGraph5_aMC@NLO`
<!-- gherkin= -->
<!-- 


-->