35
Geometry III Geometry III Makoto Asai (SLAC) Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 Tutorial Course Geant4 v8.2p01

Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

  • View
    232

  • Download
    5

Embed Size (px)

Citation preview

Page 1: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry IIIGeometry III

Makoto Asai (SLAC)Makoto Asai (SLAC)

Geant4 Tutorial CourseGeant4 Tutorial Course

Geant4 v8.2p01

Page 2: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 22

ContentsContents

Divided volumeDivided volume

Geometry checking tools Geometry checking tools

Basics of TouchableBasics of Touchable

RegionRegion

GDMLGDML

Page 3: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 33

Physical volumePhysical volume Various ways of placementVarious ways of placement

Simple placement volumeSimple placement volume

Parameterized volumeParameterized volume

Replicated volumeReplicated volume

Divided volumeDivided volume

Nested-parameterization volumeNested-parameterization volume

Reflected volumeReflected volume

Assembly volumeAssembly volume

Detail is given in later talk.Detail is given in later talk.

Page 4: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Divided volumeDivided volume

Page 5: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 55

Parameterized Physical VolumesParameterized Physical Volumes

4

01

2

3

56

User should implement a class derived from User should implement a class derived from G4VPVParameterisationG4VPVParameterisation abstract base class and define following abstract base class and define following as a function of copy numberas a function of copy number where it is positioned (transformation, rotation)where it is positioned (transformation, rotation)

Optional:Optional: the size of the solid (dimensions)the size of the solid (dimensions) the type of the solid, material, sensitivity, vis attributesthe type of the solid, material, sensitivity, vis attributes

All daughters must be fully contained in the mother.All daughters must be fully contained in the mother. Daughters should not overlap to each other.Daughters should not overlap to each other. Limitations:Limitations:

Applies to simple CSG solids onlyApplies to simple CSG solids only Granddaughter volumes allowed only for special casesGranddaughter volumes allowed only for special cases Consider parameterised volumes as “leaf” volumesConsider parameterised volumes as “leaf” volumes

Typical use-casesTypical use-cases Complex detectors Complex detectors

with large repetition of volumes, regular or irregularwith large repetition of volumes, regular or irregular Medical applicationsMedical applications

the material in animal tissue is measured as cubes with varying the material in animal tissue is measured as cubes with varying materialmaterial

Page 6: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 66

Replicated VolumesReplicated Volumes The mother volume is The mother volume is completely filledcompletely filled with with

replicas, all of which are the replicas, all of which are the same size (width)same size (width) and and

shapeshape. .

Replication may occur along:Replication may occur along:

Cartesian axes (X, Y, Z) – slices are considered Cartesian axes (X, Y, Z) – slices are considered

perpendicular to the axis of replicationperpendicular to the axis of replication

Coordinate system at the center of each Coordinate system at the center of each

replicareplica

Radial axis (Rho) – cons/tubs sections centered Radial axis (Rho) – cons/tubs sections centered

on the origin and un-rotatedon the origin and un-rotated

Coordinate system same as the motherCoordinate system same as the mother

Phi axis (Phi) – phi sections or wedges, of Phi axis (Phi) – phi sections or wedges, of

cons/tubs formcons/tubs form

Coordinate system rotated such as that the X Coordinate system rotated such as that the X

axis bisects the angle made by each wedgeaxis bisects the angle made by each wedge

a daughter logical volume to be replicated

mother volume

Page 7: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 77

G4PVDivisionG4PVDivision G4PVDivision is a special kind of G4PVParameterised.G4PVDivision is a special kind of G4PVParameterised.

G4VPVParameterisation is G4VPVParameterisation is automatically generatedautomatically generated

according to the parameters given in G4PVDivision.according to the parameters given in G4PVDivision.

G4PVDivision is similar to G4PVReplica butG4PVDivision is similar to G4PVReplica but

It currently It currently allows gaps in betweenallows gaps in between mother and mother and

