From c42f21611a38b77519b0a9d354f401ce97185a9a Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 19:24:31 +0200 Subject: [PATCH 1/6] PWGDQ: update qamatching AO2D Tables --- PWGDQ/Tasks/qaMatching.cxx | 44 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 2c7ec679d7f..85343b26357 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -96,6 +96,8 @@ DECLARE_SOA_COLUMN(P, p, float); DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(InvQPt, invQPt, float); +DECLARE_SOA_COLUMN(Tanl, tanl, float); DECLARE_SOA_COLUMN(MatchLabel, matchLabel, int8_t); DECLARE_SOA_COLUMN(MatchType, matchType, int8_t); DECLARE_SOA_COLUMN(MatchChi2, matchChi2, float); @@ -144,6 +146,8 @@ DECLARE_SOA_TABLE(QaMatchingMCHTrack, "AOD", "QAMCHTRK", qamatching::Pt, qamatching::Eta, qamatching::Phi, + qamatching::InvQPt, + qamatching::Tanl, qamatching::MftMatchAttempts, qamatching::IsTagged, qamatching::XAtVtx, @@ -169,11 +173,22 @@ DECLARE_SOA_TABLE(QaMatchingCandidates, "AOD", "QAMCAND", qamatching::ReducedEventId, qamatching::ReducedTrackId, qamatching::MatchLabel, - qamatching::P, qamatching::Pt, qamatching::Eta, qamatching::Phi, - qamatching::MatchType, qamatching::MatchChi2, qamatching::MatchScore, qamatching::MatchRanking, + qamatching::P, + qamatching::Pt, + qamatching::Eta, + qamatching::Phi, + qamatching::InvQPt, + qamatching::Tanl, + qamatching::MatchType, + qamatching::MatchChi2, + qamatching::MatchScore, + qamatching::MatchRanking, qamatching::XAtVtx, qamatching::YAtVtx, qamatching::ZAtVtx, + qamatching::FXAtPlaneZ2, + qamatching::FYAtPlaneZ2, + qamatching::FZAtPlaneZ2, qamatching::PxAtVtx, qamatching::PyAtVtx, qamatching::PzAtVtx); @@ -3083,7 +3098,7 @@ struct QaMatching { //------------------------------- // Chi2-based matching from production - fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, collisionInfo.matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds); + fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, collisionInfo.matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds, mftCovs); if constexpr (isMC) { fillMatchingPlotsMc(collision, collisionInfo, muonTracks, mftTracks, taggedMuons, collisionInfo.matchingCandidates, collisionInfo.matchingCandidates, collisionInfo.matchablePairs, cfgMatchingChi2ScoreMftMchLow, fChi2MatchingPlotter.get(), false); } else { @@ -3114,7 +3129,7 @@ struct QaMatching { double matchingScoreCut = matchingScoreCuts.at(label); matchingMethodCounter += 1; - fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds); + fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds, mftCovs); if constexpr (isMC) { fillMatchingPlotsMc(collision, collisionInfo, muonTracks, mftTracks, taggedMuons, matchingCandidates, collisionInfo.matchingCandidates, collisionInfo.matchablePairs, matchingScoreCut, plotter, false); } else { @@ -3132,7 +3147,7 @@ struct QaMatching { double matchingScoreCut = matchingScoreCuts.at(label); matchingMethodCounter += 1; - fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds); + fillQaMatchingAodTablesForCollision(collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId, collisionInfo.reducedMchTrackIds, mftCovs); if constexpr (isMC) { fillMatchingPlotsMc(collision, collisionInfo, muonTracks, mftTracks, taggedMuons, matchingCandidates, collisionInfo.matchingCandidates, collisionInfo.matchablePairs, matchingScoreCut, plotter); } else { @@ -3145,14 +3160,15 @@ struct QaMatching { fillDimuonPlotsMc(collisionInfo, collisions, muonTracks, mftTracks); } - template + template void fillQaMatchingAodTablesForCollision(TCOLLISION const& collision, TMUON const& muonTracks, TMFT const& mftTracks, const MatchingCandidates& matchingCandidates, int8_t matchLabel, int32_t reducedEventId, - std::map reducedMchTrackIds) + std::map reducedMchTrackIds, + CMFT const& mftCovs) { for (const auto& [mchIndex, candidates] : matchingCandidates) { if (candidates.empty()) { @@ -3173,8 +3189,13 @@ struct QaMatching { for (const auto& candidate : candidates) { const auto& candidateTrack = muonTracks.rawIteratorAt(candidate.globalTrackId); const auto& mftTrack = mftTracks.rawIteratorAt(candidate.mftTrackId); + if (mftTrackCovs.count(mftTrack.globalIndex()) < 1) { + continue; + } + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); // propagate global forward track to vertex using momentum rescaling method auto candidateTrackAtVertex = propagateToVertexMft(mftTrack, mchTrack, collision); + auto candidateTrackAtPlaneZ2 = propagateToZMft(mftTrack, mftTrackCov, o2::mft::constants::mft::LayerZCoordinate()[9]); qaMatchingCandidates( reducedEventId, reducedMchTrackId, @@ -3183,6 +3204,8 @@ struct QaMatching { static_cast(candidateTrack.pt()), static_cast(candidateTrack.eta()), static_cast(candidateTrack.phi()), + static_cast(candidateTrack.signed1Pt()), + static_cast(candidateTrack.tgl()), static_cast(candidate.matchType), static_cast(candidate.matchChi2), static_cast(candidate.matchScore), @@ -3190,6 +3213,9 @@ struct QaMatching { static_cast(candidateTrackAtVertex.getX()), static_cast(candidateTrackAtVertex.getY()), static_cast(candidateTrackAtVertex.getZ()), + static_cast(candidateTrackAtPlaneZ2.getX()), + static_cast(candidateTrackAtPlaneZ2.getY()), + static_cast(candidateTrackAtPlaneZ2.getZ()), static_cast(candidateTrackAtVertex.getPx()), static_cast(candidateTrackAtVertex.getPy()), static_cast(candidateTrackAtVertex.getPz())); @@ -3242,7 +3268,7 @@ struct QaMatching { mftMchMatchAttempts = mchTrackInfoIt->second.compatMftTracks.size(); } auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); - auto mchTrackAtPlaneZ2 = propagateToZMch(mchTrackAtVertex, o2::mft::constants::mft::LayerZCoordinate()[9]); + auto mchTrackAtPlaneZ2 = propagateToZMch(mchTrack, o2::mft::constants::mft::LayerZCoordinate()[9]); bool isTagged = false; if (std::find(taggedMuons.begin(), taggedMuons.end(), mchIndex) != taggedMuons.end()) { isTagged = true; @@ -3254,6 +3280,8 @@ struct QaMatching { static_cast(mchTrack.pt()), static_cast(mchTrack.eta()), static_cast(mchTrack.phi()), + static_cast(mchTrack.signed1Pt()), + static_cast(mchTrack.tgl()), static_cast(mftMchMatchAttempts), isTagged, static_cast(mchTrackAtVertex.getX()), From fed34218e0c4ecc8e27a0ae59e0362825fc7faf5 Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 19:53:01 +0200 Subject: [PATCH 2/6] PWGDQ: review PR formatting / linter errors --- PWGDQ/Tasks/qaMatching.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 85343b26357..8e80e6b57f2 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -173,15 +173,15 @@ DECLARE_SOA_TABLE(QaMatchingCandidates, "AOD", "QAMCAND", qamatching::ReducedEventId, qamatching::ReducedTrackId, qamatching::MatchLabel, - qamatching::P, - qamatching::Pt, - qamatching::Eta, + qamatching::P, + qamatching::Pt, + qamatching::Eta, qamatching::Phi, qamatching::InvQPt, qamatching::Tanl, - qamatching::MatchType, - qamatching::MatchChi2, - qamatching::MatchScore, + qamatching::MatchType, + qamatching::MatchChi2, + qamatching::MatchScore, qamatching::MatchRanking, qamatching::XAtVtx, qamatching::YAtVtx, @@ -467,7 +467,7 @@ struct QaMatching { } configMlOptions; std::vector binsPtMl; - std::array cutValues; + std::array cutValues{}; std::vector cutDirMl; std::map> matchingMlResponses; std::map matchingChi2Functions; From 3228317b7a5b738e5c5c1f8abf10857e25b47ae8 Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 20:07:08 +0200 Subject: [PATCH 3/6] PWGDQ: fix MEGALinter errors --- PWGDQ/Tasks/qaMatching.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 8e80e6b57f2..8fc27e59d80 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -2161,10 +2161,8 @@ struct QaMatching { auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); // propagate MCH and MFT tracks to matching plane - auto mchTrackProp = fwdToTrackPar(mchTrack, mchTrack); - mchTrackProp = propagateToMatchingPlaneMch(mchTrack, mftTrack, mftTrackCov, collision, MatchingPlaneDefaultZ, 0); - auto mftTrackProp = fwdToTrackPar(mftTrack, mftTrackCov); - mftTrackProp = propagateToMatchingPlaneMft(mchTrack, mftTrack, mftTrackCov, collision, MatchingPlaneDefaultZ, 0); + auto mchTrackProp = propagateToMatchingPlaneMch(mchTrack, mftTrack, mftTrackCov, collision, MatchingPlaneDefaultZ, 0); + auto mftTrackProp = propagateToMatchingPlaneMft(mchTrack, mftTrack, mftTrackCov, collision, MatchingPlaneDefaultZ, 0); // check if a vector of global muon candidates is already available for the current MCH index // if not, initialize a new one and add the current global muon track From 8a1a8876ed9e5d2880794c5f884b2cc1a56dfb6f Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 20:22:34 +0200 Subject: [PATCH 4/6] PWGDQ: fix MEGALinter errors - replace std::string parameters - remove unused members --- PWGDQ/Tasks/qaMatching.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 8fc27e59d80..1d755d9e0c2 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -255,7 +255,6 @@ struct QaMatching { static constexpr int GlobalTrackTypeMax = 2; static constexpr int MchMidTrackType = 3; - static constexpr int FirstDecayMotherRank = 2; static constexpr int MftTrackTypeStandard = 0; static constexpr int MftTrackTypeCA = 1; static constexpr int ThetaAbsBoundaryDeg = 3; @@ -531,9 +530,6 @@ struct QaMatching { std::unordered_map mftTrackCovs; - std::vector> fMatchablePairs; - MatchingCandidates fMatchingCandidates; - std::vector fTaggedMuons; using MuonPair = std::pair, std::pair>; using GlobalMuonPair = std::pair>, std::pair>>; @@ -562,8 +558,6 @@ struct QaMatching { ®istryMatching9}}; HistogramRegistry registryDimuon{"registryDimuon", {}}; - std::unordered_map matchingHistos; - Matrix dimuonHistos; Produces qaMatchingEvents; Produces qaMatchingMCHTrack; @@ -587,7 +581,7 @@ struct QaMatching { o2::framework::HistPtr etaPdgNum; o2::framework::HistPtr etaPdgDen; - EfficiencyPlotter(std::string path, std::string title, + EfficiencyPlotter(const std::string& path, const std::string& title, HistogramRegistry& registry, bool createPdgMomHistograms) { AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"}; @@ -845,7 +839,7 @@ struct QaMatching { HistogramRegistry* registry; - MatchingPlotter(std::string path, + MatchingPlotter(const std::string& path, HistogramRegistry* reg, bool createPdgMomHistograms, int mftMultMax, @@ -975,7 +969,6 @@ struct QaMatching { } }; std::unique_ptr fChi2MatchingPlotter; - std::map> fMatchingHistogramRegistries; std::map> fMatchingPlotters; std::unique_ptr fTaggedMuonsMatchingPlotter; @@ -2761,7 +2754,7 @@ struct QaMatching { TMUON const& muonTracks, TMFT const& mftTracks, CMFT const& mftCovs, - std::string funcName, + const std::string& funcName, float matchingPlaneZ, int extrapMethod, const std::vector>& matchablePairs, From 6a644ab69d7970fab631ec9aad1ae95a6e0b48ea Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 20:28:25 +0200 Subject: [PATCH 5/6] PWGDQ: minor formatting --- PWGDQ/Tasks/qaMatching.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 1d755d9e0c2..81f61a66376 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -527,7 +527,6 @@ struct QaMatching { }; using CollisionInfos = std::map; - std::unordered_map mftTrackCovs; @@ -558,7 +557,6 @@ struct QaMatching { ®istryMatching9}}; HistogramRegistry registryDimuon{"registryDimuon", {}}; - Produces qaMatchingEvents; Produces qaMatchingMCHTrack; Produces qaMatchingCandidates; From 00f357cadbad1a9c1ea2bfa9af52c851c2373910 Mon Sep 17 00:00:00 2001 From: Yoshini Bailung Date: Fri, 3 Jul 2026 20:35:44 +0200 Subject: [PATCH 6/6] PWGDQ: more minor formatting --- PWGDQ/Tasks/qaMatching.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 81f61a66376..2ab26c4db87 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -528,8 +528,6 @@ struct QaMatching { using CollisionInfos = std::map; std::unordered_map mftTrackCovs; - - using MuonPair = std::pair, std::pair>; using GlobalMuonPair = std::pair>, std::pair>>;