Test49: Geant4 Monte-Carlo Models Testing Tools
CERN Summer Student Project Report
PH-SFT Group, CERN
R. Atachiants (firstname.lastname@example.org)
Supervised by: M. Kosov (email@example.com)
August 25, 2009
1 Project Overview
During the CERN Summer Student program, I
worked in Geant4 team (PH-SFT). The project
contained several diﬀerent objectives:
• a full conversion of all Test19 PAW-tests of
existing Geant4  Monte Carlo models testing
to ROOT environment  and creation of a
fully automated testing system.
• creation of a special DB (DataBase) for the ex-
perimental data with an automatic process of
comparison of the MC distributions with data.
During the summer student work, the both objec-
tives were accomplished and even more various im-
provements has been made: auto-scaling features
for the plots, graphical user interfaces for the tools,
secondary nuclear fragments retrieval, etc. The cre-
ated tools were designed with the ﬂexibility and
ease-of-use in mind.
2 PAW to ROOT Conversion
Fist step of the project was to convert the several
.kumac ﬁles counting approximately 3000 lines of
code. Learning curve of the PAW and ROOT
environments was steeply, therefore the conversion
was achieved in about 1 month. Few insights for
the PAW to ROOT portin can be found on the
CERN ROOT website (http://root.cern.ch/root/
HowtoConvertFromPAW.html), but it was rather
insuﬃcient for the big scale porting and mostly
targeted the people who want to switch from PAW
During the porting, experience shown that the
C++ methods of ROOT are more comprehensive
and therefore more verbose. First kumac macro
conversion implementation showed 40% increase of
the length of the simple macro port.
3 Simulation and Analysis
After the conversion of all macro ﬁles to ROOT,
three comprehensive tools were developed.
• Experimental DB Creation Tool: a graph-
ical tool has been developed for the creation of
publication ﬁles (cf. 4) from ASCII data. Fig-
ure 4 shows the GUI of this tool.
• Simulation Tool: the goal of the tool is to
take the publication ﬁle as the input and us-
ing a Geant4 testing program (currently only
Test19 executable) to perform a simulation on
a Monte Carlo Model. The output of the
test then transformed from ASCII ﬁles, cuts
and rescaling for diﬀerent secondaries are per-
formed. The histogram data are then saved in
the so-called simulation ﬁles for further analy-
sis. The tool also produces a plot for the anal-
ysis of the model on which the simulation was
performed, as illustrated on ﬁgure 3.
• Analysis Tool: the goal of the tool is to take
several simulation ﬁles produced by the simu-
lation tool and to draw the comparison graphs
in order to compare diﬀerent MC models in be-
tween. The goal of the analysis is to compare
the data points (spectra, experimental data)
with the simulation curves. Figure 1 shows an
example of the output of the tool.
5 ADDITIONAL FEATURES
Figure 1: Output of the analysis tool
4 Universal DataBase for
Geant4 MC Models Testing
The second part of my work at CERN was creating
of a universal DB for Geant4 MC models testing.
The created database consists of a collection of two
types of elements:
• Publication: contains an experimental data
information, with the description a a function,
cuts and secondaries.
• Simulation: contains the simulated data (af-
ter cuts) for a particular publication ﬁle.
The publication and simulation ﬁles have exactly
the same structure and are diﬀerent only by seman-
tics. The data is stored in ROOT ﬁles (TTrees)
with headers in order to distinguish the items. Fig-
ure 2 shows the structure of the c++ classes, cre-
ated in order to represent the publication and simu-
lation concepts. The header of G4TData class con-
tains the projectile PDG code, target PDG code,
argument (ex: T) and the MC model name which
is only needed if the ﬁle is a simulation. The body
of the G4TData contains a vector of G4TDataItem
classes, which have the secondary fragment PDG
code, cut variable (ex.: Θ, 45 degrees), the argu-
ment (ex.: T) and the function (ex.: ∆S
The records of the DB are organised in .root ﬁles,
on the Linux ﬁle system, in particular the ext3 ﬁle
system on Scientiﬁc Linux 5, which allows a sin-
gle ﬁle of maximum 2TB. Ex-data (ASCII ﬁles)
Figure 2: Representation of the Data and DataItem
classes for both publications and simulations stor-
age and manipulation.
are in the test49/ascii directory and the publica-
tions/simulations are in the test49/database direc-
5 Additional Features
5.1 Automatic Scaling and Layout
An auto-scale feature have been implemented in or-
der to scale automatically the axis of plots, pro-
duced by both analysis and simulation tools. The
scale features supports logarithmic scaling of y-axis
and linear scaling of x-axis.
5.2 Automatic Secondary Frag-
ments Nuclear Mass Calcula-
A feature for the nuclear mass calculation for
secondary fragments have been implemented in
the tools, the API is based on ROOT Geometry
package, made by ALICE experiment, using the
lastest data (NUBASE2003).
August 25, 2009 2 R. Atachiants
5.3 Graphical User Interfaces
Figure 3: A graphical user interface for simulation
Several graphical user interfaces have been made
for the tools in order to give the possibility to
use them in the simplest possible way. The GUIs
have been built using ROOT widgets platform
and therefore portable to diﬀerent platforms (Mac
OSX, Windows, Linux, ...).
One can see on Figure 4 the GUI created in order to
ease the use of creating publication ﬁles, and Fig-
ure 3 shows a GUI for the simulation tool, where
one can simply select the publication ﬁle and run
the MC simulation.
5.4 Documentation and ROOT Con-
An extensive amount of documentation for the tool
have been written, a simple User Guide can be
found in the Geant4 Hadronics Wiki  . This User
Guide shows how to get started and work with both
simulation and analysis tools, and create publica-
tion data ﬁles from ASCII ﬁles (both using ROOT
macros or available GUIs).
A contribution to ROOT also have been made, sev-
eral bugs have been found during the work, submit-
ted to ROOT team of PH-SFT and their correction
have been initiated.
Figure 4: A graphical user interface for making
publication ﬁles from ASCII ﬁles
One of the main goals of the project was the PAW
to ROOT conversion. The goal of this conversion
were mainly to be able to run the simulations and
process (analyse) bigger statistics than in old sys-
tem. In order to prove that the system can han-
dle big statistics, a Monte Carlo simulation using
BERTINI MC Model was performed. This simula-
tion produced 10,000,000 events, 52,508,486 entries
and the output ﬁle of about 7.5 GB (Figure 5).
In this paper my contribution to Geant4 testing fa-
cility has been discussed. It has been proven that
old PAW .kumac ﬁles can be completely ported to
the ROOT platform and exactly the same result
can be achieved. It has also been shown that the
created simulation tool can produce practically un-
limited results, in order of 2 TB statistics, limited
purely by the ﬁle system. The simulation and anal-
ysis tools that have been created also have been
designed with the extensibility and ease-of-use in
mind. The extensibility is achieved by using the
abstract classes, data access layers and wrappers.
The ease-of-use is achieved by building a very easy
August 25, 2009 3 R. Atachiants
Figure 5: The post-simulation output of a simula-
tion of 10,000,000 events
to use API and graphical user interfaces.
The experimental DB and diﬀerent tools are
implemented in ROOT classes, compiled in
libG4ModelTester.so extension library for ROOT
and placed in tests/test49 directory of Geant4 test-
 The ROOT Users Guide. CERN, 2006.
 R. Atachiants. http://geant4hadronics.wikispaces.com/
geant4+test49+documentation. Geant4 Test19
 CERN. http://wwwasd.web.cern.ch/wwwasd/paw.
PAW − Physics Analysis Workstation.
 CERN. http://www.geant4.org/geant4.
 Rademakers F. Introduction to root. CERN
Summer Student Lecture.
August 25, 2009 4 R. Atachiants