# Detector Simulations¶

Occasionally it is useful to interface to fast detector simulations for phenomenological studies. Two of the publically available programs AcerDet and​PGS are written in FORTRAN and use the HEPEVT common block to obtain the event information.

Interfacing to these programs from is tricky as the HepMC event record must be converted to HepEVT and passed to the FORTRAN. We provide an interface to both AcerDet and PGS in the Contrib directory of Herwig, however we warn the user that due to the issues with converting between FORTRAN and C++ these interfaces are not as robust as the rest of the code.

## AcerDet¶

In order to run the AcerDet interface ThePEG must be configured to use HepMC as this is used to convert to the FORTRAN HEPEVT common block, also for compatibilty with the FORTRAN HepMC should be configured to use units of GeV and mm.

AcerDet can be obtained from the AcerDet web-page. By default AcerDet is compiled with g77. It will compile using gfortran versions after 4.3 which include support for the -finit-local-zero option which AcerDet requires. Herwig should be configured to use the same FORTRAN compiler as you use to compile AcerDet. In addition there is a minor bug in AcerDet’s ACDHERWIG6 routine which requires the line

N=NHEP


to be added after the declarations at the top of the routine and before

DO 180 I=1,N


The Makefile in the directory Contrib/AcerDetInterface will contain the correct paths to most of the code, however you will have to change the location of AcerDet, CERNLIB, and perhaps HepMC to the locations of your version. In recent versions there may be no phtools library in cernlib which can be reomved in the makefile and on 64-bit systems problems with HBOOK. AcerDet does not really need HBOOK so you can comment the HLIMIT and HOUTPU lines out in AcerDet_files.f in the interface and all calls to HBOOK, HF1 and HOPERA in the AcerDet code.

A simple example analysis ZAnalysis which plots the reconstructed mass of the Z boson at both hadron and detector level is included.

## PGS¶

The PGS program can be obtained from the PGS web-page. The most recent version, as of writing PGS-120611, uses gfortran however the -fPIC option needs to be added to the COMPILE-ARGS in the top level makefile and in the CFLAGS and FFLAGS relevant for your operating system in src/stdhep-dir/mcfio/arch_mcfio src/stdhep-dir/src/stdhep_Arch.

In order to run the PGS interface ThePEG must be configured to use HepMC as this is used to convert to the FORTRAN HEPEVT common block, also for compatibilty with the FORTRAN HepMC should be configured to use units of GeV and mm.

The Makefile in the directory Contrib/PGSInterface will contain the correct paths to most of the code, however you will have to change the location of PGS, CERNLIB, and perhaps HepMC to the locations of your version.

A simple example analysis ZAnalysis which plots the reconstructed mass of the Z boson at both hadron and detector level is included.

# MultiWeight¶

Reading of Les Houches accord files supports reading of multiple alternative weights as described in the Les Houches Event Files section. The MultiWeight analysis provides an example on how to access the multiple weights.

The analysis is loaded like any other analysis

cd /Herwig/Generators
library MultiWeight.so
create Herwig::MultiWeight /Herwig/Analysis/MultiWeight
insert theGenerator:AnalysisHandlers 0 /Herwig/Analysis/MultiWeight


It will output any optional weights according to their ‘internal’ tags. The handler currently handles, apart from the multiple weights: FxFx tags, aMCFast weights and MadGraph5 clustering and scale information.

# FxFx merging¶

The FxFx merging module consists of a Les Houches accord file reader that handles the FxFx-related tags, and a shower handler that performs the merging of the NLO events generated with MadGraph/AMC@NLO with the Herwig parton shower. An associated analysis, FxFxAnalysis is provided to allow running multiple weights within Rivet.

Note that the module has only been tested for W+jets and Z+jets events at 7 and 8 TeV. Other processes will be supported in future releases.

The file LHC-FxFx-Rivet-Wjets-15.0.in provides an example on how to load the Les Houches accord files from MadGraph/AMC@NLO.

The following options are necessary, as for MC@NLO events

set KinematicsReconstructor:ReconstructionOption General
set KinematicsReconstructor:InitialInitialBoostOption LongTransBoost


The setting for W+jets and Z+jets events is

set /Herwig/Shower/FxFxHandler:ihrd        3


The highest-multiplicity sample should be set prior to running. For example, if the events consist of Z+0 jets@NLO, Z+1 jets@NLO and Z+2 jets@NLO then the following should be set

set FxFxHandler:njetsmax      2


Options for the merging algorithm should also be set

cd /Herwig/Shower
set FxFxHandler:VetoIsTurnedOff VetoingIsOn
# Is this the highest multiplicity ME in merging?
# merging scale
set FxFxHandler:ETClus 15.0*GeV
# Cone size used in clustering in merging.
set FxFxHandler:RClus 1.0
# Max |eta| for jets in clustering in merging.
set FxFxHandler:EtaClusMax 10
# Default 1.5 factor used to decide if a jet matches a parton
# in merging: if DR(parton,jet)<rclusfactor*rclus the parton
# and jet are said to have been matched.
set FxFxHandler:RClusFactor 1.5


The FxFxAnalysis provides an interface to Rivet just as the default RivetAnalysis

cd /Herwig/Generators
# Stuff for rivet:
create ThePEG::FxFxAnalysis /Herwig/Analysis/FxFxAnalysis FxFxAnalysis.so
# use the optional weights (WARNING: runs rivet multiple times!)
set /Herwig/Analysis/FxFxAnalysis:UseOptWeights No
insert theGenerator:AnalysisHandlers 0 /Herwig/Analysis/FxFxAnalysis
insert /Herwig/Analysis/FxFxAnalysis:Analyses 0 MC_XS


# AlpGen¶

This is code that performs matrix element-parton shower merging of events produced by AlpGen. For further details see 1205.4902.