Skip to content

Commit 34c0065

Browse files
[PWGLF] Minor changes in sigma0 tasks (#14108)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 962781e commit 34c0065

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

PWGLF/DataModel/LFSigmaTables.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,16 @@ namespace sigma0Gen
481481
{
482482
DECLARE_SOA_COLUMN(IsSigma0, isSigma0, bool); // true: sigma0, false: antisigma0
483483
DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool);
484-
DECLARE_SOA_COLUMN(Sigma0MCPt, sigma0MCPt, float); // MC pT
484+
DECLARE_SOA_COLUMN(MCPt, mcpt, float); // MC pT
485+
DECLARE_SOA_COLUMN(MCY, mcy, float); // MC Y
485486

486487
} // namespace sigma0Gen
487488

488489
DECLARE_SOA_TABLE(Sigma0Gens, "AOD", "SIGMA0GENS",
489490
sigma0Gen::IsSigma0,
490491
sigma0Gen::ProducedByGenerator,
491-
sigma0Gen::Sigma0MCPt);
492+
sigma0Gen::MCPt,
493+
sigma0Gen::MCY);
492494

493495
DECLARE_SOA_TABLE(SigmaCollRef, "AOD", "SIGMACOLLREF", //! optional table to refer back to a collision
494496
o2::soa::Index<>, v0data::StraCollisionId);
@@ -859,12 +861,14 @@ DECLARE_SOA_TABLE(Pi0CollRef, "AOD", "PI0COLLREF", //! optional table to refer b
859861
namespace pi0Gen
860862
{
861863
DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool);
862-
DECLARE_SOA_COLUMN(Pi0MCPt, pi0MCPt, float); // MC pT
864+
DECLARE_SOA_COLUMN(MCPt, mcpt, float); // MC pT
865+
DECLARE_SOA_COLUMN(MCY, mcy, float); // MC Y
863866
} // namespace pi0Gen
864867

865868
DECLARE_SOA_TABLE(Pi0Gens, "AOD", "PI0GENS",
866869
pi0Gen::ProducedByGenerator,
867-
pi0Gen::Pi0MCPt);
870+
pi0Gen::MCPt,
871+
pi0Gen::MCY);
868872

869873
DECLARE_SOA_TABLE(Pi0GenCollRef, "AOD", "PI0GENCOLLREF", //! optional table to refer back to a collision
870874
o2::soa::Index<>, v0data::StraMCCollisionId);

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include <cmath>
5656
#include <cstdlib>
5757
#include <string>
58+
#include <vector>
5859

5960
using namespace o2;
6061
using namespace o2::framework;
@@ -1259,13 +1260,13 @@ struct sigma0builder {
12591260
// Fill tables
12601261
// Pi0
12611262
if (fillPi0Tables && MCGenInfo.IsPi0) {
1262-
pi0Gens(MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt); // optional table to store generated pi0 candidates. Be careful, this is a large table!
1263+
pi0Gens(MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt, mcParticle.y()); // optional table to store generated pi0 candidates. Be careful, this is a large table!
12631264
pi0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table
12641265
}
12651266

12661267
// Sigma0/ASigma0
12671268
if (fillSigma0Tables && (MCGenInfo.IsSigma0 || MCGenInfo.IsAntiSigma0)) {
1268-
sigma0Gens(MCGenInfo.IsSigma0, MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt);
1269+
sigma0Gens(MCGenInfo.IsSigma0, MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt, mcParticle.y());
12691270
sigma0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table
12701271
}
12711272
}

PWGLF/Tasks/Strangeness/sigmaanalysis.cxx

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@
5353
#include <cmath>
5454
#include <cstdlib>
5555
#include <string>
56+
#include <unordered_map>
57+
#include <vector>
5658

5759
using namespace o2;
5860
using namespace o2::framework;
5961
using namespace o2::framework::expressions;
6062

6163
using std::array;
62-
using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef, aod::SigmaMCLabels>;
64+
using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef>;
6365
using Sigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::SigmaCollRef>;
6466

