Presentation is loading. Please wait.

Presentation is loading. Please wait.

Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin

Similar presentations


Presentation on theme: "Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin"— Presentation transcript:

1 Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin
Geometry Description Markup Language and its application-specific bindings Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin CHEP06, Mumbai, India W. Pokorski - CERN Simulation Project

2 Outline Background GDML Schema GDML readers/writers Some examples
Conclusion W. Pokorski - CERN Simulation Project

3 GDML - Motivation simulation toolkits come with their native geometry description formats many (most?) of the users do not implement geometry in those formats users use their own geometry description formats providing more flexibility integral parts of experiment software frameworks cannot be easily exported in application independent way therefore GDML has been developed to have an application independent and flexible geometry format to be able to interchange geometry between different applications for the purpose of physics validation/comparison, visualization, debugging W. Pokorski - CERN Simulation Project

4 GDML design choice - why XML?
purpose of GDML is to describe data to provide persistent form of geometry data not procedural, but markup language must be easy to read and write no heavy I/O system to read GDML format must be application independent possibility to edit/read geometry files is an advantage XML file can be edited using any editor geometry can be modified easily must be easy to extend and be modular GDML designed as an application of XML W. Pokorski - CERN Simulation Project

5 GDML components GDML is defined through XML Schema (XSD)
XSD = XML based alternative to Document Type Definition (DTD) defines document structure and the list of legal elements XSD are in XML -> they are extensible GDML can be written by hand or generated automatically 'GDML writer' allows writing-out GDML file GDML needs 'reader' 'GDML reader' creates 'in-memory' representation of the geometry description user application (1) GDML writer GDML Schema GDML file GDML reader user application (2) W. Pokorski - CERN Simulation Project

6 GDML Schema defines document structure and the list of legal elements
materials material, isotope, element, mixture solids box, sphere, tube, cone, polycone, parallepiped, trapezoid, torus, polyhedra, hyperbolic tube, elliptical tube, ellipsoid boolean solids volumes assembly volumes and reflections replicas and divisions parameterised volumes (position, rotation and size) first implementation W. Pokorski - CERN Simulation Project

7 GDML document positions, rotations materials solids geometry tree
<?xml version="1.0" encoding="UTF-8"?> <gdml xsi:noNamespaceSchemaLocation="GDMLSchema/gdml.xsd"> <define> <position name="TrackerinWorldpos" unit="mm" x="0" y="0" z="100"/> </define> <materials> <material formula=" " name="Air" > <D value="1.290" unit="mg/cm3"/> <fraction n="0.7" ref="Nitrogen" /> <fraction n="0.3" ref="Oxygen" /> </material> </materials> <solids> <box lunit="mm" name="Tracker" x="50" y="50" z="50"/> </solids> <structure> <volume name="World" > <materialref ref="Air" /> <solidref ref="world" /> <physvol> <volumeref ref="Tracker" /> <positionref ref="TrackerinWorldpos"/> <rotationref ref="TrackerinWorldrot"/> </physvol> </volume> </structure> <setup name="Default" version="1.0" > <world ref="World" /> </setup> </gdml> positions, rotations materials solids geometry tree 'world' volume W. Pokorski - CERN Simulation Project

8 GDML reader give pointer to world volume reads geometry from GDML file and creates its application specific (ROOT or G4) representation in memory most logic in application-independent part light application-depended bindings Application binding (ROOT, G4) Application (ROOT, G4) create material, volume, etc… XML Engine (SAX) GDML Schema GDML file W. Pokorski - CERN Simulation Project

9 GDML writer User Application starting from 'in-memory' geometry tree (G4 or ROOT), generates the GDML file with that geometry application independent part generating XML containers for materials, solids, structure, etc 'light' application dependent bindings scanning the geometry tree and adding elements to the containers dump geometry Application binding (scanning tree) add volume, etc Document Builder write document GDML file W. Pokorski - CERN Simulation Project

10 CMS detector: G4->GDML->ROOT
~19000 physical volumes snapshot provided by R.Maunder thanks to Pedro Arce for help with running CMS simulation W. Pokorski - CERN Simulation Project

11 LHCb Detector: G4->GDML->ROOT
~5000 physical volumes snapshot provided by R.Maunder W. Pokorski - CERN Simulation Project

