tutorial:madgraph

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:madgraph [2018/12/11 19:01] minerva1993tutorial:madgraph [2023/03/06 13:44] (current) – external edit 127.0.0.1
Line 1: Line 1:
-===== Install Madgraph ===== +==== Install Madgraph ==== 
-You have to install MG5 in your home directory. +<alert type="info">**Note:** There can be troubles in compiling/library linking/etc at the runtime.
-<alert type="info">**Note:** Fully working installation script is prepared https://github.com/Yadoking/GenProduction/blob/master/install/install_madgraph.sh</alert>+
  
-<alert type="info">**Note:** There can be troubles in compiling/library linking/etc at the runtime.</alert> +</alert> 
-Initial setup - install CMSSW and MG5 from launchpad+Initial setup - install MG5 from launchpad
 <code> <code>
 mkdir -p ~/work/MG5 mkdir -p ~/work/MG5
 cd ~/work/MG5 cd ~/work/MG5
-wget https://launchpad.net/mg5amcnlo/2.0/2.6.x/+download/MG5_aMC_v2.6.0.tar.gz +wget https://launchpad.net/mg5amcnlo/2.0/2.6.x/+download/MG5_aMC_v2.6.4.tar.gz 
-tar xzf MG5_aMC_v2.6.0.tar.gz+tar xzf MG5_aMC_v2.6.4.tar.gz
 </code> </code>
  
 Setup the devtoolset to use updated gcc and python. Setup the devtoolset to use updated gcc and python.
 <code> <code>
 +# Don't need to source following lines in Ubuntu and Mac.
 # source /opt/rh/devtoolset-4/enable # source /opt/rh/devtoolset-4/enable
 # source /opt/rh/python27/enable # source /opt/rh/python27/enable
Line 19: Line 19:
 </code> </code>
  
-Install missing tools.+Install missing tools. Order does matter.
 <code> <code>
 bin/mg5_aMC bin/mg5_aMC
Line 31: Line 31:
 </code> </code>
  
-<alert type="info">The "OneLoop" package have to be recompiled, after modifying the source code</alert>+<alert type="info">For NLO production, the "OneLoop" package have to be recompiled, after modifying the source code</alert>
 Open the fortran source code ''HEPTools/oneloop/OneLOop-3.6/src/avh_olo_print.f90'' and modify the line 61, replace ''real(kindr2)'' to ''double precision'' (in the ''printr'' function). Open the fortran source code ''HEPTools/oneloop/OneLOop-3.6/src/avh_olo_print.f90'' and modify the line 61, replace ''real(kindr2)'' to ''double precision'' (in the ''printr'' function).
 This is because of a gfortran bug. See https://bugs.launchpad.net/mg5amcnlo/+bug/1631604 and https://answers.launchpad.net/mg5amcnlo/+question/268548#16 This is because of a gfortran bug. See https://bugs.launchpad.net/mg5amcnlo/+bug/1631604 and https://answers.launchpad.net/mg5amcnlo/+question/268548#16
Line 64: Line 64:
 </code> </code>
  
 +Then add the following lines to fix build flags https://answers.launchpad.net/mg5amcnlo/+question/659847
 +<code>
 +sed -i "s;PYTHIA8_PATH=NotInstalled;PYTHIA8_PATH=`pwd`/HEPTools/pythia8;g" Template/LO/Source/make_opts
 +sed -i 's;OUT+=" -ld";OUT+=" --libs";g' HEPTools/bin/pythia8-config
 +sed -i 's;OUT+=" -ld";OUT+=" --libs";g' HEPTools/pythia8/bin/pythia8-config
 +</code>
  
 +enable lhapdf6 for all of your generation (download other PDFSets depending on your needs)
 +<code>
 +cd HEPTools/lhapdf6
 +bin/lhapdf get NNPDF23_lo_as_0130_qed
 +</code>
 +
 +Then you will be able to start the generation.
 +<code>
 +./bin/mg5_aMC
 +MG5_aMC> generate p p > t t~ [QCD]
 +MG5_aMC> output ttNLO
 +MG5_aMC> launch
 +</code>
 +
 +<alert type="info">To run pythia8 in launch level, you edit runcard; replace HERWIG6 to PYTHIA8.</alert>
 +
 +You can rerun the shower program.
 +<code>
 +cd ttNLO
 +bin/shower run_01
 +</code>
 +
 +If you run the MG5 at the leading order, LHAPDF is required during the runtime, related on systematics. Set the environmental variables before running the mg5_aMC (or put into your .bashrc file) to prevent such a problem.
 +<code>
 +export PYTHONPATH=YOUR_MADGRAPH_PATH/HEPTools/lhapdf6/lib64/python2.7/site-packages:$PYTHONPATH
 +export LD_LIBRARY_PATH=YOUR_MADGRAPH_PATH/HEPTools/lhapdf6/lib:$LD_LIBRARY_PATH
 +</code>
 +
 +To speed up the parton shower step, you can set ''nsplit_jobs=10'' in the shower_card.dat
 +
 +==== Running on Cluster mode ====
 +The default setup is ''multicore-mode'', but also you can use the''cluster mode'' if you have to produce lots of events.
 +Edit the ''madgraph/various/cluster.py'' file first (line 1286), since the default submission script is not fit with the HTOP cluster. (see https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/General-Scripts#no1)
 +
 +<code>
 +        command = ['qsub','-o', stdout,
 +                     '-S', '/bin/bash',
 +                     '-N', me_dir,
 +                     '-e', stderr,
 +                     '-V']
 +</code>
 +
 +and add the following lines to your configuration file, ''input/mg5_configuration.txt''
 +<code>
 +cluster_type = sge
 +cluster_size = 96
 +</code>
 +
 +and run with ''--cluster'' option
 +<code>
 +bin/generate_events --cluster
 +</code>
 +But in this case, you should not run delphes automatically because multiple delphes sessions will make a crash.
 +
 +==== Basic Syntax ====
 +
 +==== Get New PDF ====
 +
 +==== Parameters for Run Card ====
 +
 +==== Disable HEPMC compression ====
 +만들어진 HEPMC파일을 압축하는데에는 시간이 오래 걸리므로, 외부에서 delphes를 사용할 것이라면 압축하지 않고 다음 job으로 넘어가는 것이 빠르다.
 +<code>
 +vi path_to-MG5/madgraph/interface/madevent_interface.py
 +</code>
 +line 5291의 ''misc.gzip(file_path,stdout=file_path)''를 추석처리한다. 이미 데이터셋 'output folder_name'를 만들었다면, 해당 폴더에서
 +<code>
 +vi bin/internal/madevent_interface.py #코드 수정
 +rm bin/internal/madevent_interface.pyo
 +</code>
  
  • tutorial/madgraph.1544522484.txt.gz
  • Last modified: 2023/03/06 13:44
  • (external edit)