Skip to content

Generic GDML raytrace example for the surface model

Andrei Gheata requested to merge raytrace_surf into surface_model

This example implements a simple ray tracing after loading a generic GDML. Currently, this works for geometries having only box/tube/trd solids, such as persistency/gdml/gdmls/trackML.gdml

The procedure follows: the world volume bounding box is sampled with points/directions. For each point, the location and safety distance get computed using NewSimpleNavigator and SimpleSafetyEstimator respectively. These values are used as references and compared with the same functionality provided by the surface model. Then, for each ray, the geometry setup is traversed, doing relocation at each boundary crossing and comparing the average between the two models. The time for locating, safety computation and complete traversal is compared between the two models in non-debug mode.

I added now for reference the BVH time for safety and traversal.

The executable is: build/test/testRaytracing -gdml_name default.gdml [-nrays N] [-debug D]

The output on my E5-2630 CPU: testRaytracing -gdml_name trackML.gdml -nrays 100000

=================================================================================
 Surface model info:  18790 touchables
    volume shells          = 145 [0.00507355 MB]
    local transformations  = 750 [0.0743866 MB]
    global transformations = 112615 [11.1694 MB]
    local surfaces         = 750 [0.0228882 MB]
    global surfaces        = 112614 [3.43671 MB]
    common surfaces        = 25412 [1.98061 MB]
    candidates             = 276046 [1.05303 MB]
    window masks           = 25774 [0.78656 MB]
    cyl/sph masks          = 120 [0.00366211 MB]
    ring masks             = 120 [0.00640869 MB]
    Z/phi masks            = 147 [0.00785065 MB]
    triangle masks         = 0 [0 MB]
    quad masks             = 120 [0.0146484 MB]
 Total: 18.5612[MB]
=================================================================================
Conversion time: 1.44752 [s]
locate_solids: 0.00746823  locate_surf: 0.0241659  num_errors = 0
safety_solids: 0.00517762safety_solids_BVH: 0.00184043  safety_surf: 0.00978797  num_errors = 0
    Number of better safety values: 2079
traverse_solids: 1.9392 traverse_solids_bvh: 0.620233  traverse_surf: 0.65324  num_errors = 0
=== testRaytracing: num_erros = 0 / 10000
Edited by Andrei Gheata

Merge request reports