celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Use scalar touchable rather than vector of physical volume stack

Open sethrj opened this issue 8 months ago • 2 comments

Related to #1353, #1351 , #1746 , #1390 , replacing the implementation from #1461 . A Geant4 detector geometry can be visualized as a graph where "logical volumes" are nodes and "physical volumes" are edges. A Geant4 detector geometry can be visualized as a rooted directed acyclic graph (DAG) where "logical volumes" are nodes and "physical volumes" are edges, and a "touchable history" is a directed trail from the root "world" geometry to a node that, in simulation, describes all the enclosing volumes and their locations. Thus a "touchable" is a unique volume of space in the detector.

We should be able to uniquely and efficiently be able to map a navigation path to and from a single touchable history IDs by storing:

  • For each logical volume ID (node) the physical volume daughter IDs (edges below)
  • For each physical volume (edge) the logical volume it's placing (node below)
  • For each daughter (outgoing edge) of each LV (node), the accumulated number of touchables below it

We can probably use 32-bit integers for logical/physical volumes, but we certainly want 64-bit for touchables. As a side note, FCC wants 64-bit logical but I think they're really asking for 64-bit touchables. I don't think they can fit more than 4B geant4 logical volumes in memory...

Discussion of how to construct and use

Note on IDs

  • VolumeId directly corresponds with logical volumes
  • VolumeInstanceId is a combination of physical + replica/placement (see #1649) so make sure in the above procedure to expand+map those
  • UniqueVolumeId corresponds to a touchable history (nav history/nav path)

sethrj avatar Apr 17 '25 13:04 sethrj

I don't think this will help https://github.com/celeritas-project/celeritas/issues/1351 ; we can't determine from the graph alone what pairs of nodes will connect.

sethrj avatar Apr 17 '25 15:04 sethrj

@amandalund this is what I was talking about over coffee

sethrj avatar Jun 05 '25 19:06 sethrj