Skip to content

Commit df57e01

Browse files
RecoDecay: getDaughters: Skip PDG check for the original particle. (#5303) (#5263)
Do not label the original particle as final, when its species matches the expected species of its daughter. This could happen when calling this function for a quark that radiates a gluon and becomes its own daughter. In general, there is no reason to check the PDG code of the original particle against the codes of the expected daughters, so skipping it speeds up this function. Co-authored-by: Vít Kučera <vit.kucera@cern.ch>
1 parent aa4fa4d commit df57e01

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, [](float
314314
// - ±LcToPKPi: Λc± → p± K∓ π±
315315
DECLARE_SOA_COLUMN(FlagMCMatchRec, flagMCMatchRec, int8_t); // reconstruction level
316316
DECLARE_SOA_COLUMN(FlagMCMatchGen, flagMCMatchGen, int8_t); // generator level
317+
DECLARE_SOA_COLUMN(FlagMCDecayChanRec, flagMCDecayChanRec, int8_t); // Resonant decay channel flag, reconstruction level
318+
DECLARE_SOA_COLUMN(FlagMCDecayChanGen, flagMCDecayChanGen, int8_t); // Resonant decay channel flag, generator level
317319

318320
// mapping of decay types
319321
enum DecayType { DPlusToPiKPi = 0,
@@ -428,11 +430,13 @@ using HfCandProng3 = HfCandProng3Ext;
428430

429431
// table with results of reconstruction level MC matching
430432
DECLARE_SOA_TABLE(HfCandProng3MCRec, "AOD", "HFCANDP3MCREC",
431-
hf_cand_prong3::FlagMCMatchRec);
433+
hf_cand_prong3::FlagMCMatchRec,
434+
hf_cand_prong3::FlagMCDecayChanRec);
432435

433436
// table with results of generator level MC matching
434437
DECLARE_SOA_TABLE(HfCandProng3MCGen, "AOD", "HFCANDP3MCGEN",
435-
hf_cand_prong3::FlagMCMatchGen);
438+
hf_cand_prong3::FlagMCMatchGen,
439+
hf_cand_prong3::FlagMCDecayChanGen);
436440

437441
} // namespace o2::aod
438442

Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,19 @@ struct HFCandidateCreator3ProngMC {
152152
{
153153
int8_t sign = 0;
154154
int8_t flag = 0;
155+
int8_t DecayChannel = 0;
156+
std::vector<int> arrDaughIndex;
157+
std::array<int, 2> arrPDGDaugh;
158+
std::array<int, 2> arrPDGResonant1 = {2212, 313}; // Λc± → p± K*
159+
std::array<int, 2> arrPDGResonant2 = {2224, 321}; // Λc± → Δ(1232)±± K∓
160+
std::array<int, 2> arrPDGResonant3 = {3124, 211}; // Λc± → Λ(1520) π±
155161

156162
// Match reconstructed candidates.
157163
for (auto& candidate : candidates) {
158164
//Printf("New rec. candidate");
159165
flag = 0;
166+
DecayChannel = 0;
167+
arrDaughIndex.clear();
160168
auto arrayDaughters = array{candidate.index0_as<aod::BigTracksMC>(), candidate.index1_as<aod::BigTracksMC>(), candidate.index2_as<aod::BigTracksMC>()};
161169

162170
// D± → π± K∓ π±
@@ -168,18 +176,37 @@ struct HFCandidateCreator3ProngMC {
168176
// Λc± → p± K∓ π±
169177
if (flag == 0) {
170178
//Printf("Checking Λc± → p± K∓ π±");
171-
if (RecoDecay::getMatchedMCRec(particlesMC, std::move(arrayDaughters), 4122, array{+kProton, -kKPlus, +kPiPlus}, true, &sign) > -1) {
179+
auto indexRecLc = RecoDecay::getMatchedMCRec(particlesMC, std::move(arrayDaughters), 4122, array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
180+
if (indexRecLc > -1) {
172181
flag = sign * (1 << LcToPKPi);
182+
183+
//Printf("Flagging the different Λc± → p± K∓ π± decay channels");
184+
RecoDecay::getDaughters(particlesMC, indexRecLc, &arrDaughIndex, array{0}, 1);
185+
if (arrDaughIndex.size() == 2) {
186+
for (auto iProng = 0; iProng < arrDaughIndex.size(); ++iProng) {
187+
auto daughI = particlesMC.iteratorAt(arrDaughIndex[iProng]);
188+
arrPDGDaugh[iProng] = std::abs(daughI.pdgCode());
189+
}
190+
if (arrPDGDaugh[0] == arrPDGResonant1[0] && arrPDGDaugh[1] == arrPDGResonant1[1]) {
191+
DecayChannel = 1;
192+
} else if (arrPDGDaugh[0] == arrPDGResonant2[0] && arrPDGDaugh[1] == arrPDGResonant2[1]) {
193+
DecayChannel = 2;
194+
} else if (arrPDGDaugh[0] == arrPDGResonant3[0] && arrPDGDaugh[1] == arrPDGResonant3[1]) {
195+
DecayChannel = 3;
196+
}
197+
}
173198
}
174199
}
175200

176-
rowMCMatchRec(flag);
201+
rowMCMatchRec(flag, DecayChannel);
177202
}
178203

179204
// Match generated particles.
180205
for (auto& particle : particlesMC) {
181206
//Printf("New gen. candidate");
182207
flag = 0;
208+
DecayChannel = 0;
209+
arrDaughIndex.clear();
183210

184211
// D± → π± K∓ π±
185212
//Printf("Checking D± → π± K∓ π±");
@@ -190,12 +217,29 @@ struct HFCandidateCreator3ProngMC {
190217
// Λc± → p± K∓ π±
191218
if (flag == 0) {
192219
//Printf("Checking Λc± → p± K∓ π±");
193-
if (RecoDecay::isMatchedMCGen(particlesMC, particle, 4122, array{+kProton, -kKPlus, +kPiPlus}, true, &sign)) {
220+
auto isMatchedGenLc = RecoDecay::isMatchedMCGen(particlesMC, particle, 4122, array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
221+
if (isMatchedGenLc) {
194222
flag = sign * (1 << LcToPKPi);
223+
224+
//Printf("Flagging the different Λc± → p± K∓ π± decay channels");
225+
RecoDecay::getDaughters(particlesMC, particle.globalIndex(), &arrDaughIndex, array{0}, 1);
226+
if (arrDaughIndex.size() == 2) {
227+
for (auto jProng = 0; jProng < arrDaughIndex.size(); ++jProng) {
228+
auto daughJ = particlesMC.iteratorAt(arrDaughIndex[jProng]);
229+
arrPDGDaugh[jProng] = std::abs(daughJ.pdgCode());
230+
}
231+
if (arrPDGDaugh[0] == arrPDGResonant1[0] && arrPDGDaugh[1] == arrPDGResonant1[1]) {
232+
DecayChannel = 1;
233+
} else if (arrPDGDaugh[0] == arrPDGResonant2[0] && arrPDGDaugh[1] == arrPDGResonant2[1]) {
234+
DecayChannel = 2;
235+
} else if (arrPDGDaugh[0] == arrPDGResonant3[0] && arrPDGDaugh[1] == arrPDGResonant3[1]) {
236+
DecayChannel = 3;
237+
}
238+
}
195239
}
196240
}
197241

198-
rowMCMatchGen(flag);
242+
rowMCMatchGen(flag, DecayChannel);
199243
}
200244
}
201245
};

0 commit comments

Comments
 (0)