Skip to content
Snippets Groups Projects
Commit 85ebbc60 authored by Giacomo De Pietro's avatar Giacomo De Pietro :goat:
Browse files

Merge branch 'ws2425-kick-off' into 'main'

Add exercise 8

See merge request Lehre/tp1_forstudents!17
parents e2e1017c ff9f0536
Branches
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Event Generation with Herwig7
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Note:</strong>
Did you select the **Herwig server**? If not, shut down this instance and start a new one selecting the Herwig server!
</div>
%% Cell type:markdown id: tags:
## 1. Getting Started
%% Cell type:markdown id: tags:
### Preparations
For this exercise you will need to execute the commands in a terminal. For this: click on `File` on top left, then select `New` and finally select `Terminal` to open a terminal next to this notebook.
After having opened the terminal, access the folder for this exercise:
```
cd TP1_forStudents/Exercise08
```
Confirm you are in the correct folder by executing `ls`: you should see few files including this notebook, `Exercise08.ipynb`.vents.vents.
%% Cell type:markdown id: tags:
Then to set the environment for running Herwig, execute:
```
source /herwig/bin/activate
```
Type `Herwig --help` to see the execution options for Herwig:
```
Usage: Herwig (read|build|integrate|mergegrids|run) [OPTIONS]... [FILE]
Herwig is a multi-purpose Monte-Carlo event generator for particle physics. See
arXiv:0803.0883 for a detailed manual, or arXiv:1101.2599 for a more general
description of the physics behind MC event generation.
[...]
```
%% Cell type:markdown id: tags:
You are now ready to start generating your first events.
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Note:</strong>
Whenever you are asked to run a command in the terminal, please copy the output here in a notebook cell!
</div>
%% Cell type:markdown id: tags:
### Getting Familiar
Open the inputfile for this exercise `LHC-Matchbox.in` and have a look at the last line
```
saverun <YOUR_GENERATOR_NAME> EventGenerator
```
%% Cell type:markdown id: tags:
This defines your `EventGenerator` object with the identifier `<YOUR_GENERATOR_NAME>` composed of the many module objects defined and configured above.
Set `<YOUR_GENERATOR_NAME>` to a unique string, so you will be able to identify your generator later on.
You do not have to understand each configurable module in the file in detail, but you will need to adjust some of them for this exercise.
For example, to adjust the center-of-mass energy of the collision and the type of process, you need to change the lines 18 and 39, respectively, in your input file to
```
set EventHandler:LuminosityFunction:Energy 13000*GeV
[...]
do Factory:Process p p -> mu+ mu-
```
to generate $pp \rightarrow \mu^+ \mu^-$ events at $13\,\mathrm{GeV}$ center-of-mass energy as produced for example at the LHC.
%% Cell type:markdown id: tags:
To start your first generation of events execute the following:
```
Herwig read LHC-Matchbox.in
```
in your Bash shell. This will read in your input file, build and compile all modules with your chosen configurations and produce a few outputs. The read step will usually take a while.
%% Cell type:raw id: tags:
--> Your output
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 1.1:</strong>
How many Feynman diagrams are contributing at leading order (LO) perturbation theory?
Why is there no top quark involved?
</div>
**Hint**: Have a look at the output generated by the `Herwig read` step and divide this number by a factor of two.
**Cheat**: Open the `<YOUR_GENERATOR_NAME>.out` file **after** you generated a few events with the `Herwig run` command below for another hint in case you need it.
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 1.2:</strong>
Explicitly draw the diagrams.
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
Until now the preparations should have been finished and you should have now a new directory `Herwig-cache` and a `<YOUR_GENERATOR_NAME>.run` file in your working directory.
Use them to generate 10 events of the process $pp \rightarrow \mu^+ \mu^-$ at a center-of-mass energy of 13TeV events by executing:
```
Herwig run LHC-Matchbox.run -N 10
```
%% Cell type:raw id: tags:
--> Your output
%% Cell type:markdown id: tags:
**Note**: By default each `Herwig run` will use the same seed for the random number generator, i.e., subsequent excecution of the same `.run` file will produce the exact same events. You can add the option `--seed=<ARBITRARY_INT_NUMBER>` to ensure that you use different random seeds in different runs.
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 1.3:</strong>
What is the LO cross-section of this process and its uncertainty? Does the cross-section change if you change the random seed?
</div>
**Hint**: Again, look at the output of the `Herwig run` command.
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 1.4:</strong>
What is the LO cross-section of this process and its uncertainty if you generate 10000 events? What's the difference compared to the generation of 10 events?
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
## 2. Understanding the Event History
%% Cell type:markdown id: tags:
Now let's try to understand, what is generated. When the generation is finished, a
```
<YOUR_GENERATOR_NAME>-Plot-1.dot
```
file was produced in your working directory.
Use this to generate a graphical representation of your first generated event by executing:
```
dot -Tpng <YOUR_GENERATOR_NAME>-Plot-1.dot > plot.png
```
%% Cell type:markdown id: tags:
Open now the resulting `plot.png` file (rightklick in the file browser to open it in a new browser tab, will give you a nicer layout to observe the plot) to see the whole history of this particular event.
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 2.1:</strong>
Find the colliding particles and required collision products you've specified above ($pp \rightarrow \mu^+ \mu^-$).
</div>
**Hint**: The time direction in the plot goes from left to right. You can also search with `CTRL + F` for the particles of interest if it is opened in a new tab and you created a `.svg` file instead of `.png`.
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
Let's try to deconstruct the whole event generation by switching-off certain parts of the simulation.
For simple changes in the configuration of the modules, which do not influence the calculation of the hard scattering transition matrix element (amplitude squared) Herwig allows to use a short cut, skipping the necessity of rerunning the `Herwig read` step by using a setupfile.
In the provided setupfile `setupfile.txt` you have all necessary switches already set to switch-off all generation steps except for the hard scattering process you have defined above in the input file. To re-enable a step you can simply comment out the corresponding line. It will be sufficient to generate only a few events for this purpose, as this will save you a lot of processing time.
Generate some events executing:
```
Herwig run LHC-Matchbox.run --setupfile=setupfile.txt -N 10
```
with options as defined in the setupfile `<YOUR_SETUP_FILE>`. The generated outputs will automatically include the string `<YOUR_SETUP_FILE>` in the name, which simplifies to distinguish between the separate runs.
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 2.2:</strong>
Plot the event history for five different scenarios and save them:
* for all switches off,
* only the `CascadeHandler` (for parton shower) turned on,
* additionally the `HadronizationHandler` (for Hadronization) turned on,
* `CascadeHandler` and `HadronizationHandler` and `DecayHandler` (for Hadron-decays) turned on,
* and the full simulation with all switches on (including the `MPIHandler` for Underlying-Event generation). (**Hint**: You already generated this.)
Hence, you will get an incremental representation of an event for each additional generation step.
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 2.3:</strong>
Compare the plots. What do you observe? Why are some arrows black, others colored?
Recall what you learned in the lecture about **parton shower (PS)**, **Hadronization** and **Underlying Event (UE)**. What would be different at an $e^+$-$e^-$-collider like for example LEP? Try to rerun Herwig with the provided **LEP-Matchbox.in** as input to generate events like they would occurr at the LEP-Collider. Compare the event representation with the full simulation of the LHC event.)
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 2.4:</strong>
Briefly explain Asymptotic Freedom and Confinement and how they motivate the observed event generation chain
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
## 3. Generating at NLO Perturbation Theory
%% Cell type:markdown id: tags:
Try to improve on the description of measured data by running a generation at next-to-leading order (NLO) in perturbative QCD.
In the file `LHC-Matchbox.in`, uncomment line 101 (`read Matchbox/MCatNLO-DefaultShower.in`) and comment line 104 (`read Matchbox/MCatLO-DefaultShower.in`) to set the ME generation to NLO QCD.
To prevent overwriting your previous generated outputs, set `<YOUR_GENERATOR_NAME>` in line 151 to a new value. We need both the LO and NLO simulation later in the exercise.
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 3.1:</strong>
Rerun the `Herwig read` and `Herwig run` steps to generate another ten thousand events at NLO perturbative QCD.
</div>
%% Cell type:raw id: tags:
--> Your output
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 3.2:</strong>
How many subprocesses have to be calculated for the NLO generation? What are the corresponding Feynman diagrams?
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 3.3:</strong>
What is the NLO cross-section for this process?
</div>
%% Cell type:markdown id: tags:
--> Your answer
%% Cell type:markdown id: tags:
<div class="alert alert-info">
<strong>Question 3.4:</strong>
How one could improve further the cross section calculation? Is it realistically achieveable?
</div>
%% Cell type:markdown id: tags:
--> Your answer
File added
# -*- ThePEG-repository -*-
##################################################
## Herwig/Matchbox example input file
##################################################
##################################################
## Collider type
##################################################
read snippets/Matchbox.in
read snippets/EECollider.in
##################################################
## Beam energy sqrt(s)
##################################################
cd /Herwig/EventHandlers
set EventHandler:LuminosityFunction:Energy 91.2*GeV
##################################################
## Process selection
##################################################
## Note that event generation may fail if no matching matrix element has
## been found. Coupling orders are with respect to the Born process,
## i.e. NLO QCD does not require an additional power of alphas.
## Model assumptions
read Matchbox/StandardModelLike.in
read Matchbox/DiagonalCKM.in
## Set the order of the couplings
cd /Herwig/MatrixElements/Matchbox
set Factory:OrderInAlphaS 0
set Factory:OrderInAlphaEW 2
## Select the process
## You may use identifiers such as p, pbar, j, l, mu+, h0 etc.
do Factory:Process e- e+ -> mu+ mu-
## Special settings required for on-shell production of unstable particles
## enable for on-shell top production
# read Matchbox/OnShellTopProduction.in
## enable for on-shell W, Z or h production
# read Matchbox/OnShellWProduction.in
# read Matchbox/OnShellZProduction.in
# read Matchbox/OnShellHProduction.in
##################################################
## Matrix element library selection
##################################################
## Select a generic tree/loop combination or a
## specialized NLO package
# read Matchbox/MadGraph-GoSam.in
# read Matchbox/MadGraph-MadGraph.in
# read Matchbox/MadGraph-NJet.in
# read Matchbox/MadGraph-OpenLoops.in
## Uncomment this to use ggh effective couplings
## currently only supported by MadGraph-GoSam
# read Matchbox/HiggsEffective.in
##################################################
## Cut selection
## See the documentation for more options
##################################################
## cuts on additional jets
# cd /Herwig/Cuts
# read Matchbox/DefaultEEJets.in
# set NJetsCut:NJetsMin 3
##################################################
## Scale choice
## See the documentation for more options
##################################################
cd /Herwig/MatrixElements/Matchbox
set Factory:ScaleChoice /Herwig/MatrixElements/Matchbox/Scales/SHatScale
##################################################
## Matching and shower selection
##################################################
# read Matchbox/MCatNLO-DefaultShower.in
# read Matchbox/Powheg-DefaultShower.in
## use for strict LO/NLO comparisons
read Matchbox/MCatLO-DefaultShower.in
## use for improved LO showering
# read Matchbox/LO-DefaultShower.in
# read Matchbox/MCatNLO-DipoleShower.in
# read Matchbox/Powheg-DipoleShower.in
## use for strict LO/NLO comparisons
# read Matchbox/MCatLO-DipoleShower.in
## use for improved LO showering
# read Matchbox/LO-DipoleShower.in
# read Matchbox/NLO-NoShower.in
# read Matchbox/LO-NoShower.in
##################################################
## Analyses
##################################################
# cd /Herwig/Analysis
# insert Rivet:Analyses 0 XXX_2015_ABC123
# insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 Rivet
# insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMC
set /Herwig/Analysis/Plot:EventNumber 1
insert /Herwig/Generators/EventGenerator:AnalysisHandlers 1 /Herwig/Analysis/Plot
##################################################
## Do not apply profile scales for LEP as hard
## scale coincides with kinematic limit
##################################################
set /Herwig/Shower/ShowerHandler:HardScaleProfile NULL
set /Herwig/DipoleShower/DipoleShowerHandler:HardScaleProfile NULL
##################################################
## Save the generator
##################################################
do /Herwig/MatrixElements/Matchbox/Factory:ProductionMode
set /Herwig/Generators/EventGenerator:IntermediateOutput Yes
cd /Herwig/Generators
saverun LEP-Matchbox EventGenerator
# -*- ThePEG-repository -*-
##################################################
## Herwig/Matchbox example input file
##################################################
##################################################
## Collider type
##################################################
read snippets/Matchbox.in
read snippets/PPCollider.in
##################################################
## Beam energy sqrt(s)
##################################################
cd /Herwig/EventHandlers
set EventHandler:LuminosityFunction:Energy 8000*GeV
##################################################
## Process selection
##################################################
## Note that event generation may fail if no matching matrix element has
## been found. Coupling orders are with respect to the Born process,
## i.e. NLO QCD does not require an additional power of alphas.
## Model assumptions
read Matchbox/StandardModelLike.in
read Matchbox/DiagonalCKM.in
## Set the order of the couplings
cd /Herwig/MatrixElements/Matchbox
set Factory:OrderInAlphaS 0
set Factory:OrderInAlphaEW 2
## Select the process
## You may use identifiers such as p, pbar, j, l, mu+, h0 etc.
do Factory:Process p p -> e+ e-
## Special settings required for on-shell production of unstable particles
## enable for on-shell top production
# read Matchbox/OnShellTopProduction.in
## enable for on-shell W, Z or h production
# read Matchbox/OnShellWProduction.in
# read Matchbox/OnShellZProduction.in
# read Matchbox/OnShellHProduction.in
# Special settings for the VBF approximation
# read Matchbox/VBFDiagramsOnly.in
##################################################
## Matrix element library selection
##################################################
## Select a generic tree/loop combination or a
## specialized NLO package
# read Matchbox/MadGraph-GoSam.in
# read Matchbox/MadGraph-MadGraph.in
# read Matchbox/MadGraph-NJet.in
# read Matchbox/MadGraph-OpenLoops.in
# read Matchbox/HJets.in
# read Matchbox/VBFNLO.in
## Uncomment this to use ggh effective couplings
## currently only supported by MadGraph-GoSam
# read Matchbox/HiggsEffective.in
##################################################
## Cut selection
## See the documentation for more options
##################################################
cd /Herwig/Cuts/
set ChargedLeptonPairMassCut:MinMass 60*GeV
set ChargedLeptonPairMassCut:MaxMass 120*GeV
## cuts on additional jets
# read Matchbox/DefaultPPJets.in
# insert JetCuts:JetRegions 0 FirstJet
# insert JetCuts:JetRegions 1 SecondJet
# insert JetCuts:JetRegions 2 ThirdJet
# insert JetCuts:JetRegions 3 FourthJet
##################################################
## Scale choice
## See the documentation for more options
##################################################
cd /Herwig/MatrixElements/Matchbox
set Factory:ScaleChoice /Herwig/MatrixElements/Matchbox/Scales/LeptonPairMassScale
##################################################
## Matching and shower selection
## Please also see flavour scheme settings
## towards the end of the input file.
##################################################
# read Matchbox/MCatNLO-DefaultShower.in
# read Matchbox/Powheg-DefaultShower.in
## use for strict LO/NLO comparisons
read Matchbox/MCatLO-DefaultShower.in
## use for improved LO showering
# read Matchbox/LO-DefaultShower.in
# read Matchbox/MCatNLO-DipoleShower.in
# read Matchbox/Powheg-DipoleShower.in
## use for strict LO/NLO comparisons
# read Matchbox/MCatLO-DipoleShower.in
## use for improved LO showering
# read Matchbox/LO-DipoleShower.in
# read Matchbox/NLO-NoShower.in
# read Matchbox/LO-NoShower.in
##################################################
## PDF choice
##################################################
read Matchbox/FiveFlavourScheme.in
## required for dipole shower and fixed order in five flavour scheme
# read Matchbox/FiveFlavourNoBMassScheme.in
read Matchbox/CT14.in
# read Matchbox/MMHT2014.in
##################################################
## Analyses
##################################################
cd /Herwig/Analysis
insert Rivet:Analyses 0 MC_ZINC_MU
insert Rivet:Analyses 1 MC_ZJETS_MU
insert Rivet:Analyses 2 ATLAS_2017_I1514251
insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 Rivet
set /Herwig/Analysis/Plot:EventNumber 1
insert /Herwig/Generators/EventGenerator:AnalysisHandlers 1 /Herwig/Analysis/Plot
# insert /Herwig/Generators/EventGenerator:AnalysisHandlers 2 HepMC
##################################################
## Save the generator
##################################################
do /Herwig/MatrixElements/Matchbox/Factory:ProductionMode
set /Herwig/Generators/EventGenerator:IntermediateOutput Yes
cd /Herwig/Generators
saverun LHC-Matchbox EventGenerator
......@@ -13,3 +13,4 @@ This repository serves as a collection of materials needed for the various exerc
| 05 | 19th December 2024 | 9th January 2025 |
| 06 | 10th January 2024 | 16th January 2025 |
| 07 | 19th January 2024 | 30th January 2025 |
| 08 | 30th January 2024 | 6th February 2025 |
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment