From ce006c8bb2da5589e594819c028ee25b2aa0a3a0 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 4 Apr 2025 18:34:12 +0200 Subject: [PATCH 1/2] PWGEM/Dilepton: update mft task --- PWGEM/Dilepton/Core/SingleTrackQC.h | 6 ++--- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 6 ++--- PWGEM/Dilepton/Tasks/matchingMFT.cxx | 38 ++++++++++++++++++--------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 510f657be64..2075a1ba0cf 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -266,13 +266,13 @@ struct SingleTrackQC { fRegistry.addClone("Track/positive/", "Track/negative/"); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"}; - const AxisSpec axis_eta{100, -6, -1, "#eta_{#mu}"}; - const AxisSpec axis_phi{180, 0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; + const AxisSpec axis_eta{50, -6, -1, "#eta_{#mu}"}; + const AxisSpec axis_phi{90, 0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"}; // track info fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); - fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {axis_phi, axis_eta}, false); + fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); fRegistry.add("Track/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 1fa6be4d337..eaaa78d2687 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -310,8 +310,8 @@ struct SingleTrackQCMC { } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"}; - const AxisSpec axis_eta{100, -6, -1, "#eta_{#mu}"}; - const AxisSpec axis_phi{180, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; + const AxisSpec axis_eta{50, -6, -1, "#eta_{#mu}"}; + const AxisSpec axis_phi{90, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true charge"}; @@ -329,7 +329,7 @@ struct SingleTrackQCMC { // track info fRegistry.add("Track/lf/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca, axis_charge_gen}, true); if (cfgFillQA) { - fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {axis_phi, axis_eta}, false); + fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); fRegistry.add("Track/lf/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/lf/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); diff --git a/PWGEM/Dilepton/Tasks/matchingMFT.cxx b/PWGEM/Dilepton/Tasks/matchingMFT.cxx index a5069726507..81f3a91669f 100644 --- a/PWGEM/Dilepton/Tasks/matchingMFT.cxx +++ b/PWGEM/Dilepton/Tasks/matchingMFT.cxx @@ -63,13 +63,15 @@ struct matchingMFT { Configurable minRabs{"minRabs", 17.6, "min. R at absorber end"}; Configurable midRabs{"midRabs", 26.5, "middle R at absorber end for pDCA cut"}; Configurable maxRabs{"maxRabs", 89.5, "max. R at absorber end"}; + Configurable maxDCAxy{"maxDCAxy", 1e+10, "max. DCAxy for global muons"}; Configurable maxPDCAforLargeR{"maxPDCAforLargeR", 324.f, "max. pDCA for large R at absorber end"}; Configurable maxPDCAforSmallR{"maxPDCAforSmallR", 594.f, "max. pDCA for small R at absorber end"}; Configurable maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 1e+10, "max. chi2 for MCH-MFT matching"}; - Configurable maxChi2{"maxChi2", 1e+6, "max. chi2 for muon tracking"}; + Configurable maxChi2SA{"maxChi2SA", 1e+6, "max. chi2 for standalone muon"}; + Configurable maxChi2GL{"maxChi2GL", 1e+6, "max. chi2 for global muon"}; Configurable refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"}; Configurable applyEtaCutToSAinGL{"applyEtaCutToSAinGL", false, "flag to apply eta cut to samuon in global muon"}; - Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; + Configurable requireTrueAssociation{"requireTrueAssociation", false, "flag to require true mc collision association"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; @@ -79,7 +81,6 @@ struct matchingMFT { HistogramRegistry fRegistry{"fRegistry"}; static constexpr std::string_view muon_types[5] = {"MFTMCHMID/", "MFTMCHMIDOtherMatch/", "MFTMCH/", "MCHMID/", "MCH/"}; - static constexpr std::string_view muon_matching_types[3] = {"correct/", "fake/", "miss/"}; void init(o2::framework::InitContext&) { @@ -145,6 +146,7 @@ struct matchingMFT { fRegistry.add("MFTMCHMID/primary/correct/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{100, 0.0f, 10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {100, -6.f, -1.f}}, false); fRegistry.add("MFTMCHMID/primary/correct/hEtaPhi_MatchedMCHMID", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {100, -6.f, -1.f}}, false); + fRegistry.add("MFTMCHMID/primary/correct/hDeltaEtaDeltaPhi", "#Delta#eta vs. #Delta#varphi;#Delta#varphi = #varphi_{sa} - #varphi_{gl} (rad.);#Delta#eta = #eta_{sa} - #eta_{gl}", kTH2F, {{180, -M_PI, M_PI}, {400, -2.f, 2.f}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDiffCollId", "difference in collision index;collisionId_{TTCA} - collisionId_{MP}", kTH1F, {{41, -20.5, +20.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hSign", "sign;sign", kTH1F, {{3, -1.5, +1.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hNclusters", "Nclusters;Nclusters", kTH1F, {{21, -0.5f, 20.5}}, false); @@ -170,17 +172,15 @@ struct matchingMFT { fRegistry.addClone("MFTMCHMID/primary/", "MFTMCHMID/secondary/"); } - bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float etaMatchedMCHMID) + bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float etaMatchedMCHMID, const float dcaXY) { if (pt < minPt || maxPt < pt) { return false; } - if (rAtAbsorberEnd < minRabs || maxRabs < rAtAbsorberEnd) { return false; } - - if (chi2 < 0.f || maxChi2 < chi2) { + if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) { return false; } @@ -191,17 +191,23 @@ struct matchingMFT { if (applyEtaCutToSAinGL && (etaMatchedMCHMID < minEtaGL || maxEtaGL < etaMatchedMCHMID)) { return false; } + if (maxDCAxy < dcaXY) { + return false; + } + if (chi2 < 0.f || maxChi2GL < chi2) { + return false; + } } else if (trackType == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { if (eta < minEtaSA || maxEtaSA < eta) { return false; } + if (chi2 < 0.f || maxChi2SA < chi2) { + return false; + } } else { return false; } - if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) { - return false; - } return true; } @@ -225,7 +231,7 @@ struct matchingMFT { return; } - if (cfgRequireTrueAssociation && (mcParticle_MCHMID.mcCollisionId() != collision.mcCollisionId())) { + if (requireTrueAssociation && (mcParticle_MCHMID.mcCollisionId() != collision.mcCollisionId())) { return; } @@ -274,16 +280,21 @@ struct matchingMFT { pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); } - if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), etaMatchedMCHMID)) { + if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), etaMatchedMCHMID, dcaXY)) { return; } + float deta = etaMatchedMCHMID - eta; + float dphi = phiMatchedMCHMID - phi; + o2::math_utils::bringToPMPi(dphi); + fRegistry.fill(HIST("hMuonType"), fwdtrack.trackType()); if (isPrimary) { if (isMatched) { fRegistry.fill(HIST("MFTMCHMID/primary/correct/hPt"), pt); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); + fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hNclusters"), fwdtrack.nClusters()); @@ -312,6 +323,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hPt"), pt); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); + fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hNclusters"), fwdtrack.nClusters()); @@ -342,6 +354,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hPt"), pt); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); + fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hNclusters"), fwdtrack.nClusters()); @@ -370,6 +383,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hPt"), pt); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); + fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hNclusters"), fwdtrack.nClusters()); From 41f4abfd81d17f8ccdbf93f2b5488b8abcc4d539 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 4 Apr 2025 18:34:33 +0200 Subject: [PATCH 2/2] Common: update MFT matching --- Common/TableProducer/fwdtrackPropagation.cxx | 122 ++++++++++++++----- 1 file changed, 93 insertions(+), 29 deletions(-) diff --git a/Common/TableProducer/fwdtrackPropagation.cxx b/Common/TableProducer/fwdtrackPropagation.cxx index ae43c05c0f7..aa4c1e7f21a 100644 --- a/Common/TableProducer/fwdtrackPropagation.cxx +++ b/Common/TableProducer/fwdtrackPropagation.cxx @@ -64,12 +64,16 @@ struct FwdTrackPropagation { Configurable minRabs{"minRabs", 17.6, "min. R at absorber end"}; Configurable midRabs{"midRabs", 26.5, "middle R at absorber end for pDCA cut"}; Configurable maxRabs{"maxRabs", 89.5, "max. R at absorber end"}; + Configurable maxDCAxy{"maxDCAxy", 1e+10, "max. DCAxy for global muons"}; Configurable maxPDCAforLargeR{"maxPDCAforLargeR", 324.f, "max. pDCA for large R at absorber end"}; Configurable maxPDCAforSmallR{"maxPDCAforSmallR", 594.f, "max. pDCA for small R at absorber end"}; Configurable maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 50.f, "max. chi2 for MCH-MFT matching"}; - Configurable maxChi2{"maxChi2", 1e+6, "max. chi2 for muon tracking"}; - Configurable refitGlobalMuon{"refitGlobalMuon", false, "flag to refit global muon"}; - Configurable applyEtaCutToSAinGL{"applyEtaCutToSAinGL", false, "flag to apply eta cut to samuon in global muon"}; + Configurable maxChi2SA{"maxChi2SA", 1e+6, "max. chi2 for standalone muon"}; + Configurable maxChi2GL{"maxChi2GL", 1e+6, "max. chi2 for global muon"}; + Configurable refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"}; + Configurable applyDEtaDPhi{"cfgApplyDEtaDPhi", false, "flag to apply deta-dphi elliptic cut"}; + Configurable minDEta{"minDEta", 0.1, "min deta between MFT-MCH-MID and its attached MID-MCH at PV"}; + Configurable minDPhi{"minDPhi", 0.1, "min dphi between MFT-MCH-MID and its attached MID-MCH at PV"}; HistogramRegistry fRegistry{"fRegistry"}; static constexpr std::string_view muon_types[5] = {"MFTMCHMID/", "MFTMCHMIDOtherMatch/", "MFTMCH/", "MCHMID/", "MCH/"}; @@ -138,9 +142,9 @@ struct FwdTrackPropagation { fRegistry.add("MFTMCHMID/hChi2MatchMCHMID", "chi2 match MCH-MID;chi2", kTH1F, {{100, 0.0f, 100}}, false); fRegistry.add("MFTMCHMID/hChi2MatchMCHMFT", "chi2 match MCH-MFT;chi2", kTH1F, {{100, 0.0f, 100}}, false); fRegistry.add("MFTMCHMID/hMatchScoreMCHMFT", "match score MCH-MFT;score", kTH1F, {{100, 0.0f, 100}}, false); - fRegistry.add("MFTMCHMID/hDCAxy2D", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.1, 0.1}, {200, -0.1, +0.1}}, false); + fRegistry.add("MFTMCHMID/hDCAxy2D", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5, 0.5}, {200, -0.5, +0.5}}, false); fRegistry.add("MFTMCHMID/hDCAxy2DinSigma", "DCA x vs. y in sigma;DCA_{x} (#sigma);DCA_{y} (#sigma)", kTH2F, {{200, -10, 10}, {200, -10, +10}}, false); - fRegistry.add("MFTMCHMID/hDCAxy", "DCAxy;DCA_{xy} (cm);", kTH1F, {{100, 0, 0.1}}, false); + fRegistry.add("MFTMCHMID/hDCAxy", "DCAxy;DCA_{xy} (cm);", kTH1F, {{100, 0, 1}}, false); fRegistry.add("MFTMCHMID/hDCAxyinSigma", "DCAxy in sigma;DCA_{xy} (#sigma);", kTH1F, {{100, 0, 10}}, false); fRegistry.addClone("MFTMCHMID/", "MCHMID/"); fRegistry.add("MFTMCHMID/hDCAxResolutionvsPt", "DCA_{x} vs. p_{T};p_{T} (GeV/c);DCA_{x} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 500}}, false); @@ -149,17 +153,15 @@ struct FwdTrackPropagation { fRegistry.add("MCHMID/hDCAyResolutionvsPt", "DCA_{y} vs. p_{T};p_{T} (GeV/c);DCA_{y} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 5e+5}}, false); } - bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float etaMatchedMCHMID) + bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2, const uint8_t trackType, const float dcaXY) { if (pt < minPt || maxPt < pt) { return false; } - if (rAtAbsorberEnd < minRabs || maxRabs < rAtAbsorberEnd) { return false; } - - if (chi2 < 0.f || maxChi2 < chi2) { + if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) { return false; } @@ -167,18 +169,95 @@ struct FwdTrackPropagation { if (eta < minEtaGL || maxEtaGL < eta) { return false; } - if (applyEtaCutToSAinGL && (etaMatchedMCHMID < minEtaSA || maxEtaSA < etaMatchedMCHMID)) { + if (maxDCAxy < dcaXY) { + return false; + } + if (chi2 < 0.f || maxChi2GL < chi2) { return false; } } else if (trackType == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { if (eta < minEtaSA || maxEtaSA < eta) { return false; } + if (chi2 < 0.f || maxChi2SA < chi2) { + return false; + } } else { return false; } - if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) { + return true; + } + + template + bool isBestMatch(TCollision const& collision, TTarget const& target, TCandidates const& candidates) + { + std::map map_chi2MFTMCH; + for (const auto& matchedtrack : candidates) { // MFT-MCH-MID or MFT-MCH + if (matchedtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + continue; + } + o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(matchedtrack, collision, propagationPoint::kToVertex); + float eta = propmuonAtPV.getEta(); + float phi = propmuonAtPV.getPhi(); + if (refitGlobalMuon) { + const auto& mfttrack = matchedtrack.template matchMFTTrack_as(); + eta = mfttrack.eta(); + phi = mfttrack.phi(); + } + o2::math_utils::bringTo02Pi(phi); + if (eta < minEtaGL || maxEtaGL < eta) { + continue; + } + + const auto& mchtrack = matchedtrack.template matchMCHTrack_as(); // MCH-MID + o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex); + float etaMatchedMCHMID = propmuonAtPV_Matched.getEta(); + float phiMatchedMCHMID = propmuonAtPV_Matched.getPhi(); + o2::math_utils::bringTo02Pi(phiMatchedMCHMID); + + float deta = etaMatchedMCHMID - eta; + float dphi = phiMatchedMCHMID - phi; + o2::math_utils::bringToPMPi(dphi); + if (applyDEtaDPhi && std::sqrt(std::pow(deta / minDEta, 2) + std::pow(dphi / minDPhi, 2)) > 1.f) { + continue; + } + + if (matchedtrack.chi2() < 0.f || maxChi2GL < matchedtrack.chi2()) { + continue; + } + + float rAtAbsorberEnd = matchedtrack.rAtAbsorberEnd(); // this works only for GlobalMuonTrack + if (rAtAbsorberEnd < minRabs || maxRabs < rAtAbsorberEnd) { + continue; + } + o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(matchedtrack, collision, propagationPoint::kToDCA); + float dcaX = propmuonAtDCA.getX() - collision.posX(); + float dcaY = propmuonAtDCA.getY() - collision.posY(); + float dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY); + if (maxDCAxy < dcaXY) { + continue; + } + + o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToDCA); + float dcaX_Matched = propmuonAtDCA_Matched.getX() - collision.posX(); + float dcaY_Matched = propmuonAtDCA_Matched.getY() - collision.posY(); + float dcaXY_Matched = std::sqrt(dcaX_Matched * dcaX_Matched + dcaY_Matched * dcaY_Matched); + float pDCA = mchtrack.p() * dcaXY_Matched; + + if (rAtAbsorberEnd < midRabs ? pDCA > maxPDCAforSmallR : pDCA > maxPDCAforLargeR) { + continue; + } + + map_chi2MFTMCH[matchedtrack.globalIndex()] = matchedtrack.chi2MatchMCHMFT(); + } + if (map_chi2MFTMCH.begin()->first != target.globalIndex()) { // search for minimum matching chi2 + map_chi2MFTMCH.clear(); + return false; + } + map_chi2MFTMCH.clear(); + + if (target.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) { return false; } return true; @@ -188,23 +267,11 @@ struct FwdTrackPropagation { void fillFwdTrackTable(TCollision const& collision, TFwdTrack fwdtrack, TFwdTracks const& fwdtracks, TMFTTracks const&, const bool isAmbiguous) { if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { - std::map map_chi2MFTMCH; const auto& matchedGlobalTracks = fwdtracks.sliceBy(perMFTTrack, fwdtrack.matchMFTTrackId()); // MFT-MCH-MID or MFT-MCH - for (const auto& matchedtrack : matchedGlobalTracks) { - if (matchedtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { - map_chi2MFTMCH[matchedtrack.globalIndex()] = matchedtrack.chi2MatchMCHMFT(); - } - } - if (map_chi2MFTMCH.begin()->first != fwdtrack.globalIndex()) { // search for minimum chi2 - map_chi2MFTMCH.clear(); - return; - } - map_chi2MFTMCH.clear(); - - if (fwdtrack.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) { + if (!isBestMatch(collision, fwdtrack, matchedGlobalTracks)) { return; } - } // reduce useless propagation + } // find the best match between MFT and MCH-MID o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, collision, propagationPoint::kToVertex); o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, collision, propagationPoint::kToDCA); @@ -240,9 +307,6 @@ struct FwdTrackPropagation { if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { const auto& mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID - // etaMatchedMCHMID = mchtrack.eta(); - // phiMatchedMCHMID = mchtrack.phi(); - // o2::math_utils::bringTo02Pi(phiMatchedMCHMID); o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex); etaMatchedMCHMID = propmuonAtPV_Matched.getEta(); phiMatchedMCHMID = propmuonAtPV_Matched.getPhi(); @@ -276,7 +340,7 @@ struct FwdTrackPropagation { return; } - if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), etaMatchedMCHMID)) { + if (!isSelected(pt, eta, rAtAbsorberEnd, pDCA, fwdtrack.chi2(), fwdtrack.trackType(), dcaXY)) { return; }