Skip to content

Commit 9cd37c9

Browse files
author
Shirajum Monira
committed
implemented duplicate cascade rejection using cosPA
1 parent 7fd7969 commit 9cd37c9

File tree

1 file changed

+48
-43
lines changed

1 file changed

+48
-43
lines changed

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
524524
PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventBitmask, "Enable processing same event for track - cascade using bitmask for PID", false);
525525

526526
/// cascade - cascade correlations
527+
Preslice<aod::FDCascParticles> perFDPartsCasc = aod::femtouniversecascparticle::fdParticleId;
528+
527529
template <class TableType, typename PartitionType>
528-
void doSameEventCasc(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsTwo)
530+
void doSameEventCasc(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsTwo, const aod::FDCascParticles& cascs)
529531
{
530532
const auto& magFieldTesla = col.magField();
531533

@@ -583,43 +585,47 @@ struct femtoUniversePairTaskTrackCascadeExtended {
583585
return;
584586
// track cleaning & checking for duplicate pairs
585587
if (!pairCleanerCasc.isCleanPair(p1, p2, parts)) {
586-
// mark for rejection the cascades that share a daughter with other cascades
587-
cascDuplicates.insert(p1.globalIndex());
588-
cascDuplicates.insert(p2.globalIndex());
588+
// mark for rejection the cascade that share a daughter with the other cascade and has a better cosPA value
589+
auto groupedCasc1 = cascs.sliceBy(perFDPartsCasc, p1.globalIndex());
590+
auto groupedCasc2 = cascs.sliceBy(perFDPartsCasc, p2.globalIndex());
591+
if (groupedCasc1.size() <= 0 || groupedCasc2.size() <= 0) {
592+
LOGF(warning, "Either cascade1 (%u) or cascade2 (%u) list is empty", groupedCasc1.size(), groupedCasc2.size()); // this should never happen but just for a sanity check
593+
return;
594+
}
595+
if (std::abs(groupedCasc1.begin().cpaCasc() - 1) < std::abs(groupedCasc2.begin().cpaCasc() - 1)) {
596+
cascDuplicates.insert(p1.globalIndex());
597+
} else {
598+
cascDuplicates.insert(p2.globalIndex());
599+
}
589600
}
590601
};
591602

592-
auto pairProcessFunc = [&](auto& p1, auto& p2) -> void {
603+
auto pairProcessFunc = [&](auto& p1, auto& p2) -> bool {
593604
if (cascDuplicates.contains(p1.globalIndex()) || cascDuplicates.contains(p2.globalIndex()))
594-
return;
605+
return false;
595606
if (!invMCascade(p1.mLambda(), p1.mAntiLambda(), confCascType1))
596-
return;
607+
return false;
597608
if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType2))
598-
return;
599-
if (confIsCPR.value) {
600-
if (pairCloseRejectionCasc.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) {
601-
return;
602-
}
603-
}
609+
return false;
604610

605611
const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 3 - parts.begin().globalIndex());
606612
const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 2 - parts.begin().globalIndex());
607613
const auto& bachelor1 = parts.iteratorAt(p1.globalIndex() - 1 - parts.begin().globalIndex());
608614
/// Child particles must pass this condition to be selected
609615
if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
610616
if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2]))
611-
return;
617+
return false;
612618
if (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2]))
613-
return;
619+
return false;
614620
} else {
615621
if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0)
616-
return;
622+
return false;
617623
if (confUseStrangenessTOF) {
618624
if (((confCascType1 == 1 || confCascType1 == 3) && (p1.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (p1.pidCut() & 56) != 56))
619-
return;
625+
return false;
620626
} else {
621627
if ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0)
622-
return;
628+
return false;
623629
}
624630
}
625631

@@ -629,55 +635,54 @@ struct femtoUniversePairTaskTrackCascadeExtended {
629635
/// Child particles must pass this condition to be selected
630636
if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
631637
if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2]))
632-
return;
638+
return false;
633639
if (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2]))
634-
return;
640+
return false;
635641
} else {
636642
if ((posChild2.pidCut() & (1u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType2][2])) == 0)
637-
return;
643+
return false;
638644
if (confUseStrangenessTOF) {
639645
if (((confCascType2 == 1 || confCascType2 == 3) && (p2.pidCut() & 7) != 7) || ((confCascType2 == 0 || confCascType2 == 2) && (p2.pidCut() & 56) != 56))
640-
return;
646+
return false;
641647
} else {
642648
if ((posChild2.pidCut() & (8u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (8u << CascChildTable[confCascType2][2])) == 0)
643-
return;
649+
return false;
650+
}
651+
}
652+
653+
if (confIsCPR.value) {
654+
if (pairCloseRejectionCasc.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) {
655+
return false;
644656
}
645657
}
646658

647659
float weight = 1.0f;
648660
if (plocalEffp1)
649661
weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta()));
650662
sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight);
663+
return true;
651664
};
665+
652666
cascDuplicates.clear();
653-
if (confCascType1 == confCascType2) {
654-
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) {
655-
pairDuplicateCheckFunc(p1, p2);
656-
}
657-
/// Now build the combinations for identical cascades
658-
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) {
659-
pairProcessFunc(p1, p2);
660-
}
661-
} else {
662-
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) {
663-
pairDuplicateCheckFunc(p1, p2);
664-
}
665-
/// Now build the combinations for non-identical cascades
666-
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) {
667-
pairProcessFunc(p1, p2);
668-
}
667+
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) {
668+
pairDuplicateCheckFunc(p1, p2);
669+
}
670+
/// Now build the combinations for cascades
671+
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) {
672+
if (!pairProcessFunc(p1, p2))
673+
pairProcessFunc(p2, p1);
669674
}
670675
}
671676

672-
void processSameEventCasc(const FilteredFDCollision& col, const FemtoFullParticles& parts)
677+
void processSameEventCasc(const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& cascs)
673678
{
674-
doSameEventCasc(col, parts, partsTwoFull);
679+
doSameEventCasc(col, parts, partsTwoFull, cascs);
675680
}
676681
PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCasc, "Enable processing same event for cascade - cascade", false);
677682

678-
void processSameEventCascBitmask(const FilteredFDCollision& col, const aod::FDParticles& parts)
683+
void processSameEventCascBitmask(const FilteredFDCollision& col, const aod::FDParticles& parts, const aod::FDCascParticles& cascs)
679684
{
680-
doSameEventCasc(col, parts, partsTwoBasic);
685+
doSameEventCasc(col, parts, partsTwoBasic, cascs);
681686
}
682687
PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCascBitmask, "Enable processing same event for cascade - cascade using bitmask for PID", false);
683688

0 commit comments

Comments
 (0)