Skip to content
Merged
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
57 changes: 35 additions & 22 deletions PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
// Configurables for track selection (not necessarily common for trigger and the two associated particles)
struct : ConfigurableGroup {
Configurable<float> cfgCutCharge{"cfgCutCharge", 0.0f, "Cut on charge"};
Configurable<float> cfgMinAbsCharge{"cfgMinAbsCharge", 3.0f, "Cut on absolute charge"};
Configurable<bool> cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"};
Configurable<bool> cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"};
Configurable<float> cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"};
Expand Down Expand Up @@ -259,7 +260,10 @@
SliceCache cache;

// Preslice for manual slicing
Preslice<aod::McParticles> perMCColl = aod::mcparticle::mcCollisionId;
struct : PresliceGroup {
Preslice<aod::Tracks> perColl = aod::track::collisionId;
Preslice<aod::McParticles> perMCColl = aod::mcparticle::mcCollisionId;
} preslices;

// Positive and negative tracks partitions
Partition<FullTracks> posTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge;
Expand Down Expand Up @@ -957,6 +961,21 @@
return false;
}

template <typename T>
bool isGenParticleCharged(const T& mcParticle)
{
if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax)
return false;

auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode());
if (pdgTrack == nullptr)
return false;
if (std::abs(pdgTrack->Charge()) < trackConfigs.cfgMinAbsCharge)
return false;

return true;
}

// Get phi-meson purity functions from CCDB
void getPhiPurityFunctionsFromCCDB()
{
Expand Down Expand Up @@ -1681,7 +1700,7 @@
if (mcTrack.isPhysicalPrimary()) {
mcPionHist.fill(HIST("h3RecMCDCAxyPrimPi"), track.pt(), track.dcaXY());
} else {
if (mcTrack.getProcess() == 4) { // Selection of secondary pions from weak decay

Check failure on line 1703 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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 1703 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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.
mcPionHist.fill(HIST("h3RecMCDCAxySecWeakDecayPi"), track.pt(), track.dcaXY());
} else { // Selection of secondary pions from material interactions
mcPionHist.fill(HIST("h3RecMCDCAxySecMaterialPi"), track.pt(), track.dcaXY());
Expand Down Expand Up @@ -2154,7 +2173,7 @@
if (mcParticle1.pdgCode() != o2::constants::physics::Pdg::kPhi)
continue;
auto kDaughters = mcParticle1.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 2176 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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 2176 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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.
continue;
bool isPosKaon = false, isNegKaon = false;
for (const auto& kDaughter : kDaughters) {
Expand Down Expand Up @@ -2291,7 +2310,7 @@
continue;
if (cfgisGenMCForClosure) {
auto kDaughters = mcParticle2.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 2313 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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 2313 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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.
continue;
bool isPosKaon = false, isNegKaon = false;
for (const auto& kDaughter : kDaughters) {
Expand Down Expand Up @@ -2368,7 +2387,7 @@
continue;
if (cfgisGenMCForClosure) {
auto kDaughters = mcParticle2.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 2390 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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 2390 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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.
continue;
bool isPosKaon = false, isNegKaon = false;
for (const auto& kDaughter : kDaughters) {
Expand Down Expand Up @@ -2436,7 +2455,7 @@
return;
const auto& mcCollision = collision.mcCollision_as<MCCollisions>();

auto mcParticlesThisColl = mcParticles.sliceBy(perMCColl, mcCollision.globalIndex());
auto mcParticlesThisColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex());

if (filterOnMcPhi && !eventHasMCPhi(mcParticlesThisColl))
return;
Expand All @@ -2456,13 +2475,7 @@
}

for (const auto& mcParticle : mcParticlesThisColl) {
if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax)
continue;

auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode());
if (pdgTrack == nullptr)
continue;
if (pdgTrack->Charge() == trackConfigs.cfgCutCharge)
if (!isGenParticleCharged(mcParticle))
continue;

mcEventHist.fill(HIST("h2GenMCEtaDistributionReco"), genmultiplicity, mcParticle.eta());
Expand All @@ -2471,7 +2484,7 @@

PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMCReco, "Process function for dN/deta values in MCReco", false);

void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups<SimCollisions> const& collisions, aod::McParticles const& mcParticles)
void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups<SimCollisions> const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles)
{
if (std::abs(mcCollision.posZ()) > cutZVertex)
return;
Expand All @@ -2487,14 +2500,20 @@
if (acceptEventQA<true>(collision, false)) {
mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), genmultiplicity);

for (const auto& mcParticle : mcParticles) {
if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax)
auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex());
for (const auto& track : filteredMCTracksThisColl) {
if (!track.has_mcParticle())
continue;

auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode());
if (pdgTrack == nullptr)
auto mcTrack = track.mcParticle();
if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax)
continue;
if (pdgTrack->Charge() == trackConfigs.cfgCutCharge)

mcEventHist.fill(HIST("h2RecoCheckMCEtaDistribution"), genmultiplicity, mcTrack.eta());
}

for (const auto& mcParticle : mcParticles) {
if (!isGenParticleCharged(mcParticle))
continue;

mcEventHist.fill(HIST("h2GenMCEtaDistributionRecoCheck"), genmultiplicity, mcParticle.eta());
Expand All @@ -2509,13 +2528,7 @@
mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), genmultiplicity);

for (const auto& mcParticle : mcParticles) {
if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax)
continue;

auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode());
if (pdgTrack == nullptr)
continue;
if (pdgTrack->Charge() == trackConfigs.cfgCutCharge)
if (!isGenParticleCharged(mcParticle))
continue;

mcEventHist.fill(HIST("h2GenMCEtaDistribution"), genmultiplicity, mcParticle.eta());
Expand Down Expand Up @@ -2874,7 +2887,7 @@
if (mcTrack.isPhysicalPrimary()) {
mcPionHist.fill(HIST("h3RecMCDCAxyPrimPi"), track.pt(), track.dcaXY());
} else {
if (mcTrack.getProcess() == 4) { // Selection of secondary pions from weak decay

Check failure on line 2890 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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 2890 in PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

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.
mcPionHist.fill(HIST("h3RecMCDCAxySecWeakDecayPi"), track.pt(), track.dcaXY());
} else { // Selection of secondary pions from material interactions
mcPionHist.fill(HIST("h3RecMCDCAxySecMaterialPi"), track.pt(), track.dcaXY());
Expand Down
Loading