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
107 changes: 18 additions & 89 deletions PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ struct Chargedkstaranalysis {
AxisSpec thnAxisPhi = {axisCfgs.configThnAxisPhi, "Configurabel phi axis"}; // 0 to 2pi
// THnSparse
AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"};

if (!doprocessMC) {
histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{5, 0, 5.0}});
auto hCutFlow = histos.get<TH1>(HIST("hEvtSelInfo"));
Expand Down Expand Up @@ -403,7 +402,6 @@ struct Chargedkstaranalysis {

histos.add("QA/before/CentDist", "Centrality distribution", {HistType::kTH1D, {centAxis}});
histos.add("QA/before/CentDist1", "Centrality distribution", HistType::kTH1F, {{110, 0, 110}});

histos.add("QA/trkbpionTPCPIDME", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis});

// Bachelor pion
Expand Down Expand Up @@ -744,88 +742,7 @@ struct Chargedkstaranalysis {

return returnFlag;
}
template <typename TrackTemplate, typename V0Template>
bool isTrueKstar(const TrackTemplate& bTrack, const V0Template& K0scand)
{
if (std::abs(bTrack.PDGCode()) != kPiPlus) // Are you pion?
return false;
if (std::abs(K0scand.PDGCode()) != kPDGK0s) // Are you K0s?
return false;

auto motherbTrack = bTrack.template mothers_as<aod::McParticles>();
auto motherkV0 = K0scand.template mothers_as<aod::McParticles>();

// Check bTrack first
if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter?
return false; // Apply first since it's more restrictive

if (std::abs(motherkV0.pdgCode()) != kPDGK0) // Is it K0s?
return false;
// Check if K0s's mother is K0 (311)
auto motherK0 = motherkV0.template mothers_as<aod::McParticles>();
if (std::abs(motherK0.pdgCode()) != kPDGK0)
return false;

// Check if K0's mother is Kstar (323)
auto motherKstar = motherK0.template mothers_as<aod::McParticles>();
if (std::abs(motherKstar.pdgCode()) != kKstarPlus)
return false;

// Check if bTrack and K0 have the same mother (global index)
if (motherbTrack.globalIndex() != motherK0.globalIndex())
return false;

return true;
}

int count = 0;
template <typename V0T, typename TrkT>
bool matchRecoToTruthKstar(V0T const& v0, TrkT const& trk)
{
if (!v0.has_mcParticle() || !trk.has_mcParticle())
return false;

auto mcK0s = v0.template mcParticle_as<MCTrueTrackCandidates>();
auto mcPi = trk.template mcParticle_as<MCTrueTrackCandidates>();

if (std::abs(mcK0s.pdgCode()) != kPDGK0s)
return false;
if (std::abs(mcPi.pdgCode()) != kPiPlus)
return false;

MCTrueTrackCandidates::iterator kstarFromPi;
bool havePiKstar = false;
for (const auto& m1 : mcPi.template mothers_as<MCTrueTrackCandidates>()) {
if (std::abs(m1.pdgCode()) == kKstarPlus) {
kstarFromPi = m1;
havePiKstar = true;
break;
}
}
if (!havePiKstar) {
return false;
}

bool shareSameKstar = false;
for (const auto& m1 : mcK0s.template mothers_as<MCTrueTrackCandidates>()) {
if (std::abs(m1.pdgCode()) == kPDGK0) {
for (const auto& m2 : m1.template mothers_as<MCTrueTrackCandidates>()) {
if (m2.globalIndex() == kstarFromPi.globalIndex()) {
shareSameKstar = true;
break;
}
}
if (shareSameKstar)
break;
}
}
if (!shareSameKstar) {
return false;
}

return true;
} // matchRecoToTruthKstar

template <typename T>
void fillKstarHist(bool isRot, float multiplicity, const T& mother, double cosTheta)
{
Expand Down Expand Up @@ -1313,7 +1230,6 @@ struct Chargedkstaranalysis {
histos.fill(HIST("QA/MC/QACent_woCut"), lCentrality);
histos.fill(HIST("QA/MC/QAvtxz_woCut"), coll.posZ());
}

if (!colCuts.isSelected(coll))
continue;
if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(coll))
Expand Down Expand Up @@ -1408,9 +1324,7 @@ struct Chargedkstaranalysis {

if (!coll.has_mcCollision())
continue;

const auto mcid = coll.mcCollisionId();

if (allowedMcIds.count(mcid) == 0)
continue; // To check the event is allowed or not

Expand All @@ -1427,7 +1341,6 @@ struct Chargedkstaranalysis {
}
if (!selectionK0s(coll, v0))
continue;

auto trks = tracks.sliceBy(perCollision, v0.collisionId()); // Grouping the tracks with the v0s, means only those tracks that belong to the same collision as v0
for (const auto& bTrack : trks) {
if (bTrack.collisionId() != v0.collisionId())
Expand All @@ -1436,7 +1349,6 @@ struct Chargedkstaranalysis {
continue;
if (!selectionPIDPion(bTrack))
continue;

LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot;

lResoSecondary = LorentzVectorSetXYZM(v0.px(), v0.py(), v0.pz(), MassK0Short);
Expand All @@ -1447,7 +1359,6 @@ struct Chargedkstaranalysis {
const double yreco = lResoKstar.Rapidity();
if (std::abs(yreco) > kstarCutCfgs.cKstarMaxRap)
continue;

// Since we are doing the MC study and we know about the PDG code of each particle let's try to check the things which we have
if (!v0.has_mcParticle() || !bTrack.has_mcParticle())
continue;
Expand All @@ -1470,6 +1381,24 @@ struct Chargedkstaranalysis {
if (!havePiKstar) {
continue;
}
// Loops over all the mother's of K0s and check if this K0s comming from a kstar and also share the smae mother as of the pion
bool shareSameKstar = false;
for (const auto& m1 : mcK0s.template mothers_as<MCTrueTrackCandidates>()) {
if (std::abs(m1.pdgCode()) == kPDGK0) {
for (const auto& m2 : m1.template mothers_as<MCTrueTrackCandidates>()) {
if (m2.globalIndex() == kstarFromPi.globalIndex()) {
shareSameKstar = true;
break;
}
}
if (shareSameKstar)
break;
}
}
if (!shareSameKstar) {
continue;
}

histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality);
if (helicityCfgs.cBoostKShot) {
fillInvMass(lResoKstar, lCentrality, lResoSecondary, lDecayDaughter_bach, eventCutCfgs.confIsMix);
Expand Down
Loading