alan200276
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- 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: [![arXiv](https://img.shields.io/badge/arXiv-1503.00009%20-green.svg)](https://arxiv.org/abs/1503.00009) [![arXiv](https://img.shields.io/badge/arXiv-1707.05326%20-green.svg)](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: [![LHE file format 1](https://img.shields.io/badge/LHE_file_format_1-green.svg)](https://pythia.org/manuals/pythia8305/LHEF.html) [![LHE file format 2](https://img.shields.io/badge/LHE_file_format_2-green.svg)](https://arxiv.org/pdf/1405.1067.pdf) [![LHE file format 3](https://img.shields.io/badge/LHE_file_format_3-green.svg)](https://arxiv.org/pdf/hep-ph/0609017.pdf) [![LHE file format 4](https://img.shields.io/badge/LHE_file_format_4-green.svg)](http://home.thep.lu.se/~torbjorn/talks/fnal04lha.pdf) [![LHAPDF sets](https://img.shields.io/badge/LHAPDF_sets-green.svg)](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: [![DelphesPythia8](https://img.shields.io/badge/DelphesPythia8-green.svg)](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. [![Example 1](https://img.shields.io/badge/Example_1-green.svg)](https://github.com/ja2006203966/SVJ_/blob/master/Pyjet_Demo.ipynb) [![Example 2](https://img.shields.io/badge/Example_2-green.svg)](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. [![Example 2](https://img.shields.io/badge/Example_2-green.svg)](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 [![arXiv](https://img.shields.io/badge/arXiv-1707.05326%20-green.svg)](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 [![Cards](https://img.shields.io/badge/Cards-green.svg)](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 [![Week 2](https://img.shields.io/badge/Week_2-green.svg)](https://docs.google.com/presentation/d/1jY0aLNTtlLzWCa7egCzGmDU1I872MRE2Q4-SmymP14I/edit?usp=sharing) [![Week 3](https://img.shields.io/badge/Week_3-green.svg)](https://docs.google.com/presentation/d/1oPje3z4EwLupwmy7p6nvPn8WcjZcNJOzeIz1Tnp4CIs/edit?usp=sharing) [![Week 4](https://img.shields.io/badge/Week_4-green.svg)](https://docs.google.com/presentation/d/1SjfjHyzdHkk5ZO4qIOG5umkj9IVmHRuzerS8pNjnbHY/edit#slide=id.p) [![Week 5](https://img.shields.io/badge/Week_5-green.svg)](https://docs.google.com/presentation/d/1Q3mzvT47pCiRDulbYWRJFQ6oSyWchh21Vwub1pbCMLY/edit#slide=id.p) [![Week 7: the ATLAS detector](https://img.shields.io/badge/Week7_the_ATLAS_detector-green.svg)](https://docs.google.com/presentation/d/1gbpGA6enVGJJ5sr851EkkpfyZ1059q0Sd0D6TMl_jtM/edit#slide=id.p) [![Week 8: the CMS detector](https://img.shields.io/badge/Week8_the_CMS_detector-green.svg)](https://docs.google.com/presentation/d/15Gd2NOtnP_1vlAmIaXjDGkAbac5c5zuycMj2A5INUho/edit#slide=id.p) [![Week 9: Jet's Clustering](https://img.shields.io/badge/Week9_Jet's_Clustering-green.svg)](https://docs.google.com/presentation/d/1t2KvBjjm2SkdDgbboAUd6cELTfojyN-dks9hwdhCIbM/edit?fbclid=IwAR0GaXdXVM0zZvwaIs_VGD-cQySJ0clS1qnx-SR70xYAezpIMCwIyxS6iNU#slide=id.g912a72f59a_0_0) [![Week 10: Review and the Delphes](https://img.shields.io/badge/Week10_Review_and_the_Delphes-green.svg)](https://docs.google.com/presentation/d/1HsPHA4P6xAUbbrTe-VEkkzwnOuUPMPW5iC3XIgc-YT0/edit?usp=sharing) [![Week 11: Parton Shower and Hadronization](https://img.shields.io/badge/Week11_Parton_Shower_and_Hadronization-green.svg)](https://docs.google.com/presentation/d/1f5hFIJcOK2HnGq7hd2Fpr2ik1KhPAAeEjho0X02rBkg/edit#slide=id.p) [![Week 12: Introduction to Pile Up](https://img.shields.io/badge/Week12_Introduction_to_Pile_Up-green.svg)](https://docs.google.com/presentation/d/19JNG2nrfv4bJrUsne2_rVZuT5A48-eJhmLMH4gVQo2A/edit#slide=id.g980a256d82_0_133) [![Week 14](https://img.shields.io/badge/Week14-green.svg)](https://docs.google.com/presentation/d/15qswj1iZJRhmg0Yzi9ofjUSy7fxs0GgtQ5dG0ud7omo/edit?usp=sharing) [![Week 15](https://img.shields.io/badge/Week15-green.svg)](https://docs.google.com/presentation/d/1OB7M-ht3XqPNmh3UZFQDzCyBWx27a9L8mFLw-zoEw4s/edit#slide=id.p) --- # Appendix and FAQ --- [![Read more about SVJ project](https://img.shields.io/badge/Read_more_about_SVJ_project-green.svg)](https://github.com/hrzhao76/SVJ/blob/master/Instruction/S_channel_production.ipynb) [![Advanced MG5 Tutorial 1](https://img.shields.io/badge/Advanced_MG5_Tutorial_1-green.svg)](https://indico.cern.ch/event/555228/sessions/203428/attachments/1315471/1970459/tutorial-CMSandATLAS-2016.pdf) [![Advanced MG5 Tutorial 2](https://img.shields.io/badge/Advanced_MG5_Tutorial_2-green.svg)](https://cp3.irmp.ucl.ac.be/projects/madgraph/attachment/wiki/Pavia2015/tutorial-pavia-2015.pdf) [![HEP Useful Tools](https://img.shields.io/badge/HEP_Useful_Tools-green.svg)](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= --> <!-- ![downloads](https://img.shields.io/github/downloads/atom/atom/total.svg) ![build](https://img.shields.io/appveyor/ci/:user/:repo.svg) ![chat](https://img.shields.io/discord/:serverId.svg) -->

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully