Page MenuHomeHEPForge

Improve thread safety
Open, NormalPublic

Description

The first version of thread safety will have decay table thread local as decay models do not guarantee constness in relevant decay functions. After looking bit to the code, there is way to improve this with relatively simple changes, but as they will require touching all decay models it is not trivial to do it quickly. Idea is that EvtDecayBase::make_decay() and EvtDecayBase::decay() functions have to be make constant. I have made local test in which I did part of the work as proof of principle. This work should wait for other big changes to be merged and then transition plan is:

  1. Move pure virtual method from EvtDecayBase::decay() to EvtDecayIncoherent, EvtDecayProb and EvtDecayAmp classes. This function is called only from make_decay() method in each of these derived classes.
  2. Create temporary copy of EvtDecayAmp, which should live while we are making transition.
  3. Change all decay models deriving from EvtDecayAmp to derive from its temporary copy.
  4. Make EvtDecayBase::getArg() const and propagate effect of it through code. As consequence, drop EvtDecayBase::getStoredArg() and EvtDecayBase::getNStoredArgs() methods as they are not used and not safe as meaning of the index is different to that of getArg().
  5. In each of the EvtDecayIncoherent, EvtDecayProb and EvtDecayAmp classes modify signature of decay() method to allow them to return relevant values/objects. By moving the method here each class can have different signature. At the same time in each class adapt make_decay() method to new decay() signature. EvtDecayAmp is trivial as at this point nothing will derive from it. EvtDecayProb does not have many models deriving from it and Michal has prototype. EvtDecayIncoherent() has small number of models, but I did not check how difficult it will be to convert.
  6. In small chunks adapt models based on EvtDecayAmp. Some models might need to go together if they use common infrastructure, but potentially one should be able to split to chunks doable in day or two.
  7. When nothing derives from temporary copy of EvtDecayAmp, remove temporary copy.
  8. Make EvtDecayBase::make_decay() const. At this moment, it should affect only 3 classes which define this method.
  9. If all this succeeds, we should have all we need to remove need of having decay table thread local.

Event Timeline

kreps triaged this task as Normal priority.Mar 10 2023, 1:23 PM
kreps created this task.
kreps created this object with visibility "Public (No Login Required)".
kreps created this object with edit policy "Restricted Project (Project)".