I found more issues that are similar to the one in !523 (merged).
The fitting of straightline tracks is done in global coordinates (which it has to), but it uses the local resolutions of the detectors as errors. This again causes trouble if one of the detectors is rotated around z. I tried to fix it by rotating the error ellipsoid from the local to the global plane. The results in my specific case look good, but if anyone has a better solution or sees a mistake, please let me know.
The calculation of the chi2 in the straightline suffers the same problem. I think the chi2 should also be calculated in local coordinates to have consistency, as the matching and the DUT alignment is also done in local coordinates. I now implemented a temporary solution that falls back to the previous (wrong) behaviour to not break other modules. I will comment a bit more on the specific change on where I see the problem and possible solutions.
I only looked at the modules that I am currently using (Straightline, AlignmentTrackChi2, Tracking4D) but I would suppose that other modules should also be checked for similar mistakes when comparing residuals to the detector resolution.
Closes #129 (closed)