Replace the custom memory management infrastructure in GlobalChi2Fitter
In its current implementation, the TrkGlobalChi2Fitter has an internal memory management system with concepts of "ownership" over certain pointers. This mechanism makes it extremely difficult for anyone without very intimate knowledge of the code to make changes to it, as seemingly harmless changes to the code can lead to segfaults and other errors. Our solution to this is to migrate the fitter's inner memory management code almost entirely to C++ smart pointers, which not only leverages RAII to ensure memory safety, but also ensures that unique pointers cannot simply be copied to create unsafe situations. Instead the programmer must explicitly move them, which adds a layer of protection to the development of the code.
I tested the correctness of this change by running a q431 job and comparing the results to 1d07e705 (tag
diffPoolFiles. The conclusion of this is that the resulting files are unchanged. Similarly I compared the performance of the
PMon, and the runtime changed from 919 milliseconds to 925 milliseconds, an increase of 0.65%. As far as I know this is well within the margin of measurement error for algorithm runtime.