Title: Overview of the Geant4 OO Simulation Toolkit
1Overview of the Geant4 OO Simulation Toolkit
- Maria Grazia Pia
- INFN Genova, Italy and CERN/IT
- Maria.Grazia.Pia_at_cern.ch
- S. Agostinelli, S. Chauvie, F. Foppiano, P.
Nieminen, S. Garelli, V. Rolando - 32nd Meeting of the Proton Therapy Cooperative
Group - Uppsala, 16 April 2000
- http//www.ge.infn.it/geant4/talks/Uppsala/index.h
tml
2Outline
- What is Geant?
- Status of Geant3 and motivations for Geant4
- The Geant4 RD phase RD44
- The role of software engineering and OO
technology - Main features of the Geant4 toolkit
- the kernel
- physics
- other tools
- Performance
- The Geant4 Collaboration
- A selection of Geant4 applications
- Conclusions
3The role of Geant
- Geant is a simulation tool, that provides a
general infrastructure for - the description of geometry and materials
- particle transport and interaction with matter
- the description of detector response
- visualisation of geometries, tracks and hits
- The user develops the specific code for
- the primary event generator
- the geometrical description of the set-up
- the digitisation of the detector response
4The past Geant3
- Geant 3
- has been used by most major HEP experiments
- Frozen since March 1994 (Geant3.21)
- 200K lines of code
- equivalent of 50 man-years, along 15 years
- used also in nuclear physics experiments, medical
physics, radiation background studies, space
applications etc. - The result is a complex system
- because its problem domain is complex
- because it requires flexibility for a variety of
applications - because its management and maintenance are
complex - It is not self-sufficient
- hadronic physics is not native, it is handled
through the interface to external packages
5New simulation requirements
- Very high statistics to be simulated
- robustness and reliability for large scale
production - Exchange of CAD detector descriptions
- Transparent physics for validation of physics
results - Physics extensions to high energies
- LHC, cosmic ray experiments...
- Physics extensions to low energies
- space applications, medical physics, X-ray
analysis, astrophysics, nuclear and atomic
physics... - Reliable hadronic physics
- not only for calorimetry, but also for PID
applications (CP violation experiments) - ...etc.
- User requirements formally collected and coded
according to PSS05 standard - Geant4 User Requirements Document
6What is Geant4?
- OO toolkit for the simulation of next generation
HEP detectors - ...of the current generation too
- ...not only of HEP detectors
- already used also in nuclear physics, medical
physics, space applications, radiation background
studies etc. - It is also an experiment of distributed software
production and management, as a large
international collaboration with the
participation of various experiments, labs and
institutes - It is also an experiment of application of
rigorous software engineering and Object Oriented
technologies to the HEP environment
7A bit of history...
- Approved as RD end 1994 (RD44)
- gt100 physicits and software engineers
- 40 institutes, international collaboration
- responded to DRCC/LCB
- Milestones end 1995
- OO methodology, problem domain analysis, full
OOAD - tracking prototype, performance evaluation
- Milestones spring 1997
- ?-release with the same functionality as Geant
3.21 - persistency (hits), ODBMS
- transparency of physics models
- Milestone July 1998
- public ?-release
- Milestone end 1998
- production release Geant4.0, end of the RD
phase - All milestones have been met by RD44
- Reconfiguration at the end of the RD phase
- International Geant4 Collaboration sincel
1/1/1999 - Management of the production phase
- Continuing RD also in the production phase
8Software Engineering
Software Engineering plays a fundamental role in
Geant4
- Software process
- based on Booch methodology
- spiral type, with cycles of design-implementation
iterations - OO Analysis
- OO Design
- Evolution
- Maintenance
- in a worldwide collaboration!
- Software process
- User requirements
- OOAD
- Quality Assurance
- User Requirements
- Collected initially and systematically updated
- Coded according to ESA PSS-05 standard
9OO technologies
- OO design fundamental for distributed parallel
approach - every part can be developed, refined, maintained
independently - Problem domain decomposition and OOAD result
into a unidirectional dependency of class
categories
- Open to evolution
- extensibility, implementation of new models and
algorithms without interfering with existing
software - the user can extend the toolkit with his/her
model and data
- Transparency
- decoupling from implementation
- Flexibility
- alternative models and implementations
- Interface to external software, without
dependencies - databases for persistency
- visualisation libraries
- tools for UI
- etc.
10Quality Assurance
- Testing
- Unit testing
- in most cases down to class level granularity
- Integration testing
- sets of logically connected classes
- Test-bench for each category
- eg. test-suite of 375 tests for hadronic physics
parameterised models - System testing
- exercising all Geant4 functionalities in
realistic set-ups - Physics testing
- comparisons with experimental data
- Performance Benchmarks
- Extensive use of Quality Assurance systems
- fundamental for a toolkit of wide public use
- Commercial tools
- Insure, Logiscope etc.
- C coding guidelines
- scripts to verify their applications
automatically - Code inspections
- within working groups and across groups
11Standards
Based on standards, ISO e de facto
- OpenGL e VRML for graphics
- CVS for code management
- C as programming language
- STEP
- engineering and CAD systems
- ODMG
- RD45
- Units
- Geant4 is independent from the system of units
- all numerical quantities expressed with their
units explicitly - user not constrained to use any specific system
of units - have you heard of the accident with NASAs Mars
Climate Orbiter (125 million)?
12What is needed to run Geant4
- Platforms
- AIX, HP, DEC, Sun, (SGI) native compilers, , g
- Linux g
- Windows-NT Visual C
- Commercial software
- ObjectStore STL (optional)
- Free software
- CVS
- gmake, g
- CLHEP
- Graphics
- OpenGL, X11, OpenInventor, DAWN, VRML...
- OPACS, GAG, MOMO...
- Persistence
- it is possible to run in transient mode
- in persistent mode use a HepDB interface, ODMG
standard
13The Geant4 kit
- Code
- 1M lines of code, 2000 classes
- (continuously growing)
- publicly available from the web
- Documentation
- 6 manuals
- publicly available from the web
- Examples
- distributed with the code
- navigation between documentation and examples code
14The kernel
- Run and event
- the Run Manager can handle multiple events
- possibility to handle the pile-up
- multiple runs in the same job
- with different geometries, materials etc.
- powerful stacking mechanism
- three levels by default handle trigger studies,
loopers etc. - Tracking
- decoupled from physics all processes handled
through the same abstract interface - tracking is independent from particle type
- it is possible to add new physics processes
without affecting the tracking - Geant4 has only production thresholds , no
tracking cuts - all particles are tracked down to zero range
- energy, TOF ... cuts can be defined by the user
15Geometry
- Role detailed detector description and efficient
navigation - CAD exchange
- interface through ISO STEP (Standard for the
Exchange of Product Model Data) - Multiple representations
- CGS (Constructed Solid Geometries)
- simple solids
- STEP extensions
- polyhedra,, spheres, cylinders, cones, toroids,
etc. - BREPS (Boundary REPresented Solids)
- volumes defined by boundary surfaces
- include solids defined by NURBS (Non-Uniform
Rational B-Splines) - External tool for g3tog4 geometry conversion
- Fields
- of variable non-uniformity and differentiability
- use of various integrators, beyond Runge-Kutta
- time of flight correction along particle transport
16Processes
- Processes describe how particles interact with
material or with a volume itself - Three basic types
- At rest process
- (e.g. decay at rest)
- Continuous process
- (e.g. ionization)
- Discrete process
- (e.g. decay in flight)
- Transportation is a process
- interacting with volume boundary
- A process which requires the shortest interaction
length limits the step
17Physics
- From the Minutes of LCB (LHCC Computing Board)
meeting on 21 October, 1997 - It was noted that experiments have requirements
for independent, alternative physics models. In
Geant4 these models, differently from the concept
of packages, allow the user to understand how the
results are produced, and hence improve the
physics validation. Geant4 is developed with a
modular architecture and is the ideal framework
where existing components are integrated and new
models continue to be developed.
18The approach to physics
- Ample variety of independent, alternative physics
models available in Geant4 - No more black boxes of packages
- The users are directly exposed to the physics
they use in their simulation - This approach is fundamental for the validation
of the experiments physics results
19Transparency of Geant4 physics
- No hard coded numbers
- Explicit use of units throughout the code
- Separation between the calculation of cross
sections and the generation of the final state - Calculation of cross-sections independent from
the way they are accessed (data files, analytical
formulae etc.) - Distinction between processes and models
- Cuts in range (rather than in energy, as usual)
- consistent treatment of interactions near
boundaries between materials - Modular design, at a fine granularity, to expose
the physics - physics independent from tracking
- Public distribution of the code, from one
reference repository worldwide
20Physics general features
- Abstract interface to physics processes
- tracking independent from processes
- Distinction between processes and models
- often multiple models for the same process
- Data encapsulation and polymorfism
- Transparent access to cross sections, from files,
interpolation from tables, analytical formulae
etc. - Distinction between the calculation of cross
sections and their use - Calculation of the final state independent from
tracking - Uniform treatment of electromagnetic and hadronic
physics - Open system
- Users can easily create and use their own models
21Data libraries
- Systematic collection and evaluation of
experimental data from many sources worldwide - Databases
- ENDF/B, JENDL, FENDL, CENDL, ENSDF,JEF, BROND,
EFF, MENDL, IRDF, SAID, EPDL, EEDL, EADL, SANDIA,
ICRU etc. - Collaborating distribution centres
- NEA, LLNL, BNL, KEK, IAEA, IHEP, TRIUMF, FNAL,
Helsinki, Durham, Japan etc. - The use of evaluated data is important for the
validation of physics results of the experiments
22Electromagnetic physics
- Comparable to Geant3 and EGS already in the
?-release - Substantial further extensions
- Multiple alternatives for various processes
- High energy extensions
- models for ? up to PeV
- fundamental for LHC experiments, cosmic ray
experiments etc. - Low energy extensions
- e,? down to 250 eV
- (EGS, ITS etc. to 1 keV, Geant3 to 10 keV))
- low energy hadrons and ions models based on
Ziegler and ICRU data and parametrisations - models for antiprotons
- fundamental for space and medical applications,
neutrino experiments, antimatter spectroscopy etc.
23E.M. processes in Geant4
- multiple scattering
- energy loss
- Bremsstrahlung
- ionisation
- annihilation
- photoelectric effect
- Compton scattering
- pair production
- synchrotron radiation
- transition radiation
- Cherenkov
- Rayleigh effect
- rifraction
- reflection
- absorption
- scintillation
- fluorescence
- Auger (in progress)
24Hadronic physics
- Completely different approach w.r.t. the past
- transparent
- native
- no longer interface to external packages
- clear separation between data and their use in
algorithms - Cross section data sets
- transparent and interchangeable
- Final state calculation
- models by particle, energy, material
25Completeness of Geant4 hadronic physics
- Ample variety of models
- the most complete hadronic simulation kit on the
market - alternative and complementary models
- it is possible to mix-and-match, with fine
granularity - data-driven, parameterised and theoretical models
- Consequences for the users
- no more confined to the black box of one package
- the user has control on the physics used in the
simulation, which contributes to the validation
of physics results
26Hadronic physicsParameterised and data-driven
models
- Based on experimental data
- Some models originally from GHEISHA
- completely reengineered into OO design
- refined physics parameterisations
- New parameterisations
- pp, elastic differential cross section
- nN, total cross section
- pN, total cross section
- np, elastic differential cross section
- ?N, total cross section
- ?N, coherent elastic scattering
- Other models are completely new, such as
- stopping particles (?- , K- )
- neutron transport
- isotope production
- All databases existing worldwide used in neutron
transport - Brond, CENDL, EFF, ENDFB, JEF, JENDL, MENDL etc.
27Hadronic physicsTheoretical models
- They fall into different parts
- the evaporation phase
- the low energy range, pre-equilibrium, O(100
MeV), - the intermediate energy range, O(100 MeV) to O(5
GeV), intra-nuclear transport - the high energy range, hadronic generator
régime - Geant4 provides complementary theoretical models
to cover all the various parts - Geant4 provides alternative models within the
same part - All this is made possible by the powerful Object
Oriented design of Geant4 hadronic physics - Easy evolution new models can be easily added,
existing models can be extended
28Event biasing
- Geant4 provides facilities for event biasing
- The effect consists in producing a small number
of secondaries, which are artificially recognized
as a huge number of particles by their
statistical weights - Event biasing can be used, for instance, for the
transportation of slow neutrons or in the
radioactive decay simulation
29Other components
- Materials
- elements, isotopes, compounds, chemical formulae
- Particles
- all PDG data
- and more, for specific Geant4 use, like ions
- Hits Digi
- to describe detector response
- Persistency
- possibility to run in transient or persistent
mode - no dependence on any specific persistency model
- persistency handled through abstract interfaces
to ODBMS
- Visualisation
- Various drivers
- OpenGL, OpenInventor, X11, Postscript, DAWN,
OPACS, VRML - User Interfaces
- Command-line, Tcl/Tk, Tcl/Java, batchmacros,
OPACS, GAG, MOMO - automatic code generation for geometry and
materials - Interface to Event Generators
- through ASCII file for generators supporting
/HEPEVT/ - abstract interface to Lund
30ESA projects in Geant4
- Low energy extensions of electromagnetic
physics - Source Particle Module
- Radioactivity Decay Module
- Sector Shielding Analysis Tool
- CAD Tool Front-End
31Fast simulation
- Geant4 allows to perform full simulation and
fast simulation in the same environment - Geant4 parameterisation produces a direct
detector response, from the knowledge of particle
and volume properties - hits, digis, reconstructed-like objects (tracks,
clusters etc.) - Great flexibility
- activate fast /full simulation by detector
- example full simulation for inner detectors,
fast simulation per calorimeters - activate fast /full simulation by geometry
region - example fast simulation in central areas and
full simulation near cracks - activate fast /full simulation by particle type
- example in e.m. calorimeter e/?
parameterisation and full simulation of hadrons - parallel geometries in fast/full simulation
- example inner and outer tracking detectors
distinct in full simulation, but handled together
in fast simulation
32Performance
- Various Geant4 - Geant3.21 comparisons
- realistic detector configurations
- results and plots in
- Geant4 Web Gallery (from Geant4 homepage)
- RD44 Status Report, 1995
- Benchmark in liquid Argon/Pb calorimeter
- at comparable physics performance Geant4 is
faster than (fully optimised) Geant3.21 by - a factor gt3 using exactly the same cuts
- a factor gt10 optimising Geant4 cuts, while
keeping the same physics performance - at comparable speed Geant4 physics performance is
greatly superior to Geant3.21 - Benchmark in thin silicon layer
- at comparable physics performance Geant4 is 25
faster than Geant3.21 (single volume, single
material)
33Geant4 Collaboration
- New organization for the production phase, MoU
based - Geant4 distribution, development and User Support
- Atlas, BaBar, CMS, LHCB
- CERN, KEK, SLAC, TRIUMF, JNL
- ESA, Frankfurt Univ, INFN, IN2P3, Karolinska
Inst., Lebedev, TERA - COMMON (Serpukov, Novosibirsk, Pittsburg etc.)
- other memberships currently being discussed
- Collaboration Board
- manages resources and responsibilities
- Technical Steering Board
- manages scientific and technical matters
- manages the Production Service and User Support
- Working Groups
- do maintenance, development, QA, user support etc.
Members of National Institutes, laboratories and
experiments participating in Geant4 Collaboration
acquire the right to the Production Service and
User Support For others free code and user
support on best effort basis
34Bragg peak, Magic cube data and Geant4
Experimental data Bragg peak of a 270 MeV/u
carbon ion beam
Geant4 and experimental data, PSI test with
proton beam
distance(cm)
35Brachyterapy at Nat. Inst. Cancer Research, Genova
S. Agostinelli, R. Corvo, F. Foppiano, S.
Garelli, G. Sanguineti
- The source holder is a standard endobronchial
treatment catheter, the chamber is a 0.6 cc
Capintec chamber connected to a Capintec 192
electrometer - The IST group follows the direction of Basic
Dosimetry on Radiotherapy with Brachytherapy
Source of the Italian Association of Biomedical
Physics (AIFB)
The custom calibration plexiglas jig, used for in
air measurements.
36CT interface and treatment planning
- Two possible approaches
- CT interface Geant4 full simulation
- CT interface Geant4 fast simulation
(physics processes
parameterised through an analytical treatment) - Geant-based tools for
- inverse planning
- technique of active dose delivery
- Software interface for Geant4 that reads input
data in DICOM3 format developed at Medical Dept.,
University of Piemonte Orientale and INFN Torino
37Geant4 for scatter compensation in Megavoltage 3D
CT
- Use GEANT4 to obtain digitally reconstructed
radiographs (DRRs), including full scatter
simulation - This represents a great improvement over
approaches based on ray-casting
38In vivo dosimetry for mammography
- TLD characterization for mammography screening
- simulation of dose deposition and glow curve
- Mammography simulation
- Goal minimize dose on patient
- Comparison between experimental data TLD in vivo
dosimetry and Geant4 simulation - Activity at Medical Physics Dept., Umberto I
Hospital of Ordine Mauriziano, Torino - in progress
39An ambitious project
What if the geometry to describe with Geant4 were
DNA and the process were mutagenesis?
- Multi-disciplinary Collaboration of
- astrophysicists and space scientists
- particle physicists
- medical physicists
- biologists
- physicians
- First phase of the project User
Requirements - Other applications (not only in space programmes)
- Study of radiation damage at the cellular and DNA
level in the space radiation environment - ESA-sponsored project, in
collaboration with INFN - INFN (Genova, Torino, Cosenza)
- Istituto Nazionale per la Ricerca sul Cancro
- Università del Piemonte Orientale
- ESA
- CERN
- Karolinska Institute
40Geant4 features relevant for medical applications
- The transparency of physics
- Advanced functionalities in every domain
geometry, physics, visualisation etc. - Extensibility in any domain to satisfy new user
requirements - thanks to OO technology
- open design new physics, new features can be
easily added, without any perturbation to the
existing code - Adopts standards wherever available (de jure or
de facto) - Use of evaluated data libraries
- Quality Assurance based on sound software
engineering - Subject to independent validation by a large user
community worldwide - User support organization by a large
international Collaboration of experts
41Documentation
http//wwwinfo.cern.ch/asd/geant4/geant4.html
- User Documentation
- Introduction to Geant4
- Installation Guide
- Geant4 Users Guide - For Application Developers
- for those wishing to use Geant4
- Geant4 Users Guide - For Toolkit Developers
- for those wishing to extend Geant4 functionality
- Software Reference Manual
- documentation of the public interface of all
Geant4 classes - Physics Reference Manual
- extended documentation on Geant4 physics
- Examples
- a set of Novice, Extended and Advanced examples
illustrating the main functionalities of Geant4
in realistic set-ups - The Gallery
- a web collection of performance and physics
evaluations - http//wwwinfo.cern.ch/asd/geant4/reports/gallery/
- Publication and Results web page
- http//wwwinfo.cern.ch/asd/geant4/reports/reports.
html