Skip to content

Commit ac2e662

Browse files
committed
Major fix: use robust Join between V0Cores and V0CoresMc.
1 parent fec5a9d commit ac2e662

File tree

1 file changed

+18
-33
lines changed

1 file changed

+18
-33
lines changed

PWGHF/Tasks/taskPidStudies.cxx

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ struct HfTaskPidStudies {
204204
aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>;
205205
using CollSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms>;
206206
using CollisionsMc = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms>;
207-
using V0sMcRec = soa::Join<aod::V0Datas, aod::V0CoreMCLabels>;
208-
using CascsMcRec = soa::Join<aod::CascDatas, aod::CascCoreMCLabels>;
207+
using V0sMcRec = soa::Join<aod::V0Datas, aod::V0MCCores>;
208+
using CascsMcRec = soa::Join<aod::CascDatas, aod::CascMCCores>;
209209

210210
ctpRateFetcher rateFetcher;
211211
HfEventSelection hfEvSel;
@@ -305,45 +305,32 @@ struct HfTaskPidStudies {
305305
}
306306

307307
template <typename T1>
308-
int isMatched(const T1& cand, int mcCoresSize)
308+
int isMatched(const T1& cand)
309309
{
310310
if constexpr (std::is_same<T1, V0sMcRec::iterator>::value) {
311-
if (!cand.has_v0MCCore()) {
312-
return Particle::NotMatched;
313-
}
314-
auto v0MC = cand.template v0MCCore_as<aod::V0MCCores>();
315-
int v0MCId = cand.v0MCCoreId();
316-
if (v0MCId >= mcCoresSize) {
317-
// LOG(warn) << "v0MCId (" << v0MCId << ") >= MCCores size (" << mcCoresSize << "). Some issue in the data model?";
318-
return Particle::NotMatched;
319-
}
320-
if (v0MC.pdgCode() == kK0Short && v0MC.pdgCodeNegative() == -kPiPlus && v0MC.pdgCodePositive() == kPiPlus) {
311+
if (cand.pdgCode() == kK0Short && cand.pdgCodeNegative() == -kPiPlus && cand.pdgCodePositive() == kPiPlus) {
321312
return Particle::K0s;
322313
}
323-
if (v0MC.pdgCode() == kLambda0 && v0MC.pdgCodeNegative() == -kPiPlus && v0MC.pdgCodePositive() == kProton) {
314+
if (cand.pdgCode() == kLambda0 && cand.pdgCodeNegative() == -kPiPlus && cand.pdgCodePositive() == kProton) {
324315
return Particle::Lambda;
325316
}
326-
if (v0MC.pdgCode() == -kLambda0 && v0MC.pdgCodeNegative() == -kProton && v0MC.pdgCodePositive() == kPiPlus) {
317+
if (cand.pdgCode() == -kLambda0 && cand.pdgCodeNegative() == -kProton && cand.pdgCodePositive() == kPiPlus) {
327318
return -Particle::Lambda;
328319
}
329320
}
330321
if constexpr (std::is_same<T1, CascsMcRec::iterator>::value) {
331-
if (!cand.has_cascMCCore()) {
332-
return Particle::NotMatched;
333-
}
334-
auto cascMC = cand.template cascMCCore_as<aod::CascMCCores>();
335-
if (cascMC.pdgCode() == kOmegaMinus &&
336-
cascMC.pdgCodeBachelor() == -kKPlus &&
337-
cascMC.pdgCodeV0() == kLambda0 &&
338-
cascMC.pdgCodePositive() == kProton &&
339-
cascMC.pdgCodeNegative() == -kPiPlus) {
322+
if (cand.pdgCode() == kOmegaMinus &&
323+
cand.pdgCodeBachelor() == -kKPlus &&
324+
cand.pdgCodeV0() == kLambda0 &&
325+
cand.pdgCodePositive() == kProton &&
326+
cand.pdgCodeNegative() == -kPiPlus) {
340327
return Particle::Omega;
341328
}
342-
if (cascMC.pdgCode() == -kOmegaMinus &&
343-
cascMC.pdgCodeBachelor() == kKPlus &&
344-
cascMC.pdgCodeV0() == -kLambda0 &&
345-
cascMC.pdgCodePositive() == kPiPlus &&
346-
cascMC.pdgCodeNegative() == -kProton) {
329+
if (cand.pdgCode() == -kOmegaMinus &&
330+
cand.pdgCodeBachelor() == kKPlus &&
331+
cand.pdgCodeV0() == -kLambda0 &&
332+
cand.pdgCodePositive() == kPiPlus &&
333+
cand.pdgCodeNegative() == -kProton) {
347334
return -Particle::Omega;
348335
}
349336
}
@@ -527,8 +514,7 @@ struct HfTaskPidStudies {
527514
continue;
528515
}
529516
if (isSelectedV0AsK0s(v0) || isSelectedV0AsLambda(v0)) {
530-
int const v0MCCoresSize = v0MCCores.size();
531-
int const matched = isMatched(v0, v0MCCoresSize);
517+
int const matched = isMatched(v0);
532518
if (matched != Particle::NotMatched) {
533519
fillTree<true, CollisionsMc>(v0, matched);
534520
}
@@ -571,8 +557,7 @@ struct HfTaskPidStudies {
571557
continue;
572558
}
573559
if (isSelectedCascAsOmega<CollisionsMc>(casc)) {
574-
int const cascMCCoresSize = cascMCCores.size();
575-
int const matched = isMatched(casc, cascMCCoresSize);
560+
int const matched = isMatched(casc);
576561
if (matched != Particle::NotMatched) {
577562
fillTree<false, CollisionsMc>(casc, matched);
578563
}

0 commit comments

Comments
 (0)