From 86670579146f2785c3bb079f96f6395a40fb8523 Mon Sep 17 00:00:00 2001 From: nkaratze Date: Sat, 25 Oct 2025 19:02:45 +0200 Subject: [PATCH] Signal Split Correction and Small Changes --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 92 ++++++++++++++------ 1 file changed, 63 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index c5494975dd2..fb8fe6a7f21 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -48,6 +48,9 @@ std::vector> lambdaPt; static std::vector lambdaPtBins; std::vector> antilambdaPt; static std::vector antilambdaPtBins; +std::vector> kaonSplit; +std::vector> lambdaSplit; +std::vector> antilambdaSplit; } // namespace pthistos using namespace o2; using namespace o2::framework; @@ -60,6 +63,9 @@ struct V0PtInvMassPlots { HistogramRegistry rKaonshMassPlotsPerPtBin{"KaonshMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambdaMassPlotsPerPtBin{"LambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rAntilambdaMassPlotsPerPtBin{"AntilambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rKaonshSplitMassPlotsPerPtBin{"KaonshSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rLambdaSplitMassPlotsPerPtBin{"LambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rAntilambdaSplitMassPlotsPerPtBin{"AntilambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rFeeddownMatrices{"FeeddownMatrices", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rMCCorrections{"MCCorrections", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -169,9 +175,12 @@ struct V0PtInvMassPlots { void init(InitContext const&) { - pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect - pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect - pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect + pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect + pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect + pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect + pthistos::kaonSplit.resize(nmaxHistograms); // number of Kaon Split Pt histograms to expect + pthistos::lambdaSplit.resize(nmaxHistograms); // number of Lambda Split Pt histograms to expect + pthistos::antilambdaSplit.resize(nmaxHistograms); // number of Antilambda Split Pt histograms to expect // tokenise strings into individual values pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ','); @@ -202,7 +211,7 @@ struct V0PtInvMassPlots { std::vector kaonhistvalue(nmaxHistograms + 1); std::vector lambdahistvalue(nmaxHistograms + 1); std::vector antilambdahistvalue(nmaxHistograms + 1); - // K0short Histogram Pt Bin Edges + // K0short Histogram Pt Bin Edges (and Split) for (int i = 0; i < nmaxHistograms + 1; i++) { // Histos won't accept "." character so converting it to "_" std::string kaonptbin = pthistos::kaonPtBins[i]; // getting the value of the bin edge size_t pos = kaonptbin.find("."); // finding the "." character @@ -249,6 +258,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hK0shDCANegDaughter", "hK0shDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::kaonPt[i] = rKaonshMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); + pthistos::kaonSplit[i] = rKaonshSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); } rFeeddownMatrices.add("hK0shFeeddownMatrix", "hK0shFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); rFeeddownMatrices.add("hK0shPhiFeeddownMatrix", "hK0shPhiFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); @@ -268,6 +278,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hLambdaDCANegDaughter", "hLambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); + pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); } // lambdafeeddown matrices rFeeddownMatrices.add("hLambdaFeeddownMatrix", "hLambdaFeeddownMatrix", {HistType::kTH2F, {{lambdaPtAxis}, {lambdaPtAxis}}}); @@ -290,6 +301,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hAntilambdaDCANegDaughter", "hAntilambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); + pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); } // antilambdafeeddown matrices rFeeddownMatrices.add("hAntiLambdaFeeddownMatrix", "hAntiLambdaFeeddownMatrix", {HistType::kTH2F, {{antilambdaPtAxis}, {antilambdaPtAxis}}}); @@ -299,12 +311,7 @@ struct V0PtInvMassPlots { } // Particle Level Corrections - rMCCorrections.add("hK0ShSplitDenominatorPtSpectrum", "hK0ShSplitDenominatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); - rMCCorrections.add("hLambdaSplitDenominatorPtSpectrum", "hLambdaSplitDenominatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); - rMCCorrections.add("hAntilambdaSplitDenominatorPtSpectrum", "hAntilambdaSplitDenominatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); - rMCCorrections.add("hK0ShSplitNumenatorPtSpectrum", "hK0ShSplitNumenatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); - rMCCorrections.add("hLambdaSplitNumenatorPtSpectrum", "hLambdaSplitNumenatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); - rMCCorrections.add("hAntilambdaSplitNumenatorPtSpectrum", "hAntilambdaSplitNumenatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); + rMCCorrections.add("hK0ShNoMCParticle", "hK0ShNoMCParticle", {HistType::kTH1D, {k0ShortPtAxis}}); rMCCorrections.add("hK0ShBeforeEventSelectionPtSpectrum", "hK0ShBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); rMCCorrections.add("hLambdaBeforeEventSelectionPtSpectrum", "hLambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); rMCCorrections.add("hAntilambdaBeforeEventSelectionPtSpectrum", "hAntilambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); @@ -771,6 +778,7 @@ struct V0PtInvMassPlots { pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ','); pthistos::antilambdaPtBins = o2::utils::Str::tokenize(antilambdaSettingPtBinsString, ','); + pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); // initialize and convert tokenized strings into vector of doubles for Pt Bin Edges std::vector kaonptedgevalues(nmaxHistograms + 1); @@ -789,16 +797,22 @@ struct V0PtInvMassPlots { for (const auto& v0 : V0s) { // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace) - if (v0.has_mcParticle()) { - auto v0mcParticle = v0.mcParticle(); - - if (!acceptV0(v0)) { // V0 Selections - continue; - } - // kzero analysis - if (kzeroAnalysis == true) { - if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched - if (acceptK0sh(v0)) { // K0sh Selection + if (!acceptV0(v0)) { // V0 Selections + continue; + } + // kzero analysis + if (kzeroAnalysis == true) { + if (acceptK0sh(v0)) { // K0sh Selection + // K0sh Signal Split Numerator Start + for (int i = 0; i < nmaxHistograms; i++) { + if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges for K0sh Splitting Numerator + pthistos::kaonSplit[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms for K0sh Splitting Numerator + } + } + // K0sh Signla Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges @@ -819,10 +833,20 @@ struct V0PtInvMassPlots { } } } - // lambda analysis - if (lambdaAnalysis == true) { - if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched - if (acceptLambda(v0)) { // Lambda Selections + } + // lambda analysis + if (lambdaAnalysis == true) { + if (acceptLambda(v0)) { // Lambda Selections + // Lambda Signal Split Numerator Start + for (int i = 0; i < nmaxHistograms; i++) { + if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { + pthistos::lambdaSplit[i]->Fill(v0.mLambda()); + } + } + // Lambda Signal Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { @@ -849,10 +873,20 @@ struct V0PtInvMassPlots { } } } - // antilambda analysis - if (antiLambdaAnalysis == true) { - if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched - if (acceptAntilambda(v0)) { // Antilambda Selections + } + // antilambda analysis + if (antiLambdaAnalysis == true) { + if (acceptAntilambda(v0)) { // Antilambda Selections + // Antilambda Signal Split Numerator End + for (int i = 0; i < nmaxHistograms; i++) { + if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { + pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda()); + } + } + // Antilambda Signal Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { @@ -904,7 +938,7 @@ struct V0PtInvMassPlots { if (!acceptEvent(collision)) { // Event Selection return; } - rPtAnalysis.fill(HIST("hNRecEvents_Data"), 1.0); // Number of Reconstructed Events + rPtAnalysis.fill(HIST("hNRecEvents_Data"), 0.5); // Number of Reconstructed Events for (const auto& v0 : V0s) { // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace)