The Geant4 Geometry Modeler

Download Report

Transcript The Geant4 Geometry Modeler

The Geant4 Kernel:
Status and Recent
Developments
John Apostolakis, Gabriele Cosmo – CERN / PH
Makoto Asai – SLAC
On behalf the Geant4 collaboration
April 2005
Overview


Structure of Geant4 toolkit
Highlights





Events, runs, tracking
Foundations
Geometry
Efficiency improvement
Summary
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
2
Toolkit structure
Geant4 structure

Geant4 consists of 17 categories.

Developed and maintained by Working
Geant4
Visuali
zation
Inter
faces
Readout
Groups responsible for each category.

Interfaces between categories largely
stable, with some evolution.

Run
Persis
tency
Event
Tracking
Geant4 Kernel

Handles run, event, track, step, hit,
Digits +
Hits
trajectory, etc.

Processes
Track
Provides frameworks of geometrical
Geometry
Particle
Graphic
_reps
Material
representation and physics processes,
and interfaces to visualization and GUI.
Intercoms
Global
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
4
Geant4 kernel categories

Run






Detector readout




Track, step

Abstract definition of process

UI command definition and
interpretation
Global

The Geant4 Kernel
Visualization attributes
Intercoms

Process/management
Particle definition
Graphics_reps


Material, element, isotope
Particles


Framework of shower
parameterization
Material


Geometrical description
Navigation
Electromagnetic field
Parameterization

Hit scoring, tallying
Track




Processing one event
Stack mechanism
Primary event generation, radioactive
source
Processing one track
Managing one step
Geometry

Tracking


Overall management, run control
Event loop, pile-up handling
Event



Basic classes
J.A., M.A., G.C. for the Geant4 Collab., April 2005
5
Configuration, events
Run: configures

A Run is a series of events/tracks with common:




Each of these is necessary. Run enables user to define
them:



In a general predefined way (via RunManager)
In a fine grained way, for use in external frameworks (new)
The run controls



Setup (geometry / materials)
Physics list (processes / production thresholds)
Primary generator
The ordering of creating, invoking other simulation parts
The locking of the geometry for active simulation
Note: One computing process can have many runs
June 18, 1999
J. Apostolakis for Geant4 collaboration
7
Event: groups tracks & hits


An event is the interaction of a set of primaries
In Geant4 it can collect the resulting information

In the form of hits, created by sensitive detectors



User can define own hits
The event manages handling of tracks
It maintains stacks for inactive tracks

Enables user to reorder tracks in simulation at no cost


3 default stacks for urgent, suspended and “postponed-to-nextevent” tracks.

June 18, 1999
Simulates important first, check triggers and only then do the rest.
User can increase the number of stacks
J. Apostolakis for Geant4 collaboration
8
Tracking and physics

Tracking is general


same for all particle types
different list of processes for each particle


It messages the


The ordering is important
sensitive detectors and user actions
The user chooses the physics of each particle


Choosing an existing configuration (eg a physics list)
Modifying one or creating their own
 So anyone can add or replace a physics model

June 18, 1999
simply, without restrictions or problems
J. Apostolakis for Geant4 collaboration
9
Geant4 kernel: other

Hits & digitization
Experiment specific hits
Handles event pileup
 using new readout
category






isotopes, elements,
compounds, ...
Intercoms:



between categories,
from UI to kernel
Geometry


June 18, 1999
properties from PDG
communicate
Materials

Particles
hierarchy or flat
performant
J. Apostolakis for Geant4 collaboration
10
‘Foundations’
1.
2.
3.
4.
Units
Materials
Particles
User Interface
Units, Material, Particles
Unit System

Internal unit system used in Geant4 is
completely hidden


not only from user’s code but also from
Geant4 source code implementation.
All numbers must given with their unit:
kineticEnergy = 1.24 * MeV;

To get a number, must divided by a proper
unit.
Materials




Properties from PDG

Includes resonances & ions
Each particle has its physics list
For unstable particles, it is



This unit conventions make the source
code more readable

Responsible for decay modes
Intercoms:
communicate


The Geant4 Kernel
Optical, ionization potential, ..
Particles
cout << eDep / MeV <<
“ [MeV]” ;

Describe element composition, density
Other properties can be associated
between categories,
from UI to kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
12
Intercoms: commanding


This systems enable the user to communicate with a
running application.
A built-in run-time command can



Change an option ( eg type of primary particle )
Choose a visualisation system
The user can extend it easily


GATE provided a system to create a geometry setup
dynamically at run-time
ATLAS choose between a number of setup configurations,
at run-time
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
13
Geometry
Creating a setup
Facilities & tools
Navigating

Key geometry capabilities

Describing a setup as hierarchy or ‘flat’ structure



Navigating fast in complex geometry model


Changing the setup at run-time
Parallel geometries


Automatic optimization
Geometry models can be ‘dynamic’


Describing setups up to millions of volumes
Tools for creating & checking complex structures
For hits/readout, biasing/scoring, fast simulation.
Defining geometrical ‘regions’

