Add "region" support
Geant4 regions have custom:
- Production cuts [see G4ProductionCutsTable::CreateCoupleTables]
- Generic "user region information"
- User limits (step limiter, tracking cuts) [see G4LogicalVolume::GetUserLimits]
- Fast simulation managers [see G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength]
- Field managers [see G4PropagatorInField::FindAndSetFieldManager]
But many of those can be overridden on a per-LV basis. Eventually we might want to map each combination of these from logical volumes to independent Celeritas regions.
Regions are used in Geant4 for:
- Region-dependent field (disable field outside of trackers), #538
- Region-dependent field parameters (sharing a single propagation kernel): see #883 for description of CMS using it
- Fast simulation, for which we need "onloading" (https://github.com/celeritas-project/celeritas/issues/1894)
- Physics parameters
Execution plan
One PR for each major bullet point
- [ ] Add
Regionstoinp::Model(this will look a lot like #1955)- [ ] New struct
Regionwith label andset<VolumeId>to which it applies. (Most attributes should be part of another class, and keying on region ID, rather than the Region having a bunch of different specifications.) - [ ] Load region data in GeantGeoParams:
geant_to_id/id_to_geantforG4Region*(addvector<G4Region const*>toGeantGeoParams) - [ ] Add tests: add regions to
multi-level.gdml,four-levels,lar-sphere, test by extendingGenericGeoModelInpand theIsRefEq
- [ ] New struct
- [ ] Integrate regions into runtime code (I'm not 100% sure the best way to structurally do this, but perhaps:)
- [ ] Rename
GeoMaterial*toVolumeExtras*(non-structural data about volumes) - [ ] Pass
inp::Regionsduring construction?
- [ ] Rename
Future work:
- Are regions in Geant4 fundamentally about geometry model structure, physics, or both? (From what I can see, it seems more like physics.)
- Should Celeritas try to keep the same regions as Geant4, or should we merge other physics treatments (like field definitions/parameters) into our "region"?
- If we want a broader region definition compared to Geant4, should we have
GeoRegionIdmap toG4Region*and have aPhysRegionIdthat corresponds to different fields etc.? - Unless we have a separate
GeoRegionId, should we move the region properties to the "physics" input and/or the futureGeantPhysicsParams(#1975)?
@whokion @mrguilima As we discussed last week, please elaborate on the requirements for the region calculations. In particular, I'd like to know in the following geometry: if both A and B are defined as different regions, do the properties in C change based on the full navigation "path", or is it assigned only one region, or is it invalid?
graph TD
world[world]
A[A]
B[B]
C[C]
world --> A
world --> B
A --> C
B --> C
https://geant4.web.cern.ch/documentation/pipelines/master/bfad_html/ForApplicationDevelopers/Detector/Geometry/geomLogical.html#geom-logvol-subreg
In Geant4, a logical volume cannot be shared by more than one region, regardless of whether it is a root volume or not. In the example above, the region pointer of volume C becomes ambiguous. While such a situation is unlikely in a real experimental setup, it still breaks the design since logical volumes and regions maintain mutual pointers when geometry is imported from Geant4. @mrguilima is investigating this issue in more detail and will provide a summary of his findings later.