Skip to content

Commit 1884a1b

Browse files
authored
PWGHF: fix bug in rejection of particles from bkg (embedding) (#6993)
* Properly rebase * Fix typo
1 parent 7018e5b commit 1884a1b

5 files changed

Lines changed: 36 additions & 12 deletions

File tree

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,20 @@ struct HfCandidateCreator2ProngExpressions {
710710

711711
// Check whether the particle is from background events. If so, reject it.
712712
if (rejectBackground) {
713+
bool fromBkg{false};
713714
for (const auto& daughter : arrayDaughters) {
714715
if (daughter.has_mcParticle()) {
715716
auto mcParticle = daughter.mcParticle();
716717
if (mcParticle.fromBackgroundEvent()) {
717-
rowMcMatchRec(flag, origin, -1.f, 0);
718-
continue;
718+
fromBkg = true;
719+
break;
719720
}
720721
}
721722
}
723+
if (fromBkg) {
724+
rowMcMatchRec(flag, origin, -1.f, 0);
725+
continue;
726+
}
722727
}
723728
std::vector<int> idxBhadMothers{};
724729

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,20 @@ struct HfCandidateCreator3ProngExpressions {
545545

546546
// Check whether the particle is from background events. If so, reject it.
547547
if (rejectBackground) {
548+
bool fromBkg{false};
548549
for (const auto& daughter : arrayDaughters) {
549550
if (daughter.has_mcParticle()) {
550551
auto mcParticle = daughter.mcParticle();
551552
if (mcParticle.fromBackgroundEvent()) {
552-
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
553-
continue;
553+
fromBkg = true;
554+
break;
554555
}
555556
}
556557
}
558+
if (fromBkg) {
559+
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
560+
continue;
561+
}
557562
}
558563

559564
// D± → π± K∓ π±

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,20 @@ struct HfCandidateCreatorCascadeMc {
492492
auto arrayDaughtersLc = std::array{bach, trackV0DaughPos, trackV0DaughNeg};
493493
// Check whether the particle is from background events. If so, reject it.
494494
if (rejectBackground) {
495-
auto arrayDaughers = std::array{bach, trackV0DaughPos, trackV0DaughNeg};
496-
for (const auto& daughter : arrayDaughers) {
495+
bool fromBkg{false};
496+
for (const auto& daughter : arrayDaughtersLc) {
497497
if (daughter.has_mcParticle()) {
498498
auto mcParticle = daughter.mcParticle();
499499
if (mcParticle.fromBackgroundEvent()) {
500-
rowMcMatchRec(sign, origin, -1.f, 0);
501-
continue;
500+
fromBkg = true;
501+
break;
502502
}
503503
}
504504
}
505+
if (fromBkg) {
506+
rowMcMatchRec(sign, origin, -1.f, 0);
507+
continue;
508+
}
505509
}
506510

507511
RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1);

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,20 @@ struct HfCandidateCreatorDstarExpressions {
569569

570570
// Check whether the particle is from background events. If so, reject it.
571571
if (rejectBackground) {
572+
bool fromBkg{false};
572573
for (const auto& daughter : arrayDaughtersDstar) {
573574
if (daughter.has_mcParticle()) {
574575
auto mcParticle = daughter.mcParticle();
575576
if (mcParticle.fromBackgroundEvent()) {
576-
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0);
577-
continue;
577+
fromBkg = true;
578+
break;
578579
}
579580
}
580581
}
582+
if (fromBkg) {
583+
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0);
584+
continue;
585+
}
581586
}
582587

583588
// D*± → D0(bar) π±

PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,15 +760,20 @@ struct HfCandidateCreatorXic0Omegac0Mc {
760760

761761
// Check whether the particle is from background events. If so, reject it.
762762
if (rejectBackground) {
763+
bool fromBkg{false};
763764
for (const auto& daughter : arrayDaughters) {
764765
if (daughter.has_mcParticle()) {
765766
auto mcParticle = daughter.mcParticle();
766767
if (mcParticle.fromBackgroundEvent()) {
767-
rowMCMatchRecXicToXiPi(flag, debug, origin, collisionMatched, -1.f, 0);
768-
continue;
768+
fromBkg = true;
769+
break;
769770
}
770771
}
771772
}
773+
if (fromBkg) {
774+
rowMCMatchRecXicToXiPi(flag, debug, origin, collisionMatched, -1.f, 0);
775+
continue;
776+
}
772777
}
773778

774779
// Xic0 -> xi pi matching

0 commit comments

Comments
 (0)