Skip to content

Getting started



MoMEMta depends on the following libraries and tools:

  • LHAPDF (>=6)
  • CMake (>=3.2)
  • Boost (>=1.54)
  • ROOT (>=5.34.09)
  • A C++11-capable compiler


MoMEMta has only been tested on GNU/Linux.


Retrieve the code on our github repository. Unpack the archive and / or go to the MoMEMta directory. Next, execute the following (unless one of the build options described below apply to your case):

mkdir build
cd build
cmake ..
make -j 4

Finally, make MoMEMta (public headers and library) available using:

make install

You can now use MoMEMta with your own code.

Build options

The following options are available when configuring the build (when running cmake ..):

  • -DCMAKE_INSTALL_PREFIX=(path): Install MoMEMta in a specific location when running make install (useful if you don't have admin rights)
  • -DPROFILING=ON: Generate debugging symbols and profiling information (requires gperftools)
  • -DBOOST_ROOT=(path): Use specific Boost version (path to its install directory)
  • -DTESTS=ON: Also compile the test executables
  • -DEXAMPLES=OFF: Do not compile the example executables
  • -DPYTHON_BINDINGS=ON|OFF (OFF by default). Builds python bindings for MoMEMta. Requires python and boost::python.
  • -DDEBUG_TIMING=ON|OFF (OFF by default). If ON, a summary of how long each module ran is printed at the end of the integration. Can be useful to see which module to optimize.

Usage: Lua & MoMEMta

In MoMEMta, the computation of weights is configured by the user through a small script written in the Lua language. Don’t be scared though: no previous knowledge of Lua is needed to use MoMEMta!

Computing weights in your analysis code is then a matter of only a few lines of C++: read the Lua file, instantiate MoMEMta, and call it by passing your particle 4-vectors:

#include <momemta/ConfigurationReader.h>
#include <momemta/MoMEMta.h>
#include <momemta/Types.h>

int main(int argc, char** argv) {

    ConfigurationReader configuration("tt_fullyleptonic.lua");
    MoMEMta weight(configuration.freeze());

    momemta::Particle electron { "electron", LorentzVector(16.17, -13.79, -3.43, 21.53), -11 };
    momemta::Particle bjet1 { "bjet1", LorentzVector(-55.79, -111.59, -122.14, 174.66), 5 };
    momemta::Particle bjet2 { "bjet2", LorentzVector(-18.90, 10.09, -0.60, 21.43), -5 };
    momemta::Particle muon { "muon", LorentzVector(71.39, 96.01, -77.25, 142.50), 13 };

    std::vector<std::pair<double, double>> weights = weight.computeWeights( { electron, muon, bjet1, bjet2 } );

    std::cout << "Result: " << << " +- " <<;

    return 0;


We ship a few example configuration files, along with short scripts computing a single weight: find them in MoMEMta/examples. To run them, simply call them from the build directory:


A set of more comprehensive examples on how to run MoMEMta can be found in our Tutorials repository. Each of these examples includes a matrix element generated by our exporter (see below), a ROOT file containing a few events, a documented Lua configuration file and a small source code showing how to compute weights for the events in the sample.

Matrix elements

MoMEMta includes matrix elements for a few processes, but you might soon want to compute weights for other processes. It is possible to include matrix elements for any process by using our Matrix Element Exporter, a plugin for MadGraph5_aMC@NLO (MG5). The plugin takes a leading-order matrix element generated by MG5 and exports it in a format suitable for use in MoMEMta. More information on how to use the plugin and the resulting matrix elements is provided in the plugin’s README file.

Support for other matrix element generators is planned for futures releases, however nothing prevents plugging in any code returning the matrix element provided it is wrapped properly for MoMEMta.