GDML I/O for VecGeom Geometry Package

Dmitry Savin

August 11, 2018

Problem description

VecGeom [1] is a new software toolkit for geometry modeling, which aims to exploit fine-grained parallelism for computing and provide a standard for geometry description in a range of high energy physics toolkits including GeantV [2] and ROOT [3]. The Geometry Description Markup Language (GDML[4] is a specialized XML-based language designed as an application-independent readable persistent format for describing the geometries of detectors associated with physics measurements. Currently I/O of VecGeom geometry is possible by converting transiently ROOT geometry. We need to implement a standalone GDML I/O module to have geometry persistency without ROOT.

Methods

GDML is an XML schema, thus we can use standard tools for handling files and process the in-memory representation. Since the size of the files is relatively small and we need both reading and writing files, it is more convenient to work with the DOM XML representation. Also the validation of GDML files before processing allows to omit some checks, thus it is more convenient to use a validating XML parser. All the above motivates us to build the I/O on top of Xerces-C parser. The Xerces-C library is distributed under the Apache 2.0 license which coincides with the license of VecGeom.

The library is split into the backend, the frontend and the middleware. The Xerces-C backend is used to read GDML files into DomDocument objects. The middleware traverses the DomDocument to construct VecGeom geometry when loading, and visit all volumes in GeoManager to add them to the DomDocument when saving. The middleware was implemented starting with geometries consisting of a single volume. The frontend provides a single method to load the geometry from a gdml file without exposing the details of the implementation.

The progress was tracked by a set of test examples from a single sphere to the full CMS geometry. The test files are listed in the Figure 1 below. A dotted line indicates that a file was made by slightly modifying another. A solid line indicates that a file has GDML tags from another file and thus was processed after it. The files are split in groups: solids that have only several attributes; advanced solids that has a variable number a parameters and thus require child node in the description; Boolean made by combining other solids; definitions of parameters used further in the gdml file; materials that determine the contents of the volumes. The successfully parsed examples are colored in green, the examples with GDML volumes not fully supported by VecGeom are colored in blue, and the supported but not yet parsed examples are colored in red.

The backend is tested by comparing loaded to DOM and then saved back by Xerces-C files with the original ones. The middleware is tested by comparing loaded to VecGeom and then exported by ROOT files with the original ones.

Result

The module is incorporated in the main VecGeom repository. The relevant commits and merged requests are labeled with [VECGEOM-427]. To build it activate VecGeom cmake option GDML. Use ctest for testing. The Xerces-C dependency is built automatically if not found in the system. The volumes already supported by VecGeom are processed successfully. Those are enough to process the geometry of CMS LHC detector. The material information is stored in a separate structure but not used because VecGeom interface for querying materials in not defined yet.

Acknowledgements

Development sponsored by Google in Google Summer of Code 2018 under supervision of Andrei Gheata and Witold Pokorski.

Links

GDML I/O module in VecGeom main repository
Relevant merge requests
GSoC proposal

References

[1]   J. Apostolakis, M. Bandieramonte, G. Bitzes, R. Brun, P. Canal, F. Carminati, G. Cosmo, J. C. D. F. Licht, L. Duhem, V. D. Elvira, A. Gheata, S. Y. Jun, G. Lima, T. Nikitina, M. Novak, R. Sehgal, O. Shadura, and S. Wenzel, “Towards a high performance geometry library for particle-detector simulations,” Journal of Physics: Conference Series, vol. 608, no. 1, p. 012023, 2015.

[2]    G. Amadio, A. Ananya, J. Apostolakis, A. Arora, M. Bandieramonte, A. Bhattacharyya, C. Bianchini, R. Brun, P. Canal, F. Carminati, L. Duhem, D. Elvira, A. Gheata, M. Gheata, I. Goulas, R. Iope, S. Jun, G. Lima, A. Mohanty, T. Nikitina, M. Novak, W. Pokorski, A. Ribon, R. Sehgal, O. Shadura, S. Vallecorsa, S. Wenzel, and Y. Zhang, “Geantv: from cpu to accelerators,” Journal of Physics: Conference Series, vol. 762, no. 1, p. 012019, 2016.

[3]   R. Brun and F. Rademakers, “ROOT: An object oriented data analysis framework,” Nucl. Instrum. Meth., vol. A389, pp. 81–86, 1997.

[4]   R. Chytracek, J. McCormick, W. Pokorski, and G. Santin, “Geometry description markup language for physics simulation and analysis applications,” vol. 53, pp. 2892 – 2896, 11 2006.



Figure 1: Test files and dependencies between them