k4bench.geometry.scanner¶
k4bench.geometry.scanner ¶
Scan a DD4hep compact geometry and extract subdetector names.
DD4hep geometries are split across many XML files linked by
<include ref="..."/> tags. This module resolves the full include
tree and collects every <detector name="..."> element, in
encounter order, deduplicating across files.
get_detector_names ¶
Return the names of all <detector> elements in the geometry.
Recursively follows <include ref="..."/> tags starting from
xml_path, collecting every <detector name="..."> attribute
found across all reachable files. Order is encounter order;
duplicates are suppressed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
Path
|
Path to the top-level compact XML file. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Detector names in the order they are first encountered. |
Source code in k4bench/geometry/scanner.py
resolve_includes ¶
Return all XML files reachable from xml_path via includes.
Follows <include ref="..."/> tags recursively. The returned
list is in encounter order and contains no duplicates. xml_path
itself is always the first element.
Includes whose ref attribute contains an unresolved environment
variable (e.g. ${DD4hepINSTALL}/...) are skipped silently —
ddsim resolves these at runtime using its own search path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
Path
|
Absolute or relative path to a DD4hep compact XML file. |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
Resolved, deduplicated paths in encounter order. |