Extended Examples

Geant4 extended examples serve three purposes:

  • testing and validation of processes and tracking,

  • demonstration of Geant4 tools, and

  • extending the functionality of Geant4.

The code for these examples is maintained as part of the categories to which they belong. Links to descriptions of the examples are listed below.

Analysis

  • AnaEx01 - histogram and tuple manipulations using Geant4 internal g4tools system

  • AnaEx02 - histogram and tuple manipulations using ROOT

  • AnaEx03 - histogram and tuple manipulations using the AIDA interface

  • B1Con - modified basic example B1 showing how to use a Convergence Tester

  • [A01] - this examples has been refactored in Example B5 in the basic set.

Biasing

  • Variance Reduction - examples (B01, B02 and B03) on variance reduction techniques and scoring and application of Reverse Monte Carlo in Geant4 ReverseMC

  • Generic biasing examples illustrate the usage of a biasing scheme implemented since version Geant4 10.0.

    • GB01 This example illustrates how to bias process cross-sections in this scheme.

    • GB02 Illustrates a force collision scheme similar to the MCNP one.

    • GB03 Illustrates geometry based biasing.

    • GB04 Illustrates a bremsstrahlung splitting.

    • GB05 Illustrates a “splitting by cross-section” technique: a splitting-based technique using absorption cross-section to control the neutron population.

    • GB06 Illustrates the usage of parallel geometries with generic biasing.

    • GB07 Illustrates how to use the leading particle biasing option.

Common

  • ReadMe - a set of common classes which can be reused in other examples demonstrating just a particular feature.

Electromagnetic

  • TestEm0 - how to print cross-sections and stopping power used in input by the standard EM package

  • TestEm1 - how to count processes, activate/inactivate them and survey the range of charged particles. How to define a maximum step size

  • TestEm2 - shower development in an homogeneous material : longitudinal and lateral profiles

  • TestEm3 - shower development in a sampling calorimeter : collect energy deposited, survey energy flow and print stopping power

  • TestEm4 - 9 MeV point like photon source: plot spectrum of energy deposited in a single media

  • TestEm5 - how to study transmission, absorption and reflection of particles through a single, thin or thick, layer.

  • TestEm6 - physics list for rare, high energy, electromagnetic processes: gamma conversion and e+ annihilation into pair of muons

  • TestEm7 - how to produce a Bragg curve in water phantom. How to compute dose in tallies

  • TestEm8 - test of photo-absorption-ionisation model in thin absorbers, and transition radiation

  • TestEm9 - shower development in a crystal calorimeter; cut-per-region

  • TestEm10 - XTR transition radiation model, investigation of ionisation in thin absorbers

  • TestEm11 - how to plot a depth dose profile in a rectangular box

  • TestEm12 - how to plot a depth dose profile in spherical geometry : point like source

  • TestEm13 - how to compute cross sections of EM processes from rate of transmission coefficient

  • TestEm14 - how to compute cross sections of EM processes from direct evaluation of the mean-free path. How to plot final state

  • TestEm15 - compute and plot final state of Multiple Scattering as an isolated process

  • TestEm16 - simulation of synchrotron radiation

  • TestEm17 - check the cross sections of high energy muon processes

  • TestEm18 - energy lost by a charged particle in a single layer, due to ionization and bremsstrahlung

Table 28 TestEm by theme

Check basic quantities

Total cross sections, mean free paths …

Em0, Em13, Em14

Stopping power, particle range …

Em0, Em1, Em5, Em11, Em12

Final state : energy spectra, angular distributions

Em14

Energy loss fluctuations

Em18

Multiple Coulomb scattering

as an isolated mechanism

Em15

as a result of particle transport

Em5

More global verifications

Single layer: transmission, absorption, reflection

Em5

Bragg curve, tallies

Em7

Depth dose distribution

Em11, Em12

Shower shapes, Moliere radius

Em2

Sampling calorimeters, energy flow

Em3

Crystal calorimeters

Em9

Other specialized programs

High energy muon physics

Em17

Other rare, high energy processes

Em6

Synchrotron radiation

Em16

Transition radiation

Em8

Photo-absorption-ionization model

Em10

Error Propagation

  • ReadMe - error propagation utility

Event Generator

  • exgps - illustrating the usage of the G4GeneralParticleSource utility

  • particleGun - demonstrating three different ways of usage of G4ParticleGun, shooting primary particles in different cases

  • userPrimaryGenerator - demonstrating how to create a primary event including several vertices and several primary particles per vertex

  • HepMCEx01 - simplified collider detector using HepMC interface and stacking

  • HepMCEx02 - connecting primary particles in Geant4 with various event generators using the HepMC interface

  • MCTruth - demonstrating a mechanism for Monte Carlo truth handling using HepMC as the event record

  • pythia - illustrating the usage of Pythia as Monte Carlo event generator, interfaced with Geant4, and showing how to implement an external decayer (example decayer6)

