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
34 changes: 19 additions & 15 deletions PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,8 @@
return false;
}

template <typename T1, typename T2>
bool eventHasRecoPhiWPDG(const T1& posTracks, const T2& negTracks)
template <typename T1, typename T2, typename T3>
bool eventHasRecoPhiWPDG(const T1& posTracks, const T2& negTracks, const T3& mcParticles)
{
int nPhi = 0;

Expand All @@ -992,7 +992,7 @@

if (!track1.has_mcParticle())
continue;
auto mcTrack1 = track1.template mcParticle_as<aod::McParticles>();
auto mcTrack1 = mcParticles.rawIteratorAt(track1.mcParticleId());
if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary())
continue;

Expand All @@ -1006,24 +1006,28 @@

if (!track2.has_mcParticle())
continue;
auto mcTrack2 = track2.template mcParticle_as<aod::McParticles>();
auto mcTrack2 = mcParticles.rawIteratorAt(track2.mcParticleId());
if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary())
continue;

const auto mcTrack1MotherIndexes = mcTrack1.mothersIds();
const auto mcTrack2MotherIndexes = mcTrack2.mothersIds();

float pTMother = -1.0f;
float yMother = -1.0f;
bool isMCMotherPhi = false;
for (const auto& motherOfMcTrack1 : mcTrack1.template mothers_as<aod::McParticles>()) {
for (const auto& motherOfMcTrack2 : mcTrack2.template mothers_as<aod::McParticles>()) {
if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode())
continue;
if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex())

for (const auto& mcTrack1MotherIndex : mcTrack1MotherIndexes) {
for (const auto& mcTrack2MotherIndex : mcTrack2MotherIndexes) {
if (mcTrack1MotherIndex != mcTrack2MotherIndex)
continue;
if (motherOfMcTrack1.pdgCode() != o2::constants::physics::Pdg::kPhi)

const auto mother = mcParticles.rawIteratorAt(mcTrack1MotherIndex);
if (mother.pdgCode() != o2::constants::physics::Pdg::kPhi)
continue;

pTMother = motherOfMcTrack1.pt();
yMother = motherOfMcTrack1.y();
pTMother = mother.pt();
yMother = mother.y();
isMCMotherPhi = true;
}
}
Expand Down Expand Up @@ -1056,7 +1060,7 @@
continue;

auto kDaughters = mcParticle.template daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 1063 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 @@ -1836,7 +1840,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 1843 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 @@ -2309,7 +2313,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 2316 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 @@ -2446,7 +2450,7 @@
continue;
if (cfgisGenMCForClosure) {
auto kDaughters = mcParticle2.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 2453 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 @@ -2523,7 +2527,7 @@
continue;
if (cfgisGenMCForClosure) {
auto kDaughters = mcParticle2.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2)

Check failure on line 2530 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 @@ -2668,9 +2672,9 @@
auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex());

if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB))
return;
continue;
if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisMcColl))
return;
continue;

uint64_t numberAssocColl = 0;
std::vector<float> zVtxs;
Expand All @@ -2688,7 +2692,7 @@
Partition<FilteredMCTracks> negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge;
negFiltMCTracks.bindTable(filteredMCTracksThisColl);

if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks))
if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks, mcParticles))
continue;

mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M());
Expand Down Expand Up @@ -3138,7 +3142,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 3145 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