|
15 | 15 |
|
16 | 16 | // Detray include(s) |
17 | 17 | #include <detray/geometry/tracking_surface.hpp> |
| 18 | +#include <detray/io/frontend/impl/json_readers.hpp> |
18 | 19 | #include <detray/utils/type_registry.hpp> |
19 | 20 |
|
20 | 21 | // VecMem include(s). |
@@ -49,8 +50,8 @@ void read_json_dd_impl(traccc::silicon_detector_description::host& dd, |
49 | 50 | const traccc::digitization_config& digi) |
50 | 51 | requires(traccc::is_detector_traits<detector_traits_t>) |
51 | 52 | { |
52 | | - const traccc::default_detector::host& detector_host = |
53 | | - detector.as<traccc::default_detector>(); |
| 53 | + const typename detector_traits_t::host& detector_host = |
| 54 | + detector.as<detector_traits_t>(); |
54 | 55 |
|
55 | 56 | // Iterate over the surfaces of the detector. |
56 | 57 | const typename detector_traits_t::host::surface_lookup_container& surfaces = |
@@ -118,8 +119,19 @@ void read_json_dd(traccc::silicon_detector_description::host& dd, |
118 | 119 | traccc::host_detector detector; |
119 | 120 | traccc::io::read_detector(detector, mr, geometry_file); |
120 | 121 |
|
121 | | - read_json_dd_impl<traccc::default_detector>(dd, detector, digi); |
122 | | - // detector_buffer_visitor |
| 122 | + // TODO: Implement detector visitor! |
| 123 | + // Peek at the header to determine the kind of detector that is needed |
| 124 | + const auto header = detray::io::detail::deserialize_json_header( |
| 125 | + traccc::io::get_absolute_path(geometry_file)); |
| 126 | + |
| 127 | + if (header.detector == "Cylindrical detector from DD4hep blueprint") { |
| 128 | + read_json_dd_impl<traccc::odd_detector>(dd, detector, digi); |
| 129 | + } else if (header.detector == "detray_detector") { |
| 130 | + read_json_dd_impl<traccc::itk_detector>(dd, detector, digi); |
| 131 | + } else { |
| 132 | + // TODO: Warning here |
| 133 | + read_json_dd_impl<traccc::default_detector>(dd, detector, digi); |
| 134 | + } |
123 | 135 | } |
124 | 136 |
|
125 | 137 | } // namespace |
|
0 commit comments