From fd6e4e75e0d9829224b9e377d94fdd607a4fca69 Mon Sep 17 00:00:00 2001 From: nxk335-local Date: Thu, 31 Oct 2024 17:29:16 +0000 Subject: [PATCH 1/3] PWGLF:Updated V0 Generated Pt Spectrum Process --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 168 ++++++++++--------- 1 file changed, 90 insertions(+), 78 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index 5693ab6f0a8..c9e9702c7d8 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -79,6 +79,9 @@ struct v0ptinvmassplots { Configurable kzeroshsetting_pt_string{"kzerosetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Kzero Pt Bin Values"}; Configurable lambdasetting_pt_string{"lambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Lambda Pt Bin Values"}; Configurable antilambdasetting_pt_string{"antilambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Antilambda Pt Bin Values"}; + Configurable xaxisgenbins{"xaxisgenbins", 20.0, "Number of bins for Generated Pt Spectrum"}; + Configurable xaxismingenbin{"xaxismingenbin", 0.0, "Minimum bin value of the Generated Pt Spectrum Plot"}; + Configurable xaxismaxgenbin{"xaxismaxgenbin", 3.0, "Maximum bin value of the Generated Pt Spectrum Plot"}; void init(InitContext const&) { @@ -87,7 +90,7 @@ struct v0ptinvmassplots { AxisSpec LambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{+}#pi^{-} [GeV/#it{c}^{2}]"}; AxisSpec AntiLambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{-}#pi^{+} [GeV/#it{c}^{2}]"}; AxisSpec ptAxis = {nBins, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec GenptAxis = {20, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec GenptAxis = {20, 0.0f, 3.0f, "#it{p}_{T} (GeV/#it{c})"}; rPtAnalysis.add("hV0PtAll", "hV0PtAll", {HistType::kTH1F, {{nBins, 0.0f, 10.0f}}}); @@ -156,26 +159,33 @@ struct v0ptinvmassplots { // Defining filters for events (event selection) // Processed events will be already fulfilling the event selection requirements Filter eventFilter = (o2::aod::evsel::sel8 == true); + Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < 10.0f); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < 10.0f); // Defining the type of the daughter tracks using DaughterTracks = soa::Join; // This is the Process for the MC Generated Data - void GenMCprocess(const soa::SmallGroups>& collisions, + void GenMCprocess(soa::Filtered::iterator const&, + const soa::SmallGroups>&, aod::McParticles const& mcParticles) { for (const auto& mcParticle : mcParticles) { - if (mcParticle.pdgCode() == 310) // kzero matched - { - rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == 3122) // lambda matched - { - rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -3122) // antilambda matched - { - rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt()); + if (mcParticle.isPhysicalPrimary()) { + if (TMath::Abs(mcParticle.y()) < 0.5f) { + if (mcParticle.pdgCode() == 310) // kzero matched + { + rPtAnalysis.fill(HIST("hK0ShGeneratedPtSpectrum"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 3122) // lambda matched + { + rPtAnalysis.fill(HIST("hLambdaGeneratedPtSpectrum"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -3122) // antilambda matched + { + rPtAnalysis.fill(HIST("hAntilambdaGeneratedPtSpectrum"), mcParticle.pt()); + } + } } } } @@ -183,85 +193,87 @@ struct v0ptinvmassplots { void RecMCprocess(soa::Filtered>::iterator const&, soa::Join const& V0s, DaughterTracks const&, // no need to define a variable for tracks, if we don't access them directly - aod::McParticles const&) + aod::McParticles const& mcParticles) { for (const auto& v0 : V0s) { rPtAnalysis.fill(HIST("hV0PtAll"), v0.pt()); // 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 (kzerosh_analysis == true) { - if (v0mcParticle.pdgCode() == 310) { // kzero matched - rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short()); - rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best kzero cuts - if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short()); - rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin - std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin - std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin - size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value - size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value - pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "." - pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "." - const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double - const float pthighervalue = std::stod(pt2); // converting the higher string value to a double - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value - pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms + if (v0mcParticle.isPhysicalPrimary()) { + if (kzerosh_analysis == true) { + if (v0mcParticle.pdgCode() == 310) { // kzero matched + rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short()); + rPtAnalysis.fill(HIST("hK0ShortPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best kzero cuts + if (v0.v0cosPA() > kaonshsetting_cospa && v0.dcaV0daughters() < kaonshsetting_dcav0dau && v0.v0radius() > kaonshsetting_radius && TMath::Abs(v0.dcapostopv()) > kaonshsetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > kaonshsetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassK0ShortAllAfterCuts"), v0.mK0Short()); + rPtAnalysis.fill(HIST("hK0ShortReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // getting the pt value in #_# for and converting it to a number #.# for use, we get two values which correspond to the range of each bin + std::string pt1 = pthistos::kaonptbins[i]; // getting the lower string-value of the bin + std::string pt2 = pthistos::kaonptbins[i + 1]; // getting the higher string-value of the bin + size_t pos1 = pt1.find("_"); // finding the "_" character of the lower string-value + size_t pos2 = pt2.find("_"); // finding the "_" character of the higher string-value + pt1[pos1] = '.'; // changing the "_" character of the lower string-value to a "." + pt2[pos2] = '.'; // changing the "_" character of the higher string-value to a "." + const float ptlowervalue = std::stod(pt1); // converting the lower string value to a double + const float pthighervalue = std::stod(pt2); // converting the higher string value to a double + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { // finding v0s with pt withing the range of our lower and higher value + pthistos::KaonPt[i]->Fill(v0.mK0Short()); // filling the 20 kaon namespace histograms + } } } } } - } - // lambda analysis - if (lambda_analysis == true) { - if (v0mcParticle.pdgCode() == 3122) { // lambda matched - rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda()); - rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best lambda cuts - if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda()); - rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range - std::string pt1 = pthistos::lambdaptbins[i]; - std::string pt2 = pthistos::lambdaptbins[i + 1]; - size_t pos1 = pt1.find("_"); - size_t pos2 = pt2.find("_"); - pt1[pos1] = '.'; - pt2[pos2] = '.'; - const float ptlowervalue = std::stod(pt1); - const float pthighervalue = std::stod(pt2); - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { - pthistos::LambdaPt[i]->Fill(v0.mLambda()); + // lambda analysis + if (lambda_analysis == true) { + if (v0mcParticle.pdgCode() == 3122) { // lambda matched + rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda()); + rPtAnalysis.fill(HIST("hLambdaPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best lambda cuts + if (v0.v0cosPA() > lambdasetting_cospa && v0.dcaV0daughters() < lambdasetting_dcav0dau && v0.v0radius() > lambdasetting_radius && TMath::Abs(v0.dcapostopv()) > lambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > lambdasetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassLambdaAllAfterCuts"), v0.mLambda()); + rPtAnalysis.fill(HIST("hLambdaReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // same as above with kzerosh we fill the 20 lambda namespace histograms within their Pt range + std::string pt1 = pthistos::lambdaptbins[i]; + std::string pt2 = pthistos::lambdaptbins[i + 1]; + size_t pos1 = pt1.find("_"); + size_t pos2 = pt2.find("_"); + pt1[pos1] = '.'; + pt2[pos2] = '.'; + const float ptlowervalue = std::stod(pt1); + const float pthighervalue = std::stod(pt2); + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { + pthistos::LambdaPt[i]->Fill(v0.mLambda()); + } } } } } - } - // antilambda analysis - if (antilambda_analysis == true) { - if (v0mcParticle.pdgCode() == -3122) { // antilambda matched - rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda()); - rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt()); - // Implementing best antilambda cuts - if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) { - rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda()); - rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt()); - for (int i = 0; i < 20; i++) { - // same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range - std::string pt1 = pthistos::antilambdaptbins[i]; - std::string pt2 = pthistos::antilambdaptbins[i + 1]; - size_t pos1 = pt1.find("_"); - size_t pos2 = pt2.find("_"); - pt1[pos1] = '.'; - pt2[pos2] = '.'; - const float ptlowervalue = std::stod(pt1); - const float pthighervalue = std::stod(pt2); - if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { - pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda()); + // antilambda analysis + if (antilambda_analysis == true) { + if (v0mcParticle.pdgCode() == -3122) { // antilambda matched + rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda()); + rPtAnalysis.fill(HIST("hAntilambdaPtSpectrumBeforeCuts"), v0.pt()); + // Implementing best antilambda cuts + if (v0.v0cosPA() > antilambdasetting_cospa && v0.dcaV0daughters() < antilambdasetting_dcav0dau && v0.v0radius() > antilambdasetting_radius && TMath::Abs(v0.dcapostopv()) > antilambdasetting_dcapostopv && TMath::Abs(v0.dcanegtopv()) > antilambdasetting_dcanegtopv) { + rPtAnalysis.fill(HIST("hMassAntilambdaAllAfterCuts"), v0.mAntiLambda()); + rPtAnalysis.fill(HIST("hAntilambdaReconstructedPtSpectrum"), v0.pt()); + for (int i = 0; i < 20; i++) { + // same as above with kzerosh and lambda we fill the 20 anti-lambda namespace histograms within their Pt range + std::string pt1 = pthistos::antilambdaptbins[i]; + std::string pt2 = pthistos::antilambdaptbins[i + 1]; + size_t pos1 = pt1.find("_"); + size_t pos2 = pt2.find("_"); + pt1[pos1] = '.'; + pt2[pos2] = '.'; + const float ptlowervalue = std::stod(pt1); + const float pthighervalue = std::stod(pt2); + if (ptlowervalue <= v0.pt() && v0.pt() < pthighervalue) { + pthistos::AntilambdaPt[i]->Fill(v0.mAntiLambda()); + } } } } From 9489124a676d4908c219f0af67d9b51a8a90eab4 Mon Sep 17 00:00:00 2001 From: nxk335-local Date: Fri, 1 Nov 2024 14:26:08 +0000 Subject: [PATCH 2/3] small corrections --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index c9e9702c7d8..10049865bb5 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -48,6 +48,9 @@ struct v0ptinvmassplots { // Configurable for histograms Configurable nBins{"nBins", 100, "N bins in all histos"}; + Configurable xaxisgenbins{"xaxisgenbins", 20, "Number of bins for Generated Pt Spectrum"}; + Configurable xaxismingenbin{"xaxismingenbin", 0.0, "Minimum bin value of the Generated Pt Spectrum Plot"}; + Configurable xaxismaxgenbin{"xaxismaxgenbin", 3.0, "Maximum bin value of the Generated Pt Spectrum Plot"}; // Configurable Kaonsh Topological Cuts (best cuts determined by v0topologicalcuts task) Configurable kaonshsetting_dcav0dau{"kaonshsetting_dcav0dau", 100.0, "DCA V0 Daughters"}; @@ -79,9 +82,6 @@ struct v0ptinvmassplots { Configurable kzeroshsetting_pt_string{"kzerosetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Kzero Pt Bin Values"}; Configurable lambdasetting_pt_string{"lambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Lambda Pt Bin Values"}; Configurable antilambdasetting_pt_string{"antilambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Antilambda Pt Bin Values"}; - Configurable xaxisgenbins{"xaxisgenbins", 20.0, "Number of bins for Generated Pt Spectrum"}; - Configurable xaxismingenbin{"xaxismingenbin", 0.0, "Minimum bin value of the Generated Pt Spectrum Plot"}; - Configurable xaxismaxgenbin{"xaxismaxgenbin", 3.0, "Maximum bin value of the Generated Pt Spectrum Plot"}; void init(InitContext const&) { @@ -90,7 +90,7 @@ struct v0ptinvmassplots { AxisSpec LambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{+}#pi^{-} [GeV/#it{c}^{2}]"}; AxisSpec AntiLambdaMassAxis = {nBins, 1.085f, 1.145f, "#it{M} p^{-}#pi^{+} [GeV/#it{c}^{2}]"}; AxisSpec ptAxis = {nBins, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec GenptAxis = {20, 0.0f, 3.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec GenptAxis = {xaxisgenbins, xaxismingenbin, xaxismaxgenbin, "#it{p}_{T} (GeV/#it{c})"}; rPtAnalysis.add("hV0PtAll", "hV0PtAll", {HistType::kTH1F, {{nBins, 0.0f, 10.0f}}}); From cc0fa71949e289072147e2fa9239f3c5e23814e3 Mon Sep 17 00:00:00 2001 From: nxk335-local Date: Mon, 4 Nov 2024 17:13:45 +0000 Subject: [PATCH 3/3] #include string/vector/memory as requested by Megalinter --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index 10049865bb5..6d63624569a 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \brief V0 task for production of invariant mass plots for Optimised Topological Cuts Analysis +/// \brief V0 task for production of invariant mass plots for Pt Spectrum Analysis /// \author Nikolaos Karatzenis (nikolaos.karatzenis@cern.ch) /// \author Roman Lietava (roman.lietava@cern.ch) @@ -24,6 +24,9 @@ This analysis includes two processes, one for Real Data and one for MC Data swit #include "Common/DataModel/EventSelection.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/PIDResponse.h" +#include +#include +#include // namespace to be used for pt plots and bins namespace pthistos