Sign of residuals

I am trying to understand a 2D residual plot. Specifically of our USBPix detector, for the x-residual vs x position of the track. A slope on this plot would indicate a rotation about the y-axis. the rotation angle would be acos(1/(1 + m)) where m is the slope. unfortunately I need m > 0, but in my plot m is negative.
Of course, the sign of m depends on which way round the residuals are defined: clusterPos - trackPos or vice versa?
In the User Manual, it says
“A spatial \textbf{residual} plot shows the difference of the interpolated track intercept onto a given plane minus the position of its associated cluster.\” but in the code for StraightlineTrack and GblTrack it seems to be the opposite sign.
I’m guessing the manual is the wrong way round?

Hi @hessey

which module are you referring to? There are several places where residuals are generated, and they might differ in their definition. The axis labels should however :tm: be alright.

The code for the track models themselves should not have anything to do with plotted residuals, this should happen in module code, independent of the track model chosen.

Best,
Simon

I see in the code, different modules use different signs for residuals. It would be good if the manual reflected that: preferably saying which modules use which sign; or if easier, could just say in the manual, “it is module dependent”.
I found the cause of the wrong sign slope (typo in a geometry file, 18.4 micron pitch of Mimosa26 ended up at 18.6). So that is fixed … but having manuals give statements differing from the actual implementation makes it harder to get to the bottom of such things.
In Correlations module it is Reference - Measurement, like the manual. Tracking4D uses the track definition ( globalRes = track->getGlobalResidual(detectorID); ) which in StraightlineTrack is
residual_global_[cluster->detectorID()] = cluster->global() - getState(cluster->detectorID()); – Opposite to the manual.

Hi @hessey

that’s of course true - and we gladly accept merge requests with corrections for the manual (or the code, if in order)! :slight_smile:

Best,
Simon