Skip to content

Add GeoManager member functions to lookup logical volume id<->name

Benjamin Morgan requested to merge bmorgan/geomanager-interface into master

Updates to VGDML in !805 (merged) showed need to easily lookup LogicalVolume Ids (int) from names (string) and vice versa. VecGeom's fundamental indexing of LogicalVolume is by an int Id which is guaranteed to be unique. GDML stores volumes by name only, so connecting up GDML names to VecGeom volumes often has to look in both directions.

Whilst current interfaces allow retrieval of a pointer to a LogicalVolume given an Id or Name, manual use/checks are then needed to get the Id/Name leading to repeated code.

This MR provide these new member functions to return the Id(Name) of a LogicalVolume given a Name(Id). Implement basic tests of expected behaviour.

(*) part of the discussion !805 (merged) was to see if the name can also be made unique. I'm not sure how to do this given current interfaces as LogicalVolumes can be constructed without a name and have this changed through LogicalVolume::SetLabel arbitrarily later on. This probably needs more thought in all of Geant4/GDML/VecGeom as to whether LogicalVolumes should be required to have a unique label, and if so how to implement that.

Merge request reports