ML4LHC-Tutorial


Project maintained by taolicheng Hosted on GitHub Pages — Theme by mattgraham

In the process directory, for example, “ttbar”

  1. setup Cards/
    • run_card.dat
    • pythia8_card.dat
    • delphes_card.dat
    • (me5_configuration.txt)
  2. using command line ./bin/generate_events -f will utilize settings in the cards automatically. In a single command line run, you can use [option] –cluster to submit the run to cluster, or [option] –multicore to run in a multi-core configuration. One can simply use command line ./bin/madevent multi_run [# or runs] to generate multiple runs. When generating multiple runs in serial for a single process, the random seed will be upgraded automatically by madgraph with setting iseed=0 in the run_card.dat. (more on random seeds: https://answers.launchpad.net/mg5amcnlo/+question/254698)

For flexible control of the events generation, scripting would be a better choice. The following is an example of python script, which is slightly updated from MadGraph on a PBS cluster, Adarsh Pyarelal. It takes one input argument: [# of runs].

#!/usr/bin/env python

import sys, subprocess

# Get the number of runs from the command-line argument
number_of_runs = int(sys.argv[1])

for i in range(0, number_of_runs):
  # Remove previous instance of RunWeb
  subprocess.call(['rm', 'RunWeb'])

  # Generate events and run them through Pythia and Delphes
  subprocess.call(['./bin/generate_events', '-f', '--multicore'])
  print 'INFO: Events generated.'

  # Remove parton-level files
  subprocess.call(['./bin/madevent', 'remove', 'all', 'parton', '-f'])

  # Remove Pythia-level files
  subprocess.call(['./bin/madevent', 'remove', 'all', 'pythia', '-f'])
  print 'INFO: Pythia-level files removed'

  # Remove Delphes ROOT files
  #subprocess.call('find . -name "*.root" -type f | xargs rm -f', shell = True)
  #print 'INFO: Delphes ROOT files removed, only LHCO files remain.'

  print 'Done.'
  1. submit the python script in step 2 to cluster with the following pbs script by qsub [name of the script]. You can set your own pbs paramters accordingly.
#!/bin/bash

#PBS -N ttbar_test
#PBS -q madgraph
#PBS -l nodes=1:ppn=4

cd /home/zp/cheng/HEPTools/MG5_aMC_v2_6_4/ttbar
./generation_script.py 20

For UdeM lps cluster: to avoid frequent IO in the home directory, it’s recommended to run large parallel MadGraph jobs in storage directories, such as /lcg/storage10/atlas/[your name]