daughter volumesdaughter volumes

We are extending G4PVDivision to allow gaps We are extending G4PVDivision to allow gaps

between daughters, and also gaps on side walls. between daughters, and also gaps on side walls.

We plan to release this extension in near future.We plan to release this extension in near future.

Shape of all daughter volumes must be same shape as Shape of all daughter volumes must be same shape as

the mother volume.the mother volume.

G4VSolid (to be assigned to the daughter logical G4VSolid (to be assigned to the daughter logical

volume) must be the same type, but different volume) must be the same type, but different

object.object.

Replication must be aligned along one axis.Replication must be aligned along one axis.

If your geometry does not have gaps, use If your geometry does not have gaps, use G4ReplicaG4Replica. .

For identical geometry, navigation of G4Replica is For identical geometry, navigation of G4Replica is

faster.faster.

mother volume

Page 8: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 88

nDivisions

G4PVDivision - 1G4PVDivision - 1G4PVDivision(const G4String& pName, G4PVDivision(const G4String& pName,

G4LogicalVolume* pDaughterLogical, G4LogicalVolume* pDaughterLogical,

G4LogicalVolume* pMotherLogical, G4LogicalVolume* pMotherLogical,

const EAxis pAxisconst EAxis pAxis,,

const G4int nDivisionsconst G4int nDivisions, // number of division is given, // number of division is given

const G4double offsetconst G4double offset); );

The size (width) of the daughter volume is calculated asThe size (width) of the daughter volume is calculated as( (size of mother) - offset ) / nDivisions

offset

Page 9: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 99

G4PVDivision - 2G4PVDivision - 2G4PVDivision(const G4String& pName, G4PVDivision(const G4String& pName,

G4LogicalVolume* pDaughterLogical, G4LogicalVolume* pDaughterLogical,

G4LogicalVolume* pMotherLogical, G4LogicalVolume* pMotherLogical,

const EAxis pAxisconst EAxis pAxis,,

const G4double widthconst G4double width, // width of daughter volume is given, // width of daughter volume is given

const G4double offsetconst G4double offset); );

The number of daughter volumes is calculated asThe number of daughter volumes is calculated asint( ( (size of mother) - offset ) / width ) As many daughters as width and offset allow

offsetwidth

Page 10: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1010

nDivisions

width

G4PVDivision - 3G4PVDivision - 3G4PVDivision(const G4String& pName, G4PVDivision(const G4String& pName,

G4LogicalVolume* pDaughterLogical, G4LogicalVolume* pDaughterLogical,

G4LogicalVolume* pMotherLogical, G4LogicalVolume* pMotherLogical,

const EAxis pAxisconst EAxis pAxis,,

const G4int nDivisionsconst G4int nDivisions, ,

const G4double widthconst G4double width, // both number of division and width are , // both number of division and width are givengiven

const G4double offsetconst G4double offset); );

nDivisionsnDivisions daughters of daughters of width width thickness thickness

offset

Page 11: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1111

G4PVDivisionG4PVDivision G4PVDivision currently supports following shapes / axes.G4PVDivision currently supports following shapes / axes.

G4Box : kXAxis, kYAxis, kZAxis G4Box : kXAxis, kYAxis, kZAxis G4Tubs : kRho, kPhi, kZAxis G4Tubs : kRho, kPhi, kZAxis G4Cons : kRho, kPhi, kZAxis G4Cons : kRho, kPhi, kZAxis G4Trd : kXAxis, kYAxis, kZAxis G4Trd : kXAxis, kYAxis, kZAxis G4Para : kXAxis, kYAxis, kZAxis G4Para : kXAxis, kYAxis, kZAxis G4Polycone : kRho, kPhi, kZAxisG4Polycone : kRho, kPhi, kZAxis

kZAxis - the number of divisions has to be the same as solid kZAxis - the number of divisions has to be the same as solid sections, (i.e. numZPlanes-1), the width will sections, (i.e. numZPlanes-1), the width will notnot be taken into be taken into account. account.

