My Adventures with Monte Carlo: A Guide for Producing Private Monte Carlo Samples

Monte Carlo production for the CMS experiment can often be confusing. The work flows, programs, and commands are often not well documented, but I created this page to reverse this trend. This page documents my adventures in Monte Carlo production to act as a guide for anyone else that is trying to produce their own private Monte Carlo Samples.

General Steps for Monte Carlo Production

Monte Carlo simulations use statistical Monte Carlo methods on various physical models to predict the results of a particle collision and then simulate the detector response to those particles. For CMS a typical process is to use programs like MadGraph and Pythia to calculate differential cross sections and final states, then to pass the results to a program like GEANT that simulates the detector response. Most of this can be done using cmsdriver to create automated configuration files.

I preformed a Monte Carlo simulation with two main steps. First, I used MadGraph data cards as inputs for gridpack generation. Then, I used cmsdriver to generate configuration files that used pythia to finish the calculations and GEANT to simulate the detector response. Finally, I used cmsdriver to make configuration files that simulated the detector response.

Gridpack Creation

A gridpack is a tarball (compressed) file that contains a bunch of calculation results stored in away that can be read with cmsdriver. The CMS workbook on Monte Carlo generation, WorkBookGeneration, states that "In practice only MC experts deal with these complicated instructions." However, this is not always true. Many groups need their own private samples for various studies, so they need to start by create gridpacks.

In my adventures, I have only produced gridpacks using MadGraph, but this can be done with other programs like PowHeg. A useful guide for this, is the MadGraphGuide. The Genproductions group is in charge of producing gridpacks that are requested by each physics group, their data cards are stored on GitHub:

Producing a MadGraph gridpack requires four main files: MC_proc_card.dat, MC_run_card.dat, MC_customizecards.dat and MC_extramodels.dat. Examples of these files can be found on the Genproductions GitHub repository. These examples are excellent templates for making gridpacks. Gridpacks can then be produced locally or via submitting to a computing grid. For an example and further instructions on how to produce gridpacks, please see my gridpack producer:

From Gridpacks to MiniAOD

After creating (or obtaining) a gridpack, it must be converted into a MiniAOD sample. To obtain the proper workflow for your specific case, find similar Monte Carlo datasets on the McM website ( Then click the icon that looks like a bar graph to view the work flow. On each step of the work flow, click on the "Get Set Up commands" icon to view the cmsdriver commands necessary for this process. Below is a more detailed example using the 2016 Monte Carlo production process.

The work flow for the 2016 Monte Carlo production process is:

  1. Gridpack
  2. GEN-SIM
  5. MiniAOD

Each of the next steps involves using to generate configuration files that are then run with cmsRun. The commands to produce these files for various gridpacks are located on the McM website ( A useful starting point is to search for the files corresponding to the template cards used for gridpack generation. For example, I used the Radion_hh_hVVbb MadGraph cards as a template, so I searched for the dataset "Radion_hh_hVVbb*" on McM to find and use the corresponding setup commands. For 2016 Monte Carlo production, the setup commands can be found under the following PrepID's:

  • RunIISummer15wmLHEGS - These commands use a gridpack to produce GEN-SIM and LHE files
  • RunIISummer16DR80Premix - These commands use GEN-SIM files produce GEN-SIM-RAW files, add in pile-up, and then produce AODSIM files (along with an outdated MiniAOD file)
  • RunIISummer16MiniAODv2 - These commands use AODSIM to produce the up-to-date MiniAOD files

Note that on the McM website there is a "Get Setup Command" next to each PrepID. Make sure to change input files to the locally generated Monte Carlo files. For the step adding pile-up, I encountered some difficulties. DAS has recently changed their client, so the pile-up files will need to be manually entered into the cfg file.

Most of these commands and steps will be the same for different MadGraph gridpacks and I have written step by step instructions on my GitHub repository on how to go from a gridpack to MiniAOD. So, if you are using a MadGraph gridpack for 2016 Monte Carlo generation, please see my GitHub repository:

Useful Links

Bon Voyage!

-- BrendanRegnery - 2018-01-19

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2018-06-26 - BrendanRegnery
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback