Skip to content

[PWGDQ] fix MFT momentum rescaling - #17461

Merged
mcoquet642 merged 1 commit into
AliceO2Group:masterfrom
aferrero2707:PWGDQ-fix-mft-momentum-rescaling
Aug 21, 2026
Merged

[PWGDQ] fix MFT momentum rescaling#17461
mcoquet642 merged 1 commit into
AliceO2Group:masterfrom
aferrero2707:PWGDQ-fix-mft-momentum-rescaling

Conversation

@aferrero2707

@aferrero2707 aferrero2707 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The MCH tracks are extrapolated to the first measured MFT point using TrackExtrap::extrapToVertex() instead of TrackExtrap::extrapToVertexWithoutBranson(), which cures large inaccuracies in the MCH momentum estimation at the MFT front for some tracks.
Those inaccuracies were contributing to high-mass tails in the di-muon invariant mass forward tracks with rescaled momentum.

Below is a comparison of the J/psi invariant mass before and after the fix, estimated from the same AO2Ds of LHC25i4 (OO MC simulation with injected J/psi and psi(2S)).

Before:
image

After:
image

@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 61 warnings, 🔕 12 disabled

@mcoquet642

Copy link
Copy Markdown
Collaborator

why not use the common tool for rescaling introduced in fwdtrackUtilities.h ?

@aferrero2707

Copy link
Copy Markdown
Contributor Author

why not use the common tool for rescaling introduced in fwdtrackUtilities.h ?

Mostly to have the freedom of experimenting without affecting the common tools used in analysis.
For this specific case, if I understand correctly one could use refitGlobalMuonCov() for the momentum rescaling, right? However, the issue is in the determination of the MCH momentum to be used for the rescaling, so the common function would not help.

Once the fix is confirmed we can see how to properly propagate it to the common code. What do you think?

@mcoquet642

Copy link
Copy Markdown
Collaborator

why not use the common tool for rescaling introduced in fwdtrackUtilities.h ?

Mostly to have the freedom of experimenting without affecting the common tools used in analysis. For this specific case, if I understand correctly one could use refitGlobalMuonCov() for the momentum rescaling, right? However, the issue is in the determination of the MCH momentum to be used for the rescaling, so the common function would not help.

Once the fix is confirmed we can see how to properly propagate it to the common code. What do you think?

Indeed refitGlobalMuonCov does not fix the choice of the rescaling momentum (which indeed should be computed with Branson correction as you point out). But I think it would be good to be consistent with how the parameters are computed from the provided inputs. The one implemented in refitGlobalMuonCov has been extensively tested and is used by both EM and DQ (btw they also already use Branson correction to compute the rescaling of the momentum)

@aferrero2707
aferrero2707 force-pushed the PWGDQ-fix-mft-momentum-rescaling branch 2 times, most recently from 3c6fe8c to e458622 Compare August 19, 2026 08:31
@aferrero2707
aferrero2707 marked this pull request as ready for review August 19, 2026 16:09
@aferrero2707
aferrero2707 marked this pull request as draft August 19, 2026 16:09
@aferrero2707
aferrero2707 force-pushed the PWGDQ-fix-mft-momentum-rescaling branch from e458622 to 617c499 Compare August 19, 2026 16:12
@aferrero2707
aferrero2707 marked this pull request as ready for review August 19, 2026 20:13
@alibuild

alibuild commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 617c499 at 2026-08-20 08:34:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 34 errors and 77 warnings.'
Found 34 errors and 77 warnings.
++ [[ 34 -gt 0 ]]
++ cat /sw/BUILD/5731343aaafa7ed135a9ab93085592b08b9fd68e/O2Physics-code-check/errors.txt
PWGDQ/Tasks/muonGlobalAlignment.cxx:44:1: error: included header MatchGlobalFwd.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:60:1: error: included header Vector3D.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:61:1: error: included header Vector4D.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:351:16: error: do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-static-cast-downcast,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:1409:79: error: the parameter 'mftTrackPar' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:1485:15: error: no header providing "ROOT::Math::PxPyPzMVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:1504:17: error: no header providing "ROOT::Math::XYZVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:240:8: error: constructor does not initialize these fields: ccdbManager [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:718:37: error: the parameter 'path' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:758:36: error: the parameter 'histName' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:758:58: error: the parameter 'histTitle' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:846:7: error: 'registry' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:992:20: error: do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-static-cast-downcast,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:995:38: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:1114:16: error: the variable 'globalMuonTrackParameters' 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]
PWGDQ/Tasks/qaMatching.cxx:1115:20: error: the variable 'globalMuonTrackCovariances' 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]
PWGDQ/Tasks/qaMatching.cxx:1149:16: error: the variable 'globalMuonTrackParameters' 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]
PWGDQ/Tasks/qaMatching.cxx:1150:20: error: the variable 'globalMuonTrackCovariances' 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]
PWGDQ/Tasks/qaMatching.cxx:1180:16: error: the variable 'globalMuonTrackParameters' 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]
PWGDQ/Tasks/qaMatching.cxx:1181:20: error: the variable 'globalMuonTrackCovariances' 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]
PWGDQ/Tasks/qaMatching.cxx:2163:15: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2164:15: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2179:15: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2180:15: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2811:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2812:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2826:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2827:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2864:36: error: the parameter 'label' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2897:34: error: the parameter 'label' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2957:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2958:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2972:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
PWGDQ/Tasks/qaMatching.cxx:2973:13: error: slicing object from type 'GlobalFwdTrack' to 'TrackParCovFwd' discards 40 bytes of state [cppcoreguidelines-slicing,-warnings-as-errors]
++ [[ 77 -gt 0 ]]
++ cat /sw/BUILD/5731343aaafa7ed135a9ab93085592b08b9fd68e/O2Physics-code-check/warnings.txt
PWGDQ/Tasks/qaMatching.cxx:88:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead [modernize-deprecated-headers]
PWGDQ/Tasks/qaMatching.cxx:245:3: warning: initial values in enum 'QaMatching::MuonMatchType' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
PWGDQ/Tasks/qaMatching.cxx:763:33: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
PWGDQ/Tasks/qaMatching.cxx:764:37: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
PWGDQ/Tasks/qaMatching.cxx:977:38: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:994:7: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
[0 more errors; see full log]

