Maria Grazia Pia, INFN Genova 1
Part III
Geant4 concepts and functionalities
Maria Grazia Pia, INFN Genova 2
The 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
Maria Grazia Pia, INFN Genova 3
Basic concepts
These lectures provide an overview of Geant4 basic concepts and functionality. Please refer to Geant4 User Documentation if you want to learn more, and contact your Geant4 Technical Board Representative, if you need further information.
Geant4 home page http://wwwinfo.cern.ch/asd/geant4/geant4.html
Run, Event Track, Step, Trajectory Process and Physics Sensitive detector and Hit
Maria Grazia Pia, INFN Genova 4
Run and Event
Run Conceptually, a run is a collection of events which
share the same detector condition The Run Manager can handle multiple events
possibility to handle the pile-up Multiple runs in the same job
with different geometries, materials etc.
Event At the beginning of processing an event, primary
particles are pushed into a stack When the stack becomes empty, the processing of an
event is done Powerful stacking mechanism three levels by default: can handle trigger studies, loopers etc.
It has following objects at the end of its processing: List of primary vertices and particles Trajectory collection (optional) Hit collections Digi collections (optional)
Maria Grazia Pia, INFN Genova 5
Interface to event generators
Through an ASCII file for the generators that support /HEPEVT/ currently used event generators are
mostly in Fortran no mixture with Fortran in Geant4
Interface to Pythia7 Abstract interface agreed between Geant4
and Pythia7 authors
Maria Grazia Pia, INFN Genova 6
Track, Step and Trajectory
A track is a snapshot of a particle A step is a “” information to a track A step has two points and “” information of a
particle (energy loss on the step, time-of-flight spent by the step, etc.)
A track is deleted when it goes out of the world volume it disappears (e.g. decay) it goes down below cut-off the user decides to kill it
A track is made out of three layers of classes G4Track
Position, volume, track length, global ToF ID of mother track
G4DynamicParticle Momentum, energy, local time, polarization Decay channel
G4ParticleDefinition Mass, lifetime, charge, other physical quantities Decay table
A Trajectory is a record of a track. It stores information of all steps done by the track
Maria Grazia Pia, INFN Genova 7
Tracking
Decoupled from physics: all processes handled through the same abstract interface
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
The design choices allow to optimise the performance fully exploit the validity limits of
physics processes
The design allows to handle full and fast simulation
Stepping algorithm based on Geant3 experience
Maria Grazia Pia, INFN Genova 8
Geometry
Requirements to satisfy: detailed description of the experimental set-up efficient navigation performance exchange with CAD
CAD exchange interface through ISO STEP (Standard for the
Exchange of Product Model Data) Fundamental concepts
pure geometrical shape (solid) non-positioned element (logical volume) positioned element (physical volume) single element (touchable, new concept)
G4Box
G4Tubs
G4VSolid G4VPhysicalVolume
G4Material
G4VSensitiveDetector
G4PVPlacement
G4PVParametrized
G4VisAttributes
G4LogicalVolume
Maria Grazia Pia, INFN Genova 9
Geometry representations
Multiple representations
CSG (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)
Maria Grazia Pia, INFN Genova 10
New geometry features
New algorithm to position a volume efficient memory usage
New navigation methods hierarchy of volumes (Geant3) flat geometry (CAD) smart voxels (Geant4) very efficient search in the volume database
Boolean operations between solids External tool for g3tog4 geometry
conversion
Maria Grazia Pia, INFN Genova 11
Fields
To propagate a particle inside a field (magnetic, electric, or mixture of them, etc.), we integrate the equation of motion of the particle in the field
Several Runge-Kutta methods are available for the integration
Once a method is chosen to calculate the track's motion in a field, the curved path is broken into linear chord segments
The chords are used to interrogate the Navigator, whether the track has crossed a volume boundary
One can set the accuracy of the volume intersection, by setting a parameter (the “miss distance”)
One step can consist of more than one chord
miss distance
StepChord
real trajectory
Maria Grazia Pia, INFN Genova 12
DAVID
New tool for geometry debugging DAVID allows to indentify intersecting volumes
Maria Grazia Pia, INFN Genova 13
Materials and particles
Materials Geant4 provides tools to describe any
elements isotopes compounds chemical formulae
Particles Particles descriptions are compliant with
PDG The whole set of PDG data is contained
in Geant4 and more, for specific Geant4 use, like ions
Maria Grazia Pia, INFN Genova 14
Processes
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
Maria Grazia Pia, INFN Genova 15
Cuts
In Geant4 the user defines cut-offs by length
(instead of energy, as it is usually done)
A cut-off represents the accuracy of the stopping position
It makes poor sense to use the energy cut-off:
Range of 10 keV in Si ~ a few cm
Range of 10 keV electron in Si ~ a few m
Maria Grazia Pia, INFN Genova 16
PhysicsPhysics
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.”
Maria Grazia Pia, INFN Genova 17
The 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
Maria Grazia Pia, INFN Genova 18
Physics: 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
Maria Grazia Pia, INFN Genova 19
Data 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
Maria Grazia Pia, INFN Genova 20
Electromagnetic 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 parameterisations models for antiprotons fundamental for space and medical applications,
neutrino experiments, antimatter spectroscopy etc.
Maria Grazia Pia, INFN Genova 21
E.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)
Maria Grazia Pia, INFN Genova 22
Hadronic 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
Maria Grazia Pia, INFN Genova 23
Completeness 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
Maria Grazia Pia, INFN Genova 24
Hadronic 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.
Maria Grazia Pia, INFN Genova 25
Hadronic 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
Maria Grazia Pia, INFN Genova 26
Theoretical models
Two String Models
Traditional Cascade Model, Kinetic Model, Quantum Molecular Dynamics Model some are still in progress
Precompound Model
Evaporation, Fission, Fermi break-up, Multifragmentation, Photon Evaporation
Possibility to interface to Pythia7 for hard scattering
Lepton-hadron interactions nucleus interactions, photo-fission, -meson
conversion
...and more: area under active development!
Maria Grazia Pia, INFN Genova 27
Event 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
Maria Grazia Pia, INFN Genova 28
Components for space applications
ESA participates in the Geant4 Collaboration
Various simulation packages previously used by ESA (and its contractors), including Geant3
Comparative evaluation of the main existing simulation packages: Geant3, ESABASE, Shieldose, HETC, LHI, MORSE, MCNP, ITS, MICAP, CEPX-ONELD, EGS
Specific requirements for space applications
environment cosmic rays Van Allen belts fluxes of energetic particles (solar flares)
simulation studies (mission critical!) for degradation of electronic components single event logic-flips in electronic equipment backgrounds risks for astronauts etc....
Maria Grazia Pia, INFN Genova 29
ESA projects in Geant4
Low energy extensions of electromagnetic physics Source Particle Module Radioactivity Decay Module Sector Shielding Analysis Tool CAD Tool Front-End
Maria Grazia Pia, INFN Genova 30
Detector response
Hits Hits are user-defined Examples of hits:
position and time of the step momentum and energy of the track energy deposition of the step
Each geometrical volume can be associated to a sensitive detector
A sensitive detector creates hits using the information given in the Step object
Hit objects are collected in an Event object at the end of that event
Digis They describe detector response (e.g. ADC/TDC
count, trigger signal) While Hits are generated at tracking time
automatically, the digitization function must be explicitly invoked by the user’s code
Maria Grazia Pia, INFN Genova 31
Read-out geometry
Read-out geometry is a virtual and artificial geometry, which can be defined in parallel to the real detector geometry
A read-out geometry is associated to a sensitive detector
Maria Grazia Pia, INFN Genova 32
Visualisation and UI
Visualisation Various drivers OpenGL, OpenInventor, X11, Postscript, DAWN,
OPACS, VRML... Functionality for
detector, trajectories, steps, hits etc. selections for, cut-views etc.
User Interfaces Command-line, Tcl/Tk, Tcl/Java, batch+macros,
OPACS, GAG, MOMO
The Graphic Geometry Editor (GGE) automatic code generation for geometry and
material description
The Graphic Physics Editor same as above for physics processes
Maria Grazia Pia, INFN Genova 33
Communication
The intercoms category is used by almost all other Geant4 categories for exchanging information without having pointers e.g. the user can apply the “abort event”
command from the user stepping action without knowing the pointer to G4EventManager
(G)UI also accepts commands dynamically
G4UImanager receives the application of a command and passes it to a messenger
The messenger brings the command to the target destination class object
Maria Grazia Pia, INFN Genova 34
Persistency
The big HEP experiments require a large number of complex events to be stored
Possibility to run either in transient or in persistent mode
Persistency is handled through abstract interfaces to ODBMS
Geant4 does not depend on any specific persistency model
Open to any persistency model and to future evolutions
The user can implement the concrete persistency model that he/she likes
Persistency of Events, Geometry, Hits Trajectories...
Maria Grazia Pia, INFN Genova 35
Fast 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 for 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 electromagnetic 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
Maria Grazia Pia, INFN Genova 36
User actions
Mandatory actions (abstract classes) detector construction event generation
Optional actions run, event, track, step, stacking actions process-list, particle-list actions
Main Geant4 does not provide the main() In his/her main() the user must
construct G4RunManager (or its derived class) perform mandatory actions
G4VUserDetectorConstruction G4VUserPhysicsList G4VUserPrimaryGeneratorAction
One can define VisManager, (G)UI session, optional user action classes and/or a persistency manager
Maria Grazia Pia, INFN Genova 37
The recipe: Describe your detector
Derive your own concrete class from G4VUserDetectorConstruction.
In the virtual method Construct() Construct all necessary materials Construct your detector geometry Construct your sensitive detector
classes and set them to the detector volumes
Optionally you can define visualization attributes of your detector elements
Maria Grazia Pia, INFN Genova 38
The recipe: Select physics processes
Geant4 does not have any default particles or processes even for the particle transportation, you
have to define it explicitly Derive your own concrete class from
G4VUserPhysicsList and Define all necessary particles Define all necessary processes and
assign them to proper particles Define cut-off range
Maria Grazia Pia, INFN Genova 39
The recipe: Generate primary event
Derive your concrete class from G4VUserPrimaryGeneratorAction
Pass a G4Event object to one or more primary generator concrete class objects
Geant4 provides two generators G4ParticleGun G4HEPEvtInterface PYTHIA interface will be available
when the C++ version of PYTHIA is ready
Maria Grazia Pia, INFN Genova 40
How Geant4 runs: initialization
main Run manager user detector const ruction
user physics list
1: initialize2 : const ruct
3: material const ruct ion
4: geometry construct ion5: world volume
6 : const ruct
7 : physics process const ruction
8: set cuts
Maria Grazia Pia, INFN Genova 41
How Geant4 runs
Initialization Construction of materials and geometry Construction of particles, physics
processes and calculation of physics tables
“Beam-On” = “Run” Close geometry Optimize geometry Event Loop
Maria Grazia Pia, INFN Genova 42
How Geant4 runs: event loop
main Run Manager Geometry manager
Event generator
EventManager
1: Beam On2: close
3: generate one event
4: process one event
5: open
Maria Grazia Pia, INFN Genova 43
How Geant4 runs: event processing
Event manager
Stacking manager
Tracking manager
Stepping manager
User sensitive detector
1: pop
2: process one track3: Stepping
4: generate hits
5: secondaries
6: push
Maria Grazia Pia, INFN Genova 44
Required hardware and software
Platforms AIX, HP, DEC, Sun, (SGI): native compilers, , g++ Linux: g++ Windows-NT: Visual C++
Commercial software ObjectStore STL (on platforms not yet supporting the
Standard) Free software
native STL (not supported yet by all platforms) CVS gmake, g++ CLHEP
Graphics OpenGL, X11, OpenInventor, DAWN, VRML... OPACS, GAG, MOMO...
Persistency it is possible to run in transient mode in persistent mode use a HepDB interface, ODMG
standard
Maria Grazia Pia, INFN Genova 45
Examples: novice level
ExampleN01 Demonstrates how Geant4 kernel works
ExampleN02 Simplified tracker geometry with magnetic field Electromagnetic processes
ExampleN03 Simplified calorimeter geometry Various materials
ExampleN04 Simplified collider detector with readout geometry EM + Hadronic processes Pythia interface Event filtering by stack
ExampleN05 Simplified BaBar-like calorimeter Shower parameterization
ExampleN06 Optical photon processes
Maria Grazia Pia, INFN Genova 46
Examples: extended level
ExampleE01 CLHEP histogramming
ExampleE02 Persistency by Objectivity/DB (CERN RD45)
ExampleE02 STEP geometry interface
Advanced level examples To be prepared Expect users’ contributions
Maria Grazia Pia, INFN Genova 47
Documentation
http://wwwinfo.cern.ch/asd/geant4/geant4.html User Documentation
Introduction to Geant4 Installation Guide Geant4 User’s Guide - For Application Developers
for those wishing to use Geant4 Geant4 User’s 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