How-to: write a parton-level Monte Carlo particle physics event generator


This article provides an introduction to the principles of particle physics event generators that are based on the Monte Carlo method. Following some preliminaries, instructions on how to build a basic parton-level Monte Carlo event generator for the hard interaction are given through exercises. Indications on how to proceed to full-event simulations are given (the related course was given as part of the “Advanced Scientific Computing Workshop” at ETH Zürich in July 2014).

This is a preview of subscription content, log in to check access.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Data Availability Statement

This manuscript has associated data in a data repository. [Authors’ comment: The exercises and the respective solutions related to this publication have been made available at the URL].


  1. 1.

    Formerly known as HERWIG++.

  2. 2.

  3. 3.

  4. 4.

    That is, with equal probability to lie anywhere within the given interval.

  5. 5.

    A summary of the rate of convergence of the various techniques is given in Table 3 in Appendix D.


  1. 1.

    Wikipedia. How-to (2020). Accessed 9 June 2020

  2. 2.

    M. Twain, Following the Equator (Sun-Times Media Group, Chicago, 1897)

    Google Scholar 

  3. 3.

    J. Alwall, M. Herquet, F. Maltoni, O. Mattelaer, T. Stelzer, MadGraph 5: going beyond. JHEP 06, 128 (2011).

    ADS  Article  MATH  Google Scholar 

  4. 4.

    J. Alwall, R. Frederix, S. Frixione, V. Hirschi, F. Maltoni, O. Mattelaer, H.S. Shao, T. Stelzer, P. Torrielli, M. Zaro, The automated computation of tree-level and next-to-leading order differential cross sections, and their matching to parton shower simulations. JHEP 07, 079 (2014).

    ADS  Article  MATH  Google Scholar 

  5. 5.

    M. Bahr et al., Herwig++ physics and manual. Eur. Phys. J. C 58, 639–707 (2008a).

    ADS  Article  Google Scholar 

  6. 6.

    K. Arnold et al., Herwig++ 2.6 Release Note (2012)

  7. 7.

    S. Gieseke et al., Herwig++ 2.5 Release Note (2011)

  8. 8.

    J. Bellm et al., Herwig 7.2 Release Note (2019)

  9. 9.

    J. Bellm et al., Herwig 7.1 Release Note (2017)

  10. 10.

    J. Bellm et al., Herwig 7.0/Herwig++ 3.0 release note. Eur. Phys. J. C76(4), 196 (2016).

    ADS  Article  Google Scholar 

  11. 11.

    J. Bellm et al., Herwig++ 2.7 Release Note (2013)

  12. 12.

    T. Sjostrand, S. Mrenna, P.Z. Skands, PYTHIA 6.4 physics and manual. JHEP 05, 026 (2006).

    ADS  Article  MATH  Google Scholar 

  13. 13.

    T. Sjostrand, S. Mrenna, P.Z. Skands, A brief introduction to PYTHIA 8.1. Comput. Phys. Commun. 178, 852–867 (2008).

    ADS  Article  MATH  Google Scholar 

  14. 14.

    T.G. Stefan Hoeche, F. Krauss, M. Schonherr, S. Schumann, F. Siegert, J. Winter, Event generation with SHERPA 1.1. JHEP (2009).

    Article  Google Scholar 

  15. 15.

    A. Buckley et al., General-purpose event generators for LHC physics. Phys. Rep. 504, 145–233 (2011).

    ADS  Article  Google Scholar 

  16. 16.

    W. Kittel, L. Van Hove, W. Wojcik, A Monte Carlo generation method with importance sampling for high energy collisions of hadrons. Comput. Phys. Commun. 1, 425–436 (1970).

    ADS  Article  Google Scholar 

  17. 17.

    G. Peter Lepage, VEGAS: An Adaptive Multidimensional Integration Program 3 (1980)

  18. 18.

    A. Papaefstathiou, Phenomenological aspects of new physics at high energy hadron colliders. Ph.D. thesis, Cambridge University (2011). Accessed 9 June 2020

  19. 19.

    M.E. Peskin, D.V. Schroeder, An Introduction to Quantum Field Theory. Addison-Wesley, Reading, 1995. ISBN 9780201503975, 0201503972. Accessed 9 June 2020

  20. 20.

    F. Halzen, A. Martin, Quarks and Leptons: An Introductory Course in Modern Particle Physics (Wiley, Hoboken, 1984)

    Google Scholar 

  21. 21.

    R. Keith Ellis, W. James Stirling, B.R. Webber, QCD and collider physics. Camb. Monogr. Part. Phys. Nucl. Phys. Cosmol. 8, 1–435 (1996)

    Google Scholar 

  22. 22.

    M.R. Whalley, D. Bourilkov, R.C. Group, The Les Houches accord PDFs (LHAPDF) and LHAGLUE. in HERA and the LHC: A Workshop on the Implications of HERA for LHC Physics, Proceedings, Part B, pp. 575–581 (2005)

  23. 23.

    LHAPDF (2020). Accessed 9 June 2020

  24. 24.

    M. Bahr, S. Gieseke, M.H. Seymour, Simulation of multiple partonic interactions in Herwig++. JHEP 07, 076 (2008b).

    ADS  Article  Google Scholar 

  25. 25.

    T. Sjostrand, P.Z. Skands, Transverse-momentum-ordered showers and interleaved multiple interactions. Eur. Phys. J. C 39, 129–154 (2005).

    ADS  Article  Google Scholar 

  26. 26.

    J. Alwall et al., A standard format for Les Houches event files. Comput. Phys. Commun. 176, 300–304 (2007).

    ADS  Article  Google Scholar 

