Skip to content

Fix thread-unsafety in EscapedEnergyRegistry class - CaloCalibrationHits mt validation [ATLASSIM-4106]

EscapedEnergyRegistry class was implemented as a singleton, so it was not thread-safe. This affected the HITs of LArCalibrationHitDeadMaterial when running in MT with the CaloCalibration on. Added the #ifdef G4MULTITHREADED directive to handle the multithreaded case. One instance of the class will be created per each thread and stored in a tbb::concurrent_unordered_map that is hashed with the threadID number.

This change is implemented in CaloG4Sim package but affects LArG4H6SD, LArG4H8SD, LArG4SD, TileGeoG4Calib packages, that are using EscapedEnergyRegistry class.

This was tested in sequential and mt mode with 20 ttbar events, and now the differences in the LArCalibrationHitDeadMaterial are gone. Results between sequential and mt runs are consistent.

Merge request reports