6567
static const std::vector<std::string> PhotonSels = {"NoSel", "V0Type", "DCADauToPV",
@@ -124,7 +126,12 @@ struct sigmaanalysis {
124126
} eventSelections;
125127

126128
// Generated Sigma0s
127-
Configurable<bool> mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."};
129+
struct : ConfigurableGroup {
130+
std::string prefix = "genSelections"; // JSON group name
131+
Configurable<bool> mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."};
132+
Configurable<float> mc_rapidityMin{"mc_rapidityMin", -0.5, "Min generated particle rapidity"};
133+
Configurable<float> mc_rapidityMax{"mc_rapidityMax", 0.5, "Max generated particle rapidity"};
134+
} genSelections;
128135

129136
// QA
130137
Configurable<bool> fdoSigma0QA{"doSigma0QA", false, "if true, perform Sigma0 QA analysis. Only works with MC."};
@@ -544,8 +551,8 @@ struct sigmaanalysis {
544551
histos.add("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt", "h2dGenAntiSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
545552
histos.add("Gen/h2dGenSigma0VsMultMC", "h2dGenSigma0VsMultMC", kTH2D, {axisNch, axisPt});
546553
histos.add("Gen/h2dGenAntiSigma0VsMultMC", "h2dGenAntiSigma0VsMultMC", kTH2D, {axisNch, axisPt});
547-
548-
} else { // Pi0 specific
554+
}
555+
if (doprocessPi0GeneratedRun3) { // Pi0 specific
549556
histos.add("Gen/h2dGenPi0VsMultMC_RecoedEvt", "h2dGenPi0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
550557
histos.add("Gen/h2dGenPi0", "h2dGenPi0", kTH2D, {axisCentrality, axisPt});
551558
histos.add("Gen/h2dGenPi0VsMultMC", "h2dGenPi0VsMultMC", kTH2D, {axisNch, axisPt});
@@ -813,8 +820,12 @@ struct sigmaanalysis {
813820
continue;
814821
}
815822

823+
// Rapidity selection
824+
if ((genParticle.mcy() < genSelections.mc_rapidityMin) || (genParticle.mcy() > genSelections.mc_rapidityMax))
825+
continue;
826+
816827
// Selection on the source (generator/transport)
817-
if (!genParticle.producedByGenerator() && mc_keepOnlyFromGenerator)
828+
if (!genParticle.producedByGenerator() && genSelections.mc_keepOnlyFromGenerator)
818829
continue;
819830

820831
// Select corresponding mc collision && Basic event selection
@@ -834,33 +845,35 @@ struct sigmaanalysis {
834845

835846
//______________________________________________________________________________
836847
// Generated Sigma0 processing
837-
if constexpr (requires { genParticle.sigma0MCPt(); }) {
848+
if constexpr (requires { genParticle.isSigma0(); }) {
849+
if (doprocessGeneratedRun3) {
838850

839-
float ptmc = genParticle.sigma0MCPt();
851+
float ptmc = genParticle.mcpt();
840852

841-
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
842-
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
843-
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
853+
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
854+
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
855+
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
844856

845-
if (genParticle.isSigma0())
846-
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
857+
if (genParticle.isSigma0())
858+
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
847859

848-
else
849-
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
850-
}
860+
else
861+
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
862+
}
851863

852-
if (genParticle.isSigma0()) {
853-
histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmc);
854-
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
855-
} else {
856-
histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmc);
857-
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
864+
if (genParticle.isSigma0()) {
865+
histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmc);
866+
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
867+
} else {
868+
histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmc);
869+
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
870+
}
858871
}
859872
}
860873
//______________________________________________________________________________
861874
// Generated Pi0 processing
862-
if constexpr (requires { genParticle.pi0MCPt(); }) {
863-
float ptmc = genParticle.pi0MCPt();
875+
if (doprocessPi0GeneratedRun3) {
876+
float ptmc = genParticle.mcpt();
864877

865878
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
866879
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
@@ -1210,15 +1223,15 @@ struct sigmaanalysis {
12101223
"TPCTOFPID", "DCADauToPV", "Mass"};
12111224

12121225
if (PDGRequired == 22) {
1213-
if constexpr (selection_index >= 0 && selection_index < (int)std::size(PhotonSelsLocal)) {
1226+
if constexpr (selection_index >= 0 && selection_index < static_cast<int>(std::size(PhotonSelsLocal))) {
12141227
histos.fill(HIST("Selection/Photon/hCandidateSel"), selection_index);
12151228
histos.fill(HIST("Selection/Photon/h2d") + HIST(PhotonSelsLocal[selection_index]), sigma.photonPt(), sigma.photonMass());
12161229
histos.fill(HIST("Selection/Sigma0/h2dPhoton") + HIST(PhotonSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass());
12171230
}
12181231
}
12191232

12201233
if (PDGRequired == 3122) {
1221-
if constexpr (selection_index >= 0 && selection_index < (int)std::size(LambdaSelsLocal)) {
1234+
if constexpr (selection_index >= 0 && selection_index < static_cast<int>(std::size(LambdaSelsLocal))) {
12221235
histos.fill(HIST("Selection/Lambda/hCandidateSel"), selection_index);
12231236
histos.fill(HIST("Selection/Lambda/h2d") + HIST(LambdaSelsLocal[selection_index]), sigma.lambdaPt(), sigma.lambdaMass());
12241237
histos.fill(HIST("Selection/Sigma0/h2dLambda") + HIST(LambdaSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass());
@@ -1252,9 +1265,8 @@ struct sigmaanalysis {
12521265
auto sigma0mc = fullSigma0s.rawIteratorAt(sigma0Index[mcid]);
12531266
histos.fill(HIST("Sigma0QA/hDuplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed
12541267

1255-
if (sigma0mc.isSigma0()) {
1256-
}
1257-
histos.fill(HIST("Sigma0QA/hSigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed
1268+
if (sigma0mc.isSigma0())
1269+
histos.fill(HIST("Sigma0QA/hSigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed
12581270

12591271
if (sigma0mc.isAntiSigma0())
12601272
histos.fill(HIST("Sigma0QA/hASigma0Duplicates"), NDuplicates); // how many times a mc sigma0 was reconstructed

0 commit comments

Comments
 (0)