G4Polyhedra : kRho, kPhi, kZAxis G4Polyhedra : kRho, kPhi, kZAxis kPhi - the number of divisions has to be the same as solid sides, (i.e. kPhi - the number of divisions has to be the same as solid sides, (i.e.

numSides), the width will numSides), the width will notnot be taken into account. be taken into account. kZAxis - the number of divisions has to be the same as solid kZAxis - the number of divisions has to be the same as solid

sections, (i.e. numZPlanes-1), the width will sections, (i.e. numZPlanes-1), the width will not not be taken into be taken into account. account.

In the case of division along kRho of G4Cons, G4Polycone, G4Polyhedra, if In the case of division along kRho of G4Cons, G4Polycone, G4Polyhedra, if width is provided, it is taken as the width at the -Z radius; the width at width is provided, it is taken as the width at the -Z radius; the width at other radii will be scaled to this one.other radii will be scaled to this one.

Page 12: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry checking toolsGeometry checking tools

Page 13: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1313

Debugging geometriesDebugging geometries An An protrudingprotruding volume is a contained daughter volume which actually volume is a contained daughter volume which actually

protrudesprotrudes from its mother volume. from its mother volume.

Volumes are also often positioned in a same volume with the intent of not Volumes are also often positioned in a same volume with the intent of not

provoking intersections between themselves. When volumes in a common provoking intersections between themselves. When volumes in a common

mother actually mother actually intersect themselvesintersect themselves are defined as are defined as overlappingoverlapping..

Geant4 Geant4 does not allowdoes not allow for malformed geometries, for malformed geometries, neither protruding nor neither protruding nor

overlappingoverlapping. .

The behavior of navigation is unpredictable for such cases.The behavior of navigation is unpredictable for such cases.

The problem of detecting overlaps between volumes is bounded by the The problem of detecting overlaps between volumes is bounded by the

complexity of the solid models description.complexity of the solid models description.

Utilities are provided for detecting wrong positioningUtilities are provided for detecting wrong positioning

Optional checks at constructionOptional checks at construction

Kernel run-time commandsKernel run-time commands

Graphical tools (DAVID, OLAP)Graphical tools (DAVID, OLAP)

protruding

overlapping

Page 14: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1414

Optional checks at constructionOptional checks at construction Constructors of Constructors of G4PVPlacementG4PVPlacement and and G4PVParameterisedG4PVParameterised have an have an

optional argument “pSurfChk”.optional argument “pSurfChk”.

G4PVPlacement(G4RotationMatrix* pRot,G4PVPlacement(G4RotationMatrix* pRot,const G4ThreeVector &tlate, const G4ThreeVector &tlate, G4LogicalVolume *pDaughterLogical, G4LogicalVolume *pDaughterLogical, const G4String &pName, const G4String &pName, G4LogicalVolume *pMotherLogical, G4LogicalVolume *pMotherLogical, G4bool pMany, G4int pCopyNo, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=falseG4bool pSurfChk=false); );

If this flag is true, overlap check is done at the construction.If this flag is true, overlap check is done at the construction. Some number of points are randomly sampled on the surface of Some number of points are randomly sampled on the surface of

creating volume.creating volume. Each of these points are examinedEach of these points are examined

If it is outside of the mother volume, orIf it is outside of the mother volume, or If it is inside of already existing other volumes in the same If it is inside of already existing other volumes in the same

mother volume.mother volume. This check requires lots of CPU time, but it is worth to try at least once This check requires lots of CPU time, but it is worth to try at least once

when you implement your geometry of some complexity.when you implement your geometry of some complexity.

Page 15: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1515

Debugging run-time commandsDebugging run-time commands Built-in run-time commands to activate verification tests for the Built-in run-time commands to activate verification tests for the

