Skip to content
Closed
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
5 changes: 4 additions & 1 deletion PWGCF/DataModel/FemtoDerived.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta,

DECLARE_SOA_COLUMN(K0sDcaToPv, k0sDcaToPv, float); //! DCA of the K0s candidate to the primary vertex (cm)
DECLARE_SOA_COLUMN(OriginMcV0, originMcV0, int); //! MC truth origin of the V0 candidate, see ParticleOriginMCTruth
DECLARE_SOA_COLUMN(OriginMcTrack, originMcTrack, int); //! Track origin from ParticleOriginMCTruth; -1 if unavailable

} // namespace fdhf

Expand Down Expand Up @@ -691,7 +692,9 @@ DECLARE_SOA_TABLE(FDHfTrk, "AOD", "FDHFTRK", //! table to store results for HF f
track::TPCNClsFindable,
femtodreamparticle::TPCNClsCrossedRows,
femtodreamparticle::TPCNSigmaPr,
femtodreamparticle::TOFNSigmaPr);
femtodreamparticle::TOFNSigmaPr,
track::DcaXY,
fdhf::OriginMcTrack);

DECLARE_SOA_TABLE(FDHfV0, "AOD", "FDHFV0", //! table to store results for HF femtoscopy
fdhf::GIndexCol,
Expand Down
43 changes: 43 additions & 0 deletions PWGHF/HFC/TableProducer/producerCharmHadronsTrackFemtoDream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <TMCProcess.h>
#include <TPDGCode.h>

#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
Expand Down Expand Up @@ -499,6 +500,44 @@ struct HfProducerCharmHadronsTrackFemtoDream {
-999., -999., -999.);
}

// Strong-decay kaons may be physical primaries, so inspect phi ancestry first.
template <typename T>
static bool hasPhiAncestor(T const& particles, typename T::iterator const& particle)
{
std::vector<int64_t> pending;
std::vector<int64_t> visited{particle.globalIndex()};
if (particle.has_mothers()) {
for (const auto id : particle.mothersIds()) {
pending.push_back(id);
}
}
while (!pending.empty()) {
const auto id = pending.back();
pending.pop_back();
if (id < static_cast<int64_t>(particles.offset()) ||
id - static_cast<int64_t>(particles.offset()) >= static_cast<int64_t>(particles.size()) ||
std::find(visited.begin(), visited.end(), id) != visited.end()) {
continue;
}
visited.push_back(id);
const auto mother = particles.rawIteratorAt(id - particles.offset());
const int absPdg = std::abs(mother.pdgCode());
if (absPdg == 333) {
return true;
}
// Stop at the partonic boundary of the hadron decay chain.
if (absPdg <= 100 || RecoDecay::isDiquark(absPdg)) {
continue;
}
if (mother.has_mothers()) {
for (const auto parentId : mother.mothersIds()) {
pending.push_back(parentId);
}
}
}
return false;
}

/// Classify true kaons from the correct collision for the DCA templates.
template <typename T>
static int getKaonOrigin(T const& particles, typename T::iterator const& particle)
Expand All @@ -512,6 +551,10 @@ struct HfProducerCharmHadronsTrackFemtoDream {
if (RecoDecay::getParticleOrigin(particles, particle) != RecoDecay::OriginType::None) {
return kSecondaryFromHF;
}
// Keep HF -> phi -> K in HF
if (hasPhiAncestor(particles, particle)) {
return kSecondaryFromPhi;
}
if (particle.isPhysicalPrimary()) {
return kPrimary;
}
Expand Down
14 changes: 12 additions & 2 deletions PWGHF/HFC/Tasks/taskCharmHadronsTrackFemtoDream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,12 @@ struct HfTaskCharmHadronsTrackFemtoDream {
<< trackSel.pdgCodeTrack1.value;
break;
}
int originMcTrack = -1;
if constexpr (IsMc) {
if (part.has_fdMCParticle()) {
originMcTrack = static_cast<int>(part.fdMCParticle().partOriginMCTruth());
}
}
tables.rowFemtoResultTrk(
col.globalIndex(),
timeStamp,
Expand All @@ -1009,7 +1015,9 @@ struct HfTaskCharmHadronsTrackFemtoDream {
part.tpcNClsFindable(),
part.tpcNClsCrossedRows(),
tpcNSigma,
tofNSigma);
tofNSigma,
part.dcaXY(),
originMcTrack);
}

// ---- Fill Collision Table ----
Expand Down Expand Up @@ -1637,7 +1645,9 @@ struct HfTaskCharmHadronsTrackFemtoDream {
nCls,
nCls,
nSigma,
nSigma);
nSigma,
-999.f, // No reconstructed DCAxy is available for generated tracks.
-1); // Generated track input does not carry an MC origin label.
}
if (sliceGenCharmHad.size() > 0 || sliceGenTrk1.size() > 0) {
tables.rowFemtoResultColl(col.globalIndex(), timeStamp, col.posZ(), col.multNtr());
Expand Down
Loading