380 likes | 394 Views
This article provides an overview of the structure and highlights of the Geant4 toolkit, including information on events, runs, tracking, geometry, and efficiency improvement. It also discusses the Geant4 Kernel and its interfaces, as well as the configuration and event handling process.
E N D
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 J.A., M.A., G.C. for the Geant4 Collab., April 2005
Geant4 Visuali Readout zation Run Persis tency Event Tracking Processes Track Geometry Geant4 structure • Geant4 consists of 17 categories. • Developed and maintained by Working Groups responsible for each category. • Interfaces between categories largely stable, with some evolution. • Geant4 Kernel • Handles run, event, track, step, hit, trajectory, etc. • Provides frameworks of geometrical representation and physics processes, and interfaces to visualization and GUI. Inter faces Digits + Hits Particle Graphic Material _reps Intercoms Global J.A., M.A., G.C. for the Geant4 Collab., April 2005
Run Overall management, run control Event loop, pile-up handling Event Processing one event Stack mechanism Primary event generation, radioactive source Tracking Processing one track Managing one step Detector readout Hit scoring, tallying Track Track, step Process/management Abstract definition of process Geometry Geometrical description Navigation Electromagnetic field Parameterization Framework of shower parameterization Material Material, element, isotope Particles Particle definition Graphics_reps Visualization attributes Intercoms UI command definition and interpretation Global Basic classes Geant4 kernel categories J.A., M.A., G.C. for the Geant4 Collab., April 2005
Run: configures • A Run is a series of events/tracks with common: • Setup (geometry / materials) • Physics list (processes / production thresholds) • Primary generator • 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 • The ordering of creating, invoking other simulation parts • The locking of the geometry for active simulation • Note: One computing process can have many runs J. Apostolakis for Geant4 collaboration
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 • Simulates important first, check triggers and only then do the rest. • 3 default stacks for urgent, suspended and “postponed-to-next-event” tracks. • User can increase the number of stacks J. Apostolakis for Geant4 collaboration
Tracking and physics • Tracking is general • same for all particle types • different list of processes for each particle • The ordering is important • It messages the • 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 • simply, without restrictions or problems J. Apostolakis for Geant4 collaboration
Hits & digitization Experiment specific hits Handles event pileup using new readout category Materials isotopes, elements, compounds, ... Particles properties from PDG Intercoms: communicate between categories, from UI to kernel Geometry hierarchy or flat performant Geant4 kernel: other J. Apostolakis for Geant4 collaboration
‘Foundations’ Units Materials Particles User Interface
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. cout << eDep / MeV << “ [MeV]” ; This unit conventions make the source code more readable Materials Describe element composition, density Other properties can be associated Optical, ionization potential, .. Particles Properties from PDG Includes resonances & ions Each particle has its physics list For unstable particles, it is Responsible for decay modes Intercoms: communicate between categories, from UI to kernel Units, Material, Particles J.A., M.A., G.C. for the Geant4 Collab., April 2005
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 J.A., M.A., G.C. for the Geant4 Collab., April 2005
Geometry Creating a setup Facilities & tools Navigating
Key geometry capabilities • Describing a setup as hierarchy or ‘flat’ structure • Describing setups up to millions of volumes • Tools for creating & checking complex structures • Navigating fast in complex geometry model • Automatic optimization • Geometry models can be ‘dynamic’ • Changing the setup at run-time • Parallel geometries • For hits/readout, biasing/scoring, fast simulation. • Defining geometrical ‘regions’ • For physics optimization: choice of production threshold, triggering of fast simulation. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Describing a setup • Large choice of shape (solid) • From simple (CSGs) to complex. • A logical volume contains subvolumes and attributes. • 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. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Solids • CSG (Constructed Solid Geometry) • Simple basic shapes: box, cone, cylinder… • Analogous to simple GEANT3 solids • 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 • Specific solids • G4Polycone, G4Polyhedra, G4Hype, … • G4TwistedTubs, G4TwistedBox, G4TwistedTrap • Boolean solids • Composed from unions, subtractions, intersections • Latest feature -Ability to compute the volume of any solid / shape J.A., M.A., G.C. for the Geant4 Collab., April 2005
Scintillation in Borexino 3-D view from a CT image Mercury Magnetospheric Orbiter J.A., M.A., G.C. for the Geant4 Collab., April 2005
Reflect part of a structure A hierarchy can be reflected Example pictured above Characterize parts with common attributes (regions) Region & attributes can be propagated to sub-volumes Calculate the volume of a solid the mass of a portion of a setup. Debug the geometry setup see next slide An assembly can represent a regular pattern of positioned volumes structures which are hard to describe with simple replicas or parameterised volumes structures which may consist of different shapes Facilities for describing setups An Assembly with its four imprints. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Tools for debugging geometries • 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 Geant4 normally does not check for malformed geometries at tracking time J.A., M.A., G.C. for the Geant4 Collab., April 2005
Space Environments and Effects Section Courtesy T. Ersmark, KTH Stockholm J.A., M.A., G.C. for the Geant4 Collab., April 2005
Creating and Importing/exporting geometry setups • A setup can be described either in C++ code or • using a simple tool, the Geant4 Geometry Editor • Imported (or exported) from external XML format (eg GDML) • through other tools, eg interactively in GATE. • GDML provides XML formatted files • For storage and input of geometry • For interchange of setups between applications • First implementation of GDML writer • 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. R. Chytracek W. Pokorski J.A., M.A., G.C. for the Geant4 Collab., April 2005
Navigation & optimisation • Navigation uses ‘smart voxels’ techniqueoptimises 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. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Geometry optimization (details) • ‘Smart voxels’ technique to optimise search for intersections • At tracking time, searching is done in a hierarchy of virtual divisions • Divisions sucessively along three cartesian dimensions • No need to tune description of geometry setup, as in Geant 3.21 • 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 • 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 J.A., M.A., G.C. for the Geant4 Collab., April 2005
An event in the CMS detector. An event in the LHCb detector A few example setups from LHC experiments J.A., M.A., G.C. for the Geant4 Collab., April 2005 A view of the Atlas detector Vertex Locatorin LHCb
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 Alternative geometries J.A., M.A., G.C. for the Geant4 Collab., April 2005
Default Region Region B C Region B Region A Region B D D C Region B C Detector Regions • A region represents a set of geometry volumes, typically of a sub-system • 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
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. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Geometrical biasing & scoring • “Geometrical” biasing implementing importance weight associated to logical volumes • In a real user geometry • In a parallel dedicated geometry • Different techniques implemented • 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. J.A., M.A., G.C. for the Geant4 Collab., April 2005
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 J.A., M.A., G.C. for the Geant4 Collab., April 2005
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 J.A., M.A., G.C. for the Geant4 Collab., April 2005
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) • Overriding a global field • Ability to reduce initialisation time • By saving/retrieving physics processes’ table • Variance reduction / event biasing • Importance: biasing by geometry • Leading particle biasing J.A., M.A., G.C. for the Geant4 Collab., April 2005
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 • Option to avoid voxelizing some volumes • ‘Illegal’ geometries detected & rejected • E.g. incompatible daughters (placed & parameterized) • XML binding: GDML 1.0 released • Specification & Implementation • Refinements currently on ‘hold’. I Hrivnacova G Cosmo V Grichine G Cosmo G Cosmo R Chytracek J.A., M.A., G.C. for the Geant4 Collab., April 2005
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 ) • Created by S. Tanaka, released ca 1997 • New commands to run verification tests • Created by DC Williams; released in 4.0 • New example with full tracking / navigation • Created by M Liendl; released in 5.0 Thanks to S. Tanaka J.A., M.A., G.C. for the Geant4 Collab., April 2005
CPU Performance • Our first simple benchmarks: • Geometry faster, EM shower setups: competitive • Performance in experimental setups (with Geant4 releases 2 and 3) was comparable to Geant3 • few counterexamples, including BTeV ECAL. • New performance issues arose with Geant4 4.0 • and were addressed (in the patches & release 4.1) • Difficult cases remain, including • Some setups of EM showers and field propagation, factor ~ 2x • Collecting a set of benchmarks • 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. J.A., M.A., G.C. for the Geant4 Collab., April 2005
Geometry Modeler Conclusions • The Geant4 geometry modeler allows for definition of complex geometry setups • Easy integration of the geometry model in the user application • Distinction between logical and physical entities • Memory optimisation and reuse • Navigation and transport in very complex models • 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 J.A., M.A., G.C. for the Geant4 Collab., April 2005