user geometry are defineduser geometry are defined to start verification of geometry for overlapping regions based to start verification of geometry for overlapping regions based

on a standard grid setup, limited to the first depth levelon a standard grid setup, limited to the first depth level

geometry/test/rungeometry/test/run or or geometry/test/grid_testgeometry/test/grid_test applies the grid test to all depth levels (may require lots of CPU applies the grid test to all depth levels (may require lots of CPU

time!)time!)

geometry/test/recursive_testgeometry/test/recursive_test shoots lines according to a cylindrical patternshoots lines according to a cylindrical pattern

geometry/test/cylinder_testgeometry/test/cylinder_test to shoot a line along a specified direction and positionto shoot a line along a specified direction and position

geometry/test/line_testgeometry/test/line_test to specify position for the to specify position for the line_testline_test

geometry/test/positiongeometry/test/position to specify direction for the to specify direction for the line_testline_test

geometry/test/directiongeometry/test/direction

Page 16: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1616

Debugging run-time commandsDebugging run-time commands Example layout:Example layout:

GeomTest: no daughter volume extending outside mother detected.GeomTest: no daughter volume extending outside mother detected.

GeomTest Error: Overlapping daughter volumesGeomTest Error: Overlapping daughter volumes

The volumes Tracker[0] and Overlap[0],The volumes Tracker[0] and Overlap[0],

both daughters of volume World[0],both daughters of volume World[0],

appear to overlap at the following points in global coordinates: (list appear to overlap at the following points in global coordinates: (list truncated)truncated)

length (cm) ----- start position (cm) ----- ----- end position (cm) -----length (cm) ----- start position (cm) ----- ----- end position (cm) -----

240 -240 -145.5 -145.5 0 -145.5 -145.5240 -240 -145.5 -145.5 0 -145.5 -145.5

Which in the mother coordinate system are:Which in the mother coordinate system are:

length (cm) ----- start position (cm) ----- ----- end position (cm) -----length (cm) ----- start position (cm) ----- ----- end position (cm) -----

. . .. . .

Which in the coordinate system of Tracker[0] are:Which in the coordinate system of Tracker[0] are:

length (cm) ----- start position (cm) ----- ----- end position (cm) -----length (cm) ----- start position (cm) ----- ----- end position (cm) -----

. . .. . .

Which in the coordinate system of Overlap[0] are:Which in the coordinate system of Overlap[0] are:

length (cm) ----- start position (cm) ----- ----- end position (cm) -----length (cm) ----- start position (cm) ----- ----- end position (cm) -----

. . .. . .

Page 17: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1717

Debugging tools: DAVIDDebugging tools: DAVID DAVID is a graphical debugging tool for DAVID is a graphical debugging tool for

detecting potential intersections of volumesdetecting potential intersections of volumes Accuracy of the graphical representation can Accuracy of the graphical representation can

be tuned to the exact geometrical description.be tuned to the exact geometrical description. physical-volume surfaces are physical-volume surfaces are

automatically decomposed into 3D automatically decomposed into 3D polygonspolygons

intersections of the generated polygons intersections of the generated polygons are parsed.are parsed.

If a polygon intersects with another one, If a polygon intersects with another one, the physical volumes associated to these the physical volumes associated to these polygons are highlighted in color (polygons are highlighted in color (redred is is the default).the default).

DAVID can be downloaded from the Web as DAVID can be downloaded from the Web as external tool for Geant4external tool for Geant4 http://geant4.kek.jp/~tanaka/http://geant4.kek.jp/~tanaka/

Page 18: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1818

Debugging tools: OLAPDebugging tools: OLAP Stand-alone batch applicationStand-alone batch application

Provided as extended exampleProvided as extended example Can be combined with a graphical environment and GUICan be combined with a graphical environment and GUI

Page 19: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 1919

Material scannerMaterial scanner Measures material thickness in units of geometrical length, radiation Measures material thickness in units of geometrical length, radiation

length and interaction length.length and interaction length.

