# Using different matrix elements and showers¶

We now want to modify some hard matrix elements and related options. There may also be a slightly different work flow if you start doing this. To see where this is done, we start with another simple example:

## Higgs production from gluon fusion¶

We have to go back to the input file LHC-Matchbox.in. Have a good look at the file. It is already structured in a way that guides through the choices you have to make for the hard process. After a general section, in which the beam parameters are defined and which we leave at their defaults at this point, there is a section on process selection. For this process we still provide a built-in leading-order (LO) and next-to-leading-order (NLO) matrix element, so we only have to modify this bit.

We have to alter the three command lines therein to

set Factory:OrderInAlphaS 2
set Factory:OrderInAlphaEW 1

do Factory:Process p p -> h0


Clearly, the last line selects the process. Note that the number of built-in processes is limited, but we do the same thing when we pull in external matrix element providers.

The orders of the couplings must be like this if you think of the subprocess in terms of the involved top quark triangle. Even if we use an effective theory for the ggh coupling, the orders of the coupling constants remain unchanged.

Also, note that for the subprocess only the couplings of the LO process must be given. The additional couplings of the NLO corrections are taken into account automatically.

In order of this to work we also need to change the scale for the process as the default choice used for Drell-Yan, i.e. the mass of the lepton pair won’t work for this process. You can change the line

set Factory:ScaleChoice /Herwig/MatrixElements/Matchbox/Scales/LeptonPairMassScale


in the input file to

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


to use a fixed scale rather than the lepton-pair mass. More information on the different scale choices can be found in the Section on scales.

In addition as we have an external Higgs boson which can only be handled as an on-shell particle we must set the width of the Higgs boson used in calculating the hard process to zero, which can be achieved by uncommenting the line

#read Matchbox/OnShellEWProduction.in


in the input file which also zeros the width of the W and Z bosons. In some cases you may wish to only do this for the Higgs boson, for example if you are simulating production of the Higgs boson in association with a W or Z boson. You can zero the width of the Higgs boson used in the matrix element calculation by adding

set /Herwig/Particles/h0:HardProcessWidth 0.*GeV


to the input file.

## A different work flow¶

We can now split up the work flow a little bit, as it will be more useful once we consider more complicated processes. We can separate the build of the matrix element and the integration. For more complicated processes, both steps can take some time and perhaps require a few iterations. The integration can even be parallelized, which is very useful for complicated processes.

### Build step¶

Instead of the single read step we have made previously, we now start with

[example] $Herwig build LHC-Matchbox.in  which will build the matrix elements, create diagrams and prepare sampling. And a .run file is created. All steps are very straightforward for our example process. ### Integration step¶ Next we integrate the matrix element with [example]$ Herwig integrate LHC-Matchbox.run


This may take a while (not in the ggH example, though). This step creates a file HerwigGrids.xml that contains information about the phase space after the integration. This will be used for more efficient sampling during the event generation.

Now, we can generate a few events, as before with

[example] \$ Herwig run LHC-Matchbox.run -N 100


It’s probably convenient to leave the MPIHandler and hadronization switched off for the moment, see the More runs, switching things on and off section as a reminder.

## LO or NLO calculation¶

In order to get some understanding of the impact of the NLO calculation it might be useful to also look at the leading-order only result and see what kind of radiation is produced by the parton shower alone. This can be done a bit further down in the input file. There you can comment out the line

# read Matchbox/MCatNLO-DefaultShower.in


and uncomment the following line

read Matchbox/MCatLO-DefaultShower.in


in order to switch off the real and virtual parts of the NLO calculation.

Run a few events at LO and NLO and look at the .log and .out files. You should see that at LO only a small subset of processes has been used. You can also compare the resulting LO and NLO cross sections.

## Matching with Dipole shower¶

The matching of LO/NLO computations and parton showers not only works for the default parton shower (the “q-tilde-shower”) but also for the Catani-Seymour dipole shower. To achieve this, we switch off the default shower by commenting out all the following lines

#read Matchbox/MCatNLO-DefaultShower.in
## use for strict LO/NLO comparisons
## use for improved LO showering


We switch on the dipole shower and its subtractive matching by uncommenting one of the corresponding lines below - depending on our choice of the order of perturbation theory (LO or NLO) and the matching (MCatNLO or Powheg).

# read Matchbox/MCatNLO-DipoleShower.in
## use for strict LO/NLO comparisons
## use for improved LO showering


## Fixed-order calculation¶

Besides using a parton shower and matching, we can of course choose only a fixed-order calculation to calculate the cross section of the selected process and to generate parton-level events. For this purpose, we comment out all lines corresponding to the DefaultShower or the DipoleShower

#read Matchbox/MCatNLO-DefaultShower.in
## use for strict LO/NLO comparisons
## use for improved LO showering

## use for strict LO/NLO comparisons
## use for improved LO showering


and activate either the NLO Matchbox/NLO-NoShower.in or the LO Matchbox/LO-NoShower.in snippet:

# read Matchbox/NLO-NoShower.in


## Some scale variations¶

Further below in LHC-Matchbox.in you find a section on scale variations. Some scale choices that have to be made for the simulation can be tested. Normally, the results should not depend “too much” on the choice of these scales. Therefore, the sensitivity of results to these scales is a good indication for higher orders that have not yet been accounted for in the simulation.

Try to vary some of the scales by activating either the MuDown (variation by a factor of 1/2) or the MuUp (variation by a factor of 2) snippet.

# read Matchbox/MuDown.in


Note: These variations affect only the hard subprocess.

If you want to use scale variations for the parton shower apply one of the following two additional snippets at a time.

# read Matchbox/MuQDown.in


You can check whether one of the aforementioned scale variations has some effect on your final state distributions, if you make use of e.g. a RIVET analysis within your simulation.

## A slightly more complicated process¶

Now let us consider a matrix element that is provided by an external program. Let us first choose Z+jet production, as here we also have the possibility to compare to our internal matrix element, if desired. We first change the subprocess as we have seen above

set Factory:OrderInAlphaS 1
set Factory:OrderInAlphaEW 1

do Factory:Process p p -> Z0 j


Now, that we consider an additional jet we also have to worry about the cuts on the hard subprocess. For a cross process with a final jet we have to impose a jet cut, otherwise we are running into divergent regions of phase space. In the cuts section of the LHC-Matchbox.in input file you can uncomment the appropriate lines to demand a single jet, such that they look like this

## cuts on additional jets
insert JetCuts:JetRegions 0 FirstJet
# insert JetCuts:JetRegions 1 SecondJet


More information on the cuts which can be applied can be found in the section on cuts.

For the purpose of the tutorial it might be easier to only do a very crude integration until you want to do a serious production run and invest more time in the integration part. You can adjust some parameters of the sampler by stating in your LHC-Matchbox.in file:

# crude read step
set /Herwig/Samplers/CellGridSampler:InitialPoints 1000
set /Herwig/Samplers/CellGridSampler:ExplorationPoints 500
set /Herwig/Samplers/CellGridSampler:ExplorationSteps 1
set /Herwig/Samplers/CellGridSampler:RemapperPoints 500


You will find that the cross section estimates that are written during run time have much larger errors in this way. For physical results it is crucial to set these parameters back to more accurate levels, e.g. the default values. Maybe you even run into trouble with the phase space integration. In this case you have to increase all the parameters a bit in order to get a slightly more stable phase space.

Make a quick check of this run setup. Before you continue, it is advisable to delete the sub-directory ./Herwig-scratch of your working directory before you continue. This contains information specific to the process that has been simulated.