Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April.

Similar presentations


Presentation on theme: "The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April."— Presentation transcript:

1 The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April 2005

2 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Overview Structure of Geant4 toolkit Structure of Geant4 toolkit Highlights Highlights Events, runs, tracking Events, runs, tracking Foundations Foundations Geometry Geometry Efficiency improvement Efficiency improvement Summary Summary

3 Toolkit structure

4 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Geant4 structure Geant4 consists of 17 categories. Geant4 consists of 17 categories. Developed and maintained by Working Groups responsible for each category. Developed and maintained by Working Groups responsible for each category. Interfaces between categories largely stable, with some evolution. Interfaces between categories largely stable, with some evolution. Geant4 Kernel Geant4 Kernel Handles run, event, track, step, hit, trajectory, etc. Handles run, event, track, step, hit, trajectory, etc. Provides frameworks of geometrical representation and physics processes, and interfaces to visualization and GUI. Provides frameworks of geometrical representation and physics processes, and interfaces to visualization and GUI. Geant4ReadoutVisuali zation Persis tency Run Event Inter faces Tracking Digits + Hits Processes Track Geometry Particle Graphic _reps Material Intercoms Global

5 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Geant4 kernel categories Run Run Overall management, run control Overall management, run control Event loop, pile-up handling Event loop, pile-up handling Event Event Processing one event Processing one event Stack mechanism Stack mechanism Primary event generation, radioactive source Primary event generation, radioactive source Tracking Tracking Processing one track Processing one track Managing one step Managing one step Detector readout Detector readout Hit scoring, tallying Hit scoring, tallying Track Track Track, step Track, step Process/management Process/management Abstract definition of process Abstract definition of process Geometry Geometry Geometrical description Navigation Electromagnetic field Parameterization Parameterization Framework of shower parameterization Material Material Material, element, isotope Particles Particles Particle definition Graphics_reps Graphics_reps Visualization attributes Intercoms Intercoms UI command definition and interpretation Global Global Basic classes

6 Configuration, events

7 June 18, 1999J. Apostolakis for Geant4 collaboration7 Run: configures A Run is a series of events/tracks with common: A Run is a series of events/tracks with common: Setup (geometry / materials) Setup (geometry / materials) Physics list (processes / production thresholds) Physics list (processes / production thresholds) Primary generator Primary generator Each of these is necessary. Run enables user to define them: Each of these is necessary. Run enables user to define them: In a general predefined way (via RunManager) In a general predefined way (via RunManager) In a fine grained way, for use in external frameworks (new) In a fine grained way, for use in external frameworks (new) The run controls The run controls The ordering of creating, invoking other simulation parts The ordering of creating, invoking other simulation parts The locking of the geometry for active simulation The locking of the geometry for active simulation Note: One computing process can have many runs Note: One computing process can have many runs

8 June 18, 1999J. Apostolakis for Geant4 collaboration8 Event: groups tracks & hits An event is the interaction of a set of primaries An event is the interaction of a set of primaries In Geant4 it can collect the resulting information In Geant4 it can collect the resulting information In the form of hits, created by sensitive detectors In the form of hits, created by sensitive detectors User can define own hits User can define own hits The event manages handling of tracks The event manages handling of tracks It maintains stacks for inactive tracks It maintains stacks for inactive tracks Enables user to reorder tracks in simulation at no cost Enables user to reorder tracks in simulation at no cost Simulates important first, check triggers and only then do the rest. Simulates important first, check triggers and only then do the rest. 3 default stacks for urgent, suspended and postponed-to-next- event tracks. 3 default stacks for urgent, suspended and postponed-to-next- event tracks. User can increase the number of stacks User can increase the number of stacks

9 June 18, 1999J. Apostolakis for Geant4 collaboration9 Tracking and physics Tracking is general Tracking is general same for all particle types same for all particle types different list of processes for each particle different list of processes for each particle The ordering is important The ordering is important It messages the It messages the sensitive detectors and user actions sensitive detectors and user actions The user chooses the physics of each particle The user chooses the physics of each particle Choosing an existing configuration (eg a physics list) Choosing an existing configuration (eg a physics list) Modifying one or creating their own Modifying one or creating their own So anyone can add or replace a physics model So anyone can add or replace a physics model simply, without restrictions or problems simply, without restrictions or problems

