Common Geometry Primitives (Unified Solids) Marek Gayer, CERN - - PowerPoint PPT Presentation

common geometry
SMART_READER_LITE
LIVE PREVIEW

Common Geometry Primitives (Unified Solids) Marek Gayer, CERN - - PowerPoint PPT Presentation

Common Geometry Primitives (Unified Solids) Marek Gayer, CERN PH/SFT 1 st AIDA Annual Meeting, Hamburg Motivations for a common solids library Optimize and guarantee better long-term maintenance of Root and Gean4 solids libraries A rough


slide-1
SLIDE 1

Common Geometry Primitives (Unified Solids)

Marek Gayer, CERN PH/SFT 1st AIDA Annual Meeting, Hamburg

slide-2
SLIDE 2

Motivations for a common solids library

  • Optimize and guarantee better long-term

maintenance of Root and Gean4 solids libraries

  • A rough estimation indicates that about 70-80% of code investment for

the geometry modeler concerns solids, to guarantee the required precision and efficiency in a huge variety of combinations

  • Create a single library of high quality

implementations

  • Starting from what exists today in Geant4 and Root
  • Adopt a single type for each shape
  • Create a new Multi-Union solid
  • Aims to replace solid libraries in Geant4 and Root
  • Allowing to reach complete conformance to GDML solids schema
  • Optimize, extend and rationalize the testing suite

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 2

slide-3
SLIDE 3

Strategy and current status

  • Stage ONE: Startup (completed)

 Types and USolid interface are defined  Bridge classes defined and implemented for both Geant4 and Root  First solid (box) implemented and tested  Testing suite defined and deployed  Implementation of “Multi-Union“ solid completed and performance

  • ptimized
  • Stage TWO: Migration (current)
  • Evaluate weaknesses of solids for priority
  • Implement migration of each solid according to priority

 Started implementation of primitives:

 First implementation of Orb (simple full sphere) and Trd (simple trapezoid)  Testing suite extended with Data Analysis and Performance tests with direct comparisons with Geant4 and Root implementations

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 3

slide-4
SLIDE 4

Current resources

  • Contributions from:
  • John Apostolakis (PH/SFT)
  • Gabriele Cosmo (PH/SFT)
  • Marek Gayer (PH/SFT, Fellow from 1/7/2011)
  • Andrei Gheata (ALICE)
  • Jean-Marie Guyader (CERN Summer Student until 31/8/2011)
  • Tatiana Nikitina (PH/SFT)
  • Current resources sums up to ~1.4 FTE

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 4

slide-5
SLIDE 5

Testing Suite

  • Solid Batch Test
  • Optical Escape
  • Data analysis and performance (SBT DAP)
  • Specialized tests (e.g. quick performance

scalability test for multi-union)

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 5

slide-6
SLIDE 6

Optical Escape Test

  • Optical photons are generated inside a solid
  • Repeatedly bounce on the reflecting inner surface
  • Particles must not escape the solid

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 6

slide-7
SLIDE 7

Solids Batch Test (SBT)

  • Points and vectors test
  • Generating groups of inside, outside and surface points
  • Testing all distance methods with numerous checks
  • E.g. for each inside random point p,

SafetyFromInside(p) must be > 0

  • Voxels tests
  • Randomly sized voxels with random inside points
  • Scriptable application, creates logs
  • Extendible C++ framework
  • Allowing easy addition of new tests

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 7

slide-8
SLIDE 8

Data Analysis and Performance (DAP)

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 8

slide-9
SLIDE 9

DAP features

  • Extension of the SBT framework
  • Centred around testing USolids together with

existing Geant4 and Root solids

  • Values and their differences from different codes

can be compared

  • Constrain: similar or better performance required

for each method

  • The core part of USolids testing
  • Portable: Windows, Linux, Mac
  • Two phases
  • Sampling phase (generation of data sets, implemented as C++ app.)
  • Analysis phase (data post-processing, implemented as MATLAB scripts)

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 9

slide-10
SLIDE 10

DAP - Sampling phase

  • Tests with solids from three libraries:

Geant4, Root and USolids

  • Tests with pre-calculated, randomly

generated sets of points and vectors

  • Storing of results data sets to disk
  • Measurement of performance
  • Support for batch scripting
  • Detailed configuration of conditions in the tests
  • Invoking several tests sequentially
  • Rich debugging possibilities in Visual

Studio

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 10

slide-11
SLIDE 11

DAP - Analysis phase

  • Visualization of scalar and vector data sets and shapes
  • Visual analysis of differences
  • Graphs with comparison of performance and scalability
  • Inspection of values and differences of data sets

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 12

slide-12
SLIDE 12

Visualization of scalar and vector data sets

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 13

slide-13
SLIDE 13

3D plots allowing to

  • verview data sets

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 14

slide-14
SLIDE 14

3D visualization of investigated shapes

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 15

slide-15
SLIDE 15

Support for regions of data, focusing on sub-parts

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 16

slide-16
SLIDE 16

Visual analysis of differences

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 17

slide-17
SLIDE 17

Visual analysis of differences in 3D

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 18

slide-18
SLIDE 18

Graphs with comparison

  • f performance

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 19

slide-19
SLIDE 19

Visualization of scalability performance for specific solids

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 20

slide-20
SLIDE 20

Inspection of values and differences of scalar and vector data sets

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 21

slide-21
SLIDE 21

New Multi-Union solid

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 22

slide-22
SLIDE 22

Boolean Union solids

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 23

  • Existing CSG Boolean solids (Root and

Geant4) represented as binary trees

  • To solve navigation requests, most of the solids composing a

complex one have to be checked

  • Scalability is typically linear => low performance for solids of many

parts Boolean Union solid: is composite of two solids, either primitive or Boolean [ Images source: wikipedia.org ]

slide-23
SLIDE 23

Multi-Union solid

  • We implemented a new

solid as a union of many solids using voxelization techniques to optimize the speed

  • 3D space partition for fast

localization of components

  • Aiming for a log(n) scalability
  • Useful also for several

complex composites made of many solids with regular patterns

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 24

slide-24
SLIDE 24
  • 1. Create voxel space (2D

simplification)

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 25

x y

slide-25
SLIDE 25
  • 2. Usage of bit masks for

storing voxels

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 26

slide-26
SLIDE 26

Scaling of Multi-Union vs. Boolean solid

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 27

slide-27
SLIDE 27

Test union solids for scalability measurements

28 3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status

slide-28
SLIDE 28

Test union solids for scalability measurements

29 3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status

slide-29
SLIDE 29

Test union solids for scalability measurements

30 3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status

slide-30
SLIDE 30

The most performance critical methods

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 31

slide-31
SLIDE 31

Future work

  • Systematically analyze and implement remaining

solids in the new library

  • Give priority to the most critical solids and those

where room for improvement can be easily identified

3/28/2012 Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status 32

slide-32
SLIDE 32

33 3/28/2012

Thank you for your attention.

?

?

Do you have any questions ?

Marek Gayer - Common Geometry Primitives library (Unified Solids) - Status