Follow-up from "Simple calo correction"

The following discussion from !1764 (merged) should be addressed:

  • @aszabels started a discussion: (+1 comment)

    What I see is that the multithread running has troubles with the line CaloFutureECorrection.cpp

    if ( m_caloElectron->set( tmp ) ) { incidence = m_caloElectron->caloState().momentum().Theta(); }

    when I try to print out the components of this line the I get a FATAL when running multithreaded. But even before the error strange values are assigned to 'incidence' for some events. I suspect caloState() to be the source of the problem but I don't understand how (it is of type LHCb::State). I need some help from experts here. Therefore I am not sure how big changes this requires and if this cures all problems with multithread. I am in favour to continue the work on this in a new MR to close the work that is already done.

The tool CaloFutureElectron has a state which is changed by set( tmp ). So by the time you want to get the state via caloState, another thread from a different event has overwritten it.

CaloFutureElectron has to be made thread-safe