NA62 Monte Carlo Simulations

This wiki describes how to set up and distribute the NA62 Monte Carlo simulation code.


  • Test tarball from Antonino Sergi: NA62MC.tgz
  • Obtain release number and read about modifications in NA62MC/HISTORY

Job submission and output management system code components are held on the server. The files attached to this wiki are not the latest versions.

Code compilation

  • Versions:
    • v4 - Contains bug in the MC which Tonino spotted after giving us the tar ball
    • v5 - Installed by Janusz on May 10 (r170, see table below)
    • v6 - September 2012 version (r188)
    • v7 - r193: uses GEANT4 9.5p01, improves processing speed roughly by a factor of 5 wrt the previous version
    • v8 - r244: installed directly or via CVMFS (see table below)
    • v9 - r261: fatal bug in 4-lepton decay generator fixed, memory leak fixed, points to geant4 9.5.p02
  • Unpack tarball to NA62MC
  • Fix libs path problems in GNUMakefile-s (Generator/ and Beam/)
     cp ../NA62/backups/Beam.GNUmakefile Beam/GNUmakefile
     cp ../NA62/backups/Generator.GNUmakefile Generator/GNUmakefile 
  • Make changes to source 'offline' environment, clear XAWLIBS variable, rearrange paths (move system paths after NA62-specific paths):
     export XAWLIBS=" "
  • Source the the environment file (source scripts/
  • Type make and be patient

Code distribution

      tar -czvf NA62MC_v7.tgz NA62MC
      cd /afs/
      tar -czvf ~/G4-libs.tgz sw/lcg/external/geant4/9.5.p01/x86_64-slc5-gcc43/lib
      tar -czvf ~/Qt-libs.tgz sw/lcg/external/qt/4.6.3p2/x86_64-slc5-gcc43-opt/lib
      tar -czvf ~/Boost_libs.tgz sw/lcg/external/Boost/1.48.0_python2.6/x86_64-slc5-gcc43-opt/lib
  • Add the G4EMLOW6.23.tgz tarball
      [protopop@ppepc102 gridsw]$ ls v8/
      Boost_libs_v8.tgz  G4EMLOW6.23.tgz  G4_libs_v8.tgz  NA62MC_v8.tgz  Qt_libs_v8.tgz  sqlite_v8.tgz
  • Run a special job (with an SGM Admin role) to wget and unpack these tarballs on sites (
  • Run test job


CVMFS is used for software distribution to sites. A guide is provided here:

Scripts preparation

The following files need to be checked and updated for each new s/w release:

  • Job wrapper script - update version number
  • .mac file - check for new settings, new decay types etc.
  • input_files.tgz - check if any new files need to be included in this archive

Read the HISTORY file to find out what changes might have appeared.

Job submission

  • Run parameters given in the StandardRun.mac file: run number, number of events, random seed, root output file name
  • Job environment parameters are set by sourcing the script created by
  • The .mac is modified using sed on the worker node to modify paths to LAV matrix files, which are installed in the software area by
  • The actual job script is attached (needs editing and streamlining)

Automated jobs scripts creator

There's now a suite of tools for submitting jobs either one-by-one or in bulk. Jobs submitted via this interface have the advantage that everything about the jobs (input and output files, scripts, run parameters and statistics) are archived for later reference.

The script creator interface lets the production manager (PM) set up the job parameters (both MC parameters and output options) and choose the number of 'runs' to launch. The scripter prints out in the browser a list of commands that the PM has to run on his grid UI in order to launch the job or production with his credentials. For individual jobs, the PM updates the DB by hand, for multiple runs, it is done via a wrapper script. A cron job periodically updates the list of jobs and files in the DB.


Mark Slater set up a Ganga service ( for managing entire production rounds. The Ganga request form is accessed via a link on the Production table. Once the request is submitted, a Ganga daemon from the Grid UI machine picks it up (within 10 minutes) and will submit and monitor jobs until the events target is reached.

How the Ganga service was set up and interacts with the other bot components is described in here: GangaService4NA62

Site resources

This is a simple table to keep track of site resources (please update if changes occur):

Site CPU WMS Support Storage CVMFS NA62 S/W
Liverpool DONE DONE DONE DONE r261
Birmingham DONE DONE DONE DONE r261

Note on s/w labelling: both a NA62 release number (e.g. r261) and a tarball version (e.g. v9) are used. They are kept track of in a dedicated DB table. FTS channels might not be needed is FTS3 is used (latest wrapper scripts).

Site admins - persons to contact in case something goes wrong on one of the sites are:

  • Glasgow - Dan Protopopescu (, Stuart Purdie (
  • IC - Janusz Martyniak (
  • RAL - Andrew Lahiff (
  • Liverpool - Stephen Jones (
  • Birmingham - Mark Slater (
  • UCL - Sergey Podolsky (, Pavel Demin (
Please replace the #-s.


Cron jobs

Cronjobs are employed to keep track of jobs and output files:


To log problems encountered (and solutions) use this wiki:


Topic attachments
I Attachment History Action SizeSorted ascending Date Who Comment
Texttxt ganga-script.txt r2 r1 manage 0.6 K 2012-05-01 - 13:16 DanProtopopescu Ganga script for multiple job submission: na62job.gpy
Unix shell scriptsh r1 manage 1.2 K 2012-05-01 - 11:06 DanProtopopescu Script to install NA62 MC software on a given site
Texttxt r1 manage 2.7 K 2012-05-10 - 14:23 DanProtopopescu (not final!) This is run on the Software Manager's UI machine to create the software tarballs for distribution
Texttxt r1 manage 4.7 K 2012-05-01 - 11:22 DanProtopopescu Job script
Texttxt StandardRun_template.mac.txt r1 manage 15.5 K 2012-05-01 - 10:36 DanProtopopescu StandardRun.mac template
PNGpng NA62MC-org-chart.png r1 manage 56.4 K 2012-06-21 - 16:04 DanProtopopescu NA62 MC workflow
PNGpng JobSubmissionComponents.png r1 manage 83.2 K 2012-05-01 - 13:37 DanProtopopescu Job submission components diagram
PNGpng NA62-GridPP-Sites.png r1 manage 88.3 K 2012-09-18 - 09:46 DanProtopopescu Sites Map (September 2012)
PNGpng Cronjobs-small.png r6 r5 r4 r3 r2 manage 150.0 K 2013-02-15 - 13:29 DanProtopopescu Cronjobs diagram

This topic: NA62 > WebHome > NA62MonteCarlo
Topic revision: r53 - 2013-04-23 - DanProtopopescu
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback