Book For Application Developers¶
Scope of this manual
The User’s Guide for Application Developers is the first manual the reader should consult when learning about Geant4 or developing a Geant4 -based detector simulation program. This manual is designed to:
introduce the first-time user to the Geant4 object-oriented detector simulation toolkit,
provide a description of the available tools and how to use them, and
supply the practical information required to develop and run simulation applications which may be used in real experiments.
This manual is intended to be an overview of the toolkit, rather than an exhaustive treatment of it. Related physics discussions are not included unless required for the description of a particular tool. Detailed discussions of the physics included in Geant4 can be found in the Physics Reference Manual. Details of the design and functionality of the Geant4 classes can be found in the User’s Guide for Toolkit Developers.
Geant4 is a detector simulation toolkit written in the C++ language. The reader is assumed to have a basic knowledge of object-oriented programming using C++. Although Geant4 is a fairly complicated software system, only a relatively small part of it needs to be understood in order to begin developing detector simulation applications. Bindings to the Python and Julia programming languages are also available from community projects. An understanding of radiation physics and associated processes is beneficial.
- Introduction
- Getting Started with Geant4 - Running a Simple Example
- How to Define the main() Program
- How to Define a Detector Geometry
- How to Specify Materials in the Detector
- How to Specify Particles
- How to Specify Physics Processes
- How to Generate a Primary Event
- Geant4 General Particle Source
- How to Make an Executable Program
- How to Set Up an Interactive Session
- How to Execute a Program
- How to Visualize the Detector and Events
- Toolkit Fundamentals
- Detector Definition and Response
- Geometry
- Introduction
- Solids
- Logical Volumes
- Physical Volumes
- Touchables: Uniquely Identifying a Volume
- Creating an Assembly of Volumes
- Reflecting Hierarchies of Volumes
- The Geometry Modeller and Optimisation
- The Geometry Navigator
- Converting Geometries from Geant3.21
- Detecting Overlapping Volumes
- Dynamic Geometry Setups
- Importing XML Models Using GDML
- Importing ASCII Text Models
- Saving geometry tree objects in binary format
- Material
- Electromagnetic Field
- Hits
- Digitization
- Birks Quenching
- Object Persistency
- Parallel Geometries
- Command-based scoring
- Geometry
- Tracking and Physics
- User Actions
- Control
- Visualization
- Introduction to Visualization
- Adding Visualization to Your Executable
- The Visualization Drivers
- Controlling Visualization from Commands
- Scene, scene handler, and viewer
- Choosing a graphics viewer:
/vis/open
command - Create an empty scene:
/vis/scene/create
command - Visualization of a physical volume:
/vis/drawVolume
command - Visualization of a parameterised volume
- Visualization of a logical volume:
/vis/drawLogicalVolume
command - Visualization of trajectories:
/vis/scene/add/trajectories
command - Visualization of hits:
/vis/scene/add/hits
command - Visualization of fields:
/vis/scene/add/magneticField
command - Visualization of Scored Data
- Additional attributes for Hits
- Visualization of histograms (plotting)
- Basic camera workings:
/vis/viewer/
commands - Declare the end of visualization for flushing:
/vis/viewer/flush
command - End of Event Action and End of Run Action:
/vis/scene/endOfEventAction
and/vis/scene/endOfRunAction
commands - HepRep Attributes for Trajectories
- How to save a view.
- How to save a view to an image file
- Culling
- Cut view
- Multithreading commands
- Controlling Visualization from Compiled Code
- G4VVisManager
- Visualization of detector components
- Visualization of trajectories
- Enhanced trajectory drawing
- HepRep Attributes for Trajectories
- Visualization of hits
- HepRep Attributes for Hits
- Visualization of text
- Visualization of polylines and tracking steps
- Visualization User Actions
- Standalone Visualization
- Drawing a solid as a cloud of points
- Visualization Attributes
- Enhanced Trajectory Drawing
- Trajectory Filtering
- Polylines, Markers and Text
- Making a Movie
- Debugging geometry with vis
- External Boolean processing
- Analysis
- Language Bindings
- Examples
- Appendix
- Geant4 Material Database
- Transportation in Magnetic Field - Further Details
- The challenge of integrating all tracks
- Using preset thresholds for killing loopers
- Finer-grain control of the parameters for killing looping particles
- Full control of the parameters for killing looping particles
- Using a helper object to forward parameter changes
- How to replace the Transportation Process of a particle type
- Avoiding loopers or reducing the incidence of looping particles
- Bibliography
Status of this Document
Guide for Application Developers using the Geant4 toolkit.
Rev 1.0: First Sphinx version implemented for Geant4 Release 10.4, 8th Dec 2017
Rev 2.0: Updates and fixes in documentatio for Geant4 Release 10.4, 15th May 2018
Rev 3.0: Geant4 Release 10.5, 11th December 2018
Rev 3.1: Geant4 Updates and fixes - especially to search functionality, 5th March 2019
Rev 4.0: Geant4 Release 10.6, 6th December 2019
Rev 5.0: Geant4 Release 10.7, 4th December 2020
Rev 6.0: Geant4 Release 11.0, 10th December 2021
Rev 7.0: Geant4 Release 11.1, 9th December 2022
Rev 7.1: Geant4 Fixes to http links, 15th July 2023
Rev 8.0: Geant4 Release 11.2, 8th December 2023
Rev 9.0: Geant4 Release 11.3, 6th December 2024
Rev 9.1: Geant4 Added html UI links, 18th December 2024