Skip to content

Commit a8c9038

Browse files
committed
[PWGHF] Split kaon DCA secondary origins into HF and LF
1 parent 63a31be commit a8c9038

4 files changed

Lines changed: 132 additions & 32 deletions

File tree

‎PWGCF/DataModel/FemtoDerived.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ enum ParticleOriginMCTruth {
743743
kSecondaryDaughterXistar0, //! Daughter from a Xi*^0 decay
744744
kSecondaryDaughterXistarMinus, //! Daughter from a Xi*^- decay
745745
kElse, //! none of the above; (NOTE: used to catch bugs. will be removed once MC usage is properly validated)
746+
kSecondaryFromHF, //! Kaon from a charm- or beauty-hadron decay chain
747+
kSecondaryFromLF, //! Kaon from a light-flavour decay without a heavy-flavour ancestor
746748
kNOriginMCTruthTypes
747749
};
748750

@@ -762,7 +764,9 @@ static constexpr std::string_view ParticleOriginMCTruthName[kNOriginMCTruthTypes
762764
"_SecondaryDaughterOmegaMinus",
763765
"_SecondaryDaughterXistar0",
764766
"_SecondaryDaughterXistarMinus",
765-
"_Else"};
767+
"_Else",
768+
"_SecondaryFromHF",
769+
"_SecondaryFromLF"};
766770

767771
/// Distinguished between reconstructed and truth
768772
enum MCType {

‎PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ class FemtoDreamParticleHisto
233233
mHistogramRegistry->add((folderName + folderSuffix + "/Debug/hPDGmother_SecondaryDaughterLambda").c_str(), "; PDG mother; Entries", o2::framework::HistType::kTH1I, {{12001, -6000.5, 6000.5}});
234234
mHistogramRegistry->add((folderName + folderSuffix + "/Debug/hPDGmother_SecondaryDaughterSigmaplus").c_str(), "; PDG mother; Entries", o2::framework::HistType::kTH1I, {{12001, -6000.5, 6000.5}});
235235
mHistogramRegistry->add((folderName + folderSuffix + "/Debug/hPDGmother_SecondaryDaughterOmegaMinus").c_str(), "; PDG mother; Entries", o2::framework::HistType::kTH1I, {{12001, -6000.5, 6000.5}});
236+
if (std::abs(mPDG) == kKPlus) {
237+
mHistogramRegistry->add((folderName + folderSuffix + "/Debug/hPDGmother_SecondaryFromHF").c_str(), "; PDG mother; Entries", o2::framework::HistType::kTH1I, {{12001, -6000.5, 6000.5}});
238+
mHistogramRegistry->add((folderName + folderSuffix + "/Debug/hPDGmother_SecondaryFromLF").c_str(), "; PDG mother; Entries", o2::framework::HistType::kTH1I, {{12001, -6000.5, 6000.5}});
239+
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_SecondaryFromHF").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTHnSparseF, {tempFitVarpTAxis, tempFitVarAxis, dcazAxis, multAxis});
240+
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_SecondaryFromLF").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTHnSparseF, {tempFitVarpTAxis, tempFitVarAxis, dcazAxis, multAxis});
241+
}
236242

237243
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Primary").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTHnSparseF, {tempFitVarpTAxis, tempFitVarAxis, dcazAxis, multAxis});
238244
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Secondary").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTHnSparseF, {tempFitVarpTAxis, tempFitVarAxis, dcazAxis, multAxis});
@@ -245,6 +251,10 @@ class FemtoDreamParticleHisto
245251
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Else").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTHnSparseF, {tempFitVarpTAxis, tempFitVarAxis, dcazAxis, multAxis});
246252
} else {
247253
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Primary").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
254+
if (std::abs(mPDG) == kKPlus) {
255+
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_SecondaryFromHF").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
256+
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_SecondaryFromLF").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
257+
}
248258
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Secondary").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
249259
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Material").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
250260
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_WrongCollision").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", o2::framework::HistType::kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
@@ -597,6 +607,16 @@ class FemtoDreamParticleHisto
597607
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_Secondary"),
598608
part.pt(), part.tempFitVar(), part.dcaZ(), mult);
599609
break;
610+
case (o2::aod::femtodreamMCparticle::kSecondaryFromHF):
611+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/Debug/hPDGmother_SecondaryFromHF"), part.fdExtMCParticle().motherPDG());
612+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_SecondaryFromHF"),
613+
part.pt(), part.tempFitVar(), part.dcaZ(), mult);
614+
break;
615+
case (o2::aod::femtodreamMCparticle::kSecondaryFromLF):
616+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/Debug/hPDGmother_SecondaryFromLF"), part.fdExtMCParticle().motherPDG());
617+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_SecondaryFromLF"),
618+
part.pt(), part.tempFitVar(), part.dcaZ(), mult);
619+
break;
600620
case (o2::aod::femtodreamMCparticle::kMaterial):
601621
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/Debug/hPDGmother_Material"), part.fdExtMCParticle().motherPDG());
602622
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_Material"),
@@ -645,6 +665,14 @@ class FemtoDreamParticleHisto
645665
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_Secondary"),
646666
part.pt(), part.tempFitVar());
647667
break;
668+
case (o2::aod::femtodreamMCparticle::kSecondaryFromHF):
669+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_SecondaryFromHF"),
670+
part.pt(), part.tempFitVar());
671+
break;
672+
case (o2::aod::femtodreamMCparticle::kSecondaryFromLF):
673+
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_SecondaryFromLF"),
674+
part.pt(), part.tempFitVar());
675+
break;
648676
case (o2::aod::femtodreamMCparticle::kMaterial):
649677
mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hDCAxy_Material"),
650678
part.pt(), part.tempFitVar());

