TrackSummaryTool add ATLAS_THREAD_SAFETY checker
The
public createSummary ...
methods accepting a const Trk::Track
were (and still do)
ending up calling this:
Trk::Track& nonConstTrack = const_cast<Trk::Track&>(track);
if (onlyUpdateTrack) {
// not returning summary, so add it to the track
nonConstTrack.m_trackSummary = ts;
ts=0; // returning zero
} else {
// need to return summary too, so add a copy to the track
nonConstTrack.m_trackSummary = new Trk::TrackSummary(*ts);
}
This MR
- The private
createSummary
method avoids the above lines and returns aunique_ptr<Trk::TrackSummary>
- This allows for thread safe
summary
methods andupdate
methods. - Clients would move to those ones , when either they need a summary for a const track or update a non-const track
- Mark the older methods still doing the const_cast as
ATLAS_NOT_THREAD_SAFE
Hopefully, most of the workflows can move to the thread safe ones.