Geometry 5. I.Hrivnacova¹, J.Apostolakis² ¹IPN, Orsay; ²CERN. Cours Paris June 2007

Similar documents
Geometry 3. I.Hrivnacova IPN, Orsay. Most slides thanks to M. Asai, SLAC. Cours Paris June 2007

Detector Description - Basics

Geometry 4. I.Hrivnacova IPN, Orsay. Most slides thanks to M. Asai, SLAC. Cours Paris June 2007

Geant4 v9.5. Scoring II. Makoto Asai (SLAC) Geant4 Tutorial Course

Geant4 v8.1p01. Geometry I. Makoto Asai (SLAC) Geant4 Tutorial Course

Geant4 v9.4. Geometry I. Presented by Sébastien Incerti (CNRS/IN2P3) Based on slides kindly prepared by Makoto Asai (SLAC)

Detector Sensitivity. Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18th, 2002

A Geometrical Modeller for HEP

The virtual geometry model

Simulation Techniques Using Geant4

Geant4 v8.3. Geometry I. Makoto Asai (SLAC) Geant4 Tutorial Course

Interacting with the Geant4 Kernel

Detector Descrip+on: Advanced. h#p://cern.ch/geant4

GEANT4 Introductory Course

Detector Description - Advanced.

Geant4 v9.5. Geometry I. Makoto Asai (SLAC) Geant4 Tutorial Course

Geant4 v9.3p01. Kernel III. Makoto Asai (SLAC) Geant4 Tutorial Course

Version 10.4-p02. Scoring II. Makoto Asai (SLAC) Geant4 Tutorial Course

advanced geometry Luciano Pandola INFN Laboratori Nazionali del Sud IHEP, China Based on presentations by M. Asai (SLAC) and M. Antonello (INFN-LNGS)

November 2005, Geant4 v7.1. Detector Sensitivity. Makoto Asai (SLAC) Geant4 Tutorial Bordeaux November 2005

Geant4 v9.5. Kernel III. Makoto Asai (SLAC) Geant4 Tutorial Course

Reducing CPU Consumption of Geant4 Simulation in ATLAS

First Calorimeter Simulation with the FLUGG Prototype

Solids as point set. Solid models. Solid representation schemes (cont d) Solid representation schemes. Solid representation schemes (cont d)

Boolean Component. Chapter 1. Boolean Operations

Implementing manufacturing feature based design in CAD/CAM

Visualization in GEANT4. 1 Introduction. 2 User Requirements. University of Manchester, UK. John Allison

The LHCb Alignment Framework

TGeoCad: an Interface between ROOT and CAD Systems

Multipatched B-Spline Surfaces and Automatic Rough Cut Path Generation

3 Polygonal Modeling. Getting Started with Maya 103

Optical Photon Processes

Component Design. Systems Engineering BSc Course. Budapest University of Technology and Economics Department of Measurement and Information Systems

What are the characteristics of Object Oriented programming language?

Chapter 9. Software Testing

GEANT4 BEGINNERS COURSE

Cut per region. Marc Verderi GEANT4 collaboration meeting 01/10/2002

Concurrent Models of Computation for Embedded Software

Solid Modelling. Graphics Systems / Computer Graphics and Interfaces COLLEGE OF ENGINEERING UNIVERSITY OF PORTO

Lecture 11: Ray tracing (cont.)

Representing Range Compensators in the TOPAS Monte Carlo System

Lecture 17: Solid Modeling.... a cubit on the one side, and a cubit on the other side Exodus 26:13

Using Fluxes and Geometries

Geant4 User's Guide for Toolkit Developers

Use grouping symbols including parentheses, brackets, or braces in numerical expressions, and evaluate expressions with these symbols

Computer Science AP/X CSCI 140/242

HVRSD Standards-Based Report Card Correlations for Math. Grade 1

C++ for System Developers with Design Pattern

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Worldwide Production Distributed Data Management at the LHC. Brian Bockelman MSST 2010, 4 May 2010

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

A System for Managing the CLEO III Detector Geometry

Operations and Algebraic Thinking

Geometric Templates for Improved Tracking Performance in Monte Carlo Codes

Geant4 Python Interface

Homework Assignment #1 Sample Solutions

Engineering designs today are frequently

Integration Testing. Conrad Hughes School of Informatics. Slides thanks to Stuart Anderson

Calculating the surface area of arbitrary solids for Geant4

This paper consists of 27 pages and the instructions for the completion of a mark-reading sheet.

Design Workflow for AM: From CAD to Part

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

SOME 024: Computer Aided Design. E. Rozos

Exercise to build and run a Geant4 simulation.

Quarter Core Standards Grade 5 Deconstructed Standard I Can Vocabulary Resources Technology Resources Assessments