‎PWGCF/FemtoDream/Core/femtoDreamUtils.h‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919
#include "PWGCF/DataModel/FemtoDerived.h"
2020

21+
#include "Common/Core/RecoDecay.h"
22+
2123
#include <CommonConstants/PhysicsConstants.h>
2224
#include <Framework/Logger.h>
2325

26+
#include <TMCProcess.h>
2427
#include <TPDGCode.h>
2528

2629
#include <cstdint>
@@ -102,6 +105,66 @@ inline float getMass(int pdgCode)
102105
return mass;
103106
}
104107

108+
/// Identify conventional charm/beauty mesons and baryons from their PDG quark digits.
109+
inline bool isHeavyFlavorHadron(int pdgCode)
110+
{
111+
constexpr int DigitBase = 10;
112+
constexpr int HadronLimit = 10000000;
113+
const auto code = std::abs(pdgCode);
114+
if (code >= HadronLimit || code % DigitBase == 0) {
115+
return false;
116+
}
117+
const auto quark1 = (code / RecoDecay::PdgDivisorBaryon) % DigitBase;
118+
const auto quark2 = (code / RecoDecay::PdgDivisorMeson) % DigitBase;
119+
const auto quark3 = (code / DigitBase) % DigitBase;
120+
// Quarks, diquarks and generator-specific entries are not hadron decays.
121+
if (quark1 > kTop || quark2 < kDown || quark2 > kTop || quark3 < kDown || quark3 > kTop) {
122+
return false;
123+
}
124+
return quark1 == kCharm || quark1 == kBottom || quark2 == kCharm || quark2 == kBottom || quark3 == kCharm || quark3 == kBottom;
125+
}
126+
127+
template <typename T>
128+
inline bool hasHeavyFlavorHadronAncestor(T const& particles, typename T::iterator const& particle)
129+
{
130+
auto ancestor = particle;
131+
std::vector<int64_t> motherIds;
132+
while (ancestor.has_mothers()) {
133+
motherIds.clear();
134+
RecoDecay::getOrderedMotherIds(ancestor, motherIds);
135+
if (motherIds.empty()) {
136+
break;
137+
}
138+
ancestor = particles.rawIteratorAt(motherIds.front() - particles.offset());
139+
if (isHeavyFlavorHadron(ancestor.pdgCode())) {
140+
return true;
141+
}
142+
}
143+
return false;
144+
}
145+
146+
/// Classify true kaons from the correct collision for the DCA templates.
147+
template <typename T>
148+
inline int getKaonOrigin(T const& particles, typename T::iterator const& particle)
149+
{
150+
using namespace o2::aod::femtodreamMCparticle;
151+
constexpr int GenFromTransport = -1;
152+
if (particle.getProcess() == TMCProcess::kPHInhelastic && particle.getGenStatusCode() == GenFromTransport) {
153+
return kMaterial;
154+
}
155+
// HF decay products can be physical primaries. Check their ancestry first.
156+
if (hasHeavyFlavorHadronAncestor(particles, particle)) {
157+
return kSecondaryFromHF;
158+
}
159+
if (particle.isPhysicalPrimary()) {
160+
return kPrimary;
161+
}
162+
if (particle.getProcess() == TMCProcess::kPDecay && particle.getGenStatusCode() == GenFromTransport && particle.has_mothers()) {
163+
return kSecondaryFromLF;
164+
}
165+
return kElse;
166+
}
167+
105168
inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType, int motherPDG, int daughterPDG = 0)
106169
{
107170
int partOrigin = 0;

0 commit comments

Comments
 (0)