Skip to content

[Common] TrackTuner: fix mean shift.#17091

Open
mfaggin wants to merge 1 commit into
AliceO2Group:masterfrom
mfaggin:fixMeanShiftTT
Open

[Common] TrackTuner: fix mean shift.#17091
mfaggin wants to merge 1 commit into
AliceO2Group:masterfrom
mfaggin:fixMeanShiftTT

Conversation

@mfaggin

@mfaggin mfaggin commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a conceptual mistake in the dca mean shift applied with the TrackTuner (with no impact for current analyses, see later).
From the PR #7009 the dca correction is the following:

Schermata del 2026-07-16 14-05-31

In particular, that PR introduced the subtraction of the dcaMC mean from the reco dca in MC, in order to center it at 0 when computing the residual to the generated y parameter, i.e. in the calculation of the dca resolution term. This operation already centers the reconstructed dca in MC to 0, i.e. the -<dcaXYMC_reco> term in the 3rd row is a leftover. In this PR we remove this term, ending up with the following formula:

Schermata del 2026-07-16 14-09-17

In particular, this formula now provides a robust correction, which in the ideal case of MC perfectly matching the data returns exactly the reconstructed dca in MC as it is.

The discussed issue is fixed with this PR. However, this should be totally transparent in analysis given that the dca mean in MC looks always at 0. Below some plots with some tests done on the pp reference HF MC LHC25b4a6, showing the performance of the mean and sigma w/o the usage of the TrackTuner (black), with the usage of the TrackTuner as in O2Physics up to now (violet) and with the usage of the TrackTuner as fixed in this PR (green). As expected, the TrackTuner changes the mean and resolution of the DCA, but the fix in the TrackTuner mean shift of this PR does not have a big impact given that <dca_MC>=0 (in other words: the violet and the green points coincide, even if the green are conceptually more correct).

Mean:

can_meanUpgrDcaXY can_meanUpgrDcaZ can_withPvRefit_meanUpgrDcaXY can_withPvRefit_meanUpgrDcaZ

Resolution:
can_resUpgrDcaXY
can_resDcUpgraZ
can_withPvRefit_resUpgrDcaXY
can_withPvRefit_resUpgrDcaZ

Thanks @fchinu for spotting it.
Tagging also @arossi81 and @phymanshu for info

@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 27 errors, ⚠️ 3 warnings, 🔕 0 disabled

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for da85440 at 2026-07-16 14:28:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 29 errors and 7 warnings.'
Found 29 errors and 7 warnings.
++ [[ 29 -gt 0 ]]
++ cat /sw/BUILD/99c7262e8836d36f037f16cedda777f988954e43/O2Physics-code-check/errors.txt
Common/Tools/TrackTuner.h:89:15: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
Common/Tools/TrackTuner.h:90:15: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
Common/Tools/TrackTuner.h:91:15: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
Common/Tools/TrackTuner.h:92:15: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
Common/Tools/TrackTuner.h:103:15: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
Common/Tools/TrackTuner.h:393:19: error: the variable 'str' is copy-constructed from a const reference but is only used as const reference; consider making it a const reference [performance-unnecessary-copy-initialization,-warnings-as-errors]
Common/Tools/TrackTuner.h:403:12: error: do not use 'compare' to test equality of strings; use the string equality operator instead [readability-string-compare,-warnings-as-errors]
Common/Tools/TrackTuner.h:405:19: error: do not use 'compare' to test equality of strings; use the string equality operator instead [readability-string-compare,-warnings-as-errors]
Common/Tools/TrackTuner.h:416:60: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:421:53: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:425:59: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:429:61: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:433:59: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:437:61: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:441:55: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:445:63: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:460:65: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:509:60: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:514:53: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:518:59: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:522:61: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:526:59: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:530:61: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:534:55: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:538:63: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:553:65: error: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/Tools/TrackTuner.h:630:50: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
Common/Tools/TrackTuner.h:638:5: error: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto,-warnings-as-errors]
Common/Tools/TrackTuner.h:749:18: error: narrowing conversion from 'double' to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
++ [[ 7 -gt 0 ]]
++ cat /sw/BUILD/99c7262e8836d36f037f16cedda777f988954e43/O2Physics-code-check/warnings.txt
Common/Tools/TrackTuner.h:374:40: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:473:22: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:566:22: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:644:28: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:747:20: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:1184:18: warning: statement should be inside braces [readability-braces-around-statements]
Common/Tools/TrackTuner.h:1186:18: warning: statement should be inside braces [readability-braces-around-statements]
++ [[ 29 -gt 0 ]]
++ exit 1
--

[0 more errors; see full log]

Full log here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants