Technical details for setting up and running the Grid Package

The full MG/ME package with the grid option is available on our machines.

Using the option

   .true.  = gridpack

in the {{{ run_card.dat }}} will generate a gridpack. At the results page there will be a link to this package.

The gridpackage is what is obtained after a special run of MadEvent and is what is meant to be sent over to the cluster or grid nodes. It's completely frozen, meaning that you cannot change any parameter anymore, apart from the # of event and the rnd number.

When you unpack it you get:


The first is a script which accepts two numbers (the number of events and the rnd number).

Basic Use of grid packs

Before you use locally or over the grid you need to compile the package (compilation does not occur during the run anymore, but beforehand as requested by the grid boys) on a machine compatible with your cluster:

cd madevent

after that it is ready to go. There is also an option to compile madevent with dynamic libraries. Use

./bin/compile dynamic

to compile with dynamic libraries for the madgraph source files. This will replace all makefiles with makefile_dynamic and compile using these new makefiles. Using dynamic libraries is greatly encouraged, because it can make the compiled gridpack significantly smaller. This options is currently not working. We are investigating this

After a succesful compilation you can run the


script to remove all source files and reduce the size of the package. Now you can just repackage and send it to some cpu on the other side of the world or run it locally (after chmod +x

./ 10000 37

Running the same gridpacks simultaneously

One limitation of the gridpack is that you can only run maximum one instance at any given time. To avoid to have to untar the code multiple times, you can follow this method (please use at least 2.7.3):

cd madevent
./bin/internal/restore_data default
cd ../
chmod -R 555 madevent 

If you need to reduce the size of the gridpack after the command "restore_data". You can technically remove all the following files present in any directories:


After that you you can create as many empty directory as you want and run the code as


At the end of the execution, you will have a single file named events.lh.gz created in the local directory.


The DECAY directory contains a program to decay final state particles. It has been designed to keep track of spin correlations as much as possible and is particularly useful for the decay of (anti) top quarks E.g. for the decay of top quarks up to 95% of the correlations are preserved.

The DECAY package can be found in the MadGraph v4 developer's kit that can be downloaded from the MadGraph/MadEvent Downloads webpage. Make sure you have a MadGraph/MadEvent version v4.3 or later. To add the package to the gridpack, simply untar the gridpack to get the =./madevent/= directory and the =./ script. Move the DECAY directory from the MG/ME developer's kit to the directory in which you untarred the gridpack, to get here the two directories and the one script file:

./madevent/                 ./DECAY/                 ./

The DECAY package is compiled automatically when


is executed from the ./madevent directory. As input to specify the decays, files with the names

should be put in the ./DECAY directory. (Where x is a number between 1 and 20.) These files are read automatically, and one file should be put for each decaying particle. (E.g. for ttbar events 2 files are necessary: one for the decay of the top and one for the anti-top.) The first three lines of these files should be


while the fourth line specifies the particle that needs decay, e.g. put


for the decay of a top quark. The fifth line is an integer that specifies the decay mode. This depends on the particle that is going to be decayed. For top quarks it is:

1 = ' t -> b  w+ '
2 = ' t -> b  ve e+'
3 = ' t -> b  vm mu+'
4 = ' t -> b  vt ta+'
5 = ' t -> b  vl l+    (e+mu)'
6 = ' t -> b  vl l+    (e+mu+ta)'
7 = ' t -> b  j   j    (ud+cs)'
8 = ' t -> b  anything (e+mu+ta+ud+cs)'

and similar for the anti-top.

Hence this file decays all top quarks (ignoring anti-tops!) in the event file leptonically.


REPLACE is a package that lets the user replace particles in event files. This is particulary useful to save precious time in the generation of the diagrams. For example, the generation of Z+4jets, in which the Z is decay leptonically, will take (at least) three times longer when the three generations of leptons are specified in the process. Because we know that, if we assume that all of them are massless, the decay of Z bosons is unfavored to any specific lepton flavor, we could as well have generated events with only muons and then randomly replacing the muons in the event file by electrons or tau's with 33% probability for each. This is exactly what the REPLACE script has been designed to do.

To add this functionality to the gridpack you'll have to create a directory 'REPLACE" after you have untarred a gridpack to get the following:

./madevent/                 ./REPLACE/                 ./

The {{{ }}} script from the =./madevent/bin/= directory as well as the {{{ replace_card1.dat }}} from the =./madevent/Cards= needs to be copied to the REPLACE directory by typing:

cp  ./madevent/bin/  ./madevent/Cards/replace_card1.dat  ./REPLACE/

(Note the in the latest version of replace, the '1' add the end of the filename is necessary, and can be any number between 1 and 20, to have the possibility of more than one replace.) In the {{{ replace_card1.dat }}} the particles that needs to be replaced and the particles in which it needs to be replaced have to be specified by their corresponding PDG codes. E.g. adding the lines:

11 : 11 13 15
-11 : -11 -13 -15

will replace all electrons from the event file by electrons (i.e. do nothing), muons or taus with equal probabilities, and simultaneously positrons with positrons, anti-muons and anti-taus. The replace card that can be used in the example above in which only diagrams where the Z decays in muons were generated and need to be replaced by electrons and taus can be found here: replace_card1.dat

Last modified 5 weeks ago Last modified on 06/29/20 21:20:31

Attachments (2)

Download all attachments as: .zip