More on matrix elements

External matrix element providers

Let’s now simulate the same process with matrix elements from external providers. To this end, we have to make sure that we have built Herwig with support for the desired external matrix element providers and have to activate one combination of external matrix element providers using one of the following snippets:

# read Matchbox/
# read Matchbox/
# read Matchbox/
# read Matchbox/
# read Matchbox/
# read Matchbox/

It is worth noting, that two different matrix element providers can be chosen - one for the tree level and another one for the one-loop amplitudes. We choose MadGraph to provide the tree level amplitudes and OpenLoops to provide the one-loop amplitudes.

read Matchbox/

Make sure that you have installed the required process libraries in OpenLoops, before starting the build of the matrix elements and the preparation of the sampling.

[example] $ Herwig build

Now, during the build stage you see that Herwig once more generates diagrams in order to set up subtraction terms and phase space but then the external providers are called to generate the amplitudes. No further handling of the external providers is required once they are properly installed. You will see some of their output at this stage. It does of course take a bit longer to generate the matrix element at this stage than to just set up the internal code.

Once you are finished, start the integration, this should take a similar amount of time as before, but this stage depends on the efficiency of the external code, of course.

Generate a few events and check that everything works as expected.


In principle we can now run any process we like, as long as the matrix element provider is able to handle it. However, the computational effort of generating the matrix elements and then sampling the phase space grows very, very quickly with the number of external particles.

As in a quick tutorial it does not make much sense to simply increase the number of additional jets, we want to see how we can generate other processes.

Top Quark Pair Production using Madgraph and OpenLoops

Let’s look at top quark pair production, which is also very common at the LHC.

set Factory:OrderInAlphaS 2
set Factory:OrderInAlphaEW 0

do Factory:Process p p -> t tbar

As with the Higgs boson we need to set the width of the top quark used in the hard process to zero by uncommenting the line

read Matchbox/

We also need to make an appropriate choice of scale for the process. If you look at the section on scales then either using

set Factory:ScaleChoice Scales/TopPairMassScale


set Factory:ScaleChoice Scales/TopMTScale

is a sensible choice for the top quark pair production.

Note: Don’t forget to comment out the jet cut applied in the example before.

Generate the amplitudes and run a few events with this setup. If you still have the Plot AnalysisHandler included in your run you can have a quick look at one event and find the top quarks with all their decay products. This is best done when you only leave the parton shower switched on, i.e. you switch off Hadronization, Decays and Underlying Event.

If we are just interested in the bare properties we may set the top quark stable with

set /Herwig/Particles/t:Stable Stable
set /Herwig/Particles/tbar:Stable Stable

Higgs Production in Gluon Fusion using Madgraph and GoSam

We can use GoSam in order to simulate processes involving the effective \(gg\to h^0\) vertex from a top quark loop. When using GoSam make sure the environment variables are correctly set using the script installed to the bin directory by GoSam.


We need to use the relevant snippets to use GoSam and allow effective Higgs interactions

read Matchbox/
read Matchbox/

Specify the process

set Factory:OrderInAlphaS 2
set Factory:OrderInAlphaEW 1
do Factory:Process p p -> h0
set /Herwig/Particles/h0:HardProcessWidth 0.*GeV

and pick an appropriate scale

set Factory:ScaleChoice /Herwig/MatrixElements/Matchbox/Scales/FixedScale
set /Herwig/MatrixElements/Matchbox/Scales/FixedScale:Scale 125.7

We can then setup and run the generator as before.

By default the Higgs boson is not considered as a possible internal particle using the ExcludeInternal interface of the DiagramGenerator. If we wish to include the Higgs boson as an intermediate we must erase it from this vector using

erase /Herwig/MatrixElements/Matchbox/Utility/DiagramGenerator:ExcludeInternal 0

We can then generate \(gg\to h^0\to \tau^+\tau^-\) using

set Factory:OrderInAlphaS 2
set Factory:OrderInAlphaEW 2
do Factory:Process p p -> tau+ tau-

Higgs Production in Vector Boson Fusion using VBFNLO

The VBFNLO program can be used to calculate the leading- and next-to-leading-order amplitudes for processes involving vector boson fusion, only include the vector boson fusion subset of the diagrams, the simplest process is \(qq\to q q h^0\). This can be simulated by uncommenting the line

read Matchbox/


set Factory:OrderInAlphaS 0
set Factory:OrderInAlphaEW 3
do Factory:Process p p -> j j h0
set /Herwig/Particles/h0:HardProcessWidth 0.*GeV

We can use a fixed scale of the Higgs boson mass:

set Factory:ScaleChoice /Herwig/MatrixElements/Matchbox/Scales/FixedScale
set /Herwig/MatrixElements/Matchbox/Scales/FixedScale:FixedScale 125.7*GeV

To help the phase space to find the dominant regions it is helpful to restrict topologies for the Diagram generator with:

cd /Herwig/MatrixElements/Matchbox
insert Factory:DiagramGenerator:RestrictLines 0 /Herwig/Particles/Z0
insert Factory:DiagramGenerator:RestrictLines 0 /Herwig/Particles/W+
insert Factory:DiagramGenerator:RestrictLines 0 /Herwig/Particles/W-
insert Factory:DiagramGenerator:RestrictLines 0 /Herwig/Particles/gamma
do Factory:DiagramGenerator:TimeLikeRange 0 0

Alternatively the input snippet Matchbox/ can be read.

In principle this process is finite in the VBF approximation but we can still impose cuts on the jets

read Matchbox/
insert JetCuts:JetRegions 0 FirstJet
insert JetCuts:JetRegions 1 SecondJet

This can be quite complicated so we can make use of the option in Herwig of performing the integration step in parallel, suppose we have 4 cores on our machine we can use the build step to set up 4 integration jobs

Herwig build --maxjobs=4

In bash we can then integrate them using

for i in {0..3}; do (./Herwig integrate --jobid=$i &); done

Once all the integration jobs have finished we can run the event generator which will automatically combine them

Herwig run -N 1000

Try other processes that come to your mind and have fun exploring all the other features of Herwig!