It can be region sensitive, so that you can measure the thickness It can be region sensitive, so that you can measure the thickness

of one particular region.of one particular region.

/control/matScan/control/matScan

scan - Start material scanning.scan - Start material scanning.

theta - Define theta range.theta - Define theta range.

phi - Define phi range.phi - Define phi range.

singleMeasure - Measure thickness for one particular direction.singleMeasure - Measure thickness for one particular direction.

eyePosition - Define the eye position.eyePosition - Define the eye position.

regionSensitive - Set region sensitivity.regionSensitive - Set region sensitivity.

region - Define region name to be scanned.region - Define region name to be scanned.

Page 20: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Basics of TouchableBasics of Touchable

Page 21: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2121

TouchableTouchable Suppose a geometry is made of Suppose a geometry is made of

4x5 voxels.4x5 voxels. and it is implemented by and it is implemented by two two

levels of replicalevels of replica.. In reality, there is In reality, there is only oneonly one

physical volumephysical volume object object for each for each

level. Its position is parameterized level. Its position is parameterized

by its copy number.by its copy number. To get the copy number of each To get the copy number of each

level,level, Use touchableUse touchable to get the copy to get the copy

number of each level.number of each level.

CopyNo = 0

CopyNo = 1

CopyNo = 2

CopyNo = 3

0

0

0

0

1

1

1

1

2

2

2

2

3

3

3

3

4

4

4

4

G4VTouchable has a method G4VTouchable has a method

GetCopyNumber(G4int nLevel=0)GetCopyNumber(G4int nLevel=0) nLevel = 0 : returns the copy number of the bottom levelnLevel = 0 : returns the copy number of the bottom level nLevel = 1 : returns the copy number of the mother volumenLevel = 1 : returns the copy number of the mother volume nLevel = 2 : returns the copy number of the grandmother volume, etc.nLevel = 2 : returns the copy number of the grandmother volume, etc.

A touchable object is associated with A touchable object is associated with G4StepPointG4StepPoint, i.e. two points for a step., i.e. two points for a step. Details of how to use a touchable will be given at Scoring II talk.Details of how to use a touchable will be given at Scoring II talk.

Page 22: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

RegionRegion

Page 23: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2323

RegionRegion A region may have its uniqueA region may have its unique

Production thresholds (cuts)Production thresholds (cuts) If a region in the mass geometry does not have its own If a region in the mass geometry does not have its own

production thresholds, those of the default region are used production thresholds, those of the default region are used (i.e., may not be those of the parent region).(i.e., may not be those of the parent region).

User limitsUser limits Artificial limits affecting to the tracking, e.g. max step length, Artificial limits affecting to the tracking, e.g. max step length,

max number of steps, min kinetic energy left, etc.max number of steps, min kinetic energy left, etc. You can set user limits directly to logical volume as well. If both You can set user limits directly to logical volume as well. If both

logical volume and associated region have user limits, those of logical volume and associated region have user limits, those of logical volume wins.logical volume wins.

User region informationUser region information E.g. to implement a fast Boolean method to identify the nature E.g. to implement a fast Boolean method to identify the nature

of the region.of the region. Fast simulation managerFast simulation manager Regional user stepping action (Regional user stepping action (new with version 9.0new with version 9.0))

Please note :Please note : World logical volume is recognized as World logical volume is recognized as the default regionthe default region. User is . User is

notnot allowed to define a region to the world logical volume. allowed to define a region to the world logical volume.

Page 24: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2424

World Volume - Default Region

Root logical volumeRoot logical volume A logical volume can be a region. A logical volume can be a region.

More than one logical volumes may More than one logical volumes may belong to a region.belong to a region.

A region is a part of the geometrical A region is a part of the geometrical hierarchy, i.e. a shierarchy, i.e. a set of geometry et of geometry volumes, typically of a sub-system.volumes, typically of a sub-system.