For physics optimization: choice of production threshold, triggering of
fast simulation.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
15
Describing a setup

Large choice of shape (solid)


A logical volume contains subvolumes and attributes.


From simple (CSGs) to complex.
field, material, visual properties,
A physical volume represents one or many volume instances


A single copy (in the case of a placement)
A replicated volume represents any number of sub-volumes:


Regular slices of a parent (in a division or replica), or
Arbitrary sub-volumes with parameterized attributes (in parameterised vol)


Solid type, sizes, positioning, material can be varied in a user-defined
parameterisation.
Complex structures with millions of volumes possible


Using hierarchy and logical/physical volumes
Using replica/divisions and parameterisations.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
16
Solids
• CSG (Constructed Solid Geometry)
• Simple basic shapes: box, cone, cylinder…
• Analogous to simple GEANT3 solids
• Specific solids
• G4Polycone, G4Polyhedra, G4Hype, …
• G4TwistedTubs, G4TwistedBox, G4TwistedTrap
• Boolean solids
– Composed from unions, subtractions, intersections
• BREP solids
• Listing all its surfaces specifies a solid
• e.g. 6 squares for a cube
• Surfaces can be
• planar, 2nd or higher order: elementary BREPS
• Few BREPS pre-defined
• Box, cons, tubs, sphere, torus, polycone, polyhedra
• Latest feature - Ability to compute the volume of any solid / shape
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
17
Scintillation in Borexino
3-D view from a CT image
The Geant4 Kernel
J.A.,
M.A., G.C.
for the Geant4 Collab.,
April 2005
Mercury
Magnetospheric
Orbiter
18
Facilities for
describing setups


Reflect part of a structure

A hierarchy can be reflected



Region & attributes can be
propagated to sub-volumes
Calculate




Characterize parts with common
attributes (regions)


Example pictured above
An assembly can represent a
regular pattern of positioned
volumes
the volume of a solid
the mass of a portion of a setup.
structures which are hard to
describe with simple replicas or
parameterised volumes
structures which may consist of
different shapes
An Assembly with
its four imprints.
Debug the geometry setup

see next slide
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
19
Tools for debugging
geometries
Geant4 normally does not check for malformed
geometries at tracking time


An overlapping volume is a volume which
protrudes from its mother volume or overlaps a
sibling volume.
Utilities for detecting wrong positioning
 Graphical external tools (DAVID, OLAP)
 Kernel run-time commands


Using different techniques and tunable according
to geometry setup complexity
New ability to do some checks during
tracking
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
20
Courtesy T. Ersmark, KTH Stockholm
Space Environments
and Effects Section
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
21
Creating and Importing/exporting
geometry setups

A setup can be described either in C++ code or




GDML provides XML formatted files



For storage and input of geometry
For interchange of setups between applications
R. Chytracek
W. Pokorski
First implementation of GDML writer



using a simple tool, the Geant4 Geometry Editor
Imported (or exported) from external XML format (eg GDML)
through other tools, eg interactively in GATE.
Included as of GDML 2.0.0. See http://cern.ch/gdml
Capable of streaming out simple placement-based geometries to file
Extension to GDML now provided

Schema supporting replicas and parameterized volumes



Generates persistent map of transformations
Additional solids supported
Further extension, refinements planned.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
22
Navigation & optimisation

Navigation uses ‘smart voxels’ technique optimises
search for intersections

Efficiently uses memory at price of limited ‘startup’ cost



For the most complex setups, can tune these further.
During tracking, quickly searches hierarchy of virtual
divisions
In complex setups, this automatic 3d-voxelisation
provides speedups


Improvement of 20-30% compared with well-optimised
custom geometry setups using Geant 3.21
Large factors for un-tuned setups.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
23
Geometry optimization (details)

‘Smart voxels’ technique to optimise search for intersections

At tracking time, searching is done in a hierarchy of virtual divisions



Does not require large memory or computing resources



Adopted and ‘tuned’ early in the Geant4 project (1995)
Refinements enable user to reduce initialisation time and/or memory
consumed even further for largest cases (D.Williams/S. Giani).
Can handle well also ‘flat’ geometries


Divisions sucessively along three cartesian dimensions
No need to tune description of geometry setup, as in Geant 3.21
in some cases 20 times or more faster than GEANT 3.21
Latest: can use 3D voxelization also for parameterized volumes

Improves efficiency in setups where a large number of sub-volumes are
placed in a 2 or 3 dimensional pattern
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
24
An event in the CMS detector.
An event in the LHCb detector
A few example setups
from LHC experiments
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab.,
Aprilof
2005
A view
the Atlas
25
detector
Vertex Locator in LHCb
Alternative geometries

Geant4 can handle ‘dynamic’
geometries which vary in time,


Switching between multiple geometry
setups in memory, one per run, and/or
Modifying just a portion of a single ‘active’
geometry setup


Eg rotating one or more elements
Geant4 also allows a parallel geometry description


