From 6a021018d0d8c381385b6229dd4e118a0d0dec83 Mon Sep 17 00:00:00 2001 From: Navneet Date: Tue, 1 Dec 2026 19:07:53 +0530 Subject: [PATCH] To add the QA plots for the MC --- .../Tasks/Resonances/chargedkstaranalysis.cxx | 345 ++++++++++++++---- 1 file changed, 282 insertions(+), 63 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx index 364b677d2a0..f8ff41cef4d 100644 --- a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx +++ b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx @@ -281,6 +281,10 @@ struct Chargedkstaranalysis { Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined Configurable cfgTOFVeto{"cfgTOFVeto", false, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto Configurable cfgTOFMinPt{"cfgTOFMinPt", 0.6, "Minimum TOF pT cut for Pion"}; // TOF pT cut + Configurable shiftInNsigmaTOFKa{"shiftInNsigmaTOFKa", 0.0, "Shift in Nsigma for kaons in TOF"}; + Configurable shiftInNsigmaTOFPi{"shiftInNsigmaTOFPi", 0.0, "Shift in Nsigma for pions in TOF"}; + Configurable cfgApplyTOFShiftMC{"cfgApplyTOFShiftMC", false, "Apply shiftInNsigmaTOFPi to TOF nSigma(pi) in MC (run-period specific)"}; + Configurable cfgMaxTPCnSigmaK0sDau{"cfgMaxTPCnSigmaK0sDau", 5.0, "TPC nSigma cut for K0s daughter pions (loose, TPC only)"}; } pidCutCfgs; struct : ConfigurableGroup { @@ -439,7 +443,8 @@ struct Chargedkstaranalysis { histos.add("QA/before/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); histos.add("QA/before/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); histos.add("QA/before/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - + histos.add("QA/after/trkbpionTPCPIDCent", "TPC PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkbpionTOFPIDCent", "TOF PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); histos.add("QA/after/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); histos.add("QA/after/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); histos.add("QA/after/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); @@ -536,50 +541,88 @@ struct Chargedkstaranalysis { histos.add("QA/MC/QAvtxz_woCut", "z-vertex without cut", HistType::kTH1F, {vtxzAxis}); histos.add("QA/MC/QAvtxz_wVtxzCut", "z-vertex with vtxz cut", HistType::kTH1F, {vtxzAxis}); - histos.add("QAMC/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); - // Bachelor pion - histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 1 - histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 2 - histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); - - // Secondary Resonance (K0s cand) - histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - - histos.add("QAMC/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); - histos.add("QAMC/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); - histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); - histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); - histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); - - // K892 - histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); - histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); - - histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); + // MC QA with the same before/after structure as in data + histos.add("QAMC/before/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/before/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/before/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/before/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/after/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/after/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/after/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/after/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/after/trkbpionTPCPIDCent", "TPC PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trkbpionTOFPIDCent", "TOF PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/after/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/before/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/before/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/after/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/after/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/before/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/before/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/before/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/before/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/before/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QAMC/before/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QAMC/before/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QAMC/before/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/before/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QAMC/before/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + histos.add("QAMC/before/hArmSecondary", "Armenteros distribution of secondary resonance", HistType::kTH2D, {AxisSpec{100, -1, 1, "alpha"}, {200, 0, 0.5, "qtArm"}}); + histos.add("QAMC/after/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/after/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/after/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/after/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/after/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QAMC/after/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QAMC/after/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QAMC/after/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/after/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QAMC/after/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + histos.add("QAMC/after/hArmSecondary", "Armenteros distribution of secondary resonance", HistType::kTH2D, {AxisSpec{100, -1, 1, "alpha"}, {200, 0, 0.5, "qtArm"}}); + histos.add("QAMC/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("QAMC/before/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QAMC/after/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("QAMC/after/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + + // QAMC/afterPDG: after selection + PDG check (true pi / true K0s / true K*) + histos.add("QAMC/afterPDG/trkbpionDCAxy", "[after PID + PDG check] DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/afterPDG/trkbpionDCAz", "[after PID + PDG check] DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/afterPDG/trkbpionpT", "[after PID + PDG check] pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/afterPDG/trkbpionTPCPID", "[after PID + PDG check] TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkbpionTOFPID", "[after PID + PDG check] TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkbpionTPCTOFPID", "[after PID + PDG check] TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/afterPDG/trkbpionTPCPIDCent", "[after PID + PDG check] TPC PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkbpionTOFPIDCent", "[after PID + PDG check] TOF PID of bachelor pion candidates vs centrality", HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkppionTPCPID", "[after PID + PDG check] TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkppionTOFPID", "[after PID + PDG check] TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trkppionTPCTOFPID", "[after PID + PDG check] TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/afterPDG/trknpionTPCPID", "[after PID + PDG check] TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trknpionTOFPID", "[after PID + PDG check] TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QAMC/afterPDG/trknpionTPCTOFPID", "[after PID + PDG check] TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/afterPDG/hDauDCASecondary", "[after PID + PDG check] DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/afterPDG/hDauPosDCAtoPVSecondary", "[after PID + PDG check] Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/afterPDG/hDauNegDCAtoPVSecondary", "[after PID + PDG check] Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/afterPDG/hpT_Secondary", "[after PID + PDG check] pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QAMC/afterPDG/hy_Secondary", "[after PID + PDG check] Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QAMC/afterPDG/hRadiusSecondary", "[after PID + PDG check] Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QAMC/afterPDG/hCPASecondary", "[after PID + PDG check] Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QAMC/afterPDG/hDCAtoPVSecondary", "[after PID + PDG check] DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/afterPDG/hPropTauSecondary", "[after PID + PDG check] Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QAMC/afterPDG/hInvmassSecondary", "[after PID + PDG check] Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + histos.add("QAMC/afterPDG/hArmSecondary", "[after PID + PDG check] Armenteros distribution of secondary resonance", HistType::kTH2D, {AxisSpec{100, -1, 1, "alpha"}, {200, 0, 0.5, "qtArm"}}); + histos.add("QAMC/afterPDG/KstarRapidity", "[after PID + PDG check] Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("QAMC/afterPDG/kstarinvmass", "[after PID + PDG check] Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); } if (!helicityCfgs.qAOptimisation) { histosMc.add("h3ChaKstarInvMassDSMcGen", "h3ChaKstarInvMassDSMcGen", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true); @@ -756,10 +799,24 @@ struct Chargedkstaranalysis { return true; } // PID selection tools - template + // TOF nSigma(pi), shifted in MC only when enabled for the run period + template + float tofNSigmaPiCorr(TrackType const& track) + { + float nSigma = track.tofNSigmaPi(); + if constexpr (IsMC) { + if (pidCutCfgs.cfgApplyTOFShiftMC) { + nSigma -= pidCutCfgs.shiftInNsigmaTOFPi; + } + } + return nSigma; + } + + template bool selectionPIDPion(TrackType const& candidate) { - if (std::abs(candidate.tpcNSigmaPi()) >= pidCutCfgs.cfgMaxTPCnSigmaPion) { + const float tpcNSigma = candidate.tpcNSigmaPi(); + if (std::abs(tpcNSigma) >= pidCutCfgs.cfgMaxTPCnSigmaPion) { return false; } if (pidCutCfgs.cfgTPConly) { @@ -769,16 +826,23 @@ struct Chargedkstaranalysis { return true; } if (candidate.hasTOF()) { - const bool tofPIDPassed = std::abs(candidate.tofNSigmaPi()) < pidCutCfgs.cfgMaxTOFnSigmaPion; - const bool combo = (pidCutCfgs.cfgNsigmaCutCombinedPion > 0) && - (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + - candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < - pidCutCfgs.cfgNsigmaCutCombinedPion * pidCutCfgs.cfgNsigmaCutCombinedPion); + const float tofNSigma = tofNSigmaPiCorr(candidate); + const float cutComb = pidCutCfgs.cfgNsigmaCutCombinedPion; + const bool tofPIDPassed = std::abs(tofNSigma) < pidCutCfgs.cfgMaxTOFnSigmaPion; + const bool combo = (cutComb > 0) && + (tpcNSigma * tpcNSigma + tofNSigma * tofNSigma < cutComb * cutComb); return tofPIDPassed || combo; } return pidCutCfgs.cfgTOFVeto; } + // K0s daughter pions: loose TPC-only cut (K0s already cleaned by topological cuts) + template + bool selectionPIDK0sDau(TrackType const& candidate) + { + return std::abs(candidate.tpcNSigmaPi()) < pidCutCfgs.cfgMaxTPCnSigmaK0sDau; + } + template bool selectionK0s(CollisionType const& collision, K0sType const& candidate) { @@ -1118,8 +1182,10 @@ struct Chargedkstaranalysis { if constexpr (!IsMix) { if (!doprocessMC && isQaRequired) { histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + histos.fill(HIST("QA/after/trkbpionTPCPIDCent"), getCentrality(collision), trkbpt, trkbNSigmaPiTPC); if (istrkbhasTOF) { histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTOFPIDCent"), getCentrality(collision), trkbpt, trkbNSigmaPiTOF); histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); } histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); @@ -1132,7 +1198,7 @@ struct Chargedkstaranalysis { } } - if (!trackCut(bTrack) || !selectionPIDPion(bTrack)) { + if (!trackCut(bTrack) || !selectionPIDPion(bTrack)) { continue; } @@ -1215,7 +1281,7 @@ struct Chargedkstaranalysis { } if ((!secondaryCutsCfgs.cfgByPassDauPIDSelection && - (!selectionPIDPion(pos) || !selectionPIDPion(neg))) || + (!selectionPIDK0sDau(pos) || !selectionPIDK0sDau(neg))) || !selectionK0s(collision, K0scand)) { continue; } @@ -1348,16 +1414,16 @@ struct Chargedkstaranalysis { if (!trackCut(t1)) { continue; } - if (!selectionPIDPion(t1)) { + if (!selectionPIDPion(t1)) { continue; } auto posDauTrack = t2.template posTrack_as(); auto negDauTrack = t2.template negTrack_as(); - if (!secondaryCutsCfgs.cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) { // Perhaps it's already applied in trackCut (need to check QA plots) + if (!secondaryCutsCfgs.cfgByPassDauPIDSelection && !selectionPIDK0sDau(posDauTrack)) { continue; } - if (!secondaryCutsCfgs.cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) { + if (!secondaryCutsCfgs.cfgByPassDauPIDSelection && !selectionPIDK0sDau(negDauTrack)) { continue; } if (!selectionK0s(c2, t2)) { @@ -1428,6 +1494,40 @@ struct Chargedkstaranalysis { } allowedMcIds.insert(mcid); centTruthByAllowed.emplace(mcid, lCentrality); + // Bachelor pion QA (MC): each track of a selected event filled once, as in data + if (isQaRequired) { + auto trksQA = tracks.sliceBy(perCollision, coll.globalIndex()); + for (const auto& bTrack : trksQA) { + auto trkbpt = bTrack.pt(); + auto istrkbhasTOF = bTrack.hasTOF(); + auto trkbNSigmaPiTPC = bTrack.tpcNSigmaPi(); + auto trkbNSigmaPiTOF = istrkbhasTOF ? tofNSigmaPiCorr(bTrack) : -999.f; + + histos.fill(HIST("QAMC/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QAMC/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QAMC/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QAMC/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QAMC/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QAMC/before/trkbpionDCAz"), bTrack.dcaZ()); + + if (!trackCut(bTrack) || !selectionPIDPion(bTrack)) { + continue; + } + + histos.fill(HIST("QAMC/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + histos.fill(HIST("QAMC/after/trkbpionTPCPIDCent"), lCentrality, trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QAMC/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QAMC/after/trkbpionTOFPIDCent"), lCentrality, trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QAMC/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QAMC/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QAMC/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QAMC/after/trkbpionDCAz"), bTrack.dcaZ()); + } + } } // To builds a list of accepted MC collisions ID's for the truth candidates: i.e. the total number of generated events @@ -1657,20 +1757,84 @@ struct Chargedkstaranalysis { const auto mccoll = coll.template mcCollision_as>(); const float lCentrality = getCentrality(mccoll); + auto posDauTrack = v0.template posTrack_as(); + auto negDauTrack = v0.template negTrack_as(); + + auto trkppt = posDauTrack.pt(); + auto trknpt = negDauTrack.pt(); + auto istrkphasTOF = posDauTrack.hasTOF(); + auto istrknhasTOF = negDauTrack.hasTOF(); + auto trkpNSigmaPiTPC = posDauTrack.tpcNSigmaPi(); + auto trknNSigmaPiTPC = negDauTrack.tpcNSigmaPi(); + auto trkpNSigmaPiTOF = istrkphasTOF ? posDauTrack.tofNSigmaPi() : -999.; + auto trknNSigmaPiTOF = istrknhasTOF ? negDauTrack.tofNSigmaPi() : -999.; + + if (isQaRequired) { + // positive pion + histos.fill(HIST("QAMC/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QAMC/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QAMC/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + // negative pion + histos.fill(HIST("QAMC/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QAMC/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QAMC/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + // K0s + histos.fill(HIST("QAMC/before/hDauDCASecondary"), v0.dcaV0daughters()); + histos.fill(HIST("QAMC/before/hDauPosDCAtoPVSecondary"), v0.dcapostopv()); + histos.fill(HIST("QAMC/before/hDauNegDCAtoPVSecondary"), v0.dcanegtopv()); + histos.fill(HIST("QAMC/before/hpT_Secondary"), v0.pt()); + histos.fill(HIST("QAMC/before/hy_Secondary"), v0.yK0Short()); + histos.fill(HIST("QAMC/before/hRadiusSecondary"), v0.v0radius()); + histos.fill(HIST("QAMC/before/hDCAtoPVSecondary"), v0.dcav0topv()); + histos.fill(HIST("QAMC/before/hCPASecondary"), v0.v0cosPA()); + histos.fill(HIST("QAMC/before/hInvmassSecondary"), v0.mK0Short()); + histos.fill(HIST("QAMC/before/hArmSecondary"), v0.alpha(), v0.qtarm()); + histos.fill(HIST("QAMC/before/hPropTauSecondary"), v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * MassK0Short); + } if (!secondaryCutsCfgs.cfgByPassDauPIDSelection) { - auto posDauTrack = v0.template posTrack_as(); - auto negDauTrack = v0.template negTrack_as(); - if (!selectionPIDPion(posDauTrack)) { + if (!selectionPIDK0sDau(posDauTrack)) { continue; } - if (!selectionPIDPion(negDauTrack)) { + if (!selectionPIDK0sDau(negDauTrack)) { continue; } } if (!selectionK0s(coll, v0)) { continue; } + + if (isQaRequired) { + // positive pion + histos.fill(HIST("QAMC/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QAMC/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QAMC/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + // negative pion + histos.fill(HIST("QAMC/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QAMC/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QAMC/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + // K0s + histos.fill(HIST("QAMC/after/hDauDCASecondary"), v0.dcaV0daughters()); + histos.fill(HIST("QAMC/after/hDauPosDCAtoPVSecondary"), v0.dcapostopv()); + histos.fill(HIST("QAMC/after/hDauNegDCAtoPVSecondary"), v0.dcanegtopv()); + histos.fill(HIST("QAMC/after/hpT_Secondary"), v0.pt()); + histos.fill(HIST("QAMC/after/hy_Secondary"), v0.yK0Short()); + histos.fill(HIST("QAMC/after/hRadiusSecondary"), v0.v0radius()); + histos.fill(HIST("QAMC/after/hDCAtoPVSecondary"), v0.dcav0topv()); + histos.fill(HIST("QAMC/after/hCPASecondary"), v0.v0cosPA()); + histos.fill(HIST("QAMC/after/hInvmassSecondary"), v0.mK0Short()); + histos.fill(HIST("QAMC/after/hArmSecondary"), v0.alpha(), v0.qtarm()); + histos.fill(HIST("QAMC/after/hPropTauSecondary"), v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * MassK0Short); + } + auto trks = tracks.sliceBy(perCollision, v0.collisionId()); // Grouping the tracks with the v0s, means only those tracks that belong to the same collision as v0 for (const auto& bTrack : trks) { if (bTrack.collisionId() != v0.collisionId()) { @@ -1679,7 +1843,7 @@ struct Chargedkstaranalysis { if (!trackCut(bTrack)) { continue; } - if (!selectionPIDPion(bTrack)) { + if (!selectionPIDPion(bTrack)) { continue; } LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot; @@ -1690,10 +1854,18 @@ struct Chargedkstaranalysis { const double ptreco = lResoKstar.Pt(); const double yreco = lResoKstar.Rapidity(); + if (isQaRequired) { + histos.fill(HIST("QAMC/before/KstarRapidity"), yreco); + histos.fill(HIST("QAMC/before/kstarinvmass"), lResoKstar.M()); + } + if (std::abs(yreco) > kstarCutCfgs.cKstarMaxRap) { continue; } - + if (isQaRequired) { + histos.fill(HIST("QAMC/after/KstarRapidity"), yreco); + histos.fill(HIST("QAMC/after/kstarinvmass"), lResoKstar.M()); + } if (mcCfgs.doMcClosure) { // For MC clousre test mcClosure = true; @@ -1747,6 +1919,53 @@ struct Chargedkstaranalysis { if (!shareSameKstar) { continue; } + // QA after selection + PDG check: bachelor pi and K0s from the same chK*(892) + if (isQaRequired) { + // bachelor pion + auto trkbpt = bTrack.pt(); + auto istrkbhasTOF = bTrack.hasTOF(); + auto trkbNSigmaPiTPC = bTrack.tpcNSigmaPi(); + auto trkbNSigmaPiTOF = istrkbhasTOF ? tofNSigmaPiCorr(bTrack) : -999.f; + histos.fill(HIST("QAMC/afterPDG/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + histos.fill(HIST("QAMC/afterPDG/trkbpionTPCPIDCent"), lCentrality, trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QAMC/afterPDG/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QAMC/afterPDG/trkbpionTOFPIDCent"), lCentrality, trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QAMC/afterPDG/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QAMC/afterPDG/trkbpionpT"), trkbpt); + histos.fill(HIST("QAMC/afterPDG/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QAMC/afterPDG/trkbpionDCAz"), bTrack.dcaZ()); + + // K0s daughters + histos.fill(HIST("QAMC/afterPDG/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QAMC/afterPDG/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QAMC/afterPDG/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QAMC/afterPDG/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QAMC/afterPDG/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QAMC/afterPDG/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + + // K0s + histos.fill(HIST("QAMC/afterPDG/hDauDCASecondary"), v0.dcaV0daughters()); + histos.fill(HIST("QAMC/afterPDG/hDauPosDCAtoPVSecondary"), v0.dcapostopv()); + histos.fill(HIST("QAMC/afterPDG/hDauNegDCAtoPVSecondary"), v0.dcanegtopv()); + histos.fill(HIST("QAMC/afterPDG/hpT_Secondary"), v0.pt()); + histos.fill(HIST("QAMC/afterPDG/hy_Secondary"), v0.yK0Short()); + histos.fill(HIST("QAMC/afterPDG/hRadiusSecondary"), v0.v0radius()); + histos.fill(HIST("QAMC/afterPDG/hDCAtoPVSecondary"), v0.dcav0topv()); + histos.fill(HIST("QAMC/afterPDG/hCPASecondary"), v0.v0cosPA()); + histos.fill(HIST("QAMC/afterPDG/hInvmassSecondary"), v0.mK0Short()); + histos.fill(HIST("QAMC/afterPDG/hArmSecondary"), v0.alpha(), v0.qtarm()); + histos.fill(HIST("QAMC/afterPDG/hPropTauSecondary"), v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * MassK0Short); + + // chK*(892) + histos.fill(HIST("QAMC/afterPDG/KstarRapidity"), yreco); + histos.fill(HIST("QAMC/afterPDG/kstarinvmass"), lResoKstar.M()); + } histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); if (helicityCfgs.cCosWithKShot) {