Download references


The author would like to thank Christoph Grab and Nicolas Chanon the opportunity to lecture at the “Advanced Scientific Computing Workshop” at ETH Zürich, as well the students who attended the course, providing helpful feedback. Support is acknowledged in part by the Swiss National Science Foundation (SNF) under Contract 200020-149517, by the European Commission through the “LHCPhenoNet” Initial Training Network PITN-GA-2010-264564, MCnetITN FP7 Marie Curie Initial Training Network PITN-GA-2012-315877 and by a Marie Curie Intra European Fellowship within the 7th European Community Framework Programme (Grant No. PIEF-GA-2013-622071).

Author information



Corresponding author

Correspondence to Andreas Papaefstathiou.



The constants in this section are given to provide agreement with the MadGraph event generator. They appear in Table 2.

Table 2 Constants used throughout this article, given to provide agreement with MadGraph

Parton density functions using LHAPDF

At the time of writing, the latest version of the LHAPDF package is 6.1.3. It is recommended to use this or a latter version for the exercises given here. The library can be interfaced to either C++, FORTRAN or Python. Since the solutions to the exercises are given in Python, the PDFs should be initialized as:


and the PDF should be called as:


where FLAVOUR should be replaced by the quark flavours contributing to the process: 1 for down-quarks, 2 for up, 3 for strange, 4 for charm and negative values for the corresponding anti-quarks. The gluon, not used here, is given by 21. Note that this actually gives \(x \times f(x)\) and thus one has to divide by the momentum fraction to get f(x). Moreover, this specific function takes as input the scale and not the scale squared.

The Les Houches event file format

The file header and the first event in a Les Houches-accord event file have the following form:


The first row after \(\mathtt {<}\)init\(\mathtt {>}\) shows the ids of the incoming hadrons, their energy and the PDF numbers (10042 in this case). The following line shows the cross section and the error. The first event follows, containing the particle ids, their status codes and mother information, colour information, their momenta, and whether they are stable particles or not. See Ref. [26] for more details.


See Table 3.

Table 3 The rate of convergence with the number of points N used for each method in d-dimensions

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Papaefstathiou, A. How-to: write a parton-level Monte Carlo particle physics event generator. Eur. Phys. J. Plus 135, 497 (2020).

Download citation