From d6a6ba07efd63aef42a25e279d556cd8e00f7b32 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Sat, 22 Feb 2025 10:04:42 +0530 Subject: [PATCH] [PWGLF] added MC for Kstar flow task and purity for phi task (#10133) Co-authored-by: sarjeeta gami --- PWGLF/Tasks/Resonances/kstarpbpb.cxx | 331 +++++++++++++++--- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 37 +- 2 files changed, 308 insertions(+), 60 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarpbpb.cxx b/PWGLF/Tasks/Resonances/kstarpbpb.cxx index 2275d62d05d..f18b0e3e607 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.cxx @@ -20,12 +20,12 @@ #include #include #include -#include -#include #include #include #include #include +#include +#include #include "TRandom3.h" #include "Math/Vector3D.h" @@ -54,6 +54,8 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table using namespace o2; using namespace o2::framework; @@ -113,6 +115,7 @@ struct kstarpbpb { Configurable additionalEvselITS{"additionalEvselITS", true, "Additional event selcection for ITS"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; Configurable isNoTOF{"isNoTOF", true, "isNoTOF"}; + Configurable PDGcheck{"PDGcheck", true, "PDGcheck"}; Configurable strategyPID{"strategyPID", 2, "PID strategy"}; Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; @@ -126,6 +129,9 @@ struct kstarpbpb { Configurable fillOccupancy{"fillOccupancy", false, "fill Occupancy"}; Configurable cfgOccupancyCut{"cfgOccupancyCut", 500, "Occupancy cut"}; Configurable useWeight{"useWeight", false, "use EP dep effi weight"}; + Configurable useSP{"useSP", false, "use SP"}; + Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; + Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; Configurable ConfWeightPath{"ConfWeightPath", "Users/s/skundu/My/Object/PbPb2024/MCWeight2", "Path to gain calibration"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -135,6 +141,15 @@ struct kstarpbpb { using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; + + using CollisionMCTrueTable = aod::McCollisions; + using TrackMCTrueTable = aod::McParticles; + using CollisionMCRecTableCentFT0C = soa::SmallGroups>; + using TrackMCRecTable = soa::Join; + using FilTrackMCRecTable = soa::Filtered; + + Preslice perCollision = aod::track::collisionId; + SliceCache cache; Partition posTracks = aod::track::signed1Pt > cfgCutCharge; Partition negTracks = aod::track::signed1Pt < cfgCutCharge; @@ -171,8 +186,14 @@ struct kstarpbpb { histos.add("hRotation", "hRotation", kTH1F, {{360, 0.0, 2.0 * TMath::Pi()}}); histos.add("hSparseV2SASameEventRotational_V2", "hSparseV2SASameEventRotational_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); } - + histos.add("hSparseV2SAGen_V2", "hSparseV2SAGen_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("hSparseV2SARec_V2", "hSparseV2SARec_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("hpt", "hpt", kTH1F, {thnAxisPt}); + histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}}); + histos.add("CentPercentileMCRecHist", "MC Centrality", kTH1F, {{100, 0.0f, 100.0f}}); histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {thnAxisPt, thnAxisCentrality}); + histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {thnAxisPt, thnAxisCentrality}); if (additionalQAplots1) { histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); @@ -197,12 +218,12 @@ struct kstarpbpb { histos.add("QAafter/trkDCAzka", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); // PID QA before cuts histos.add("QAbefore/TOF_TPC_Mapka_allka", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_allka", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAbefore/TPC_Nsigma_allka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAbefore/TOF_Nsigma_allka", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); + histos.add("QAbefore/TPC_Nsigma_allka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); // PID QA after cuts histos.add("QAafter/TOF_TPC_Mapka_allka", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_allka", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAafter/TPC_Nsigma_allka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAafter/TOF_Nsigma_allka", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); + histos.add("QAafter/TPC_Nsigma_allka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); // DCA QA histos.add("QAbefore/trkDCAxypi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); @@ -211,12 +232,12 @@ struct kstarpbpb { histos.add("QAafter/trkDCAzpi", "DCAz distribution of pion track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); // PID QA before cuts histos.add("QAbefore/TOF_TPC_Mapka_allpi", "TOF + TPC Combined PID for pion;#sigma_{TOF}^{pion};#sigma_{TPC}^{pion}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_allpi", "TOF NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAbefore/TPC_Nsigma_allpi", "TPC NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAbefore/TOF_Nsigma_allpi", "TOF NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{pion};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); + histos.add("QAbefore/TPC_Nsigma_allpi", "TPC NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{pion};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); // PID QA after cuts histos.add("QAafter/TOF_TPC_Mapka_allpi", "TOF + TPC Combined PID for pion;#sigma_{TOF}^{pion};#sigma_{TPC}^{pion}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_allpi", "TOF NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAafter/TPC_Nsigma_allpi", "TPC NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAafter/TOF_Nsigma_allpi", "TOF NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{pion};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); + histos.add("QAafter/TPC_Nsigma_allpi", "TPC NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{pion};", {HistType::kTH3D, {{200, 0.0, 20.0}, {100, -6, 6}, {100, 0.0, 100.0}}}); } // Event selection cut additional - Alex @@ -279,23 +300,23 @@ struct kstarpbpb { bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } - if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) { return true; } } else if (PID == 1) { - if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } - if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) { return true; } } @@ -344,20 +365,20 @@ struct kstarpbpb { return true; } } else if (strategy == 1) { - if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } - if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!useGlobalTrack && !candidate.hasTPC()) { return true; } } else if (strategy == 2) { if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) { @@ -377,20 +398,20 @@ struct kstarpbpb { return true; } } else if (strategy == 1) { - if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } - if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!useGlobalTrack && !candidate.hasTPC()) { return true; } } else if (strategy == 2) { if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) { return true; } if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) { @@ -428,7 +449,7 @@ struct kstarpbpb { double v2, v2Rot; using BinningTypeVertexContributor = ColumnBinningPolicy; - ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, kaonrot, kstarrot; + ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, kaonrot, kstarrot, KaonPlus, KaonMinus; int currentRunNumber = -999; int lastRunNumber = -999; @@ -512,7 +533,18 @@ struct kstarpbpb { if (!track1kaon || !track2pion) { continue; } - + if (additionalQAplots) { + histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa(), centrality); + histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa(), centrality); + histos.fill(HIST("QAafter/trkDCAxyka"), track1.dcaXY()); + histos.fill(HIST("QAafter/trkDCAzka"), track1.dcaZ()); + histos.fill(HIST("QAafter/TOF_TPC_Mapka_allka"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); + histos.fill(HIST("QAafter/TOF_TPC_Mapka_allpi"), track2.tofNSigmaPi(), track2.tpcNSigmaPi()); + histos.fill(HIST("QAafter/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi(), centrality); + histos.fill(HIST("QAafter/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi(), centrality); + histos.fill(HIST("QAafter/trkDCAxypi"), track2.dcaXY()); + histos.fill(HIST("QAafter/trkDCAzpi"), track2.dcaZ()); + } if (useWeight) { if (track2.pt() < 10.0 && track2.pt() > 0.15) { weight2 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track2.phi() - psiFT0C), track2.pt() + 0.000005)); @@ -526,9 +558,15 @@ struct kstarpbpb { if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { continue; } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); - v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + if (useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + } + if (!useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi); + } auto totalweight = weight1 * weight2; if (totalweight <= 0.0005) { totalweight = 1.0; @@ -556,8 +594,12 @@ struct kstarpbpb { } auto phiminuspsiRot = GetPhiInRange(kstarrot.Phi() - psiFT0C); - v2Rot = TMath::Cos(2.0 * phiminuspsiRot) * QFT0C; - + if (useSP) { + v2Rot = TMath::Cos(2.0 * phiminuspsiRot) * QFT0C; + } + if (!useSP) { + v2Rot = TMath::Cos(2.0 * phiminuspsiRot); + } histos.fill(HIST("hSparseV2SASameEventRotational_V2"), kstarrot.M(), kstarrot.Pt(), v2Rot, centrality); } } @@ -619,8 +661,8 @@ struct kstarpbpb { continue; } if (additionalQAplots) { - histos.fill(HIST("QAbefore/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAbefore/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa()); + histos.fill(HIST("QAbefore/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa(), centrality); + histos.fill(HIST("QAbefore/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa(), centrality); histos.fill(HIST("QAbefore/trkDCAxyka"), track1.dcaXY()); histos.fill(HIST("QAbefore/trkDCAzka"), track1.dcaZ()); histos.fill(HIST("QAbefore/TOF_TPC_Mapka_allka"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); @@ -643,8 +685,8 @@ struct kstarpbpb { } if (additionalQAplots) { histos.fill(HIST("QAbefore/TOF_TPC_Mapka_allpi"), track2.tofNSigmaPi(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAbefore/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAbefore/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi()); + histos.fill(HIST("QAbefore/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi(), centrality); + histos.fill(HIST("QAbefore/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi(), centrality); histos.fill(HIST("QAbefore/trkDCAxypi"), track2.dcaXY()); histos.fill(HIST("QAbefore/trkDCAzpi"), track2.dcaZ()); } @@ -697,14 +739,14 @@ struct kstarpbpb { if (same) { if (track1kaon && track2pion) { if (additionalQAplots) { - histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa()); + histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa(), centrality); + histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa(), centrality); histos.fill(HIST("QAafter/trkDCAxyka"), track1.dcaXY()); histos.fill(HIST("QAafter/trkDCAzka"), track1.dcaZ()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_allka"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_allpi"), track2.tofNSigmaPi(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAafter/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAafter/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi()); + histos.fill(HIST("QAafter/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi(), centrality); + histos.fill(HIST("QAafter/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi(), centrality); histos.fill(HIST("QAafter/trkDCAxypi"), track2.dcaXY()); histos.fill(HIST("QAafter/trkDCAzpi"), track2.dcaZ()); } @@ -723,7 +765,12 @@ struct kstarpbpb { } auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); - v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + if (useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + } + if (!useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi); + } histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); } @@ -753,7 +800,12 @@ struct kstarpbpb { } auto phiminuspsiRot = GetPhiInRange(kstarrot.Phi() - psiFT0C); - v2Rot = TMath::Cos(2.0 * phiminuspsiRot) * QFT0C; + if (useSP) { + v2Rot = TMath::Cos(2.0 * phiminuspsiRot) * QFT0C; + } + if (!useSP) { + v2Rot = TMath::Cos(2.0 * phiminuspsiRot); + } histos.fill(HIST("hSparseV2SASameEventRotational_V2"), kstarrot.M(), kstarrot.Pt(), v2Rot, centrality); } @@ -866,7 +918,12 @@ struct kstarpbpb { } auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); - v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + if (useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + } + if (!useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi); + } histos.fill(HIST("hSparseV2SAlikeEventNN_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); } } else if (track1pion && track2kaon) { @@ -879,7 +936,12 @@ struct kstarpbpb { } auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); - v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + if (useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + } + if (!useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi); + } histos.fill(HIST("hSparseV2SAlikeEventPP_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); } @@ -934,6 +996,11 @@ struct kstarpbpb { // printf("Mix = %d\n", 6); continue; } + auto track1ID = track1.globalIndex(); + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) { + continue; + } if (ispTdepPID && !(selectionPIDNew(track1, 0))) { continue; } @@ -961,6 +1028,186 @@ struct kstarpbpb { } } PROCESS_SWITCH(kstarpbpb, processMixedEvent, "Process Mixed event", true); + void processMC(CollisionMCTrueTable::iterator const& /*TrueCollision*/, CollisionMCRecTableCentFT0C const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + histos.fill(HIST("hMC"), 0); + if (RecCollisions.size() == 0) { + histos.fill(HIST("hMC"), 1); + return; + } + if (RecCollisions.size() > 1) { + histos.fill(HIST("hMC"), 2); + return; + } + for (auto& RecCollision : RecCollisions) { + auto psiFT0C = 0.0; + histos.fill(HIST("hMC"), 3); + if (!RecCollision.sel8()) { + histos.fill(HIST("hMC"), 4); + continue; + } + + if (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + histos.fill(HIST("hMC"), 5); + continue; + } + if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { + histos.fill(HIST("hMC"), 6); + continue; + } + histos.fill(HIST("hMC"), 7); + auto centrality = RecCollision.centFT0C(); + histos.fill(HIST("CentPercentileMCRecHist"), centrality); + auto oldindex = -999; + auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); + // loop over reconstructed particle + for (auto track1 : Rectrackspart) { + if (!selectionTrack(track1)) { + continue; + } + if (ispTdepPID && !(selectionPIDNew(track1, 0))) { + continue; + } + if (!ispTdepPID && !(selectionPID(track1, 0))) { + continue; + } + if (!track1.has_mcParticle()) { + continue; + } + auto track1ID = track1.index(); + for (auto track2 : Rectrackspart) { + auto track2ID = track2.index(); + if (track2ID == track1ID) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + if (ispTdepPID && !(selectionPIDNew(track2, 1))) { + continue; + } + if (!ispTdepPID && !(selectionPID(track2, 1))) { + continue; + } + if (!track2.has_mcParticle()) { + continue; + } + if (track1.sign() * track2.sign() > 0) { + continue; + } + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = TMath::Abs(mctrack1.pdgCode()); + int track2PDG = TMath::Abs(mctrack2.pdgCode()); + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + if (!(track1PDG == 321 && track2PDG == 211)) { + continue; + } + for (auto& mothertrack1 : mctrack1.mothers_as()) { + for (auto& mothertrack2 : mctrack2.mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { + continue; + } + if (mothertrack1 != mothertrack2) { + continue; + } + if (TMath::Abs(mothertrack1.y()) > confRapidity) { + continue; + } + if (PDGcheck && TMath::Abs(mothertrack1.pdgCode()) != 313) { + continue; + } + if (ispTdepPID && !(selectionPIDNew(track1, 0) || selectionPIDNew(track2, 1))) { + continue; + } + if (!ispTdepPID && !(selectionPID(track1, 0) || selectionPID(track2, 1))) { + continue; + } + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + continue; + } + oldindex = mothertrack1.globalIndex(); + if (track1.sign() > 0 && track2.sign() < 0) { + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + } + if (track1.sign() < 0 && track2.sign() > 0) { + KaonMinus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + KaonPlus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + } + KstarMother = KaonPlus + KaonMinus; + if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); + + v2 = TMath::Cos(2.0 * phiminuspsi); + + histos.fill(HIST("hSparseV2SARec_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + histos.fill(HIST("h2PhiRec2"), KstarMother.pt(), centrality); + histos.fill(HIST("hpt"), KstarMother.Pt()); + } + } + } + } + // loop over generated particle + for (auto& mcParticle : GenParticles) { + if (TMath::Abs(mcParticle.y()) > confRapidity) { + continue; + } + if (PDGcheck && mcParticle.pdgCode() != 313) { + continue; + } + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != 2) { + continue; + } + auto daughtp = false; + auto daughtm = false; + for (auto kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + if (kCurrentDaughter.pdgCode() == +321) { + if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + daughtp = true; + } + if (!genacceptancecut) { + daughtp = true; + } + KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } else if (kCurrentDaughter.pdgCode() == -211) { + if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + daughtm = true; + } + if (!genacceptancecut) { + daughtm = true; + } + KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); + } + } + if (daughtp && daughtm) { + KstarMother = KaonPlus + KaonMinus; + if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); + + v2 = TMath::Cos(2.0 * phiminuspsi); + + histos.fill(HIST("hSparseV2SAGen_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + histos.fill(HIST("h2PhiGen2"), KstarMother.pt(), centrality); + } + } + } // rec collision loop + + } // process MC + PROCESS_SWITCH(kstarpbpb, processMC, "Process MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index b5145275178..ca4c7e313ba 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -96,6 +96,7 @@ struct phianalysisrun3_PbPb { Configurable fillRotation{"fillRotation", true, "fill rotation"}; Configurable confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; Configurable confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; + Configurable PDGcheck{"PDGcheck", true, "PDGcheck"}; Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; // MC @@ -131,8 +132,8 @@ struct phianalysisrun3_PbPb { histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); - histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, -12, 12}, {200, 0.0, 200.0}}}); - histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, -12, 12}, {200, 0.0, 200.0}}}); + histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); } // DCA QA @@ -142,12 +143,12 @@ struct phianalysisrun3_PbPb { histos.add("QAafter/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); // PID QA before cuts histos.add("QAbefore/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{100, -6, 6}, {200, 0.0, 200.0}}}); - histos.add("QAbefore/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{100, -6, 6}, {200, 0.0, 200.0}}}); + histos.add("QAbefore/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("QAbefore/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); // PID QA after cuts histos.add("QAafter/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{100, -6, 6}, {200, 0.0, 200.0}}}); - histos.add("QAafter/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{100, -6, 6}, {200, 0.0, 200.0}}}); + histos.add("QAafter/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("QAafter/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); } double massKa = o2::constants::physics::MassKPlus; @@ -289,8 +290,8 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track1)) { continue; } - histos.fill(HIST("QAbefore/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity); - histos.fill(HIST("QAbefore/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity); + histos.fill(HIST("QAbefore/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("QAbefore/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity, track1.pt()); histos.fill(HIST("QAbefore/trkDCAxy"), track1.dcaXY()); histos.fill(HIST("QAbefore/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAbefore/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); @@ -310,16 +311,16 @@ struct phianalysisrun3_PbPb { bool unlike = true; bool mix = false; if (!ispTdepPID && selectionPID(track1) && selectionPID(track2)) { - histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity); - histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity); + histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity, track1.pt()); histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); FillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { - histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity); - histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity); + histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity, track1.pt()); histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); @@ -570,7 +571,7 @@ struct phianalysisrun3_PbPb { if (TMath::Abs(mothertrack1.y()) > confRapidity) { continue; } - if (TMath::Abs(mothertrack1.pdgCode()) != 333) { + if (PDGcheck && TMath::Abs(mothertrack1.pdgCode()) != 333) { continue; } if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { @@ -606,7 +607,7 @@ struct phianalysisrun3_PbPb { if (TMath::Abs(mcParticle.y()) > confRapidity) { continue; } - if (mcParticle.pdgCode() != 333) { + if (PDGcheck && mcParticle.pdgCode() != 333) { continue; } auto kDaughters = mcParticle.daughters_as(); @@ -681,7 +682,7 @@ struct phianalysisrun3_PbPb { if (std::abs(mcParticle.y()) >= 0.5) { continue; } - if (mcParticle.pdgCode() != 333) { + if (PDGcheck && mcParticle.pdgCode() != 333) { continue; } auto kDaughters = mcParticle.daughters_as(); @@ -786,7 +787,7 @@ struct phianalysisrun3_PbPb { if (std::abs(mothertrack1.y()) >= 0.5) { continue; } - if (std::abs(mothertrack1.pdgCode()) != 333) { + if (PDGcheck && std::abs(mothertrack1.pdgCode()) != 333) { continue; } if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { @@ -796,8 +797,8 @@ struct phianalysisrun3_PbPb { continue; } - histos.fill(HIST("TPC_Nsigma_MC"), track1.tpcNSigmaKa(), multiplicity); - histos.fill(HIST("TOF_Nsigma_MC"), track1.tofNSigmaKa(), multiplicity); + histos.fill(HIST("TPC_Nsigma_MC"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("TOF_Nsigma_MC"), track1.tofNSigmaKa(), multiplicity, track1.pt()); if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); continue;