10 June 18, 1999J. Apostolakis for Geant4 collaboration10 Geant4 kernel: other Hits & digitization Hits & digitization Experiment specific hits Experiment specific hits Handles event pileup using new readout category using new readout category Materials Materials isotopes, elements, isotopes, elements, compounds,... compounds,... Particles Particles properties from PDG Intercoms: Intercoms: c ommunicate between categories, from UI to kernel Geometry Geometry hierarchy or flat performant

11 FoundationsFoundations 1. Units 2. Materials 3. Particles 4. User Interface

12 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Units, Material, Particles Unit System Internal unit system used in Geant4 is completely hidden Internal unit system used in Geant4 is completely hidden not only from user s code but also from Geant4 source code implementation. not only from user s code but also from Geant4 source code implementation. All numbers must given with their unit: All numbers must given with their unit: kineticEnergy = 1.24 * MeV; To get a number, must divided by a proper unit. To get a number, must divided by a proper unit. cout << eDep / MeV << [MeV] ; This unit conventions make the source code more readable This unit conventions make the source code more readableMaterials Describe element composition, density Describe element composition, density Other properties can be associated Other properties can be associated Optical, ionization potential,..Particles Properties from PDG Properties from PDG Includes resonances & ions Includes resonances & ions Each particle has its physics list Each particle has its physics list For unstable particles, it is For unstable particles, it is Responsible for decay modes Intercoms : Intercoms : c ommunicate between categories, from UI to kernel

13 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Intercoms: commanding This systems enable the user to communicate with a running application. This systems enable the user to communicate with a running application. A built-in run-time command can A built-in run-time command can Change an option ( eg type of primary particle ) Change an option ( eg type of primary particle ) Choose a visualisation system Choose a visualisation system The user can extend it easily The user can extend it easily GATE provided a system to create a geometry setup dynamically at run-time GATE provided a system to create a geometry setup dynamically at run-time ATLAS choose between a number of setup configurations, at run-time ATLAS choose between a number of setup configurations, at run-time

14 Geometry Creating a setup Creating a setup Facilities & tools Facilities & tools Navigating Navigating

15 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Key geometry capabilities Describing a setup as hierarchy or flat structure Describing a setup as hierarchy or flat structure Describing setups up to millions of volumes Describing setups up to millions of volumes Tools for creating & checking complex structures Tools for creating & checking complex structures Navigating fast in complex geometry model Navigating fast in complex geometry model Automatic optimization Automatic optimization Geometry models can be dynamic Geometry models can be dynamic Changing the setup at run-time Changing the setup at run-time Parallel geometries Parallel geometries For hits/readout, biasing/scoring, fast simulation. For hits/readout, biasing/scoring, fast simulation. Defining geometrical regions Defining geometrical regions For physics optimization: choice of production threshold, triggering of fast simulation. For physics optimization: choice of production threshold, triggering of fast simulation.

16 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Describing a setup Large choice of shape (solid) Large choice of shape (solid) From simple (CSGs) to complex. From simple (CSGs) to complex. A logical volume contains subvolumes and attributes. A logical volume contains subvolumes and attributes. field, material, visual properties, field, material, visual properties, A physical volume represents one or many volume instances A physical volume represents one or many volume instances A single copy ( in the case of a placement ) A single copy ( in the case of a placement ) A replicated volume represents any number of sub-volumes: A replicated volume represents any number of sub-volumes: Regular slices of a parent ( in a division or replica ), or Regular slices of a parent ( in a division or replica ), or Arbitrary sub-volumes with parameterized attributes ( in parameterised vol ) Arbitrary sub-volumes with parameterized attributes ( in parameterised vol ) Solid type, sizes, positioning, material can be varied in a user-defined parameterisation. Solid type, sizes, positioning, material can be varied in a user-defined parameterisation. Complex structures with millions of volumes possible Complex structures with millions of volumes possible Using hierarchy and logical/physical volumes Using hierarchy and logical/physical volumes Using replica/divisions and parameterisations. Using replica/divisions and parameterisations.

