Skip to content

ATLASRECTS-7249, ATLASRECTS-7251 , make clear where the remaining issues are for ATLASRECTS-7246

This merge requests does 2 things :

  1. The TrkDetDescr/TrkGeometry becomes thread safe . This means that all GeometryBuilder bar the Inner Detector ones can become safe

  2. The issue in the Inner Detector Geometry builders comes because we couple directly to surfaces owned by the detector elements.

  • We seem to not use the Surface constructor that accepts DetElement ( why ? to be seen ).
  • What we do instead is that we pass directly the Surface held by the internal cache of the detector element ... (why ? to be seen)

Anyhow, this is where we couple the lifetime of Inner Detector elements to Tracking Geometry that causes the special treatment we have now. I commented in all instances where this coupling exists. Actually the do_not_delete is already a clue ... here ... that some funky ownership goes on. I guess this coupling is the last step we need to take care .

       // Trk::SharedObject<Trk::Surface>  =
       // std::make_shared<Trk::Surface>(.... some det element)) could be fine
       //
       // As things are now
       // 1) Notice that basically we couple the DetElement owned
       // surface to the Tracking Geometry passing a no-op deleter
       // (no delete happens) to the shared_ptr(SharedObject is
       // typedef of shared_ptr)
       // 2) The const_cast here make the
       // code non MT safe. For now we handle this by being careful
       // on lifetimes and non-re-entrant TG construction.

Trk::SharedObject<Trk::Surface> sharedSurface(const_cast<Trk::Surface*>(moduleSurface),
                                                     Trk::do_not_delete<Trk::Surface>);

In short after a cascade of MRs getting read ~ 100 const_cast the only remaining const_cast exist where we couple cached surface of the Inner Detector Elements with the Tracking Geometry, i.e where the actual cause of having to be careful with the relevant CondObj lifetimes comes from ...

ping @fwinkl , @sroe , @ssnyder

Edited by Christos Anastopoulos

Merge request reports