Exotic Physics

  • Channeling - simulates channeling of 400 GeV/c protons in a bent crystal.

  • Dmparticle - a very preliminary and simplified Geant4 example for light dark matter (LDM) particles.

  • Monopole - illustrating how to measure energy deposition in classical magnetic monopole.

  • Phonon - demonstrates simulation of phonon propagation in cryogenic crystals.

  • Saxs - implements the typical setup of a Small Angle X-ray Scattering (SAXS) experiment. It is meant to illustrate the usage of molecular interference (MI) of Rayleigh (coherent) scattering of photons inside the matter.

  • UCN - simulates the passage of ultra-cold neutrons (UCN) in a hollow pipe.

Fields

  • BlineTracer - tracing and visualizing magnetic field lines

  • field01 - tracking using magnetic field and field-dependent processes

  • field02 - tracking using electric field and field-dependent processes

  • field03 - tracking in a magnetic field where field associated with selected logical volumes varies

  • field04 - definition of overlapping fields either magnetic, electric or both

  • field05 - demonstration of “spin-frozen” condition, how to cancel the muon g-2 precession by applying an electric field

  • field06 - exercising the capability of tracking massive particles in a gravity field

Geant3 to Geant4

  • General ReadMe - converting simple geometries in Geant3.21 to their Geant4 equivalents (example clGeometry)

Geometry

Hadronic

  • Hadr00 - example demonstrating the usage of G4PhysListFactory to build physics lists and usage of G4HadronicProcessStore to access the cross sections

  • Hadr01 - example based on the application IION developed for simulation of proton or ion beam interaction with a water target. Different aspects of beam target interaction are included

  • Hadr02 - example application providing simulation of ion beam interaction with different targets. Hadronic aspects of beam target interaction are demonstrated including longitudinal profile of energy deposition, spectra of secondary particles, isotope production spectra.

  • Hadr03 - example demonstrating how to compute total cross section from the direct evaluation of the mean free path, how to identify nuclear reactions and how to plot energy spectrum of secondary particles

  • Hadr04 - example focused on neutronHP physics, especially neutron transport, including thermal scattering

  • Hadr06 - demonstrates survey of energy deposition and particle’s flux from a hadronic cascade

  • Hadr07 - demonstrates survey of energy deposition and particle’s flux from a hadronic cascade. Show how to plot a depth dose profile in a rectangular box.

  • Hadr08 - demonstrates how to use “generic biasing” to get the following functionality which is currently not available directly in the Geant4 hadronic framework. We want to use the physics list FTFP_BERT everywhere in our detector, except that in one (or more) logical volume(s) we want to use a different combination of hadronic models, e.g. FTFP + INCLXX (instead of the default FTFP + BERT), for the final-state generation.

  • Hadr09 - demonstrates how to use Geant4 as a generator for simulating inelastic hadron-nuclear interactions. Notice that the Geant4 run-manager is not used.

    See the README file (provided with the example) for more information.

  • FissionFragment - This example demonstrates the Fission Fragment model as used within the neutron_hp model. It will demonstrate the capability for fission product containment by the cladding in a water moderated sub-critical assembly. It could also be further extended to calculate the effective multiplication factor of the subcritical assembly for various loading schemes.

  • NeutronSource - NeutronSource is an example of neutrons production. It illustrates the cooperative work of nuclear reactions and radioactive decay processes. It surveys energy deposition and particle’s flux. It uses PhysicsConstructor objects.

  • [Hadr05] - this example has been refactored in genericPL in Physics lists.

Medical Applications

  • DICOM - geometry set-up using the Geant4 interface to the DICOM image format

  • DICOM2 - inheritance from the DICOM example, method for memory savings, scoring into a sequential container instead of an associative container, accumulating the scoring with a statistics class instead of a simple floating point, and generic iteration over the variety of scoring container storage variants

  • electronScattering - benchmark on electron scattering

  • electronScattering2 - benchmark on electron scattering (second way to implement the same benchmark as the above)

  • fanoCavity - dose deposition in an ionization chamber by a monoenergetic photon beam

  • fanoCavity2 - dose deposition in an ionization chamber by an extended one-dimensional monoenergetic electron source

  • GammaTherapy - gamma radiation field formation in water phantom by electron beam hitting different targets

  • dna - Set of examples using the Geant4-DNA physics processes and models.

    • chem1 - Simple activation of the chemistry module.

    • chem2 - Usage of TimeStepAction in the chemistry module.

    • chem3 - Activate the full interactivity with the chemistry module.

    • chem4 - Simulation of G radiochemical yields with the chemistry module.

    • chem5 - A variation of the chem4 example, using preliminary G4EmDNAPhysics_option8 and G4EmDNAChemistry_option1 constructors.

    • chem6 - Scoring of the radiochemical yield G as a function of time and LET.

    • clustering - Clustering application for direct damage extraction.

    • dnadamage1 - Simulation of damage on a chromatin fiber.

    • dnaphysics - Simulation of track structures in liquid water using the Geant4-DNA physics processes and models.

    • icsd - Use of cross section models for DNA materials.

    • mfp - Simulation of mean free path in liquid water.

    • microdosimetry - Simulation of the track of a 5 MeV proton in liquid water. Geant4 standard EM models are used in the World volume while Geant4-DNA models are used in a Target volume, declared as a Region.

    • microprox - Computation of proximity functions in liquid water.

    • microyz - Simulation of microdosimetry spectra.

    • neuron - Irradiation of a realistic neuron cell.

    • pdb4dna - Usage of the Protein Data Bank (PDB) file format to build geometries.

    • range - Simulation of ranges.

    • slowing - Simulation of slowing down spectra.

    • splitting - Acceleration of Geant4-DNA physics simulations by particle splitting.

    • spower - Simulation of stopping power.

    • svalue - Simulation of S-values in spheres of liquid water using the Geant4-DNA physics processes and models.

    • wholeNuclearDNA - Description of the full nucleus of a biological cell.

    • wvalue - Simulation of W-values in liquid water using the Geant4-DNA physics processes and models.