17 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Solids BREP solidsBREP solids Listing all its surfaces specifies a solidListing all its surfaces specifies a solid e.g. 6 squares for a cubee.g. 6 squares for a cube Surfaces can beSurfaces can be planar, 2 nd or higher order: elementary BREPSplanar, 2 nd or higher order: elementary BREPS Few BREPS pre-definedFew BREPS pre-defined Box, cons, tubs, sphere, torus, polycone, polyhedraBox, cons, tubs, sphere, torus, polycone, polyhedra Specific solids G4Polycone, G4Polyhedra, G4Hype, … G4TwistedTubs, G4TwistedBox, G4TwistedTrap Boolean solids –Composed from unions, subtractions, intersections (Constructed Solid Geometry)CSG (Constructed Solid Geometry) Simple basic shapes: box, cone, cylinder… Analogous to simple GEANT3 solids Latest feature - Ability to compute the volume of any solid / shape

18 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Scintillation in Borexino 3-D view from a CT image Mercury Magnetospheric Orbiter

19 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Facilities for describing setups Reflect part of a structure Reflect part of a structure A hierarchy can be reflected A hierarchy can be reflected Example pictured above Example pictured above Characterize parts with common attributes (regions) Characterize parts with common attributes (regions) Region & attributes can be propagated to sub-volumes Region & attributes can be propagated to sub-volumes Calculate Calculate the volume of a solid the volume of a solid the mass of a portion of a setup. the mass of a portion of a setup. Debug the geometry setup Debug the geometry setup see next slide see next slide An assembly can represent a regular pattern of positioned volumes 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 An Assembly with its four imprints.

20 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Tools for debugging geometries An overlapping volume is a volume which protrudes from its mother volume or overlaps a sibling volume. An overlapping volume is a volume which protrudes from its mother volume or overlaps a sibling volume. Utilities for detecting wrong positioning Utilities for detecting wrong positioning Graphical external tools (DAVID, OLAP) Graphical external tools (DAVID, OLAP) Kernel run-time commands Kernel run-time commands Using different techniques and tunable according to geometry setup complexity Using different techniques and tunable according to geometry setup complexity New ability to do some checks during tracking New ability to do some checks during tracking Geant4 normally does not check for malformed geometries at tracking time

21 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Courtesy T. Ersmark, KTH Stockholm Space Environments and Effects Section

22 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Creating and Importing/exporting geometry setups A setup can be described either in C++ code or A setup can be described either in C++ code or using a simple tool, the Geant4 Geometry Editor using a simple tool, the Geant4 Geometry Editor Imported (or exported) from external XML format (eg GDML) Imported (or exported) from external XML format (eg GDML) through other tools, eg interactively in GATE. through other tools, eg interactively in GATE. GDML provides XML formatted files GDML provides XML formatted files For storage and input of geometry For storage and input of geometry For interchange of setups between applications For interchange of setups between applications First implementation of GDML writer First implementation of GDML writer Included as of GDML See Included as of GDML See Capable of streaming out simple placement-based geometries to file Capable of streaming out simple placement-based geometries to file Extension to GDML now provided Extension to GDML now provided Schema supporting replicas and parameterized volumes Schema supporting replicas and parameterized volumes Generates persistent map of transformations Generates persistent map of transformations Additional solids supported Additional solids supported Further extension, refinements planned. Further extension, refinements planned. R. Chytracek W. Pokorski

23 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Navigation & optimisation Navigation uses smart voxels technique optimises search for intersections Navigation uses smart voxels technique optimises search for intersections Efficiently uses memory at price of limited startup cost Efficiently uses memory at price of limited startup cost For the most complex setups, can tune these further. For the most complex setups, can tune these further. During tracking, quickly searches hierarchy of virtual divisions During tracking, quickly searches hierarchy of virtual divisions In complex setups, this automatic 3d-voxelisation provides speedups In complex setups, this automatic 3d-voxelisation provides speedups Improvement of 20-30% compared with well-optimised custom geometry setups using Geant 3.21 Improvement of 20-30% compared with well-optimised custom geometry setups using Geant 3.21 Large factors for un-tuned setups. Large factors for un-tuned setups.

24 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Geometry optimization (details) Smart voxels technique to optimise search for intersectionsSmart voxels technique to optimise search for intersections At tracking time, searching is done in a hierarchy of virtual divisions At tracking time, searching is done in a hierarchy of virtual divisions Divisions sucessively along three cartesian dimensions Divisions sucessively along three cartesian dimensions No need to tune description of geometry setup, as in Geant 3.21 No need to tune description of geometry setup, as in Geant 3.21 Does not require large memory or computing resources Does not require large memory or computing resources Adopted and tuned early in the Geant4 project (1995) 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). 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 Can handle well also flat geometries in some cases 20 times or more faster than GEANT 3.21 in some cases 20 times or more faster than GEANT 3.21 Latest: can use 3D voxelization also for parameterized volumes 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 Improves efficiency in setups where a large number of sub-volumes are placed in a 2 or 3 dimensional pattern

