Skip to content

ActsGeometryContext - Non const access

Johannes Junggeburth requested to merge jojungge/athena:ThreadSafetyAlign into main

Hi everybody,

this MR improves the memory footprint of the ActsGeometry in particular of the ActsGeometryContext.

  • GeoAlignmentStore: The three transform maps holding the alignment delta, the final transformations and the default transformations are now shared pointers --> fast instansiation of the copy constructor (Done in !70221 (merged)).

  • TransformMap: Exploit the ConcurrentMap to allow for thread-safe access (Done in !70221 (merged))

  • GeometryContext: Instead of a simple transform map, the context holds for each detector technology a DetectorAlignStore (merged in !70220 (merged)). Simply speaking the DetectorAlignStore is nothing else than a std::vector of unique transform pointers. The vector with full size is allocated if the object is instantiated, but all pointers are set to zero. Each DetectorElement which needs to interact with the DetectorAlignStore needs to reserve a slot at the construction stage via calling the static drawTicket(<DetectorSubsystem>) method. As the ActsDetectorElements are created and deleted multiple times during the tracking geometry building, the clients are supposed to return their slot to the DetectorAlignmentStore via calling the giveBackTicekt() when they're destructed. Subsequent clients will then draw a ticket from the returned pool avoiding the DetectorAlignmentStores to grow unneccessarily large.

  • *TransformCache: Implements the pattern to use the DetectorAlignmentStore. If the parent inherits from the GeoVDetectorElement, the nominal transform cache of the GeoFullPhysVol is cleared everytime when a new Transform is put into the DetectorAlignmentStore.

  • ActsAlignmentAlgs: Replace the ActsAlignmentCondAlg and ActsDetAlignCondAlg by the GeometryContextAlg, the DetectorAlignCondAlg and the AlignmentStoreProviderAlg. Put all the three algorithms into the ActsAlignmentAlgs package in order to be able to use the algorithms also in AthSimulation (Follow-up MR !70219 (merged)). The ActsDetAlignCondAlg preserves pretty much the same functionallity as the ActsDetAlignCondAlg. Everytime when the alignment constants run out of scope, a new DetectorAlignStore object is written into the conditions store holding the alignment deltas. Optionally, the algorithm is interfaced to the ActsTrackingGeometrySvc and to the DetectorVolumeSvc which then cache the final acts transformations into this instance of the DetectorAlignmentStore as well. The AlignmentStoreProviderAlg is called at the beginning of every event. It fetches the DetectorAlignStore from the ConditionsStore and write another copy into the event store. If the final transforms have been already populated, it's simply piped into the event store as well. Otherwise a new store is created. The GeometryContextAlg packs all DetectorAlignmentStores written by the AlignmentStoreProviderAlg isntances and packs them into the EventStore.

  • ActsDetectorElement: Use the transform cache to handle the communication with the geometry context. At construction stage, the TransformCache draws a unique ticket number to reserve a slot in the DetectorAlignmentStore and pipes later the transform into the presented store if it's not already present. Further, the class inherits from the GeoVDetectorElement w

Effect on Itk reconstruction has been evaluated using the Acts spot test:

Log files: spotMain.logspotPatched.log

Algorithm main patch Rel runtime.
ActsTrackFindingAlg 783867.76 755139.08 96%
ActsPixelSeedingAlg 128181.73 125948.77 98%
ITkPixelClusterization 47279.76 46665.34 98%
ActsPixelClusterizationAlg 37962.64 37168.76 98%
ActsStripSeedingAlg 26272.70 26049.77 99%
ActsStripClusterizationAlg 22822.71 22984.57 101%
ITkInDetToXAODClusterConversion 21778.60 21883.37 100%
ITkStripClusterization 15474.70 15431.59 100%
ActsAmbiguityResolutionAlg 10061.89 9933.53 98%

Overall the changes speed up the top 9 algorithms by 3%.

Check that the reconstruction output remain untouched: All_quick_plots.pdf

Tagging from the Acts group: @ncalace, @cvarni, @asalzbur, @pagessin

Edited by Johannes Junggeburth

Merge request reports