Skip to content

Commit 240d1d3

Browse files
FDUEnrichfgrosa
andcommitted
[PWGHF] Use RecoDecay for kaon origin classification
Follow RecoDecay::getParticleOrigin with its default arguments and classify nonzero origins as HF, as suggested by Fabrizio. Remove the custom PDG and ancestry helpers without changing the remaining origin routing. Co-authored-by: Fabrizio Grosa <fabrizio.grosa@cern.ch>
1 parent a8c9038 commit 240d1d3

1 file changed

Lines changed: 1 addition & 39 deletions

File tree

‎PWGCF/FemtoDream/Core/femtoDreamUtils.h‎

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -105,44 +105,6 @@ inline float getMass(int pdgCode)
105105
return mass;
106106
}
107107

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-
146108
/// Classify true kaons from the correct collision for the DCA templates.
147109
template <typename T>
148110
inline int getKaonOrigin(T const& particles, typename T::iterator const& particle)
@@ -153,7 +115,7 @@ inline int getKaonOrigin(T const& particles, typename T::iterator const& particl
153115
return kMaterial;
154116
}
155117
// HF decay products can be physical primaries. Check their ancestry first.
156-
if (hasHeavyFlavorHadronAncestor(particles, particle)) {
118+
if (RecoDecay::getParticleOrigin(particles, particle) != RecoDecay::OriginType::None) {
157119
return kSecondaryFromHF;
158120
}
159121
if (particle.isPhysicalPrimary()) {

0 commit comments

Comments
 (0)