Skip to content

1. The Genesis Device: Madgraph

Jonathan Guiang edited this page Jul 5, 2022 · 11 revisions

All of the code here is taken from the 2022 CMSDAS example, but it has been consolidated for simplicity. The following instructions detail the use of code contained in the madgraph directory in this repository for making gridpacks.

1. Making a gridpack

  1. Create a new set of cards for a process (e.g. VBS WWH) called PROCESS (e.g. VBSWWH)
cd cards
mkdir PROCESS_4f_LO
cp WpToLNu_4f_LO/WpToLNu_4f_LO_run_card.dat PROCESS_4f_LO/PROCESS_4f_LO_run_card.dat
cp WpToLNu_4f_LO/WpToLNu_4f_LO_proc_card.dat PROCESS_4f_LO/PROCESS_4f_LO_proc_card.dat
  1. Edit the cards appropriately:
    • PROCESS_4f_LO_proc_card.dat: contains the most basic Madgraph instructions that can often be read/understood verbatim, like generate p p > w w h j j (includes VBS WWH); see the cards directory for additional examples
    • PROCESS_4f_LO_run_card.dat: contains more detailed parameters for Madgraph, like requirements on the momenta of various physics objects. Adding more stringent requirements can make things faster, but at the cost of a limited phase space. Note that adding such requirements (e.g. ptj > 20) will change the cross section that Madgraph calculates!
    • (Optional) PROCESS_4f_LO_customizecards.dat: contains instructions like setting the default value for a given coupling. Note that couplings in external models are typically given a non-zero or non-unity value, so if you want to generate a Standard Model sample, you may need to set the couplings of interest to the SM value by hand using this card.
    • (Optional) PROCESS_4f_LO_reweight_card.dat: contains the configuration for a scan of a number of coupling values. A series of event weights will be computed. When applied, they will scale the event kinematics distributions to look approximately like a corresponding set of coupling values.
  2. Add any additional models to the models directory
  3. Create a gridpack
usage: ./make_gridpack CARDSDIR [OPTIONAL ARGS]

Make a gridpack

required arguments:
  CARDSDIR                     directory containing Madgraph process/run cards

optional arguments:
  -h, --help                   display this message
  -n, --name NAME              process/card name (default: basename of cards dir)
  -m, --modelsdir MODELSDIR    directory containing Madgraph models
  -q, --queue QUEUE            which queue (default: 'local')
  -j, --jobstep JOBSTEP        processing options (default: 'ALL'; allowed: 'ALL','CODEGEN',
                               'INTEGRATE', 'MADSPIN')
  --scram SCRAM                which SCRAM architecture to use (default: slc7_amd64_gcc700)
  --cmssw CMSSW                which CMSSW version to use (default: CMSSW_10_6_0)
  1. Check that the gridpack is good; the following command should produce an LHE file
mkdir temp
cd temp
tar xf ../PROCESS_4f_LO_slc7_amd64_gcc700_CMSSW_10_6_0_tarball.tar.xz # contains runcmsgrid.sh
./runcmsgrid.sh $NEVENTS $RANDOMSEED $NCPU
head cmsgrid_final.lhe # make sure that the file has content
cd ..
rm -rf temp
  1. Clean up
rm -rf PROCESS_4f_LO
rm -rf PROCESS_4f_LO.log
  1. Move the gridpack to Ceph (if it's large enough)

2. Testing the gridpack

A handy script has been included in this repository for testing gridpacks/making LHE files.

$ ./test_gridpack /full/path/to/gridpack.tar.xz [NEVENTS] [SEED]

where NEVENTS is the number of LHE events to produce and SEED is the random seed to use. The results will be saved to $PWD/tests/PROCESS. Note: because CMS uses an old version of MadGraph, the random seed is only used for a portion of the event generation. This means that if you use the exact same gridpack to generate two separate LHE files using the same seed, they will not contain an identical list of output events.

Clone this wiki locally