AIDA project: SFT group develops a new generation Geometry Toolkit
The design of the Detector Description Toolkit and the Unified Solids Library has been prototyped for some of the main key aspects. This prototype served the purpose of testing some of the design ideas and implementation choices. The code is available the AIDA WP2 SVN repository. Initial documentation and links to the code repositories can be found in the dedicated webpages for the Geometry Toolkit and for the Unified Solids Library.Modern HEP detectors are highly complex utilising a wide variety of different detection techniques; those operating at colliders usually have a hermetic geometry surrounding the interaction point. Typically they comprise silicon and gaseous tracking detectors, immersed in a magnetic field, combined with high granularity calorimetry. SFT group has been working on the development of a new generation of software geometry modellers that are used to describe the geometry and material composition, and which are used as the basis for tracking particles through the various detector layers. Firstly we describe the Geometry Toolkit, which is a general software framework that provides consistent views of detector setups for use in all types of data processing applications, including simulation, reconstruction and analysis. Following this, we describe the development of a new common library of 3D geometrical primitives (i.e. geometrical shapes), which provides the building blocks for modelling complex detector geometries.
The work is being carried out in the contet of the Task 2.2 of the AIDA EU-FP7 project. Its goal is to develop a coherent set of common software tools for the description of HEP detectors from a single source of information and to provide appropriate and consistent views to the simulation, reconstruction and analysis of data applications.
The Detector Description Toolkit
Detector description not only includes the geometry and material information, it comprises as well the parameters specific to the detection techniques, the alignment and calibration, the readout structures, and the slowly changing conditions data such as temperature, pressure, high-voltage status, etc. The aim is create an overall consistent set of tools by reusing existing software components (e.g. Geant4 and ROOT geometry packages) and complete the toolkit with any missing elements in order to get a fully consistent set of tools. Lessons from the LHC experiments teach us that having a more coherent set of tools is particularly important later in the experiment life cycle, in which the detector data will be stored in the so-called ‘conditions database’ that will be able to deliver a valid set of data for each moment in the lifetime of a detector. These data can fully describe and qualify the detecting apparatus and are used to interpret the event or collision data.
The architecture overview of the toolkit is shown in Figure 1. It shows the main components of the toolkit and their interfaces to the end-user applications such as the simulation, reconstruction, alignment and visualization. The central element of the toolkit is the so-called generic detector description model. This is an in-memory model, i.e., a set of C++ objects holding the data describing the geometry and other information of the detector. The rest of the toolkit is just a set of tools and interfaces to input or output the information from this generic detector model.
Fig 1. Main Components of the Detector Description Toolkit.
Besides the basic tools and interfaces of the toolkit we also intend to deliver a number of specific software modules that describe concrete detector types that can easily be configured and are ready to be used by experimental communities that need to develop quickly new detector designs to be evaluated. This library or collection of modules can also be used as examples for other users to facilitate the development of their specific detector descriptions. In addition to developing the different parts of the toolkit that should facilitate the creation of new detector models by end-users, a library of configurable detector models (detector constructors) for various common detection technologies has been integrated. This will range from silicon based tracking detectors to calorimeter detectors. The idea is that for quick detector studies a rich set of generic models would be available and ready for use. The design is strongly driven by the easy use of the toolkit. The end-user will just need to modify the compact description using these detector types to start building a new detector concept by specifying physical dimensions, materials and a number of basic parameters. The challenge is to ask users for minimal information and minimal specific code in order to achieve the desired result.
The design of the Geometry Toolkit is shaped on the experience of detector description systems that have been implemented for the LHC experiments and more particularly the LHCb experiment as well as the lessons gained from the various implementations of geometry description tools developed for the Linear Collider community. In all cases it turns out that designing a coherent set of tools, with most of the basic components already existing in one form or another, is a great opportunity for getting the best of all existing solutions. A main goal was to re-use existing software components and not re-inventing everything from scratch.
Unified Solids - New software library for modeling of solids in Geant4 and ROOT
The geometrical models in Geant4 and ROOT are used to describe the experimental setups in simulation or reconstruction programs and include the implementation of geometrical solid primitives as building blocks for the description of complex detector setups. These include a large collection of 3D primitives, ranging from simple shapes like boxes, tubes or cones to more complex ones, also allowing for Boolean combinations among these.
From experience from the past decade, it is estimated that a good fraction (not less than 70-80%) of the effort spent on code maintenance in the geometry modeler is devoted to improve the implementation of the geometrical primitives. This code, written in C++, provides all the algorithms required for tracking efficiently particles in detectors simulation with high level of precision.
In order to reduce the effort required for support and maintenance, and converge on a unique solution based on high quality code, a project to create a new software library of geometrical primitives has started within the EU-AIDA initiative. The new library is meant to unify and in future replace the existing implementations in Geant4 and ROOT, improving wherever possible both reliability and CPU performance of the implemented algorithms. The new library is realized as a standalone package, not depending on any external package, and the interfaces have been defined by combining the APIs provided in Geant4 and ROOT to guarantee full compatibility. Simple adapter classes have been implemented to allow the use of the new optimized code from Geant4 and ROOT.
Reviewed implementation of several solids using existing algorithms, Box, Orb, Trapezoid, Sphere, Tube, Cone, Generic trapezoid, Tetrahedron, Arbitrary Trapezoid, have been already completed. In some cases, new algorithms have been designed and implemented, as for the case of “Polycone”, a geometrical shape rather heavily used in most experimental setups, and for which considerable performance improvement has been achieved.
“Multi-Union” is a new structure implementing a composite set of solids (several or many). It differentiates from the simple technique based on Boolean union of solids traditionally implemented in Geant4 or ROOT, with the aim to provide excellent scalability on the number of constituent solids. Multi-Union introduces the use of voxelization as optimization technique to improve speed and scalability; this consists in adopting 3D space partition for fast localization of the components, and allows for the ability to determine which constituent solids are localized in a determined portion of the partitioned space, which is candidate for intersection with the particle being tracked. This allows to achieve logarithmic scalability vs. linear provided with the old algorithms, resulting in significant performance speedup especially for the case where a large number of constituent solids is considered.
The new library also provides a new implementation of Tessellated Solid, originally implemented in Geant4. A Tessellated Solid consists in a composition of connected triangular and quadrangular facets forming any kind of regular or irregular shape as a closed solid. The original implementation suffered of low performance, mostly due to the fact that no spatial optimization for the composing facets was used. The new implementation adopts spatial partitioning for the facets into 3D grid of voxels in a similar way characterizing the Multi-Union. Such a technique allowed reaching a factor thousands speedup for relatively complex structures of the order of 100k facets, such as the LHCb VELO foil description imported from CAD drawings and used as test case. The memory footprint for the Tessellated Solid has also been reduced by roughly 20-30%. Thanks to all this, it is now possible to use tessellated geometries for tuning the precision in simulation by increasing the meshes resolution, something that was not possible before.
One fundamental aspect of the procedure adopted for implementing the new library was to put in place a comprehensive testing suite, to systematically monitor correctness and performance of the new algorithms in comparison to the corresponding implementations in Geant4 and ROOT. Tests to verify the scalability of the algorithms as a function of the complexity of the geometrical setup have been also deployed. These include the development of a tool, Unified Solid Batch Test, designed to measure computing performance and compare the results, and used to identify differences between implementations and identify areas of improvement. Some existing tests from the Geant4 and ROOT suites are also used and adapted. The Unified Solid Batch Test allows concurrent testing of the new code in parallel with existing Geant4 and ROOT algorithms and can compare performance and output values in either numerical or visual form. The testing suite has also become useful to identify potential problems in the existing Geant4 and ROOT geometry code.
It is in plan to complete the implementation of the remaining shapes needed to be included in the Unified Solids library. Adapter classes have been implemented, allowing for easy future integration of Unified Solids in Geant4 and ROOT in their next versions.
Outlook
The design of the Detector Description Toolkit and the Unified Solids Library has been prototyped for some of the main key aspects. This prototype served the purpose of testing some of the design ideas and implementation choices. The code is available the AIDA WP2 SVN repository. Initial documentation and links to the code repositories can be found in the dedicated webpages for the Geometry Toolkit and for the Unified Solids Library.
The current working prototype will evolve to a complete developed solution as part of the WP2 Task 2.2 and will constitute the final deliverable. The software development will follow an iterative process with periodic releases and offering incremental functionality in each iteration. It is important for the success of the project as well as for the quality of the final product to identify very early in the development phase possible clients willing to use the new software packages in order to provide very valuable feedback during the development phase. We plan to achieve this by using the toolkit in the other task and subtasks of WP2 as well as in other work packages of the AIDA project.
Acknowledgments
The people involved in the Geometry project are: John Apostolakis, Gabriele Cosmo, Marek Gayer, Andrei Gheata, Tatiana Nikitina and Pere Mato Vila from the PH-SFT group and Markus Frank from the PH-LBC group.
Further Readings:
AIDA Unified Solids library web site: http://aidasoft.web.cern.ch/USolids
AIDA project web site: http://aida.web.cern.ch/
Unified Solids Library web page, http://aidasoft.web.cern.ch/USolids
M. Gayer et al., “New software library of geometrical primitives for modeling of solids used in Monte-Carlo detector simulations”, Journal of Physics: Conference Series, vol. 396, no. 5 [ http://iopscience.iop.org/1742-6596/396/5/052035 ]
S.Ponce et al., Detector Description Framework in LHCb, Proceedings CHEP 2003 conference. http://www.slac.stanford.edu/econf/C0303241/proc/papers/THJT007.PDF
R.Chytracek et al., Geometry Description Markup Language for Physics Simulation and Analysis Applications, IEEE Trans. Nucl. Sci., Vol. 53, Issue: 5, Part 2, 2892-2896
T.Johnson et al., LCGO - geometry description for ILC detectors, Proceedings CHEP 2007
N. Graf et al., lcsim: An integrated detector simulation, reconstruction and analysis environment, Proceedings CHEP 2012