LHCb Simulation Validation

LHCb Birmingham has an ongoing participation in the development of the experiment's simulation framework, a large part of which involes the validation of new versions of Geant4 physics lists. These are validated independantly of Gauss and as part of the Gauss software.

Geant4 in LHCb

The LHCb Gauss framework uses Geant4 to simulate the passage of particles through matter. The descriptions of particle behaviours are determined by "physics lists" which are compositions of physics models. What model is invoked to describe the behaviour depends on the physical process, particle energy and random number generators for continuity at model boundaries.

Hadronic Physics Lists:

LHEP (Low and High Energy Paramerterisation)

These Physics Lists are based on a parametrised modeling for all hadronic interactions for all particles. The parametrised model is an improved version of the Geisha model. This list combines the high energy parametrised model (HEP) and the low energy one (LEP) describing hadronic interactions. There is a sharp switch from the low to high energy model at 25 GeV? . The modeling of elastic scattering off a nucleus and of capture of negative stopped particles and neutrons proceeds via parametrised models.

  • Bertini cascade (BERT) model, which simulates the intra-nuclear cascade, followed by pre-equilibrium and evaporation phases of the residual nucleus, for protons, neutron, pion and kaons interaction with nuclei at kinetic energies below 9.9 GeV? . The Bertini model produces more secondary neutrons and protons than the LEP model, yielding a better agreement with experiment data.
  • Fritiof (FTF) model for protons, neutrons, pions, kaons interactions with nuclei at high energies. The change between the two models happens with a shaded shift from BERT to FTF that starts at 4 GeV? and ends at 5 GeV? .

Bertini cascade at low energy, switching to LEP at ~9.5GeV and QGSP at 25GeV.

Electromagnetc Physics Lists

The electromagnetic physics list constructors are described on the Geant4 webpage:

LHCb has a private list "EmLHCb" tailored for use with the experiment, and "EmNoCuts" which is "EmLHCb" without the production cuts.

Documentation of Recent Validation Studies

For the incorporation of Geant4 v9.5 into Gauss, hadronic and electromagnetic validation studies were undertaken. The documented results can be found here:

LHCb-INT-2013-026_.pdf 23/05/2013

Validation software Installation and use

Electromagnetic Physics dE/dx Tools

This tool analyses the passage of muons, electrons and pions from simulated particle guns through the silicon of the Velo to investigate the energy loss due to electromagnetic interactions. A .root file is produced containing histograms for MPV, FWHM and MPV/FWHM for all the specified combinations of lists and versions.

The code currently works for Sim06b and Sim07 productions for energies of 0.1, 0.2, 0.4, 1, 5, 10, 17, 34, 50, 100, 120 and 168 GeV? . However it is designed to be easily modified for the incorporation of new productions to validate new versions and lists.

This tool requires you have Gauss installed along with the "VeloGauss" tool.

A modified version of the " VeloGaussMoni.cpp " script is required and can currently be found at


and should be placed in Velo/VeloGauss/src of your Gauss directory and VeloGauss? compiled. In this script one can specify what path lengths are required and will produce, among other information, the energy loss distributions for all specified path lengths. For example, in the current script, histogram "1002" is energy deposited between 290 and 310 microns, while "1003" is for paths greater than 300 microns.

Installing the package

Firstly, Gauss and VeloGauss? must be installed (see relevant LHCB Twiki page) with the modified VeloGaussMoni? script

The package consists of a several python and C++ script. They can currently be found at


navigating to this directory and running


will create the relevant directories (if they do not exist) and copy the scripts into the required locations in your userspace, for instance:


will contain the scripts and

" " is designed to be executed in the frontend software for the LCG, "ganga" and is used to submit Gauss jobs to extract the required information from the particle gun productions. " " merges the job outputs in your "gangadir" and organises them in a useable way in the directories:

~/GaussTests/dEdx/histos/Sim07/dEdx/G4PL_LHEP_Em +list+particle /

with a root file for each gun energy and named in the same convention as in particle gun productions, such as:

MCDEVParticleGunMagDown + list + Sim + version + particle code + energy code + SIM.root




Energy (GeV? )
0.1 30100
0.2 30200
0.4 30400
1 10001
5 10005
10 10010
17 10017
34 10034
50 10050
100 10100
120 10120
168 10168

The files used to analyse the data are


~/GaussTests/dEdx/makeplots.cpp calls on the scripts landauGenn.C and landau4new.C adopted from Mathew Needham which are used to analyse the distributions, fitting the peak with a parabolic fit to estimate the MPV and linear interplolation to estimate the FWHM. These results are stored as an (x,y) point in a TGraph alongside the full energy loss distributions in .root files in the same directory.

makeplots.cpp is used to plot the results and contains functions to plot the desired combinations. It must be compiled with the line:

g++ -o makeplots makeplots.c `root-config --cflags --glibs`

This code now functions properly in ganga 6 (but there is a deprecated ganga 5 setup script (.sh and .csh) included in code)

Firstly, set up the environment for ganga 6:


In ganga, run the " ~/myganga/ " script to submit jobs to the Grid. Particle gun type, simulation version and physics list
will need to be defined beforehand in the ganga python interpreter. i.e:

sim = '06b', '07'

particle = 'muon', 'pion', 'electron'

pl = 'EmNoCuts', 'EmLHCb', 'EmOpt1', 'EmOpt3', 'EmStd'

Either single strings or lists of strings may be used for all variables. Using a list of more than one string will cause the script to loop over all possible combinations of the variables defined and submit ganga jobs (split with 100 files per subjob) and 1 job per particle gun energy. The script makes use of ganga's "jobtree" method and will create the required job directories if they do not exist, based on the list, particle and sim version.

