Skip to content

Commit 5876a27

Browse files
committed
[PWGHF] Cleanup table filling in D0 tree creator
1 parent 61b662a commit 5876a27

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

PWGHF/TableProducer/treeCreatorD0ToKPi.cxx

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ struct HfTreeCreatorD0ToKPi {
276276
}
277277

278278
template <bool applyMl, typename T>
279-
auto fillTable(const T& candidate, int candFlag, double invMass, double cosThetaStar, double topoChi2,
280-
double ct, double y, double e, int8_t flagMc, int8_t origin, std::vector<float> const& mlProbD0)
279+
auto fillTable(const T& candidate, int candFlag, double invMass, double topoChi2,
280+
double ct, double y, double e, int8_t flagMc, int8_t origin)
281281
{
282282
if (fillCandidateLiteTable) {
283283
rowCandidateLite(
@@ -317,6 +317,7 @@ struct HfTreeCreatorD0ToKPi {
317317
flagMc,
318318
origin);
319319
} else {
320+
double cosThetaStar = candFlag == 0 ? hfHelper.cosThetaStarD0(candidate) : hfHelper.cosThetaStarD0bar(candidate);
320321
rowCandidateFull(
321322
candidate.collisionId(),
322323
candidate.posX(),
@@ -381,10 +382,17 @@ struct HfTreeCreatorD0ToKPi {
381382
candidate.globalIndex());
382383
}
383384
if constexpr (applyMl) {
384-
rowCandidateMl(
385-
mlProbD0[0],
386-
mlProbD0[1],
387-
mlProbD0[2]);
385+
if (candFlag == 0) {
386+
rowCandidateMl(
387+
candidate.mlProbD0()[0],
388+
candidate.mlProbD0()[1],
389+
candidate.mlProbD0()[2]);
390+
} else if (candFlag == 1) {
391+
rowCandidateMl(
392+
candidate.mlProbD0bar()[0],
393+
candidate.mlProbD0bar()[1],
394+
candidate.mlProbD0bar()[2]);
395+
}
388396
}
389397
}
390398

@@ -419,7 +427,6 @@ struct HfTreeCreatorD0ToKPi {
419427
double eD = hfHelper.eD0(candidate);
420428
double ctD = hfHelper.ctD0(candidate);
421429
float massD0, massD0bar;
422-
std::vector<float> mlProbD0, mlProbD0bar;
423430
float topolChi2PerNdf = -999.;
424431
if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) {
425432
massD0 = candidate.kfGeoMassD0();
@@ -430,16 +437,10 @@ struct HfTreeCreatorD0ToKPi {
430437
massD0bar = hfHelper.invMassD0barToKPi(candidate);
431438
}
432439
if (candidate.isSelD0()) {
433-
if constexpr (applyMl) {
434-
mlProbD0 = std::vector<float>(candidate.mlProbD0().begin(), candidate.mlProbD0().end());
435-
}
436-
fillTable<applyMl>(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0, mlProbD0);
440+
fillTable<applyMl>(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, 0, 0);
437441
}
438442
if (candidate.isSelD0bar()) {
439-
if constexpr (applyMl) {
440-
mlProbD0bar = std::vector<float>(candidate.mlProbD0bar().begin(), candidate.mlProbD0bar().end());
441-
}
442-
fillTable<applyMl>(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0, mlProbD0bar);
443+
fillTable<applyMl>(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, 0, 0);
443444
}
444445
}
445446
}
@@ -525,7 +526,6 @@ struct HfTreeCreatorD0ToKPi {
525526
double ctD = hfHelper.ctD0(candidate);
526527
float massD0, massD0bar;
527528
float topolChi2PerNdf = -999.;
528-
std::vector<float> mlProbD0, mlProbD0bar;
529529
if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) {
530530
massD0 = candidate.kfGeoMassD0();
531531
massD0bar = candidate.kfGeoMassD0bar();
@@ -535,16 +535,10 @@ struct HfTreeCreatorD0ToKPi {
535535
massD0bar = hfHelper.invMassD0barToKPi(candidate);
536536
}
537537
if (candidate.isSelD0()) {
538-
if constexpr (applyMl) {
539-
mlProbD0 = std::vector<float>(candidate.mlProbD0().begin(), candidate.mlProbD0().end());
540-
}
541-
fillTable<applyMl>(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec(), mlProbD0);
538+
fillTable<applyMl>(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec());
542539
}
543540
if (candidate.isSelD0bar()) {
544-
if constexpr (applyMl) {
545-
mlProbD0bar = std::vector<float>(candidate.mlProbD0bar().begin(), candidate.mlProbD0bar().end());
546-
}
547-
fillTable<applyMl>(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec(), mlProbD0bar);
541+
fillTable<applyMl>(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec());
548542
}
549543
}
550544

0 commit comments

Comments
 (0)