Skip to content

Commit 24310e6

Browse files
authored
[PWGLF] Fix mc info matching bugs in hypertriton kink analysis (#12829)
1 parent 1f513da commit 24310e6

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,6 @@ struct HyperkinkRecoTask {
369369
Service<o2::ccdb::BasicCCDBManager> ccdb;
370370
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
371371

372-
std::vector<int> mcPartIndices;
373-
374372
// Histograms are defined with HistogramRegistry
375373
HistogramRegistry registry{"registry", {}};
376374

@@ -590,17 +588,17 @@ struct HyperkinkRecoTask {
590588
auto motherTrackPar = getTrackParCov(trackMoth);
591589
o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}};
592590
std::array<float, 3> pMotherPv = {-999.f};
591+
std::array<float, 3> updatePMotherPv = {-999.f};
593592
if (o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT)) {
594593
motherTrackPar.getPxPyPzGlo(pMotherPv);
594+
if (motherTrackPar.update(primaryVtx)) {
595+
motherTrackPar.getPxPyPzGlo(updatePMotherPv);
596+
}
595597
}
598+
596599
hypkinkCand.momMothPV[0] = pMotherPv[0];
597600
hypkinkCand.momMothPV[1] = pMotherPv[1];
598601
hypkinkCand.momMothPV[2] = pMotherPv[2];
599-
600-
std::array<float, 3> updatePMotherPv = {-999.f};
601-
if (motherTrackPar.update(primaryVtx)) {
602-
motherTrackPar.getPxPyPzGlo(updatePMotherPv);
603-
}
604602
hypkinkCand.updateMomMothPV[0] = updatePMotherPv[0];
605603
hypkinkCand.updateMomMothPV[1] = updatePMotherPv[1];
606604
hypkinkCand.updateMomMothPV[2] = updatePMotherPv[2];
@@ -714,23 +712,27 @@ struct HyperkinkRecoTask {
714712

715713
void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCsWithTimestamps const&)
716714
{
717-
mcPartIndices.clear();
718715
std::vector<int64_t> mcPartIndices;
719716
setTrackIDForMC(mcPartIndices, particlesMC, tracks);
717+
std::vector<int64_t> signalIndicesPool;
720718
std::vector<bool> isReconstructedMCCollisions(mcCollisions.size(), false);
721719
std::vector<bool> isSelectedMCCollisions(mcCollisions.size(), false);
722720
std::vector<bool> isGoodCollisions(collisions.size(), false);
723721
std::vector<int> dauIDList(2, -1);
724722

725723
for (const auto& collision : collisions) {
726-
isReconstructedMCCollisions[collision.mcCollisionId()] = true;
724+
if (collision.has_mcCollision()) {
725+
isReconstructedMCCollisions[collision.mcCollisionId()] = true;
726+
}
727727
registry.fill(HIST("hEventCounter"), 0);
728728
if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) {
729729
continue;
730730
}
731731
registry.fill(HIST("hEventCounter"), 1);
732732
registry.fill(HIST("hVertexZCollision"), collision.posZ());
733-
isSelectedMCCollisions[collision.mcCollisionId()] = true;
733+
if (collision.has_mcCollision()) {
734+
isSelectedMCCollisions[collision.mcCollisionId()] = true;
735+
}
734736
isGoodCollisions[collision.globalIndex()] = true;
735737
}
736738

@@ -883,7 +885,7 @@ struct HyperkinkRecoTask {
883885
hypkinkCand.isSignal = true;
884886
hypkinkCand.isSignalReco = true;
885887
fillCandidateMCInfo(hypkinkCand, mcMothTrack, mcDaugTrack, mcNeutTrack);
886-
mcPartIndices.push_back(mcMothTrack.globalIndex());
888+
signalIndicesPool.push_back(mcMothTrack.globalIndex());
887889

888890
std::array<float, 2> dcaInfo;
889891
auto mcMothTrackPar = getTrackParFromMC(mcMothTrack, 2);
@@ -934,7 +936,7 @@ struct HyperkinkRecoTask {
934936
continue;
935937
}
936938

937-
if (std::find(mcPartIndices.begin(), mcPartIndices.end(), mcparticle.globalIndex()) != mcPartIndices.end()) {
939+
if (std::find(signalIndicesPool.begin(), signalIndicesPool.end(), mcparticle.globalIndex()) != signalIndicesPool.end()) {
938940
continue;
939941
}
940942

@@ -1243,13 +1245,16 @@ struct HyperkinkQa {
12431245
setTrackIDForMC(mcPartIndices, particlesMC, tracks);
12441246
std::vector<bool> isSelectedMCCollisions(mcCollisions.size(), false);
12451247
std::vector<int> dauIDList(2, -1);
1248+
12461249
for (const auto& collision : collisions) {
12471250
genQAHist.fill(HIST("hCollCounter"), 0.5);
12481251
if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) {
12491252
continue;
12501253
}
12511254
genQAHist.fill(HIST("hCollCounter"), 1.5);
1252-
isSelectedMCCollisions[collision.mcCollisionId()] = true;
1255+
if (collision.has_mcCollision()) {
1256+
isSelectedMCCollisions[collision.mcCollisionId()] = true;
1257+
}
12531258
}
12541259

12551260
for (const auto& mcCollision : mcCollisions) {

0 commit comments

Comments
 (0)