Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions PWGLF/DataModel/LFSigmaTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef PWGLF_DATAMODEL_LFSIGMATABLES_H_
#define PWGLF_DATAMODEL_LFSIGMATABLES_H_

using std::array;

Check failure on line 32 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[import-std-name]

Do not import names from the std namespace in headers.

// Creating output TTree for sigma analysis
namespace o2::aod
Expand Down Expand Up @@ -73,7 +73,7 @@

DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt,
[](float photonPx, float photonPy, float lambdaPx, float lambdaPy) -> float {
return RecoDecay::pt(array{photonPx + lambdaPx, photonPy + lambdaPy});

Check failure on line 76 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
});

DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Total momentum in GeV/c
Expand Down Expand Up @@ -335,10 +335,10 @@
DECLARE_SOA_COLUMN(LambdaIsCorrectlyAssoc, lambdaIsCorrectlyAssoc, bool);

DECLARE_SOA_DYNAMIC_COLUMN(IsSigma0, isSigma0, //! IsSigma0
[](int pdgCode) -> bool { return pdgCode == 3212; });

Check failure on line 338 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.

Check failure on line 338 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

DECLARE_SOA_DYNAMIC_COLUMN(IsAntiSigma0, isAntiSigma0, //! IsASigma0
[](int pdgCode) -> bool { return pdgCode == -3212; });

Check failure on line 341 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Sigma0 px
[](float photonMCPx, float lambdaMCPx) -> float { return photonMCPx + lambdaMCPx; });
Expand All @@ -349,7 +349,7 @@

DECLARE_SOA_DYNAMIC_COLUMN(MCPt, mcpt,
[](float photonMCPx, float photonMCPy, float lambdaMCPx, float lambdaMCPy) -> float {
return RecoDecay::pt(array{photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy});

Check failure on line 352 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
});

DECLARE_SOA_DYNAMIC_COLUMN(MCP, mcp, //! Total momentum in GeV/c
Expand Down Expand Up @@ -481,14 +481,16 @@
{
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);
Expand Down Expand Up @@ -564,7 +566,7 @@

DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt,
[](float photon1Px, float photon1Py, float photon2Px, float photon2Py) -> float {
return RecoDecay::pt(array{photon1Px + photon2Px, photon1Py + photon2Py});

Check failure on line 569 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
});

DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Total momentum in GeV/c
Expand Down Expand Up @@ -718,10 +720,10 @@
DECLARE_SOA_COLUMN(Photon2IsCorrectlyAssoc, photon2IsCorrectlyAssoc, bool);

DECLARE_SOA_DYNAMIC_COLUMN(IsPi0, isPi0, //! IsPi0
[](int pdgCode) -> bool { return pdgCode == 111; });

Check failure on line 723 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

DECLARE_SOA_DYNAMIC_COLUMN(IsFromXi0, isFromXi0, //! Pi0 from Xi0
[](int pdgCodeMother) -> bool { return pdgCodeMother == 3322; });

Check failure on line 726 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Pi0 MC px
[](float photon1MCPx, float photon2MCPx) -> float { return photon1MCPx + photon2MCPx; });
Expand All @@ -732,7 +734,7 @@

DECLARE_SOA_DYNAMIC_COLUMN(MCPt, mcpt,
[](float photon1MCPx, float photon1MCPy, float photon2MCPx, float photon2MCPy) -> float {
return RecoDecay::pt(array{photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy});

Check failure on line 737 in PWGLF/DataModel/LFSigmaTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
});

DECLARE_SOA_DYNAMIC_COLUMN(MCP, mcp, //! Total momentum in GeV/c
Expand Down Expand Up @@ -859,12 +861,14 @@
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);
Expand Down
5 changes: 3 additions & 2 deletions PWGLF/TableProducer/Strangeness/sigma0builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -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
}
}
Expand Down
68 changes: 40 additions & 28 deletions PWGLF/Tasks/Strangeness/sigmaanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@
#include <cmath>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

using std::array;
using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef, aod::SigmaMCLabels>;
using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef>;
using Sigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::SigmaCollRef>;

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

// Generated Sigma0s
Configurable<bool> 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<bool> mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."};
Configurable<float> mc_rapidityMin{"mc_rapidityMin", -0.5, "Min generated particle rapidity"};
Configurable<float> mc_rapidityMax{"mc_rapidityMax", 0.5, "Max generated particle rapidity"};
} genSelections;

// QA
Configurable<bool> fdoSigma0QA{"doSigma0QA", false, "if true, perform Sigma0 QA analysis. Only works with MC."};
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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
Expand All @@ -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()]);
Expand Down Expand Up @@ -1210,15 +1223,15 @@ 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<int>(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());
}
}

if (PDGRequired == 3122) {
if constexpr (selection_index >= 0 && selection_index < (int)std::size(LambdaSelsLocal)) {
if constexpr (selection_index >= 0 && selection_index < static_cast<int>(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());
Expand Down Expand Up @@ -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
Expand Down
Loading