A A logical volumelogical volume becomes a becomes a root root logical volumelogical volume once a region is once a region is assigned to it.assigned to it. All daughter volumes belonging All daughter volumes belonging

to the root logical volume share to the root logical volume share the same region, unless a the same region, unless a daughter volume itself becomes daughter volume itself becomes to another root.to another root.

Important restriction :Important restriction : NoNo logical volume can be shared logical volume can be shared

by more than one regions, by more than one regions, regardless of root volume or not.regardless of root volume or not.

Root logical - Region A

Root logical - Region B

Page 25: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2525

G4RegionG4Region A region is instantiated and defined byA region is instantiated and defined by

G4Region* aRegion = new G4Region(“region_name”);

aRegion->AddRootLogicalVolume(aLogicalVolume);

Region propagates down to all geometrical hierarchy until the

bottom or another root logical volume.

Production thresholds (cuts) can be assigned to a region byProduction thresholds (cuts) can be assigned to a region by

G4Region* aRegionG4Region* aRegion

= G4RegionStore::GetInstance()->GetRegion= G4RegionStore::GetInstance()->GetRegion(“region_name”);

G4ProductionCuts* cuts = new G4ProductionCuts;G4ProductionCuts* cuts = new G4ProductionCuts;

cuts->SetProductionCut(cuts->SetProductionCut(cutValuecutValue););

aRegion->SetProductionCuts(cuts);aRegion->SetProductionCuts(cuts);

Page 26: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

GDMLGDML

Page 27: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2727

GDML componentsGDML components GDML is defined through XML Schema (XSD) GDML is defined through XML Schema (XSD)

XSD = XML based alternative to XSD = XML based alternative to Document Type Definition (DTD) Document Type Definition (DTD)

defines document structure and the list of defines document structure and the list of legal elementslegal elements

XSD are in XML -> they are extensibleXSD are in XML -> they are extensible

GDML can be written by hand or generated GDML can be written by hand or generated automatically automatically 'GDML writer' allows writing-out GDML file'GDML writer' allows writing-out GDML file

GDML needs 'reader'GDML needs 'reader' 'GDML reader' creates 'in-memory' 'GDML reader' creates 'in-memory'

representation of the geometry representation of the geometry descriptiondescription

GDMLSchema

GDML file

user application (1)

GDML writer

GDML reader

user application (2)

Page 28: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2828

GDML Geant4 bindingGDML Geant4 binding package available from package available from www.cern.ch/gdmlwww.cern.ch/gdml

latest release GDML_2_8_0 tested with G4.8.1.p01latest release GDML_2_8_0 tested with G4.8.1.p01 autoconf/make based build systemautoconf/make based build system requires XercesC parser (tested with versions 2.3.0 and requires XercesC parser (tested with versions 2.3.0 and

2.7.0)2.7.0) could be (in the future) integrated more with G4 distributioncould be (in the future) integrated more with G4 distribution

optional package to be linked against during buildoptional package to be linked against during build GDMLDetectorConstruction class providedGDMLDetectorConstruction class provided geometry exportation in GDML steered by UI command?geometry exportation in GDML steered by UI command?

Page 29: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 2929

CMS detector: G4->GDML->ROOTCMS detector: G4->GDML->ROOT

snapshot provided by R.Maunder

thanks to Pedro Arce for help with running CMS

simulation

~19000 physical volumes

Page 30: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3030

LHCb Detector: G4->GDML->ROOTLHCb Detector: G4->GDML->ROOT

snapshot provided by R.Maunder

~5000 physical volumes

Page 31: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3131

Using GDML with Geant4Using GDML with Geant4to write:to write:

#include "WriterG4/G4GDMLWriter.h"#include "WriterG4/G4GDMLWriter.h"

G4GDMLWriter g4writer("GDMLSchema/gdml.xsd", "g4test.gdml");G4GDMLWriter g4writer("GDMLSchema/gdml.xsd", "g4test.gdml");