25 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Vertex Locator in LHCb An event in the CMS detector. A view of the Atlas detector An event in the LHCb detector A few example setups from LHC experiments

26 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Alternative geometries Geant4 can handle dynamic geometries which vary in time, Geant4 can handle dynamic geometries which vary in time, Switching between multiple geometry setups in memory, one per run, and/or Switching between multiple geometry setups in memory, one per run, and/or Modifying just a portion of a single active geometry setup Modifying just a portion of a single active geometry setup Eg rotating one or more elements Eg rotating one or more elements Geant4 also allows a parallel geometry description Geant4 also allows a parallel geometry description to trigger shower parameterizations to steer biasing with volumes carrying importance values

27 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Default Region B D C Region B Region A C C Region B D Detector Regions A region represents a set of geometry volumes, typically of a sub-system 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 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 Special root-region associated to the world volume. Default cut assigned to the world volume Propagation of regions attributes triggered at initialization time Propagation of regions attributes triggered at initialization time Memory management through registration/deregistration mechanism Memory management through registration/deregistration mechanism

28 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Tracking in field Charged particle tracking in external EM field Charged particle tracking in external EM field Uniform or non-uniform fields Uniform or non-uniform fields Magnetic, electric or combined fields. Magnetic, electric or combined fields. Adaptable precision requirements Adaptable precision requirements High precision where it is important High precision where it is important O(50 um) through 500 volumes (CMS) O(50 um) through 500 volumes (CMS) Tested for the high precision requirements in tracking trigger muons and beams. Tested for the high precision requirements in tracking trigger muons and beams.

29 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Geometrical biasing & scoring Geometrical biasing implementing importance weight associated to logical volumesGeometrical biasing implementing importance weight associated to logical volumes In a real user geometry In a real user geometry In a parallel dedicated geometry In a parallel dedicated geometry Different techniques implemented Different techniques implemented geometry splitting and Russian roulette geometry splitting and Russian roulette Weight roulette (or weight cutoff) Weight roulette (or weight cutoff) Simple weight window. Simple weight window. Use cases collected from many application fields, ranging from radiation shielding to dosimetry and fluencies calculations Use cases collected from many application fields, ranging from radiation shielding to dosimetry and fluencies calculations Introduced abilities for parallel transportation and scoring Introduced abilities for parallel transportation and scoring An advanced example based on the Tiara experiment illustrates most of these features An advanced example based on the Tiara experiment illustrates most of these features Other biasing options implemented as physics processes or options Other biasing options implemented as physics processes or options Enhanced interaction, leading particle options for particular processes. Enhanced interaction, leading particle options for particular processes.

30 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Summary The Geant4 kernel enables the toolkit user The Geant4 kernel enables the toolkit user To track particles with customized physics configurations, and deposit hits To track particles with customized physics configurations, and deposit hits To describe geometrical setups of significant complexity and navigate efficiently in these To describe geometrical setups of significant complexity and navigate efficiently in these To change a geometry at run-time To change a geometry at run-time For more see For more see

31 THE END

32 Other slides Original, older or alternative slides

33 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Reflection of volumes and hierarchies Reflection of volumes and hierarchies of volumes is possible through the class G4ReflectionFactory Reflection of volumes and hierarchies of volumes is possible through the class G4ReflectionFactory Applies to simple placements, replicas and divided PVs Applies to simple placements, replicas and divided PVs Does not currently apply to generic parameterised PVs Does not currently apply to generic parameterised PVs Adopts decomposition of reflection transformation Adopts decomposition of reflection transformation Takes into account setting of attributes in the reflected counterpart Takes into account setting of attributes in the reflected counterpart Materials Materials Magnetic fields Magnetic fields Association to regions Association to regions Visualization attributes Visualization attributes Biasing weights … Biasing weights … The factory provides also query facilities for retrieving/determining reflected volumes The factory provides also query facilities for retrieving/determining reflected volumes

