From 6e948376cb86f53baa8e84b99c0dd820d20f008f Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Tue, 1 Dec 2026 11:58:39 +0100 Subject: [PATCH] [PWGDQ] improve residuals plots in matching QA task - make the filling of residuals plots optional and configurable - add plot with correlation between spatial and angular deviations - optimize axes ranges and binning --- PWGDQ/Tasks/qaMatching.cxx | 192 ++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 100 deletions(-) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx index 505d044e52e..58ffd6c2721 100644 --- a/PWGDQ/Tasks/qaMatching.cxx +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -311,6 +311,7 @@ struct QaMatching { Configurable cfgEnableSingleMuonPlots{"cfgEnableSingleMuonPlots", true, ""}; Configurable cfgEnableDiMuonPlots{"cfgEnableDiMuonPlots", true, ""}; Configurable cfgEnableDecayLengthPlots{"cfgEnableDecayLengthPlots", true, ""}; + Configurable cfgEnableMatchingFeaturesPlots{"cfgEnableMatchingFeaturesPlots", false, ""}; Configurable cfgSamplingFraction{"cfgSamplingFraction", 1.f, "Fraction of randomly selected events to be processed"}; } configAnalysis; @@ -609,7 +610,7 @@ struct QaMatching { { AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"}; AxisSpec rejAccAxis{2, 0, 2., ""}; - AxisSpec multAxis{15, 0, std::log10f(2.0) * 15., "log_{10}(multiplicity)"}; + AxisSpec multAxis{20, 0, 5, "log_{10}(match attempts)"}; AxisSpec pTAxis = {100, 0, 10, "p_{T} (GeV/c)"}; AxisSpec etaAxis = {100, -4, -2, "#eta"}; AxisSpec phiAxis = {90, -180, 180, "#phi (degrees)"}; @@ -682,11 +683,10 @@ struct QaMatching { o2::framework::HistPtr hDeltaPt; o2::framework::HistPtr hDeltaX; o2::framework::HistPtr hDeltaY; - o2::framework::HistPtr hDeltaR; o2::framework::HistPtr hDeltaPhi; o2::framework::HistPtr hDeltaTanl; - o2::framework::HistPtr hDeltaTheta; o2::framework::HistPtr hDeltaEta; + o2::framework::HistPtr hDeltaREtaPhi; o2::framework::HistPtr hRabs; o2::framework::HistPtr hPullPt; o2::framework::HistPtr hPullX; @@ -694,7 +694,6 @@ struct QaMatching { o2::framework::HistPtr hPullR; o2::framework::HistPtr hPullPhi; o2::framework::HistPtr hPullTanl; - o2::framework::HistPtr hPullTheta; o2::framework::HistPtr hPullTot; MatchFeaturesHistos(const std::string& path, HistogramRegistry* registry, int numCandidates, double scoreMax) @@ -703,19 +702,19 @@ struct QaMatching { int matchTypeMax = static_cast(kMatchTypeUndefined) + 1; AxisSpec matchTypeAxis = {matchTypeMax, 0, static_cast(matchTypeMax), "match type"}; AxisSpec taggedAxis = {2, 0, 2.0, "is tagged"}; - AxisSpec scoreAxis = {100, 0, scoreMax, "match penalty"}; - AxisSpec scoreGapAxis = {100, 0, scoreMax, "match penalty gap"}; + AxisSpec scoreAxis = {static_cast(scoreMax * 4 / 10), 0, scoreMax, "match penalty"}; + AxisSpec scoreGapAxis = {static_cast(scoreMax * 4 / 10), 0, scoreMax, "match penalty gap"}; AxisSpec logpAxis = {16, -1, 3, "log_{10}(p)"}; AxisSpec resonanceTypeAxis = {8, 0, 8, "resonance"}; AxisSpec dxAxis = {100, -20, 20, "#Deltax (cm)"}; AxisSpec dyAxis = {100, -20, 20, "#Deltay (cm)"}; - AxisSpec dRAxis = {100, 0, 20, "#DeltaR (cm)"}; + AxisSpec dRAxis = {250, 0, 50, "#DeltaR (cm)"}; AxisSpec dpAxis = {100, -50, 50, "#Deltap (GeV/c)"}; AxisSpec dptAxis = {100, -5, 5, "#Deltap_{T} (GeV/c)"}; - AxisSpec dphiAxis = {100, -2, 2, "#Delta#phi (rad)"}; + AxisSpec dphiAxis = {100, -5, 5, "#Delta#phi (rad)"}; AxisSpec dtanlAxis = {100, -20, 20, "#Deltatanl"}; - AxisSpec dthetaAxis = {100, 0, 20, "#Deltatheta"}; AxisSpec detaAxis = {100, -2, 2, "#Delta#eta"}; + AxisSpec detaPhiAxis = {100, 0, 5, "#Delta#eta#phi"}; AxisSpec rabsAxis = {100, 0, 100, "R_{abs}"}; AxisSpec uxAxis = {100, -10, 10, "pull(x)"}; AxisSpec uyAxis = {100, -10, 10, "pull(y)"}; @@ -723,18 +722,17 @@ struct QaMatching { AxisSpec uptAxis = {100, -10, 10, "pull(p_{T})"}; AxisSpec uphiAxis = {100, -10, 10, "pull(#phi)"}; AxisSpec utanlAxis = {100, -10, 10, "pull(tanl)"}; - AxisSpec uthetaAxis = {500, 0, 50, "pull(theta)"}; - AxisSpec utotAxis = {500, 0, 50, "pull(tot)"}; - - auto setResonanceAxisLabels = [](const std::shared_ptr& hn) { - hn->GetAxis(7)->SetBinLabel(1, ""); - hn->GetAxis(7)->SetBinLabel(2, "#omega"); - hn->GetAxis(7)->SetBinLabel(3, "#phi"); - hn->GetAxis(7)->SetBinLabel(4, "J/#psi"); - hn->GetAxis(7)->SetBinLabel(5, "#psi(2S)"); - hn->GetAxis(7)->SetBinLabel(6, "#Upsilon(1S)"); - hn->GetAxis(7)->SetBinLabel(7, "#Upsilon(2S)"); - hn->GetAxis(7)->SetBinLabel(8, "#Upsilon(3S)"); + AxisSpec utotAxis = {100, 0, 20, "pull(tot)"}; + + auto setResonanceAxisLabels = [](const std::shared_ptr& hn, int bin = 7) { + hn->GetAxis(bin)->SetBinLabel(1, ""); + hn->GetAxis(bin)->SetBinLabel(2, "#omega"); + hn->GetAxis(bin)->SetBinLabel(3, "#phi"); + hn->GetAxis(bin)->SetBinLabel(4, "J/#psi"); + hn->GetAxis(bin)->SetBinLabel(5, "#psi(2S)"); + hn->GetAxis(bin)->SetBinLabel(6, "#Upsilon(1S)"); + hn->GetAxis(bin)->SetBinLabel(7, "#Upsilon(2S)"); + hn->GetAxis(bin)->SetBinLabel(8, "#Upsilon(3S)"); }; hDeltaP = registry->add((path + "/deltaP").c_str(), "MFT-MCH #Deltap", {HistType::kTHnSparseF, {dpAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); @@ -745,16 +743,14 @@ struct QaMatching { setResonanceAxisLabels(std::get>(hDeltaX)); hDeltaY = registry->add((path + "/deltaY").c_str(), "MFT-MCH #Deltay", {HistType::kTHnSparseF, {dyAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hDeltaY)); - hDeltaR = registry->add((path + "/deltaR").c_str(), "MFT-MCH #DeltaR", {HistType::kTHnSparseF, {dRAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); - setResonanceAxisLabels(std::get>(hDeltaR)); hDeltaPhi = registry->add((path + "/deltaPhi").c_str(), "MFT-MCH #Delta#phi", {HistType::kTHnSparseF, {dphiAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hDeltaPhi)); hDeltaTanl = registry->add((path + "/deltaTanl").c_str(), "MFT-MCH #DeltaTanl", {HistType::kTHnSparseF, {dtanlAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hDeltaTanl)); - hDeltaTheta = registry->add((path + "/deltaTheta").c_str(), "MFT-MCH #DeltaTheta", {HistType::kTHnSparseF, {dthetaAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); - setResonanceAxisLabels(std::get>(hDeltaTheta)); hDeltaEta = registry->add((path + "/deltaEta").c_str(), "MFT-MCH #Delta#eta", {HistType::kTHnSparseF, {detaAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hDeltaEta)); + hDeltaREtaPhi = registry->add((path + "/deltaREtaPhi").c_str(), "MFT-MCH #DeltaR#eta#phi", {HistType::kTHnSparseF, {dRAxis, detaPhiAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); + setResonanceAxisLabels(std::get>(hDeltaREtaPhi), 8); hRabs = registry->add((path + "/Rabs").c_str(), "MFT-MCH R_{abs}", {HistType::kTHnSparseF, {rabsAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hRabs)); @@ -770,8 +766,6 @@ struct QaMatching { setResonanceAxisLabels(std::get>(hPullPhi)); hPullTanl = registry->add((path + "/pullTanl").c_str(), "MFT-MCH Pull Tanl", {HistType::kTHnSparseF, {utanlAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hPullTanl)); - hPullTheta = registry->add((path + "/pullTheta").c_str(), "MFT-MCH Pull Theta", {HistType::kTHnSparseF, {uthetaAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); - setResonanceAxisLabels(std::get>(hPullTheta)); hPullTot = registry->add((path + "/pullTot").c_str(), "MFT-MCH Pull Tot", {HistType::kTHnSparseF, {utotAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis, resonanceTypeAxis}}); setResonanceAxisLabels(std::get>(hPullTot)); } @@ -796,7 +790,7 @@ struct QaMatching { AxisSpec dzAxis = {100, -1, 4, "#Deltaz (cm)"}; AxisSpec trackMultAxis = {mftMultMax / 10, 0, static_cast(mftMultMax), "MFT track mult."}; AxisSpec matchAttemptsAxis = {mftMultMax / 10, 0, static_cast(mftMultMax), "match attempts"}; - AxisSpec matchAttemptsLogAxis{15, 0, std::log10f(2.0) * 15., "log_{10}(match attempts)"}; + AxisSpec matchAttemptsLogAxis{20, 0, 5, "log_{10}(match attempts)"}; AxisSpec trackTypeAxis = {2, 0, 2, "MFT track type"}; int matchTypeMax = static_cast(kMatchTypeUndefined); AxisSpec matchTypeAxis = {matchTypeMax, 0, static_cast(matchTypeMax), "match type"}; @@ -2456,79 +2450,79 @@ struct QaMatching { } // ==================================== - // Matching properties - for (const auto& [mchIndex, globalTracksVector] : matchingCandidates) { - if (globalTracksVector.size() < 1) - continue; + // Matching features + if (configAnalysis.cfgEnableMatchingFeaturesPlots) { + for (const auto& [mchIndex, globalTracksVector] : matchingCandidates) { + if (globalTracksVector.size() < 1) + continue; - // get the standalone MCH track - auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + // get the standalone MCH track + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); - // skip global muon tracks that do not pass the MCH and MFT quality cuts - if (!isGoodGlobalMuon(mchTrack, collision)) - continue; + // skip global muon tracks that do not pass the MCH and MFT quality cuts + if (!isGoodGlobalMuon(mchTrack, collision)) + continue; - double logp = std::log10(mchTrack.p()); + double logp = std::log10(mchTrack.p()); - int isTagged = 0; - if (std::find(taggedMuons.begin(), taggedMuons.end(), mchIndex) != taggedMuons.end()) { - isTagged = 1; - } + int isTagged = 0; + if (std::find(taggedMuons.begin(), taggedMuons.end(), mchIndex) != taggedMuons.end()) { + isTagged = 1; + } - float chi2Gap = 0; - if (globalTracksVector.size() > 1) { - // we have at least two candidates, so we can check the score difference - // between the leading and the sub-leading - auto leadingChi2 = globalTracksVector[0].matchChi2; - auto subleadingChi2 = globalTracksVector[1].matchChi2; - chi2Gap = subleadingChi2 - leadingChi2; - } + float chi2Gap = 0; + if (globalTracksVector.size() > 1) { + // we have at least two candidates, so we can check the score difference + // between the leading and the sub-leading + auto leadingChi2 = globalTracksVector[0].matchChi2; + auto subleadingChi2 = globalTracksVector[1].matchChi2; + chi2Gap = subleadingChi2 - leadingChi2; + } - for (const auto& candidate : globalTracksVector) { - int resonanceId = 0; - double dp = candidate.mchTrackProp.getP() - candidate.mftTrackProp.getP(); - double dpt = candidate.mchTrackProp.getPt() - candidate.mftTrackProp.getPt(); - double dx = candidate.mchTrackProp.getX() - candidate.mftTrackProp.getX(); - double dy = candidate.mchTrackProp.getY() - candidate.mftTrackProp.getY(); - double dR = std::hypot(dx, dy); - double dphi = candidate.mchTrackProp.getPhi() - candidate.mftTrackProp.getPhi(); - double dtanl = candidate.mchTrackProp.getTanl() - candidate.mftTrackProp.getTanl(); - double dtheta = std::hypot(dphi, dtanl); - double deta = candidate.mchTrackProp.getEta() - candidate.mftTrackProp.getEta(); - int matchType = static_cast(candidate.matchType); - int ranking = candidate.matchRanking - 1; - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaP)->Fill(dp, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPt)->Fill(dpt, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaX)->Fill(dx, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaY)->Fill(dy, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaR)->Fill(dR, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPhi)->Fill(dphi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaTanl)->Fill(dtanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaTheta)->Fill(dtheta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaEta)->Fill(deta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hRabs)->Fill(mchTrack.rAtAbsorberEnd(), logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - - double ptError = std::sqrt((1. / candidate.mchTrackProp.getSigma2InvQPt()) + (1. / candidate.mftTrackProp.getSigma2InvQPt())); - double pullPt = (ptError > 0) ? dpt / ptError : 1.e6; - double xError = std::sqrt(candidate.mchTrackProp.getSigma2X() + candidate.mftTrackProp.getSigma2X()); - double pullX = (xError > 0) ? dx / xError : 1.e6; - double yError = std::sqrt(candidate.mchTrackProp.getSigma2Y() + candidate.mftTrackProp.getSigma2Y()); - double pullY = (yError > 0) ? dy / yError : 1.e6; - double pullR = std::hypot(pullX, pullY); - double phiError = std::sqrt(candidate.mchTrackProp.getSigma2Phi() + candidate.mftTrackProp.getSigma2Phi()); - double pullPhi = (phiError > 0) ? dphi / phiError : 1.e6; - double tanlError = std::sqrt(candidate.mchTrackProp.getSigma2Tanl() + candidate.mftTrackProp.getSigma2Tanl()); - double pullTanl = (tanlError > 0) ? dtanl / tanlError : 1.e6; - double pullTheta = std::hypot(pullPhi, pullTanl); - double pullTot = std::hypot(pullR, pullTheta); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullPt)->Fill(pullPt, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullX)->Fill(pullX, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullY)->Fill(pullY, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullR)->Fill(pullR, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullPhi)->Fill(pullPhi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullTanl)->Fill(pullTanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullTheta)->Fill(pullTheta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullTot)->Fill(pullTot, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + for (const auto& candidate : globalTracksVector) { + int resonanceId = 0; + double dp = candidate.mchTrackProp.getP() - candidate.mftTrackProp.getP(); + double dpt = candidate.mchTrackProp.getPt() - candidate.mftTrackProp.getPt(); + double dx = candidate.mchTrackProp.getX() - candidate.mftTrackProp.getX(); + double dy = candidate.mchTrackProp.getY() - candidate.mftTrackProp.getY(); + double dR = std::hypot(dx, dy); + double dphi = candidate.mchTrackProp.getPhi() - candidate.mftTrackProp.getPhi(); + double dtanl = candidate.mchTrackProp.getTanl() - candidate.mftTrackProp.getTanl(); + double deta = candidate.mchTrackProp.getEta() - candidate.mftTrackProp.getEta(); + double detaPhi = std::hypot(deta, dphi); + int matchType = static_cast(candidate.matchType); + int ranking = candidate.matchRanking - 1; + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaP)->Fill(dp, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPt)->Fill(dpt, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaX)->Fill(dx, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaY)->Fill(dy, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPhi)->Fill(dphi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaTanl)->Fill(dtanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaEta)->Fill(deta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaREtaPhi)->Fill(dR, detaPhi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hRabs)->Fill(mchTrack.rAtAbsorberEnd(), logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + + double ptError = std::sqrt((1. / candidate.mchTrackProp.getSigma2InvQPt()) + (1. / candidate.mftTrackProp.getSigma2InvQPt())); + double pullPt = (ptError > 0) ? dpt / ptError : 1.e6; + double xError = std::sqrt(candidate.mchTrackProp.getSigma2X() + candidate.mftTrackProp.getSigma2X()); + double pullX = (xError > 0) ? dx / xError : 1.e6; + double yError = std::sqrt(candidate.mchTrackProp.getSigma2Y() + candidate.mftTrackProp.getSigma2Y()); + double pullY = (yError > 0) ? dy / yError : 1.e6; + double pullR = std::hypot(pullX, pullY); + double phiError = std::sqrt(candidate.mchTrackProp.getSigma2Phi() + candidate.mftTrackProp.getSigma2Phi()); + double pullPhi = (phiError > 0) ? dphi / phiError : 1.e6; + double tanlError = std::sqrt(candidate.mchTrackProp.getSigma2Tanl() + candidate.mftTrackProp.getSigma2Tanl()); + double pullTanl = (tanlError > 0) ? dtanl / tanlError : 1.e6; + double pullTheta = std::hypot(pullPhi, pullTanl); + double pullTot = std::hypot(pullR, pullTheta); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullPt)->Fill(pullPt, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullX)->Fill(pullX, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullY)->Fill(pullY, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullR)->Fill(pullR, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullPhi)->Fill(pullPhi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullTanl)->Fill(pullTanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hPullTot)->Fill(pullTot, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + } } } @@ -2690,7 +2684,7 @@ struct QaMatching { std::get>(plotter->fMatchRankingPairedGoodMCH->histVsDeltaChi2)->Fill(dchi2, trueMatchIndex); } - if (isGoodMCH) { + if (isGoodMCH && configAnalysis.cfgEnableMatchingFeaturesPlots) { int isTagged = 0; if (std::find(taggedMuons.begin(), taggedMuons.end(), mchIndex) != taggedMuons.end()) { isTagged = 1; @@ -2713,19 +2707,18 @@ struct QaMatching { double dR = std::hypot(dx, dy); double dphi = candidate.mchTrackProp.getPhi() - candidate.mftTrackProp.getPhi(); double dtanl = candidate.mchTrackProp.getTanl() - candidate.mftTrackProp.getTanl(); - double dtheta = std::hypot(dphi, dtanl); double deta = candidate.mchTrackProp.getEta() - candidate.mftTrackProp.getEta(); + double detaPhi = std::hypot(deta, dphi); int matchType = static_cast(candidate.matchType); int ranking = candidate.matchRanking - 1; std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaP)->Fill(dp, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPt)->Fill(dpt, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaX)->Fill(dx, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaY)->Fill(dy, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaR)->Fill(dR, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaPhi)->Fill(dphi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaTanl)->Fill(dtanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaTheta)->Fill(dtheta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaEta)->Fill(deta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); + std::get>(plotter->fMatchFeaturesGoodMCH->hDeltaREtaPhi)->Fill(dR, detaPhi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hRabs)->Fill(mchTrack.rAtAbsorberEnd(), logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); double ptError = std::sqrt((1. / candidate.mchTrackProp.getSigma2InvQPt()) + (1. / candidate.mftTrackProp.getSigma2InvQPt())); @@ -2747,7 +2740,6 @@ struct QaMatching { std::get>(plotter->fMatchFeaturesGoodMCH->hPullR)->Fill(pullR, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hPullPhi)->Fill(pullPhi, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hPullTanl)->Fill(pullTanl, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); - std::get>(plotter->fMatchFeaturesGoodMCH->hPullTheta)->Fill(pullTheta, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); std::get>(plotter->fMatchFeaturesGoodMCH->hPullTot)->Fill(pullTot, logp, candidate.matchChi2, chi2Gap, ranking, matchType, isTagged, resonanceId); } }