Skip to content

Thread-safety and code style changes to iPatFitter

Pascal Boeschoten requested to merge pboescho/athena:master-mt into master

Various changes to iPatFitter & iPatGlobalFitter for thread-safety and code style.

Summary:

  • Thread-safety
    • Move state used by iPatGlobalFitter::alignmentFit() from mutable iPatFitter class members onto the stack. This will help make the class thread-safe/re-entrant. iPatGlobalFitter::alignmentFit() now just calls iPatFitter::fitWithState() instead of calling iPatFitter::fit() and then accessing mutable iPatFitter class state which could be messed with in a multi-threaded environment.
    • Use std::atomic for the mutable counters. Note: the counters still need work to guarantee correct/sensible multi-threaded operation.
  • Style
    • Use smart pointers instead of manual memory management in various places. Note: a notable spot still missing smart pointers is iPatFitter::addMeasurements(), where it's a bit tricky to convert.
    • Use Gaudi::Property instead of declareProperty()
    • Small style changes such as:
      • Add virtual & override specifiers
      • Add brackets to if-statements
      • Use range-based for loops
      • Use nullptr instead of 0

Looking to get some feedback on this!

Thanks, Pascal

Edited by Pascal Boeschoten

Merge request reports