Optical Photons

  • General ReadMe

  • OpNovice - simulation of optical photons generation and transport. (It was moved in extended examples from novice/N06 with removal of novice examples.)

  • OpNovice2 - investigate optical properties and parameters; details of optical photon boundary interactions on a surface, optical photon generation and transport

  • LXe - optical photons in a liquid xenon scintillator

  • WLS - application simulating the propagation of photons inside a Wave Length Shifting (WLS) fiber

Parallel Computing

  • General ReadMe

  • MPI - interface and examples of applications (exMPI01, exMPI02, exMPI03* and exMPI04) parallelized with different MPI compliant libraries, such as LAM/MPI, MPICH2, OpenMPI, etc.

  • TBB - demonstrate how to interface a simple application with the Intel Threading Building Blocks library (TBB), and organise MT event-level parallelism as TBB tasks

  • ThreadsafeScorers - demonstrates a very simple application where an energy deposit and # of steps is accounted in thread-local (i.e. one instance per thread) hits maps with underlying types of plain-old data (POD) and global (i.e. one instance) hits maps with underlying types of atomics.

  • TopC - set of examples (ParN02 and ParN04) derived from novice using parallelism at event level with the TopC application

Parameterisations

  • Par01 - Demonstrates the use of parameterisation facilities. (It was moved in extended examples from novice/N05 with removal of novice examples.)

  • Par02 - Shows how to do “track and energy smearing” in Geant4, in order to have a very fast simulation based on assumed detector resolutions.

  • Par03 - Demonstrates how to create multiple energy deposits using helper class G4FastSimHitMaker. Thanks to storing hits in the same hit collection (using one sensitive detector class) whether they originated in the full or fast simulation, this example allows to perform the same analysis on both outputs and compare the results.

  • Gflash - Examples set (gflash1, 2, 3, gflasha) demonstrating the use of the GFLASH parameterisation library. It uses the GFLASH equations (hep-ex/0001020, Grindhammer & Peters) to parametrise electromagnetic showers in matter.

Persistency

  • General ReadMe

  • GDML - examples set (G01, G02, G03 and G04) illustrating import and export of a detector geometry with GDML, and how to extend the GDML schema or use the auxiliary information field for defining additional persistent properties

  • P01 - storing calorimeter hits using reflection mechanism with Root

  • P02 - storing detector description using reflection mechanism with Root

  • P03 - illustrating import and export of a detector geometry using ASCII text description and syntax

Physics lists

  • General ReadMe

  • factory - demonstrates the usage of G4PhysListFactory to build the concrete physics list.

  • extensibleFactory - demonstrates the usage of extensible g4alt::G4PhysListFactory to build a concrete physics list. It also demonstrates the setting of an alternative “default” physics list; extending existing lists by adding/replacing physics constructors; and extending the factory with user supplied physics lists.

  • genericPL - demonstrates the usage of G4GenericPhysicsList to build the concrete physics list at the run time.

Polarisation

  • Pol01 - interaction of polarized beam (e.g. circularly polarized photons) with polarized target

Radioactive Decay

  • rdecay01 - demonstrating basic functionality of the G4RadioactiveDecay process

  • rdecay02 (Exrdm) - decays of radioactive isotopes as well as induced radioactivity resulted from nuclear interactions

  • Activation - compute and plot time evolution of each nuclide in an hadronic cascade. Compute and plot activity of emerging particles.

Run & Event

  • RE01 - information between primary particles and hits and usage of user-information classes

  • RE02 - simplified fixed target application for demonstration of primitive scorers

  • RE03 - use of UI-command based scoring; showing how to create parallel world(s) for defining scoring mesh(es)

  • RE04 - demonstrating how to define a layered mass geometry in parallel world

  • RE05 - demonstrating interfacing to the PYTHIA primary generator, definition of a ‘readout’ geometry, event filtering using the stacking mechanism. (It was moved in extended examples from novice/N04 with removal of novice examples.)

  • RE06 - demonstrating how to modify part of the geometry setup at run-time, detector description parameterisation by materials, sharing of a sensitive detector definition for different sub-detectors, different geometrical regions definition with different production thresholds, customization of the G4Run (It was moved in extended examples from novice/N07 with removal of novice examples.)

Visualization

  • General ReadMe - examples (perspective, standalone and userVisAction) of customisation for visualization