This tutorial teaches you the basics of the Monte Carlo Event Generator [[https://herwig.hepforge.org/ | Herwig]]. An installation of Herwig on your own device is not necessary if you use the provided docker image (see next section). If you plan to use Herwig for your own research follow the instructions provided under [[ https://phab.hepforge.org/w/herwigtutorial/installation/ | Installation ]]. **For the purpose of this tutorial, you do not need to install Herwig.**
In this tutorial you will learn:
How to simulate LEP events
How to simulate LHC events
How to include rivet analyses and compare a simulation with data
How to switch parts of the Event Generator on and off
How to modify parameters of the Parton shower and the Hadronization model
How to run LHE files in Herwig with its Les Houches Event Handler
==Before you start: setting up Herwig's docker containers==
All exercises within this tutorial can be done by using the provided docker image for Herwig. This contains a working copy of Herwig's latest version, Hewrig-7.3.0 with ThePEG-2.3.0. If you have not already installed docker, please follow the instructions on the [[https://docs.docker.com/install/ | docker website]] and install docker on your device.
The required docker containers can be pulled directly from the [[https://hub.docker.com/ | docker hub]] with
docker pull herwigcollaboration/herwig-7.3:7.3.0
Linux users will need to add **sudo** to the beginning of the above command.
In order to run Herwig, execute the following shell command
docker run -i --rm -u `id -u $USER`:`id -g` -v $PWD:$PWD -w $PWD herwigcollaboration/herwig-7.3:7.3.0 Herwig --help
This allows the container to access your local files and to write to the current working directory
Create an alias for the run command by editing the file **~/.bashrc** on your local machine. Simply add the following line to the end of .bashrc
alias DRH='docker run -i --rm -u `id -u $USER`:`id -g` -v $PWD:$PWD -w $PWD herwigcollaboration/herwig-7.3:7.3.0'
To run **Herwig** execute
DRH Herwig
Similar commands like **rivet-mkhtml** can be run in the same fashion
DRH rivet-mkhtml
From here on if you use this alias note that you prefix
If this works, you are ready to start the tutorial with [[ https://phab.hepforge.org/w/mcnet2019/firstrun/ | First run: LEP]]. If you encounter problems, please talk to a tutor.
==For attendees of the McNet school==
If you are interested in doing a Merging run, you can use the file `LHC-W-Merging.in` file, but this will take a long time for the integration step. For the sake of making more runs with more stats better use the `LHC-W-Matching.in` input file
For using the Rivet analysis: copy the `MY_W_ANALYSIS.cc`, `MY_W_ANALYSIS.plot` and `MY_W_ANALYSIS.yoda.gz` to the `herwig` directory and type `make RivetMY_W_ANALYSIS.so` to compile the analysis
For changing the W boson mass there is a snippet called `MassW.in` where you can change the value for the W+ and W- boson individually, so remember to change both masses to the same value to be consistent.
For parallelising the run steps :
```
DRH Herwig run LHC-W-Matching.run --jobs=N_CORES -N N_EVENTS
DRH rivet-merge -e LHC-W-Matching-*.yoda -o LHC-W-Matching.yoda
```
For not doing the read step again do:
```
DRH Herwig run LHC-W-Matching.run --jobs=N_CORES -N N_EVENTS --setup=MassW.in
DRH rivet-merge -e LHC-W-Matching-*.yoda -o LHC-W-Matching.yoda
```
==For attendees of the DESY Terascale School==
We prepared a [[ https://gitlab.com/stefan-kiebacher/desy-terascale-herwig-tutorial | gitlab repository ]], which you can clone and follow the instructions.
**Instructions:**
# [[ https://phab.hepforge.org/w/herwigtutorial/installation/ | Installation ]]
# [[ https://phab.hepforge.org/w/mcnet2019/firstrun/ | First run: LEP ]]
# [[ https://phab.hepforge.org/w/mcnet2019/secondrun/ | Second run: Z production and jets at the LHC ]]
# [[ https://phab.hepforge.org/w/mcnet2019/thirdrun/ | Third run: minimum bias events and soft physics ]]
# [[ https://phab.hepforge.org/w/mcnet2019/leshouches/ | The Les Houches Event Handler ]]
# [[ https://phab.hepforge.org/w/herwigtutorial/photoninduced/ | Photon Induced Process in Herwig ]]
# [[ https://phab.hepforge.org/w/herwigtutorial/MCNetSchoolDurham2023 | W mass measurement project with Herwig (MC Net School Durham 2023) ]]
**Helpful literature**
[[ https://arxiv.org/abs/0803.0883 | Herwig manual ]]