# Integrators¶

Herwig 7 offer a new infrastructure for Monte Carlo integration, which has
been developed along with the `Matchbox`

module; a `GeneralSampler`

class
is responsible of exploiting a certain algorithm implemented in `BinSampler`

classes to perform the integration of individual subprocesses. Currently, we
offer three main algorithms: `CellGridSampler`

, `MonacoSampler`

and
`FlatBinSampler`

for validation purposes. All sampling objects are loacted
in the `/Herwig/Smaplers`

directory of the default repository.

## General options¶

We report some of the less-expert settings here; a full and detailed documentation can be found in the manual.

Switch to verbose mode to report results on individual sub-process contributions:

```
set Sampler:Verbose On
```

Minimum selection probability for a sub-process if its estimated cross section would give rise to a smaller probability:

```
set Sampler:MinSelection 0.01
```

Sample sub-processes flat (validation purposes only):

```
set Sampler:FlatSubprocesses On
```

Update grid information from statistics accumulated while running:

```
set Sampler:WriteGridsOnFinish Yes
```

## Common sampler options¶

Set the number of initial points to be used for estimating sub-process cross sections:

```
set Sampler:BinSampler:InitialPoints 10000
```

The following options make sense for the `CellGridSampler`

and `MonacoSampler`

:

Set the number of iterations to be performed (not applicable to flat sampling):

```
set Sampler:BinSampler:NIterations 3
```

Set the enhancement factor for the number of points to be used in the next iteration:

```
set Sampler:BinSampler:EnhancementFactor 1.2
```

Set a path for data on random number population versus cross section:

```
set Sampler:BinSampler:RandomNumbers ./population-data
```

The following options make sense for the `CellGridSampler`

and `FlatBinSampler`

:

Enable the remapping of phase space dimensions using a given number of points:

```
set Sampler:BinSampler:RemapperPoints 10000
```

Remap the dimension used for channel selection (only applicable for
`TreePhasespace`

):

```
set Sampler:BinSampler:RemapChannelDimension Yes
```

Remap the random numbers corresponding to the parton luminosity using a certain number of bins:

```
set Sampler:BinSampler:LuminsoityMapperBins 20
```

Remap all other dimensions using a certain number of bins:

```
set Sampler:BinSampler:GeneralMapperBins 20
```

Enforce a minimum selection probability for remapper bins even if the estimated cross section would have given rise to a smaller probability:

```
set Sampler:BinSampler:RemapperMinSelection 0.01
```

## CellGrid sampler¶

The `CellGridSampler`

is extending the algorithm initially described in
1108.6182. It can be enabled using:

```
set Sampler:BinSampler CellGridSampler
```

Options accepted by the `CellGridSampler`

include:

Set the number of exploration points to presample a cell:

```
set CellGridSampler:ExplorationPoints 1000
```

Set the number of exploration steps to be performed:

```
set CellGridSampler:ExplorationSteps 3
```

Set the gain parameter of the cell splitting algorithm:

```
set CellGridSampler:Gain 0.3
```

Set the epsilon parameter of the cell splitting algorithm:

```
set CellGridSampler:Epsilon 1.0
```

Enforce a minimum selection probability for cells even if the estimated cross section would have given rise to a smaller probability:

```
set CellGridSampler:MinimumSelection 0.01
```

## Monaco sampler¶

The `MonacoSampler`

is implementing the algorithm described in 0811.4559.
It can be enabled using:

```
set Sampler:BinSampler MonacoSampler
```

Options accepted by the `MonacoSampler`

include:

Set the grid modification rate:

```
set MonacoSampler:Alpha 0.8
```

Set the number of grid divisions:

```
set MonacoSampler:GridDivisions 48
```

## Flat sampling¶

Flat sampling is offered as a cross check facitlity. It can be enabled via:

```
set Sampler:BinSampler FlatBinSampler
```

There are no parameters for flat sampling.

# NLO consistency checks¶

## Subtraction checks¶

The convergence of the unintegrated subtraction can be checked by indicating a directory where the relevant data should be stored:

```
set Factory:SubtractionData ./subtraction-checks
```

Keep in mind that phase space sampling will be highly restricted to the singular regions, so no physics analysis should be run when enabling this test.

Several types of plots are supported:

Perform enveloping of the ratio \(D/M\):

```
set Factory:SubtractionPlotType LinRatio
```

Perform enveloping of the logarithm of the relative difference \(|D-M|/M\):

```
set Factory:SubtractionPlotType LogRelDiff
```

## Pole cancellation¶

Similarly to the subtraction checks, histograms of pole cancellation measures can be performed by indicating a directory to store the data:

```
set Fatctory:PoleData ./pole-checks
```

## List of dipoles and mappings¶

The list of dipoles which have been found for a certain process and the mapping of real emission to Born legs can be accessed via:

```
set Factory:InitVerbose On
```