Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/VecGeom/navigation/README.md is written in an unsupported language. File is not indexed.

0001 # Navigation {#navigation}
0002 
0003 This page collects implementation notes for VecGeom navigation. It is intended
0004 as the entry point for the full navigation system documentation. The sections
0005 below are intentionally organized by concept so that the navigation-state table
0006 description can grow together with navigator, locator, safety, surface, GPU,
0007 and validation details.
0008 
0009 For the application API and track lifecycle, see the
0010 [navigation interface guide](../../docs/navigation.md), covering NavView,
0011 direct BVHNavigator calls, safety, stepping, boundary normals, and state ownership.
0012 
0013 ## Navigation State Tables {#navigation_state_tables}
0014 
0015 VecGeom navigators need a compact state that identifies the current touchable:
0016 the concrete path from the world volume to the currently located placed volume.
0017 On GPU this state must be small, trivially copyable, and independent of host
0018 pointers. The navigation table is the precomputed data structure that makes
0019 this possible. It translates between a navigation state and the placed-volume
0020 path metadata needed during transport: parent links, placed-volume ids,
0021 logical-volume ids, child ids, daughter links, scene ids, and cached
0022 transformations.
0023 
0024 The navigation table is derived from the placed-volume hierarchy during geometry
0025 closure. It is not a second geometry description. It stores enough indexing
0026 information to recover the current path and to move up or down the hierarchy
0027 without carrying a CPU-only path object in each track. The same common
0028 `NavigationState` API is implemented by both table-backed representations:
0029 `NavStateIndex` and `NavStateTuple`.
0030 
0031 ### NavStateIndex
0032 
0033 `NavStateIndex` is the fully expanded representation. A navigation state is one
0034 `NavIndex_t` pointing to a table record for the full touchable. Each record
0035 stores its parent, the current placed-volume id, logical-volume id, touchable
0036 id, child id, daughter records, level, and optional cached transformation.
0037 
0038 The main advantage is runtime simplicity. Since every touchable has its own
0039 record, the state is a single index and operations can follow direct parent and
0040 daughter links in one expanded table. When the table fits comfortably in the
0041 accepted memory budget, this representation is usually the preferred
0042 performance-oriented choice.
0043 
0044 The cost is table size and initialization time. Repeated detector structures can
0045 create a very large number of distinct touchables even when the underlying
0046 placed and logical volumes are heavily reused. In such geometries, the expanded
0047 index table can become too large to transfer or initialize efficiently. It also
0048 has an encoded daughter-count limit, so geometries with a logical volume having
0049 too many daughters cannot use `NavStateIndex`.
0050 
0051 ### NavStateTuple
0052 
0053 `NavStateTuple` is the scene-compressed representation and is the default
0054 navigation-state table choice. Instead of expanding every repeated subtree into
0055 every parent context, the table is split into scene-local touchable records and
0056 shared logical-volume records. A track state stores a fixed-size tuple of
0057 scene-local table indices, one component per active scene.
0058 
0059 This greatly reduces table size for geometries with repeated or reusable
0060 subtrees, and keeps the default geometry closure safer for large detector
0061 setups. The cost is that the per-track state is larger than a single index and
0062 some operations must reconstruct full-path information by combining tuple
0063 components and scene-local parent links.
0064 
0065 The tuple depth is the maximum number of active scene components that can be
0066 stored in a track state. The default depth is 4. Smaller depths are preferable
0067 when they fit the geometry because they reduce per-track state size and GPU
0068 state traffic. Larger depths may be needed when a geometry requires deeper scene
0069 nesting to stay within the configured table memory budget.
0070 
0071 ### Choosing a representation
0072 
0073 The preferred representation is the fastest one that fits the user's accepted
0074 memory and initialization budget. In practice this means:
0075 
0076 - use `NavStateIndex` when the expanded table fits comfortably and the geometry
0077   satisfies the encoding limits;
0078 - use `NavStateTuple` when the expanded index table is too large, too slow to
0079   initialize or transfer, or incompatible with the geometry;
0080 - keep tuple depth as small as possible while still satisfying the memory
0081   target.
0082 
0083 `VECGEOM_NAV` selects the representation (`tuple` or `index`). The default is
0084 `tuple`, with `VECGEOM_NAVTUPLE_MAXDEPTH=4`.
0085 
0086 `VECGEOM_NAVTABLE_WARN_MEMORY_MB` sets the table memory budget used for
0087 guidance messages. The default is 512 MB. Set it to 0 to disable size guidance.
0088 
0089 `VECGEOM_NAVTABLE_RECOMMEND` enables the more expensive recommendation mode. It
0090 can run additional count-only table passes to estimate alternative tuple depths
0091 and representation choices. This is opt-in because users generally need this
0092 scan only when choosing settings for a geometry, not on every production run.
0093 
0094 During `CloseGeometry`, VecGeom reports cheap guidance when the current setting
0095 looks suboptimal for the configured memory budget, for example when
0096 `NavStateIndex` appears to fit but `NavStateTuple` was selected, or when the
0097 index representation is impossible for the geometry. Recommendation mode can
0098 then be used once to choose a better tuple depth or representation.
0099 
0100 ## Navigators {#navigation_navigators}
0101 
0102 To be expanded.
0103 
0104 ## Locators {#navigation_locators}
0105 
0106 To be expanded.
0107 
0108 ## Safety Estimators {#navigation_safety_estimators}
0109 
0110 To be expanded.
0111 
0112 ## Surface Navigation {#navigation_surface}
0113 
0114 To be expanded.
0115 
0116 ## GPU Navigation {#navigation_gpu}
0117 
0118 To be expanded.
0119 
0120 ## Validation and Diagnostics {#navigation_validation}
0121 
0122 To be expanded.