to trigger shower parameterizations
to steer biasing with volumes ‘carrying’ importance
values
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
26
Detector Regions
Default
Region
Region B

A region represents a set of
geometry volumes, typically of a
sub-system

C

Region
B
Region A
Region
B

D
D
C
Region B
The Geant4 Kernel
C

Has a cut in range associated. A
different range cut for each particle is
allowed in a region
Special “root-region” associated to the
world volume. Default cut assigned to
the world volume
Propagation of region’s attributes
triggered at initialization time
Memory management through
registration/deregistration mechanism
J.A., M.A., G.C. for the Geant4 Collab., April 2005
27
Tracking in field

Charged particle tracking in external EM
field



Uniform or non-uniform fields
Magnetic, electric or combined fields.
Adaptable precision requirements

High precision where it is important


O(50 um) through 500 volumes (CMS)
Tested for the high precision requirements
in tracking ‘trigger’ muons and beams.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
28
Geometrical biasing & scoring

“Geometrical” biasing implementing importance weight associated to
logical volumes



Different techniques implemented







In a real user geometry
In a parallel dedicated geometry
geometry splitting and Russian roulette
Weight roulette (or weight cutoff)
Simple weight window.
Use cases collected from many application fields, ranging from radiation
shielding to dosimetry and fluencies calculations
Introduced abilities for parallel transportation and scoring
An advanced example based on the Tiara experiment illustrates most of
these features
Other biasing options implemented as physics processes or options

Enhanced interaction, leading particle options for particular processes.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
29
Summary

The Geant4 kernel enables the toolkit user




To track particles with customized physics
configurations, and deposit hits
To describe geometrical setups of significant
complexity and navigate efficiently in these
To change a geometry at run-time
For more see http://cern.ch/geant4
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
30
THE END
Other slides
Original, older or alternative slides
Reflection of volumes
and hierarchies

Reflection of volumes and hierarchies of volumes is possible through the
class G4ReflectionFactory




Applies to simple placements, replicas and divided PVs
Does not currently apply to generic parameterised PVs
Adopts decomposition of reflection transformation
Takes into account setting of attributes in the reflected counterpart






Materials
Magnetic fields
Association to regions
Visualization attributes
Biasing weights …
The factory provides also query facilities for retrieving/determining reflected
volumes
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
33
Other Development highlights

Detector description



New ways to create geometries
Tools to detect incorrect geometry definitions
A different field for any volume (or volume tree)


Ability to reduce initialisation time


Overriding a global field
By saving/retrieving physics processes’ table
Variance reduction / event biasing

Importance: biasing by geometry

Leading particle biasing
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
34
Improvements in Geometry

Reflection of volume hierarchies


Eg to create endcap geometry
Improved voxelisation for performant navigation

3-D for parameterized volumes



Now equal performance to ‘placed’ volume
G Cosmo
Option to avoid voxelizing some volumes
‘Illegal’ geometries detected & rejected


I Hrivnacova
G Cosmo
V Grichine
G Cosmo
E.g. incompatible daughters (placed & parameterized)
XML binding: GDML 1.0 released

R Chytracek
Specification & Implementation

The Geant4 Kernel
Refinements currently on ‘hold’.
J.A., M.A., G.C. for the Geant4 Collab., April 2005
35
Debugging geometries

It is easy to create overlapping volumes




a volume that protrudes from its mother,
2+ volumes that intersect in common mother
During tracking Geant4 does not check for
malformed geometries
The problem of detecting ‘significant’
overlaps is now addressed by

DAVID that intersects volumes directly
( Uses graphical representations )


New commands to run verification tests


Created by S. Tanaka, released ca 1997
Created by DC Williams; released in 4.0
New example with full tracking / navigation

The Geant4 Kernel
Created by M Liendl; released in 5.0
Thanks
J.A., M.A., G.C. for the Geant4 Collab., April
2005
to S. Tanaka
36
CPU Performance

Our first simple benchmarks:


Performance in experimental setups (with Geant4 releases 2 and
3) was comparable to Geant3


Some setups of EM showers and field propagation, factor ~ 2x
Collecting a set of benchmarks


and were addressed (in the patches & release 4.1)
Difficult cases remain, including


few counterexamples, including BTeV ECAL.
New performance issues arose with Geant4 4.0


Geometry faster, EM shower setups: competitive
To follow computing performance regularly
Goal is that Geant4 is at least as fast as Geant3 in almost all
cases

When its power is used.
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
37
Geometry Modeler Conclusions

The Geant4 geometry modeler allows for definition of
complex geometry setups


Distinction between logical and physical entities



Memory optimisation and reuse
Navigation and transport in very complex models


Easy integration of the geometry model in the user application
Precise and efficient with advanced optimisation techniques
Geometry biasing techniques (real or parallel geometry)
Special facilities allow for




Grouping of volumes for regular geometry patterns
Replica/reflection of composite structures
Characterisation of areas with common attributes (regions)
Debugging of the user-defined geometry
The Geant4 Kernel
J.A., M.A., G.C. for the Geant4 Collab., April 2005
38