celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/user/index.html
Other
58 stars 32 forks source link

Construct proto-universe hierarchy from converted volumes #1179

Closed sethrj closed 3 months ago

sethrj commented 3 months ago

This adds the code to convert an ORANGE LogicalVolume hierarchy into a hierarchy of UnitProtos. Since Geant4 has no distinction between LogicalVolumes with and without children, we have a couple of heuristics to construct a universe hierarchy from these.

  1. If a logical volume has no children, simply place it as a volume in its parent(s) as a material.
  2. If a logical volume is used only once, it's probably meant for acceleration or convenience, and we don't have to make a universe from it; we can just make a volume. Construct a volume by subtracting its children and place it as a material.
  3. Otherwise (or for the "world" volume), create a new UnitProto corresponding to the logical volume.
  4. If a logical volume corresponding to a proto-universe has 2 or fewer children, construct an explicit "background" volume by subtracting out the daughters. Otherwise, use a "background" fill.

The choice of 2 is somewhat arbitrary but it provides a good value for testing; we can make it user-configurable if desired (right now it's a static constexpr value). The tradeoff is that transporting on a background volume may be more expensive than doing an explicit volume. That may change if we implement BVH/BIH tracking to accelerate tracking.

In the future we can look at further accelerating construction by merging volumes within the same region that have the same material. The ALICE ZDC components look like they have lots of ROOT-constructed "bounding boxes" that are inlined.

sethrj commented 3 months ago

@elliottbiondo This one is also ready for review.

sethrj commented 3 months ago

Ping @elliottbiondo