diff --git a/PWGLF/DataModel/LFSigmaTables.h b/PWGLF/DataModel/LFSigmaTables.h index 5f7307c3010..521759750a7 100644 --- a/PWGLF/DataModel/LFSigmaTables.h +++ b/PWGLF/DataModel/LFSigmaTables.h @@ -481,14 +481,16 @@ namespace sigma0Gen { DECLARE_SOA_COLUMN(IsSigma0, isSigma0, bool); // true: sigma0, false: antisigma0 DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool); -DECLARE_SOA_COLUMN(Sigma0MCPt, sigma0MCPt, float); // MC pT +DECLARE_SOA_COLUMN(MCPt, mcpt, float); // MC pT +DECLARE_SOA_COLUMN(MCY, mcy, float); // MC Y } // namespace sigma0Gen DECLARE_SOA_TABLE(Sigma0Gens, "AOD", "SIGMA0GENS", sigma0Gen::IsSigma0, sigma0Gen::ProducedByGenerator, - sigma0Gen::Sigma0MCPt); + sigma0Gen::MCPt, + sigma0Gen::MCY); DECLARE_SOA_TABLE(SigmaCollRef, "AOD", "SIGMACOLLREF", //! optional table to refer back to a collision o2::soa::Index<>, v0data::StraCollisionId); @@ -859,12 +861,14 @@ DECLARE_SOA_TABLE(Pi0CollRef, "AOD", "PI0COLLREF", //! optional table to refer b namespace pi0Gen { DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool); -DECLARE_SOA_COLUMN(Pi0MCPt, pi0MCPt, float); // MC pT +DECLARE_SOA_COLUMN(MCPt, mcpt, float); // MC pT +DECLARE_SOA_COLUMN(MCY, mcy, float); // MC Y } // namespace pi0Gen DECLARE_SOA_TABLE(Pi0Gens, "AOD", "PI0GENS", pi0Gen::ProducedByGenerator, - pi0Gen::Pi0MCPt); + pi0Gen::MCPt, + pi0Gen::MCY); DECLARE_SOA_TABLE(Pi0GenCollRef, "AOD", "PI0GENCOLLREF", //! optional table to refer back to a collision o2::soa::Index<>, v0data::StraMCCollisionId); diff --git a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx index 033b5d46b15..dcbf8f8f31c 100644 --- a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx +++ b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx @@ -55,6 +55,7 @@ #include #include #include +#include using namespace o2; using namespace o2::framework; @@ -1259,13 +1260,13 @@ struct sigma0builder { // Fill tables // Pi0 if (fillPi0Tables && MCGenInfo.IsPi0) { - pi0Gens(MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt); // optional table to store generated pi0 candidates. Be careful, this is a large table! + pi0Gens(MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt, mcParticle.y()); // optional table to store generated pi0 candidates. Be careful, this is a large table! pi0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table } // Sigma0/ASigma0 if (fillSigma0Tables && (MCGenInfo.IsSigma0 || MCGenInfo.IsAntiSigma0)) { - sigma0Gens(MCGenInfo.IsSigma0, MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt); + sigma0Gens(MCGenInfo.IsSigma0, MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt, mcParticle.y()); sigma0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table } } diff --git a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx index 9d826448de9..3b6bd0b0730 100644 --- a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx @@ -53,13 +53,15 @@ #include #include #include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using MCSigma0s = soa::Join; +using MCSigma0s = soa::Join; using Sigma0s = soa::Join; static const std::vector PhotonSels = {"NoSel", "V0Type", "DCADauToPV", @@ -124,7 +126,12 @@ struct sigmaanalysis { } eventSelections; // Generated Sigma0s - Configurable mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."}; + struct : ConfigurableGroup { + std::string prefix = "genSelections"; // JSON group name + Configurable mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."}; + Configurable mc_rapidityMin{"mc_rapidityMin", -0.5, "Min generated particle rapidity"}; + Configurable mc_rapidityMax{"mc_rapidityMax", 0.5, "Max generated particle rapidity"}; + } genSelections; // QA Configurable fdoSigma0QA{"doSigma0QA", false, "if true, perform Sigma0 QA analysis. Only works with MC."}; @@ -544,8 +551,8 @@ struct sigmaanalysis { histos.add("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt", "h2dGenAntiSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); histos.add("Gen/h2dGenSigma0VsMultMC", "h2dGenSigma0VsMultMC", kTH2D, {axisNch, axisPt}); histos.add("Gen/h2dGenAntiSigma0VsMultMC", "h2dGenAntiSigma0VsMultMC", kTH2D, {axisNch, axisPt}); - - } else { // Pi0 specific + } + if (doprocessPi0GeneratedRun3) { // Pi0 specific histos.add("Gen/h2dGenPi0VsMultMC_RecoedEvt", "h2dGenPi0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); histos.add("Gen/h2dGenPi0", "h2dGenPi0", kTH2D, {axisCentrality, axisPt}); histos.add("Gen/h2dGenPi0VsMultMC", "h2dGenPi0VsMultMC", kTH2D, {axisNch, axisPt}); @@ -813,8 +820,12 @@ struct sigmaanalysis { continue; } + // Rapidity selection + if ((genParticle.mcy() < genSelections.mc_rapidityMin) || (genParticle.mcy() > genSelections.mc_rapidityMax)) + continue; + // Selection on the source (generator/transport) - if (!genParticle.producedByGenerator() && mc_keepOnlyFromGenerator) + if (!genParticle.producedByGenerator() && genSelections.mc_keepOnlyFromGenerator) continue; // Select corresponding mc collision && Basic event selection @@ -834,33 +845,35 @@ struct sigmaanalysis { //______________________________________________________________________________ // Generated Sigma0 processing - if constexpr (requires { genParticle.sigma0MCPt(); }) { + if constexpr (requires { genParticle.isSigma0(); }) { + if (doprocessGeneratedRun3) { - float ptmc = genParticle.sigma0MCPt(); + float ptmc = genParticle.mcpt(); - if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { - auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { + auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - if (genParticle.isSigma0()) - histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + if (genParticle.isSigma0()) + histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); - else - histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); - } + else + histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } - if (genParticle.isSigma0()) { - histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmc); - histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); - } else { - histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmc); - histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (genParticle.isSigma0()) { + histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmc); + histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } else { + histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmc); + histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } } //______________________________________________________________________________ // Generated Pi0 processing - if constexpr (requires { genParticle.pi0MCPt(); }) { - float ptmc = genParticle.pi0MCPt(); + if (doprocessPi0GeneratedRun3) { + float ptmc = genParticle.mcpt(); if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); @@ -1210,7 +1223,7 @@ struct sigmaanalysis { "TPCTOFPID", "DCADauToPV", "Mass"}; if (PDGRequired == 22) { - if constexpr (selection_index >= 0 && selection_index < (int)std::size(PhotonSelsLocal)) { + if constexpr (selection_index >= 0 && selection_index < static_cast(std::size(PhotonSelsLocal))) { histos.fill(HIST("Selection/Photon/hCandidateSel"), selection_index); histos.fill(HIST("Selection/Photon/h2d") + HIST(PhotonSelsLocal[selection_index]), sigma.photonPt(), sigma.photonMass()); histos.fill(HIST("Selection/Sigma0/h2dPhoton") + HIST(PhotonSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass()); @@ -1218,7 +1231,7 @@ struct sigmaanalysis { } if (PDGRequired == 3122) { - if constexpr (selection_index >= 0 && selection_index < (int)std::size(LambdaSelsLocal)) { + if constexpr (selection_index >= 0 && selection_index < static_cast(std::size(LambdaSelsLocal))) { histos.fill(HIST("Selection/Lambda/hCandidateSel"), selection_index); histos.fill(HIST("Selection/Lambda/h2d") + HIST(LambdaSelsLocal[selection_index]), sigma.lambdaPt(), sigma.lambdaMass()); histos.fill(HIST("Selection/Sigma0/h2dLambda") + HIST(LambdaSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass()); @@ -1252,9 +1265,8 @@ struct sigmaanalysis { auto sigma0mc = fullSigma0s.rawIteratorAt(sigma0Index[mcid]); histos.fill(HIST("Sigma0QA/hDuplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed - if (sigma0mc.isSigma0()) { - } - histos.fill(HIST("Sigma0QA/hSigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed + if (sigma0mc.isSigma0()) + histos.fill(HIST("Sigma0QA/hSigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed if (sigma0mc.isAntiSigma0()) histos.fill(HIST("Sigma0QA/hASigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed