Skip to content

Commit 7eb71e6

Browse files
authored
[PWGHF] Cleanup table filling in D0 tree creator (#9919)
1 parent 74b84d2 commit 7eb71e6

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

PWGHF/TableProducer/treeCreatorD0ToKPi.cxx

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/// \author Nicolo' Jacazio <nicolo.jacazio@cern.ch>, CERN
1818
/// \author Andrea Tavira García <tavira-garcia@ijclab.in2p3.fr>, IJCLab
1919

20-
#include <vector>
21-
2220
#include "CommonConstants/PhysicsConstants.h"
2321
#include "Framework/AnalysisTask.h"
2422
#include "Framework/runDataProcessing.h"
@@ -276,8 +274,8 @@ struct HfTreeCreatorD0ToKPi {
276274
}
277275

278276
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)
277+
auto fillTable(const T& candidate, int candFlag, double invMass, double topoChi2,
278+
double ct, double y, double e, int8_t flagMc, int8_t origin)
281279
{
282280
if (fillCandidateLiteTable) {
283281
rowCandidateLite(
@@ -317,6 +315,7 @@ struct HfTreeCreatorD0ToKPi {
317315
flagMc,
318316
origin);
319317
} else {
318+
double cosThetaStar = candFlag == 0 ? hfHelper.cosThetaStarD0(candidate) : hfHelper.cosThetaStarD0bar(candidate);
320319
rowCandidateFull(
321320
candidate.collisionId(),
322321
candidate.posX(),
@@ -381,10 +380,17 @@ struct HfTreeCreatorD0ToKPi {
381380
candidate.globalIndex());
382381
}
383382
if constexpr (applyMl) {
384-
rowCandidateMl(
385-
mlProbD0[0],
386-
mlProbD0[1],
387-
mlProbD0[2]);
383+
if (candFlag == 0) {
384+
rowCandidateMl(
385+
candidate.mlProbD0()[0],
386+
candidate.mlProbD0()[1],
387+
candidate.mlProbD0()[2]);
388+
} else if (candFlag == 1) {
389+
rowCandidateMl(
390+
candidate.mlProbD0bar()[0],
391+
candidate.mlProbD0bar()[1],
392+
candidate.mlProbD0bar()[2]);
393+
}
388394
}
389395
}
390396

@@ -419,7 +425,6 @@ struct HfTreeCreatorD0ToKPi {
419425
double eD = hfHelper.eD0(candidate);
420426
double ctD = hfHelper.ctD0(candidate);
421427
float massD0, massD0bar;
422-
std::vector<float> mlProbD0, mlProbD0bar;
423428
float topolChi2PerNdf = -999.;
424429
if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) {
425430
massD0 = candidate.kfGeoMassD0();
@@ -430,16 +435,10 @@ struct HfTreeCreatorD0ToKPi {
430435
massD0bar = hfHelper.invMassD0barToKPi(candidate);
431436
}
432437
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);
438+
fillTable<applyMl>(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, 0, 0);
437439
}
438440
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);
441+
fillTable<applyMl>(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, 0, 0);
443442
}
444443
}
445444
}
@@ -525,7 +524,6 @@ struct HfTreeCreatorD0ToKPi {
525524
double ctD = hfHelper.ctD0(candidate);
526525
float massD0, massD0bar;
527526
float topolChi2PerNdf = -999.;
528-
std::vector<float> mlProbD0, mlProbD0bar;
529527
if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) {
530528
massD0 = candidate.kfGeoMassD0();
531529
massD0bar = candidate.kfGeoMassD0bar();
@@ -535,16 +533,10 @@ struct HfTreeCreatorD0ToKPi {
535533
massD0bar = hfHelper.invMassD0barToKPi(candidate);
536534
}
537535
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);
536+
fillTable<applyMl>(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec());
542537
}
543538
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);
539+
fillTable<applyMl>(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec());
548540
}
549541
}
550542

0 commit comments

Comments
 (0)