add ATLAS_CHECK_THREAD_SAFETY to TRT_ElectronPidTools
This MR is about adding ATLAS_CHECK_THREAD_SAFETY
to the TRT_ElectronPidTools
The real issue was the line
HTcalculator* HTcalc = const_cast<HTcalculator*>(*readHandle);
the const_cast
was there so as to allow this check
HTcalc->checkInitialization()
-
Here I Assume that the check is really needed i.e it can have an effect at certain cases. Then one has to make the
checkInitialization
alsoconst
. One way to do it is via "double checked locking", check ifvalid
,lock
, recheck do work and set valid. -
If the check is not really needed or at some stage turns is not needed, then things can be simplified i.e the HTcalculator
checkInitialization
can remainnon-const
For good measure I also added ATLAS_CHECK_FILE_THREAD_SAFETY
to the HTCalculator
Mentioning @oda as I know he has been looking at codes like this.
Edited by Christos Anastopoulos