LINEAR PROGRAMMING: A GEOMETRIC APPROACH. Copyright Cengage Learning. All rights reserved.

Spatial Data Structures

Standards for Mathematics: Grade 1

Lesson 12: Recursion, Complexity, Searching and Sorting. Modifications By Mr. Dave Clausen Updated for Java 1_5

Could you make the XNA functions yourself?

Algebra 2 Semester 1 (#2221)

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to:

Spatial Data Structures

GUIMesh: a tool to import STEP geometries into Geant4 via GDML

Detector Description.

How to use the IP generator from Xilinx to instantiate IP cores

(Refer Slide Time: 06:01)

Hello, Thanks for the introduction

5 Mathematics Curriculum. Module Overview... i. Topic A: Concepts of Volume... 5.A.1

4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING

Mechanical Design V5R19 Update

6.001 Notes: Section 1.1

Kate Collins Middle School Pre-Algebra Grade 6

FastSim tutorial for beginners

(Refer Slide Time: 05:25)

Trees Slow Insertion in an Ordered Array If you re going to be doing a lot of insertions and deletions, an ordered array is a bad choice.

Compiler Architecture

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Polygon Partitioning. Lecture03

Contemporary Design. Traditional Hardware Design. Traditional Hardware Design. HDL Based Hardware Design User Inputs. Requirements.

High Quality 4D Development. David Adams

Georgia Department of Education

Interaction with the Geant4kernelI.

Chapter 1: Principles of Programming and Software Engineering

Integration Testing. Unit Test vs Integration Testing 1. Unit Testing vs Integration Testing 2. Unit testing: isolation, stub/mock objects

Geant4 v9.5. Kernel II. Makoto Asai (SLAC) Geant4 Tutorial Course

Universiteit Leiden Computer Science

Spring 2010 Research Report Judson Benton Locke. High-Statistics Geant4 Simulations

Transcription:

Geometry 5 I.Hrivnacova¹, J.Apostolakis² ¹IPN, Orsay; ²CERN Cours Geant4 @ Paris 2007 4-8 June 2007

Contents Navigator's view of the geometry Geometry navigator and its utilities Navigation & Tracking Locating points in a user application Best practice in creating a geometry Things to avoid, recipes to use Cours Geant4 @ Paris 2007 2

Geometry Navigator Navigation through the geometry at tracking time is implemented by the class G4Navigator It locates a point in the geometry It computes the distance to the next geometry boundary It is the key point of interaction between the tracking and the geometry Cours Geant4 @ Paris 2007 3

Geometry Navigator (cont.) The Navigator sees the user s geometry definition, which provides a 'logical' hierarchy of volumes with relative positions mother <-> daughter The set of volume starting from the world, going down the volume tree to the current volume is stored in the Navigator and provided as the touchable. Its relative position is defined by a multiplication of all transformations. To avoid recomputing of the final positions of touchable every time, a utility class G4NavigationHistory is defined TA TB TC B B A A C TC' = TA * TB * TC Cours Geant4 @ Paris 2007 4

Touchable (and Navigation) History The information in the touchable/navigation history object, at each level of the hierarchy to the current location (depth): the compounded transformations, the volume types - whether normal (placement), replicated or parameterised. replication/parameterisation information volume pointers Level 1 Level 2 Cours Geant4 @ Paris 2007 5

Touchable (and Navigation) History (cont.) The Navigator owns a private G4NavigationHistory object, Which enables it to go up a level with no effort, and to retrieve the transformation at the current and all other levels. The same functionality is made available for the user using the G4TouchableHistory, Which the Navigator creates (it is requested by the G4Transportation process, which passes it to the G4Track). Cours Geant4 @ Paris 2007 6

The Navigator State With each locating a point, the navigator 'remembers' this and updates its state Besides the navigation history (G4NavigationHistory), the navigator state includes various other information like The last located local point Whether entering a daughter volume with this step, whether existing the mother volume Whether the last step was limited by geometry Etc. This information is then used when locating the next point to speed up this process Cours Geant4 @ Paris 2007 7

Locate a point with the Navigator The Navigator can locate a point either relative to the previous location or starting from the world volume With each new step a track can move only to a neighboring volume in space. Locating relative to the previous location offers better performance Even most new tracks are close to previous tracks Yet if there is an overlap in the geometry this can cause difficulties. B C A A When track arrives at point B, the Navigator locates the green volume by searching only for sub-volumes of A. After the track died at C, the tracking starts the next track at A. It can find it quickly looking up to the blue volume. Cours Geant4 @ Paris 2007 8

How the Navigator Locates a point At each location the Navigator will examine whether the new point is inside the current volume: If the point is not inside the current volume it will exit into its mother volume It will check again continuing to do this until it finds a volume that contains it. Else if it is not contained even in the world, it is done. Once it has located a containing volume (it could be the original one), it will check to see whether the point is contained by any of the its daughter volumes. (At every point it will use the local coordinates for the right level.) A C It will continue to descend, checking to see whether the point is inside any daughter at each level In this figure, starting from the green volume, and locating at A requires checking only two volumes: the green one (outside) and the blue one (inside). Cours Geant4 @ Paris 2007 9

Navigation Utilities The concrete way of computing the location and distances depends strongly on the type of the physical volume; that's why there are introduced the following navigation utility classes G4NormalNavigation For geometries containing 'placement' volumes, with no voxels. G4VoxelNavigation For geometries containing 'placement' volumes, with voxels. G4ParameterisedNavigation For geometries containing parameterised volumes, with voxels. G4ReplicaNavigation For replicated geometries Cours Geant4 @ Paris 2007 10

Navigation Utilities (cont.) G4VoxelNavigation Internally a stack of voxel information is maintained. Private functions allow for isotropic distance computation to voxel boundaries and for computation of the 'next voxel' in a specified direction. G4ParameterisedNavigation Voxel information is maintained similarly to G4VoxelNavigation, but computation can also be simpler by adopting voxels to be one level deep only (unrefined, or 1D optimisation) If you have many sub-volumes in a 2D or 3D pattern (eg. lattice) then you must ensure that the navigator uses full voxelisation (to do this use 'kundefined' as axis.) If you have volumes placed along an axis so that only 3 or less exist in any one 'slice' along this axis, then you can inform the navigator by specifying this axis Cours Geant4 @ Paris 2007 11

Navigation & Tracking The Navigator must be told the root or first volume of the geometry. SetWorldVolume() - sets the first volume in the hierarchy. It must be unrotated and untranslated from the origin. The main functions required for tracking in the geometry: LocateGlobalPointAndSetup() - locates the volume containing the specified global point. To improve efficiency a G4TouchableHistory can be used. LocateGlobalPointAndUpdateTouchableHandle() - as previous, but then use the volume found and its navigation history to update the touchable. ComputeStep() - computes the distance to the next boundary intersected along the specified unit direction from a specified point. The point must have been located prior to calling ComputeStep(). Cours Geant4 @ Paris 2007 12

Navigation & Tracking (cont.) SetGeometricallyLimitedStep() - informs the navigator that the last computed step was taken in its entirety. In a running application it is the responsibility of the Transportation process to call this method. CreateTouchableHistory() - creates a G4TouchableHistory object, for which the caller has deletion responsibility. The 'touchable' volume is the volume returned by the last Locate operation. The object includes a copy of the current NavigationHistory, enabling the efficient relocation of points in/close to the current volume in the hierarchy. User code or other processes can create a touchable history. They are now responsible to delete the object they get or they can use a handle to enable automatic deletion using eg. CreateTouchableHistoryHandle() Cours Geant4 @ Paris 2007 13

Locating Points in a User Application G4Navigator functions can be used in a user application to locate points in geometry The 'main' navigator object The navigator instantiated automatically at the startup of a simulation program, It is used for all the tracking (locating at the start of the track, and each step) Can be accessed at any stage of the application: G4Navigator* tracking_navigator = G4TransportationManager::GetInstance() ->GetNavigatorForTracking(); But the 'main'navigator also takes care of relocating the actual particle tracked if user code uses it during tracking, the tracking actual particle can be affected by such a user call! Note: it is not safe to use either the tracking Navigator or another one during tracking if the geometry contains a replica, division or parameterised volume since their state is part of the state of the navigation. Cours Geant4 @ Paris 2007 14

Locating Points During Tracking Use the touchable handle available via current step: G4StepPoint* presteppoint = astep->getpresteppoint(); G4TouchableHandle thetouchable = presteppoint->gettouchablehandle(); G4ThreeVector worldposition = presteppoint->getposition(); Cours Geant4 @ Paris 2007 15

Locating Points In the Idle> State Create an alternative navigator object first and assign it to the world volume: G4Navigator* mynavigator = new G4Navigator(); mynavigator->setworldvolume(worldvolumepointer); To locate a given point in global coordinates: G4ThreeVector mypoint(10*cm, 10*cm., 10*cm); mynavigator->locateglobalpointandsetup(mypoint); G4TouchableHistoryHandle mytouchable = mynavigator->createtouchablehistoryhandle(); // Convert point in local coordinates (local to the current volume) G4ThreeVector localposition = atouchable->gethistory() ->GetTopTransform().TransformPoint(myPoint); Cours Geant4 @ Paris 2007 16

Run-time commands To print debugging information user can set the navigator verbose level /geometry/navigator/verbose [verbose_level] Geant4 has to be compiled with G4VERBOSE set (what is the default) To force the navigator to run in check mode /geometry/navigator/check_mode [true/false] More strict and less tolerant checks in step/safety computation to verify the correctness of the solids' response in the geometry Cours Geant4 @ Paris 2007 17

Run-time commands Examples By combining check_mode with verbosity level-1, additional verbosity checks on the response from the solids can be activated To get verbose information from each solid asked, including problem issues, use: /geometry/navigator/verbose 1 /geometry/navigator/check_mode true To get checking, but without verboseness for each solid, use instead: /geometry/navigator/verbose 0 /geometry/navigator/check_mode true Cours Geant4 @ Paris 2007 18

Contents Navigator's view of the geometry Geometry navigator and its utilities Navigation & Tracking Locating points Best practice in creating a geometry Things to avoid, recipes to use Cours Geant4 @ Paris 2007 19

Creating Geometry The define the geometry setup in Geant4, you have to derive your own concrete class from G4VUserDetectorConstruction abstract base class and implement the method Construct() This includes: Construct all necessary materials Define shapes/solids required to describe the geometry Construct and place volumes of your detector geometry Define sensitive detectors Associate magnetic field to detector region Define visualization attributes for the detector elements In this lecture, we will concentrate on the items in red Cours Geant4 @ Paris 2007 20

Modularizing Geometry Construction Definition of geometry is often an iterative process The first simulation starts from a rough geometry which is successively replaced with more detailed pieces Such a process allows geometry verifications step by step Big experiment setups The whole detector is usually composed from several sub-detector, which are often constructed by different teams It is natural to decompose geometry construction in several classes per subsystems and let the main geometry construction operate as their manager Small experiment setups If one class can do it (without exceeding thousands of lines), it may turn useful to define member functions per detector parts and call them from the ConstructGeometry() method Cours Geant4 @ Paris 2007 21

Choosing/Verifying a solid Choose the simplest solid that is close enough to your case Eg. G4Box to G4BREPBox, G4Trd to G4Trap if its symmetry allows it Check solids parameters All solids have implemented streaming operator: G4cout << *mysolid << G4endl; Verification of solid by shooting geantino in suitable directions Useful for more complex solids (general trapezoids, polyhedra, tessellated solids,...) Verification with visualization Cours Geant4 @ Paris 2007 22

Choosing/Verifying a solid (cont.) Boolean solids Avoid too many levels of boolean operations (time consuming) The time for location and intersection operations can/will rise proportionally to the number of operations used To aid visualization (and verification), avoid having coincident surfaces between constituent solids, if possible. It should be easily possible to avoid these in particular when subtracting solids This causes difficulty in visualization: A - B = A-B Whereas extending the volume B outside can avoid the problem: A - B = A-B Cours Geant4 @ Paris 2007 23

Assembling volumes The defined solid can be placed in geometry in various ways: Via simple placement (G4PVPlacement) Via multiple placements (as a parameterised volume, replica, division,...) There are different trade-offs when utilising placements, and parameterised volumes: Using placements means that no computation is needed to see each copy, but that each copy uses memory If memory is not an issue, then placements would be the fastest solution Otherwise a parameterised volume is a solution which will reduce the size of memory but will increase computation time Cours Geant4 @ Paris 2007 24

Assembling volumes (cont.) Memory is used in two ways: 1) First for the volumes themselves and also 2) for the voxel information that is used to optimise locating a point and deciding which volumes to intersect in a step computation. Implementing a geometry with a lot of volumes at the same level ( flat ) is possible in Geant4. It must be done with care in order to avoid requiring more memory than is available (in particular for the voxelisation information.) Parameters exist (smartless) that aid to tune the amount of memory required (See in Geometry 4: Geometry optimisation); G4LogicalVolume::SetSmartless(G4double); Cours Geant4 @ Paris 2007 25

Assembling volumes (cont.) For geometries that can be divided hierarchically it is better to put fewer volumes in one mother. For example six physical copies of the same sixth of a cylinder will consume less memory than a whole cylinder. This can be done easily only when the pieces can be subdivided, without subvolumes protruding from the parent. If possible, prefer replica to parameterised volume or division Replica can be used if the slices fill the whole mother Navigation in replica is faster than in parameterised volume Cours Geant4 @ Paris 2007 26

Verification Tools Switch on geometry checking in the G4LogicalVolume constructor Eliminating overlaps/protruding Several methods have been presented Visualization See in detail in Geometry 4: Geometry checking tools Cours Geant4 @ Paris 2007 27