34 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Other Development highlights Detector description Detector description New ways to create geometries New ways to create geometries Tools to detect incorrect geometry definitions Tools to detect incorrect geometry definitions A different field for any volume (or volume tree) A different field for any volume (or volume tree) Overriding a global field Overriding a global field Ability to reduce initialisation time Ability to reduce initialisation time By saving/retrieving physics processes table By saving/retrieving physics processes table Variance reduction / event biasing Variance reduction / event biasing Importance: biasing by geometry Importance: biasing by geometry Leading particle biasing Leading particle biasing

35 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Improvements in Geometry Reflection of volume hierarchies Reflection of volume hierarchies Eg to create endcap geometry Eg to create endcap geometry Improved voxelisation for performant navigation Improved voxelisation for performant navigation 3-D for parameterized volumes 3-D for parameterized volumes Now equal performance to placed volume Now equal performance to placed volume Option to avoid voxelizing some volumes Option to avoid voxelizing some volumes Illegal geometries detected & rejected Illegal geometries detected & rejected E.g. incompatible daughters (placed & parameterized) E.g. incompatible daughters (placed & parameterized) XML binding: GDML 1.0 released XML binding: GDML 1.0 released Specification & Implementation Specification & Implementation Refinements currently on hold. Refinements currently on hold. G Cosmo R Chytracek I Hrivnacova G Cosmo V Grichine G Cosmo

36 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Debugging geometries It is easy to create overlapping volumes It is easy to create overlapping volumes a volume that protrudes from its mother, a volume that protrudes from its mother, 2+ volumes that intersect in common mother 2+ volumes that intersect in common mother During tracking Geant4 does not check for malformed geometries During tracking Geant4 does not check for malformed geometries The problem of detecting significant overlaps is now addressed by The problem of detecting significant overlaps is now addressed by DAVID that intersects volumes directly DAVID that intersects volumes directly ( Uses graphical representations ) ( Uses graphical representations ) Created by S. Tanaka, released ca 1997 Created by S. Tanaka, released ca 1997 New commands to run verification tests New commands to run verification tests Created by DC Williams; released in 4.0 Created by DC Williams; released in 4.0 New example with full tracking / navigation New example with full tracking / navigation Created by M Liendl; released in 5.0 Created by M Liendl; released in 5.0 Thanks to S. Tanaka

37 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April CPU Performance Our first simple benchmarks: Our first simple benchmarks: Geometry faster, EM shower setups: competitive Geometry faster, EM shower setups: competitive Performance in experimental setups (with Geant4 releases 2 and 3) was comparable to Geant3 Performance in experimental setups (with Geant4 releases 2 and 3) was comparable to Geant3 few counterexamples, including BTeV ECAL. few counterexamples, including BTeV ECAL. New performance issues arose with Geant4 4.0 New performance issues arose with Geant4 4.0 and were addressed (in the patches & release 4.1) and were addressed (in the patches & release 4.1) Difficult cases remain, including Difficult cases remain, including Some setups of EM showers and field propagation, factor ~ 2x Some setups of EM showers and field propagation, factor ~ 2x Collecting a set of benchmarks Collecting a set of benchmarks To follow computing performance regularly To follow computing performance regularly Goal is that Geant4 is at least as fast as Geant3 in almost all cases Goal is that Geant4 is at least as fast as Geant3 in almost all cases When its power is used. When its power is used.

38 The Geant4 KernelJ.A., M.A., G.C. for the Geant4 Collab., April Geometry Modeler Conclusions The Geant4 geometry modeler allows for definition of complex geometry setups The Geant4 geometry modeler allows for definition of complex geometry setups Easy integration of the geometry model in the user application Easy integration of the geometry model in the user application Distinction between logical and physical entities Distinction between logical and physical entities Memory optimisation and reuse Memory optimisation and reuse Navigation and transport in very complex models Navigation and transport in very complex models Precise and efficient with advanced optimisation techniques Precise and efficient with advanced optimisation techniques Geometry biasing techniques (real or parallel geometry) Geometry biasing techniques (real or parallel geometry) Special facilities allow for Special facilities allow for Grouping of volumes for regular geometry patterns Grouping of volumes for regular geometry patterns Replica/reflection of composite structures Replica/reflection of composite structures Characterisation of areas with common attributes (regions) Characterisation of areas with common attributes (regions) Debugging of the user-defined geometry Debugging of the user-defined geometry


Download ppt "The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April."

Similar presentations


Ads by Google