g4writer.DumpGeometryInfo(g4worldvolume);g4writer.DumpGeometryInfo(g4worldvolume);

to read:to read:

SAXProcessor sxp;SAXProcessor sxp;sxp.Initialize();sxp.Initialize();ProcessingConfigurator config;ProcessingConfigurator config;config.SetURI( "g4test.gdml" );config.SetURI( "g4test.gdml" );sxp.Configure( &config );sxp.Configure( &config );

sxp.Run()sxp.Run()

fWorld = (G4VPhysicalVolume *)fWorld = (G4VPhysicalVolume *)GDMLProcessor::GetInstance()->GetWorldVolume();GDMLProcessor::GetInstance()->GetWorldVolume();

instantiate GDML writer

pass the 'top' volume to the writer

instantiate and configure the processor

get pointer to 'top' volume

GDML example in examples/extended/gdml

Page 32: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3232

GDML processing - performanceGDML processing - performance GDML G4reader/G4writer (C++) tested on GDML G4reader/G4writer (C++) tested on

complete LHCb and CMS geometriescomplete LHCb and CMS geometries parts of ATLAS geometryparts of ATLAS geometry

problem with full ATLAS geometry - use of custom problem with full ATLAS geometry - use of custom solidssolids

for LHCb geometry for LHCb geometry (~5000 logical volumes)(~5000 logical volumes) writing out ~10 seconds (on P4 2.4GHz)writing out ~10 seconds (on P4 2.4GHz) reading in ~ 5 secondsreading in ~ 5 seconds file size ~2.7 Mb (~40k lines)file size ~2.7 Mb (~40k lines)

for CMS geometry for CMS geometry (~19000 logical volumes)(~19000 logical volumes) writing out ~30 secondswriting out ~30 seconds reading in ~15 secondsreading in ~15 seconds file size ~7.9 Mb (~120k lines)file size ~7.9 Mb (~120k lines)

Page 33: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3333

GDML as primary geometry sourceGDML as primary geometry source Linear Collider - Jeremy McCormick, SLACLinear Collider - Jeremy McCormick, SLAC

Linear Collider Detector Description (LCDD) Linear Collider Detector Description (LCDD) extends GDML with Geant4-specific information extends GDML with Geant4-specific information (sensitive detectors, physics cuts, etc)(sensitive detectors, physics cuts, etc)

GDML/LCDD is generic and flexibleGDML/LCDD is generic and flexible several different full detector design several different full detector design

concepts, including SiD, GLD, and LDC, concepts, including SiD, GLD, and LDC, where simulated using the same applicationwhere simulated using the same application

SiD

GLDLDC

Page 34: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3434

GDML as primary geometry sourceGDML as primary geometry source Space Research - Giovanni Space Research - Giovanni

Santin, ESASantin, ESA all geometry models for all geometry models for

Geant4Geant4 component degradation component degradation

studies (JWST, studies (JWST, ConeXpress,...)ConeXpress,...)

GRAS (Geant4 Radiation GRAS (Geant4 Radiation Analysis for Space)Analysis for Space)

enables flexible geometry enables flexible geometry configuration and changesconfiguration and changes

main candidate for CAD to main candidate for CAD to G4 exchange formatG4 exchange format

ConeXpress

JWST NIRSpec

Page 35: Geometry III Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01

Geometry III - M.Asai (SLAC)Geometry III - M.Asai (SLAC) 3535

GDML as primary geometry sourceGDML as primary geometry source Anthropomorphic Phantom Anthropomorphic Phantom

Project - Giorgio Guerrieri, Project - Giorgio Guerrieri, Maria Grazia Pia, Susanna Maria Grazia Pia, Susanna Guatelli, INFNGuatelli, INFN Modelization of the Modelization of the

human body and human body and anatomy for anatomy for radioprotection studiesradioprotection studies

no hard-coded geometry, no hard-coded geometry, flexible configurationflexible configuration