diff --git a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx index bb52685c14e..fba8b5ef210 100644 --- a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx @@ -94,6 +94,7 @@ struct HfDerivedDataCreatorB0ToDPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassB0}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -139,6 +140,7 @@ struct HfDerivedDataCreatorB0ToDPi { void fillTablesCandidate(const T& candidate, const U& prongCharm, const V& prongBachelor, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, float mlScore, const std::vector& mlScoresCharm) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -249,20 +251,32 @@ struct HfDerivedDataCreatorB0ToDPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParDplus, fillCandidateParDplus, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateMlDplus, fillCandidateMlDplus, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -270,17 +284,6 @@ struct HfDerivedDataCreatorB0ToDPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParDplus, fillCandidateParDplus, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateMlDplus, fillCandidateMlDplus, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMl) { diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx index 5baaec8dafa..e337ec4649f 100644 --- a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -97,6 +97,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassBPlus}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -142,6 +143,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { void fillTablesCandidate(const T& candidate, const U& prongCharm, const V& prongBachelor, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, float mlScore, const std::vector& mlScoresCharm) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -284,20 +286,33 @@ struct HfDerivedDataCreatorBplusToD0Pi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParD0, fillCandidateParD0, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateParD0E, fillCandidateParD0E, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateMlD0, fillCandidateMlD0, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -305,18 +320,6 @@ struct HfDerivedDataCreatorBplusToD0Pi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParD0, fillCandidateParD0, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateParD0E, fillCandidateParD0E, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateMlD0, fillCandidateMlD0, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMl) { diff --git a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index 9041d4d7c2e..603316670a1 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -89,6 +89,7 @@ struct HfDerivedDataCreatorD0ToKPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassD0}; + static constexpr int NHypothesesCand{2}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -150,6 +151,7 @@ struct HfDerivedDataCreatorD0ToKPi { void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double cosThetaStar, double topoChi2, double ct, double y, int8_t flagMc, int8_t origin, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { std::array, 2>, 2> sigmas{}; // PID nSigma [Expected][Hypothesis][TPC/TOF/TPC+TOF] @@ -248,20 +250,30 @@ struct HfDerivedDataCreatorD0ToKPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -269,15 +281,6 @@ struct HfDerivedDataCreatorD0ToKPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMc) { diff --git a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx index ddc56bfaebc..74da79ae04c 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx @@ -90,6 +90,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassDPlus}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -134,6 +135,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, int8_t swapping, int8_t flagDecayChan, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -246,20 +248,30 @@ struct HfDerivedDataCreatorDplusToPiKPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -267,15 +279,6 @@ struct HfDerivedDataCreatorDplusToPiKPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0, swapping = 0, flagDecayChanRec = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMl) { diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx index 587b967af0b..165dcadd758 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -88,6 +88,7 @@ struct HfDerivedDataCreatorDsToKKPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassDS}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -132,6 +133,7 @@ struct HfDerivedDataCreatorDsToKKPi { void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, int8_t swapping, int8_t flagDecayChan, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -229,20 +231,30 @@ struct HfDerivedDataCreatorDsToKKPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -250,15 +262,6 @@ struct HfDerivedDataCreatorDsToKKPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0, swapping = 0, flagDecayChanRec = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMl) { diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index a04dc0cf033..d2812782bde 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -86,6 +86,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassDStar}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -130,6 +131,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, const U& prongSoftPi, int candFlag, double invMass, double invMassD0, double y, int8_t flagMc, int8_t flagMcD0, int8_t origin, int8_t nTracksDecayed, double ptBhad, int pdgBhad, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -217,20 +219,30 @@ struct HfDerivedDataCreatorDstarToD0Pi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParD0, fillCandidateParD0, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -238,15 +250,6 @@ struct HfDerivedDataCreatorDstarToD0Pi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParD0, fillCandidateParD0, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, flagMcRecD0 = 0, origin = 0, nTracksDecayed = 0; double ptBhadMotherPart = 0; int pdgBhadMotherPart = 0; diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToK0sP.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToK0sP.cxx index 371b9ab9c4c..3f6a0b77fdb 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToK0sP.cxx @@ -88,6 +88,7 @@ struct HfDerivedDataCreatorLcToK0sP { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassLambdaCPlus}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -132,6 +133,7 @@ struct HfDerivedDataCreatorLcToK0sP { void fillTablesCandidate(const T& candidate, const U& bach, int candFlag, double invMass, double ct, double ctV0, double y, int8_t flagMc, int8_t origin, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -220,20 +222,30 @@ struct HfDerivedDataCreatorLcToK0sP { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -241,15 +253,6 @@ struct HfDerivedDataCreatorLcToK0sP { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMc) { diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx index efecd6f6713..7b37995e3a3 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx @@ -88,6 +88,7 @@ struct HfDerivedDataCreatorLcToPKPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassLambdaCPlus}; + static constexpr int NHypothesesCand{2}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -132,6 +133,7 @@ struct HfDerivedDataCreatorLcToPKPi { void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, int8_t swapping, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -228,20 +230,30 @@ struct HfDerivedDataCreatorLcToPKPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -249,15 +261,6 @@ struct HfDerivedDataCreatorLcToPKPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0, swapping = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMc) { diff --git a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx index 9e0529b97d6..fdce0301529 100644 --- a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx @@ -89,6 +89,7 @@ struct HfDerivedDataCreatorXicToXiPiPi { SliceCache cache; static constexpr double Mass{o2::constants::physics::MassXiCPlus}; + static constexpr int NHypothesesCand{1}; // Number of possible selection hypotheses per candidate. using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -134,6 +135,7 @@ struct HfDerivedDataCreatorXicToXiPiPi { void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double ct, double y, int8_t flagMc, int8_t origin, const std::vector& mlScores) { + LOGF(debug, "Filling candidate at derived index %d", rowsCommon.rowCandidateBase.lastIndex() + 1); rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -228,20 +230,30 @@ struct HfDerivedDataCreatorXicToXiPiPi { rowsCommon.matchedCollisions.clear(); } } - auto sizeTableColl = collisions.size(); - rowsCommon.reserveTablesColl(sizeTableColl); + // const auto sizeTableColl = collisions.size(); + // rowsCommon.reserveTablesColl(sizeTableColl); + const auto sizeTableCand = candidates.size() * NHypothesesCand; + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (IsMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME - auto sizeTableCand = candidatesThisColl.size(); - LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + const auto thisCollId = collision.globalIndex(); + const auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + const auto sizeTableCandThisColl = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCandThisColl); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } - if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + if (sizeTableCandThisColl == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { LOGF(debug, "Skipping rec. collision %d", thisCollId); continue; } @@ -249,15 +261,6 @@ struct HfDerivedDataCreatorXicToXiPiPi { rowsCommon.fillTablesCollision(collision); // Fill candidate properties - rowsCommon.reserveTablesCandidates(sizeTableCand); - reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); - reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); - reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); - reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); - reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (IsMc) { - reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); - } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { if constexpr (IsMl) { diff --git a/PWGHF/Utils/utilsDerivedData.h b/PWGHF/Utils/utilsDerivedData.h index 8b2b4fd431a..29fd3b7c1fc 100644 --- a/PWGHF/Utils/utilsDerivedData.h +++ b/PWGHF/Utils/utilsDerivedData.h @@ -230,8 +230,10 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { const TMass massParticle) { // Fill MC collision properties - const auto sizeTableMcColl = mcCollisions.size(); - reserveTablesMcColl(sizeTableMcColl); + // const auto sizeTableMcColl = mcCollisions.size(); + // reserveTablesMcColl(sizeTableMcColl); + const auto sizeTablePart = mcParticles.size(); + reserveTablesParticles(sizeTablePart); for (const auto& mcCollision : mcCollisions) { const auto thisMcCollId = mcCollision.globalIndex(); const auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); @@ -247,7 +249,6 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { fillTablesMcCollision(mcCollision); // Fill MC particle properties - reserveTablesParticles(sizeTablePart); for (const auto& particle : particlesThisMcColl) { fillTablesParticle(particle, massParticle); }