Full log here.

@aferrero2707
aferrero2707 marked this pull request as draft August 20, 2026 14:57
The MCH tracks are extrapolated to the first measured MFT point using
TrackExtrap::extrapToVertex() instead of TrackExtrap::extrapToVertexWithoutBranson(),
which cures large inaccuracies in the MCH momentum estimation at the MFT
front for some tracks. Those inaccuracies were contributing to high-mass
tails in the di-muon invariant mass distribution reconstructed from global
forward tracks with rescaled momentum.
@aferrero2707
aferrero2707 force-pushed the PWGDQ-fix-mft-momentum-rescaling branch from 617c499 to c49d6d5 Compare August 20, 2026 15:19
@aferrero2707
aferrero2707 marked this pull request as ready for review August 20, 2026 15:30
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for c49d6d5 at 2026-08-20 18:19:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 4 errors and 73 warnings.'
Found 4 errors and 73 warnings.
++ [[ 4 -gt 0 ]]
++ cat /sw/BUILD/888c0814b2539350ba20f99eb4c23fcfa7a18dbd/O2Physics-code-check/errors.txt
PWGDQ/Tasks/muonGlobalAlignment.cxx:59:1: error: included header Vector3D.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:60:1: error: included header Vector4D.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:1494:15: error: no header providing "ROOT::Math::PxPyPzMVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/muonGlobalAlignment.cxx:1513:17: error: no header providing "ROOT::Math::XYZVector" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 73 -gt 0 ]]
++ cat /sw/BUILD/888c0814b2539350ba20f99eb4c23fcfa7a18dbd/O2Physics-code-check/warnings.txt
PWGDQ/Tasks/qaMatching.cxx:1224:11: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
PWGDQ/Tasks/qaMatching.cxx:1224:26: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
PWGDQ/Tasks/qaMatching.cxx:1224:41: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1252:11: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
PWGDQ/Tasks/qaMatching.cxx:1252:26: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
PWGDQ/Tasks/qaMatching.cxx:1252:70: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
PWGDQ/Tasks/qaMatching.cxx:1252:86: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1268:31: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
PWGDQ/Tasks/qaMatching.cxx:1312:14: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
PWGDQ/Tasks/qaMatching.cxx:1328:35: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1382:35: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1386:45: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1401:68: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1405:49: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1418:50: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1432:29: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1441:36: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1653:17: warning: redundant explicit casting to the same type 'float' as the sub-expression, remove this casting [readability-redundant-casting]
PWGDQ/Tasks/qaMatching.cxx:1713:33: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1733:38: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1763:73: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1767:38: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1769:58: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1773:39: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1782:40: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1817:36: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1819:36: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1825:68: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1828:57: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1839:71: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1855:50: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1896:38: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1898:80: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1920:111: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1926:107: warning: statement should be inside braces [readability-braces-around-statements]
PWGDQ/Tasks/qaMatching.cxx:1945:36: warning: statement should be inside braces [readability-braces-around-statements]
[0 more errors; see full log]

Full log here.

@aferrero2707

aferrero2707 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

@mcoquet642 I have replaced my custom code by refitGlobalMuonCov() in all places where I extrapolate the global tracks to the vertex. I am still using my simpler UpdateTrackMomentum() in a couple of other places, I will look how to properly replace it at a later stage.

I have also fixed all the code-check errors (except the two remaining ones that really look like false positives). There are still several warnings, but I propose to fix them in a separate PR to avoid making lots of cosmetic changes in this one.

@iarsene @mcoquet642 @XiaozhiBai @mguilbau given that the changes here are relevant and needed for all the ongoing muon alignment studies, could you please have a look and merge if there are no more objections?

Thanks a lot!

@mcoquet642
mcoquet642 merged commit 55f54a0 into AliceO2Group:master Aug 21, 2026
13 of 14 checks passed
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.

3 participants