Once the jobs have completed and auto-merged, running

in the ganga prompt will give output files useful names and move them to the relevant directories. It loops over a given range of job numbers, which needs to be set in the script.

To analyse the data produced, run


where the naming convention is the same as when sim, physics list and particle names are defined in ganga.

More than one combination can be run with a simple shell loop, for example, in tcshell:

foreach sim (06b 07)

foreach pl (EmNoCuts? EmLHCb? EmOpt1? EmOpt3? EmStd? )

foreach particle (muon electron pion)

python $sim $pl $particle




Will run for all combinations provided the required root files exist. Any missing data will cause that combination to be skipped. The script calls upon the landau4new.C to fit the distributions. Which distribution is used is set in the landau4new.C script. By default it is histogram "1002" which is for path lengths of 290< x < 300 microns.

The data files created by in the same directory can be extracted and plotted with makeplots program. In here, there are functions that will automatically set colours and styles of lines and points depending on the version, list and particle and plot these on TGraphs and TMultigraphs

MakeGraph(): Takes in string options to create plot for specific sim version particle and physics list. Returns 1D vector of MPV, FWHM and MPV/FWHM

MakeMG() : Takes in a 2D vector of the graphs you want to plot and a title string,
returns a vector of 3 multigraphs for MPV, FWHM, MPV/FWHM

DrawCanv(): Takes in the vector returned by MakeMG? (), auto sets titles, axis options etc
and draws each graph and saves them as .png's in ~/GaussTests/dEdx/plots

To create a graph for a specific combination use MakeGraph? (), which returns a vector of MPV, FWHM and MPV/FWHM graphs like so:

MakeGraph(string 'particle', string 'version', string 'cut')


vector v_NoCutsmm_07 = MakeGraph? ("muons","07","EmNoCuts");

vector v_LHCbmm_07 = MakeGraph? ("muons","07","EmLHCb");

To then plot several graphs together, they must be pushed back into a 2D vector of TGraphs which is taken by MakeMG() and a further vector of TMultigraphs is returned, for MPV, FWHM and MPV/FWHM. eg:

 =vector mgl = MakeMG(Vl, "Sim 07 muons, EmNoCuts vs EmLHCb");= 

which will return the multigraphs for the comparison of EmNoCuts? muons and EmLHCb? muons in sim07, with the specified title.

.png files of these can be created with, for example

DrawCanv(mg, "Sim07 muons EmNoCuts? vs EmLHCb? ","Sim07LHCbNoCutsmm");

which would draw a canvas for each graph with the title "Sim07 muons EmNoCuts? vs EmLHCb? " + and file name "Sim07LHCbNoCutsmm.png"

All plots are also saved in " dedx_out.root " as TGraphs and TMultiGraphs? for manual editing.

Modifying for future validations

Most of the scripts determine parameters such as file locations, names and titles based on string concatenation of inputs, so assuming no drastic changes to the LHCb book keeping structure, using the scripts for new lists and version should not require any modification.

makeplots requires very minor changes such as new options to be added into MakeGraph() as it chooses visual options based on the current physics lists, particles and only for sim06b and sim07.

Hadronic Physics Multiplicity Tool

Here is a copy of the README file included in the package. Until it is officially released all the files can be found at "/afs/" on the LxPlus? afs. Here I report the README file you can find in the folder

The analysis is divided in two steps creating tuples and analysing them. This is all done using a simplified geometry made of target planes. Until is properly released the geometry can be found in the "fakeGeomOnly" folder.

This README will assume you already installed Gauss ans GaussTools? package.


In order to CREATE tuples you need:

- the "Multiplicity" tool in Gauss ( Multiplicity.cpp Multiplicity.h ):
These should be already present in the folder


Until is properly released an updated copy is among my files.
You must copy them in the folder said above and remake GaussTools?

- the python option file
tells Gauss to activate the Multiplicity tool and use the particular geometry
and contains options for the energy and ID of the incoming particles
Furthermore you'll need
(Gauss standard you can find one at \$GAUSSOPTS)


In order to create tuples:

SetupGauss (to be sure it is the right version)

source LbLogin? .sh -c x86_64-slc5-gcc43-opt
source SetupProject? .sh Gauss (version)

(you can edit the included in my package and source it

- go inside the script and modify the options at the beginning
(inside the available values reported)
Remember to set useganga=False or it will fail running locally.

- run it typing:


In order to ANALYSE the tuples:

The script created an option file named " option.txt "
(this is created in the folder you set as output)
This option file can be modified to obtain different analysis output
(e.g. not plot all the particles on a single plot)

  • Compile the analyser:
  • Go in the Analysis folder
  • type
    SetupProject root

  • compile by typing

you may also use the following command:

g++ Multi.cpp Filereader.cpp options.cpp Multi_classes.cpp -o
Multi.out `root-config --cflags --glibs`

  • run the analysis by typing:


The Multi.exe program reads the " options.txt " file and runs with those options,
allowing to draw different histos of total, inelastic cross secion or
multiplicity of different particles as a funcion of energy and more.

Allows to run in sequence many energies, materials, incoming particles and so on.

All files are provided in the "CreateTuples" folder

In order to analyse the tuples:

All following files provided in the "Analysis" folder together with a Makefile

-- PeterGriffith - 23 May 2013

Topic attachments
I Attachment Action Size Date Who Comment
pdfpdf LHCb-INT-2013-026_.pdf manage 2111.6 K 24 May 2013 - 09:53 PeterGriffith  

This topic: LHCb > LHCb?  > LHCbSimulationValidation
Topic revision: r2 - 24 May 2013 - 13:34:15 - PeterGriffith
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback