This MR is related to the issue ATLASRECTS-7621 and fixes the crash that is reported.
A brief description of the problem that causes the crash. As the code is now in the MooTrackFitter, NSW segments offers only one phi constraint regardless of how many phi hits they may contain. This one phi constrain comes from a PseudoMeasurement. So, In that case a fake phi is added. However, there is a small amount of cases where the following features are true simultaneously:
- NSW segment doesn't contain that PseudoMeasurement (maybe because the MuonTrackExtrapolationTool "failed to extrapolate parameters to muon entry and perigee" but can't say for sure. I get the relevant warnings for that events however). This happens to ~ 1% of the NSW segments.
- The size of the measurement vector (number of eta plus phi hits of both segments involved) is less than the position of the first phi or MDT hit in the hit list vector (number of eta plus phi hits plus outliers plus pseudomeasurements of both segments involved).
In that case a crash will be seen. As the code is now in this missing PseudoMeasurement scenario, it picks the first phi hit from the NSW segment. If there is no phi hit in the NSW segment the code picks both phi constrains from the second segment, that is a non-NSW segment.
This MR corrects this behavior by saying to the code that in case of NSW segments and a missing PseudoMeasurement, pick the fake phi constraint from the first sTGC measurement. Let me emphasize the fact that this MR effects all the cases when 1 above is true, that is ~ 1% of the cases that NSW segment is involved, regardless whether 2 above is true or false and regardless whether NSW segment contains phi hits or not. This means that there are cases currently where 2 above is false and 1 is true and no crash is seen.
I run 1000 events which involved 37037 NSW segments which contained a PseudoMeasurement and 414 NSW segments which missed that PseudoMeasurement. I checked some distributions with MuonTester and couldn't spot any difference.
In the next few days I will compile some slides and place a link here and in the ticket mentioning also certain points which I think are problematic (or at least I don't understand).