Skip to content

Deferred initialisation for LAr simulation components relying on G4 geometry

Breaking off part of !43822 (merged) into something more manageable

A lot of things are done in the initialize() methods of tools/services that should not be: they rely on Geant4 geometries already having been set up, which is not guaranteed. Can make this more robust by deferring the setup.

Almost all of the changes are just to interfaces, adding the deferred init method. Functional changes are in LArBarrelGeometry and HECGeometry, moving the dangerous parts out of initialize(). Corresponding calls to geantInit are added to the (deferred) makeSD() method of EMBSDTool and HECSDTool

Note that a deferred initialisation can happen inside worker threads, so also had to add some thread safety with std::call_once to the singleton helper classes.

Edited by Benjamin Michael Wynne

Merge request reports