Skip to content

FakeBkgTools: label classes as thread-unsafe and allow concurrent class instances

Julien Maurer requested to merge (removed):fbt-static-090724 into main

This is to clarify the current thread-safety situation (or lack thereof) of the FakeBkgTools package, after related discussions in !72538 (merged).

First, all tools in the package (not the interfaces though) get marked as ATLAS_NOT_THREAD_SAFE. This is because in the current implementation, internal states are assumed to remain unchanged between calls to addEvent() and getEventWeight(), and also because binned event counts are being accumulated by the tools across events.

One may still wish to parallelize by instantiating one tool per thread. This almost works, except for one static variable used by the fit function of LhoodMM_tools (m_current_lhoodMM_tool). Therefore this MR secures the whole fit with a mutex (it may be a good idea for TMinuit anyway). This shouldn't impact the execution time significantly because the fit is performed only at the end of the event loop, not for every event.

Since !72538 (merged) enables the package build in the Athena project, it may be better to merge mine only after, in case the labelling as ATLAS_NOT_THREAD_SAFE unveils more problems.

FYI @evarnes @nbruscin @ravinab

Merge request reports

Loading