12 Using GDML with Geant4 to write: to read: instantiate GDML writer
#include "WriterG4/G4GDMLWriter.h" G4GDMLWriter g4writer("GDMLSchema/gdml.xsd", "g4test.gdml"); g4writer.DumpGeometryInfo(g4worldvolume); to read: SAXProcessor sxp; sxp.Initialize(); ProcessingConfigurator config; config.SetURI( "g4test.gdml" ); sxp.Configure( &config ); sxp.Run() fWorld = (G4VPhysicalVolume *) GDMLProcessor::GetInstance()->GetWorldVolume(); instantiate GDML writer pass the 'top' volume to the writer instantiate and configure the processor get pointer to 'top' volume W. Pokorski - CERN Simulation Project

13 GDML processing - performance
GDML G4reader/G4writer (C++) tested on complete LHCb and CMS geometries parts of ATLAS geometry problem with full ATLAS geometry - use of custom solids for LHCb geometry (~5000 physical volumes) writing out ~10 seconds (on P4 2.4GHz) reading in ~ 5 seconds file size ~2.7 Mb (~40k lines) for CMS geometry (~19000 physical volumes) writing out ~30 seconds reading in ~15 seconds file size ~7.9 Mb (~120k lines) W. Pokorski - CERN Simulation Project

14 GDML reader/writer in Python
Python - an interesting alternative to C++ for implementing the GDML processing code dealing with XML in Python much easier (less code needed) Python very good for 'glueing' different applications together very easy interaction with C++ objects through generic Python bindings (PyROOT + Reflex) used for G4->GDML->ROOT geometry exchange enables running Geant4 + GDML reader/writer + ROOT from common Python prompt W. Pokorski - CERN Simulation Project

15 GDML for ROOT (in Python)
Python SAX parser import xml.sax import ROOT import GDMLContentHandler ROOT.gSystem.Load("libGeom") geomgr = ROOT.TGeoManager("World","GDMLGeo") gdmlhandler = GDMLContentHandler.GDMLContentHandler() xml.sax.parse('test.gdml',gdmlhandler) geomgr.SetTopVolume(gdmlhandler.WorldVolume()) geomgr.CloseGeometry() gdmlhandler.WorldVolume().Draw() PyROOT GDML-specific parser extension Standard TGeo GDML parsing get world volume from GDMLContentHandler W. Pokorski - CERN Simulation Project

16 GDML facilitates physics validation
we want to compare Geant4 with FLUKA in the case of Atlas TileCal testbeam we need a common geometry source we have G4 geometry 'in-memory' we export GDML GDML binding added to FluGG (Fluka Geant4 Geometry interface) FLUKA (FLUGG) job run with GDML geometry GDML solves the problem of reimplementing geometry W. Pokorski - CERN Simulation Project

17 GDML as primary geometry source
Linear Collider - Jeremy McCormick, SLAC Linear Collider Detector Description (LCDD) extends GDML with Geant4-specific information (sensitive detectors, physics cuts, etc) GDML/LCDD is generic and flexible several different full detector design concepts, including SiD, GLD, and LDC, where simulated using the same application SiD LDC GLD W. Pokorski - CERN Simulation Project

18 GDML as primary geometry source
Space Research - Giovanni Santin, ESA all geometry models for Geant4 component degradation studies (JWST, ConeXpress,...) GRAS (Geant4 Radiation Analysis for Space) enables flexible geometry configuration and changes main candidate for CAD to G4 exchange format ConeXpress JWST NIRSpec W. Pokorski - CERN Simulation Project

19 GDML as primary geometry source
Anthropomorphic Phantom Project - Giorgio Guerrieri, Maria Grazia Pia, Susanna Guatelli, INFN Modelization of the human body and anatomy for radioprotection studies no hard-coded geometry, flexible configuration W. Pokorski - CERN Simulation Project

20 Future developement support for new solids handling of multiple files
'twisted' solids recently added to G4 handling of multiple files enable splitting of GDML description into several files (containing different parts of the detector, etc) W. Pokorski - CERN Simulation Project

21 Conclusions GDML is an application-independent, extensible geometry description language GDML proving very useful as the geometry interchange format geometries can be extracted from experiment-specific frameworks and then used in generic applications physics validation geometries can be moved between Geant4 and ROOT geometry visualization using ROOT GDML is used by several Geant4 users as the primary geometry description language avoids hard-coding the geometry allows running easily the same application with several different geometries W. Pokorski - CERN Simulation Project


Download ppt "Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin"

Similar presentations


Ads by Google