# More runs, switching things on and off¶

Now, having an idea how to read the input files, we are going to modify our copy of the LHC-Matchbox.in input file and make a few more runs.

## Analysis Handlers¶

As you have seen in the previous section, the event generator has an event handler that handles single events. This in turn has several so-called StepHandlers that each simulate one part of the event. Look at the log-file again to see which steps are being generated. Each step usually conserves energy and momentum. A special set of handlers, that can be called are so-called AnalysisHandlers. They are called, once the event is finished. Every analysis handler has access to the whole event record and can compute some of its properties and book them into histograms. At the end of the run, it could write its output into an output file, a histogram file, for instance.

### BasisConsistency AnalysisHandler¶

One AnalysisHandler you have already got to know is the BasicConsistency Handler. This checks for conservation of charge, momentum, energy and looks for coloured particles in the final state. In case something goes wrong it will write a lot of warning messages. In case you want to look at parton-level results for studying purposes you can e.g. switch off the check for coloured final states as otherwise you get a warning for every quark and gluon in the final state by stating

cd /Herwig/Analysis
set Basics:CheckQuark No


in your own LHC-Matchbox.in file.

Note: If your using either the

read Matchbox/NLO-NoShower.in


or

read Matchbox/LO-NoShower.in


snippet, the BasisConsistency Handler is automatically switched off.

### GraphViz AnalysisHandler¶

Another analysis handler of interest for the following could be one for the graphical representation of single events. Please add the following lines to your LHC-Matchbox.in file to make use of it:

##################################################
## Analyses
##################################################

cd /Herwig/Generators
set /Herwig/Analysis/Plot:EventNumber 42
insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot


This handler will write a dot file of event number 42 to your working directory. The program dot is needed to create a nice graphical representation of this event. This can be very useful to understand the event flow. Insert the above lines to your input file and run the generator for at least 42 events. This should have produced the file LHC-Matchbox-Plot-42.dot. If you have installed GraphViz you can then run

[example] $dot -Tpng LHC-Matchbox-Plot-42.dot > plot.png  and view the resulting plot.png e.g. with eog or any other viewer. If you fail at this point or it takes very long, then this is perhaps because there are simply too many particles in event 42. Repeat this after you have switched off some parts of the simulation, as explained below. ## Switching simple things on and off¶ A very prolific source of additional particles is the underlying event. Particularly if you have already cranked your LHC up to 13 TeV CM energy! We can switch off the multiple interaction handler of the ShowerHandler by explicitly setting it to NULL. Therefore you have to add the following lines to your own copy of the LHC-Matchbox.in file: ################################################## ## ShowerHandler(s) ################################################## cd /Herwig/EventHandlers set EventHandler:CascadeHandler:MPIHandler NULL  Likewise you can set other StepHandlers to NULL set EventHandler:DecayHandler NULL set EventHandler:HadronizationHandler NULL set EventHandler:CascadeHandler NULL  Have a look on the FAQ section to get more information about possible switches. At this point you might also want to go back to the default input file HerwigDefaults.in and see whether you understand where these modules are inserted to the generator. Browse a few files and follow the setup of individual modules. ## A short cut for quick modifications¶ At this point, when you start to try different things like using different AnalysisHandler, it is a bit annoying to always wait for the integration during the read step. There is a simple way to add a few lines to the configuration when you think these will not affect the adaption and generation of the hard subprocess. This is definitely the case for what we are doing at the moment. You can skip the read phase altogether and pass a small (or not so small) file with additional input commands to the generator. The setup of the hard process is skipped and only the few switches you wanted to flick are added to the configuration. [example]$ Herwig run LHC-Matchbox.run -N 1000 -d 1 --setupfile==short.in


Note, that your output files now also carry the name of the setupfile. Also, if you find unexpected behaviour with this short cut, you might have broken parts of the repository configuration. In this case go back to modify what you had in mind directly in the input file. For our examples you must e.g. switch of the MPIHandler already in the main input file.

With these switches at hand, you should be able to produce some graphical views of the event with only the hard process, then plus parton showers etc. Try a few possibilities.