Skip to content

Commit 194f417

Browse files
sarjeetagamisarjeeta gami
andauthored
[PWGLF] Modify PID selection in kstarpbpb task (#16937)
Co-authored-by: sarjeeta gami <sarjeetagami@sarjeetas-MacBook-Air-217.local>
1 parent c148dd1 commit 194f417

1 file changed

Lines changed: 19 additions & 85 deletions

File tree

PWGLF/Tasks/Resonances/kstarpbpb.cxx

Lines changed: 19 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ struct Kstarpbpb {
117117
ConfigurableAxis configrapAxis{"configrapAxis", {VARIABLE_WIDTH, -0.8, -0.4, 0.4, 0.8}, "Rapidity"};
118118
Configurable<float> confFakeKaonCut{"confFakeKaonCut", 0.1, "Cut based on track from momentum difference"};
119119
ConfigurableAxis configThnAxisV2{"configThnAxisV2", {400, -16, 16}, "V2"};
120-
Configurable<bool> ispTdepPID{"ispTdepPID", true, "pT dependent PID"};
121120
Configurable<bool> isNoTOF{"isNoTOF", true, "isNoTOF"};
122121
Configurable<bool> pdgcheck{"pdgcheck", true, "pdgcheck"};
123122
Configurable<int> strategyPID{"strategyPID", 2, "PID strategy"};
@@ -307,32 +306,6 @@ struct Kstarpbpb {
307306
static constexpr float TPCOnlyPt = 0.5f;
308307
static constexpr int Strategy = 2;
309308
template <typename T>
310-
bool selectionPIDNew(const T& candidate, int PID)
311-
{
312-
if (PID == 0) {
313-
if (candidate.pt() < TPCOnlyPt && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
314-
return true;
315-
}
316-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
317-
return true;
318-
}
319-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) {
320-
return true;
321-
}
322-
} else if (PID == 1) {
323-
if (candidate.pt() < TPCOnlyPt && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
324-
return true;
325-
}
326-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
327-
return true;
328-
}
329-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) {
330-
return true;
331-
}
332-
}
333-
return false;
334-
}
335-
template <typename T>
336309
bool selectionPID2(const T& candidate, int PID)
337310
{
338311
if (PID == 0) {
@@ -347,33 +320,6 @@ struct Kstarpbpb {
347320
}
348321
return false;
349322
}
350-
template <typename T>
351-
bool selectionPID(const T& candidate, int PID)
352-
{
353-
if (PID == 0) {
354-
if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
355-
return true;
356-
}
357-
if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) {
358-
return true;
359-
}
360-
if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
361-
return true;
362-
}
363-
} else if (PID == 1) {
364-
if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
365-
return true;
366-
}
367-
if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) {
368-
return true;
369-
}
370-
if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
371-
return true;
372-
}
373-
}
374-
return false;
375-
}
376-
377323
template <typename T>
378324
bool strategySelectionPID(const T& candidate, int PID, int strategy)
379325
{
@@ -389,13 +335,13 @@ struct Kstarpbpb {
389335
return true;
390336
}
391337
} else if (strategy == 1) {
392-
if (candidate.pt() < TPCOnlyPt && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
338+
if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
393339
return true;
394340
}
395-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
341+
if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) {
396342
return true;
397343
}
398-
if (!useGlobalTrack && !candidate.hasTPC()) {
344+
if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
399345
return true;
400346
}
401347
} else if (strategy == Strategy) {
@@ -422,13 +368,13 @@ struct Kstarpbpb {
422368
return true;
423369
}
424370
} else if (strategy == 1) {
425-
if (candidate.pt() < TPCOnlyPt && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
371+
if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
426372
return true;
427373
}
428-
if (candidate.pt() >= TPCOnlyPt && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > cfgCutTOFBeta) {
374+
if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) {
429375
return true;
430376
}
431-
if (!useGlobalTrack && !candidate.hasTPC()) {
377+
if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
432378
return true;
433379
}
434380
} else if (strategy == Strategy) {
@@ -554,15 +500,14 @@ struct Kstarpbpb {
554500
if (!selectionTrack(track1)) {
555501
continue;
556502
}
557-
bool track1kaon = false;
503+
558504
auto track1ID = track1.globalIndex();
559505
if (!isTOFOnly && !strategySelectionPID(track1, 0, strategyPID)) {
560506
continue;
561507
}
562508
if (isTOFOnly && !selectionPID2(track1, 0)) {
563509
continue;
564510
}
565-
track1kaon = true;
566511

567512
if (useWeight) {
568513
if (track1.pt() < cfgMaxTrackPt &&
@@ -576,21 +521,19 @@ struct Kstarpbpb {
576521
if (!selectionTrack(track2)) {
577522
continue;
578523
}
579-
bool track2pion = false;
524+
580525
auto track2ID = track2.globalIndex();
581526
if (!isTOFOnly && !strategySelectionPID(track2, 1, strategyPID)) {
582527
continue;
583528
}
584529
if (isTOFOnly && !selectionPID2(track2, 1)) {
585530
continue;
586531
}
587-
track2pion = true;
532+
588533
if (track2ID == track1ID) {
589534
continue;
590535
}
591-
if (!track1kaon || !track2pion) {
592-
continue;
593-
}
536+
594537
if (additionalQAplots) {
595538
histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa(), centrality);
596539
histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa(), centrality);
@@ -787,16 +730,10 @@ struct Kstarpbpb {
787730
if (!selectionTrack(track1) || !selectionTrack(track2)) {
788731
continue;
789732
}
790-
if (ispTdepPID && !isTOFOnly && !(selectionPIDNew(track1, 0))) {
791-
continue;
792-
}
793-
if (ispTdepPID && !isTOFOnly && !(selectionPIDNew(track2, 1))) {
794-
continue;
795-
}
796-
if (!ispTdepPID && !isTOFOnly && !(selectionPID(track1, 0))) {
733+
if (!isTOFOnly && !strategySelectionPID(track1, 0, strategyPID)) {
797734
continue;
798735
}
799-
if (!ispTdepPID && !isTOFOnly && !(selectionPID(track2, 1))) {
736+
if (!isTOFOnly && !strategySelectionPID(track2, 1, strategyPID)) {
800737
continue;
801738
}
802739
if (isTOFOnly && !selectionPID2(track1, 0)) {
@@ -915,10 +852,10 @@ struct Kstarpbpb {
915852
if (!selectionTrack(track1)) {
916853
continue;
917854
}
918-
if (ispTdepPID && !(selectionPIDNew(track1, 0))) {
855+
if (!isTOFOnly && !strategySelectionPID(track1, 0, strategyPID)) {
919856
continue;
920857
}
921-
if (!ispTdepPID && !(selectionPID(track1, 0))) {
858+
if (isTOFOnly && !selectionPID2(track1, 0)) {
922859
continue;
923860
}
924861
if (!track1.has_mcParticle()) {
@@ -933,10 +870,10 @@ struct Kstarpbpb {
933870
if (!selectionTrack(track2)) {
934871
continue;
935872
}
936-
if (ispTdepPID && !(selectionPIDNew(track2, 1))) {
873+
if (!isTOFOnly && !strategySelectionPID(track2, 1, strategyPID)) {
937874
continue;
938875
}
939-
if (!ispTdepPID && !(selectionPID(track2, 1))) {
876+
if (isTOFOnly && !selectionPID2(track2, 1)) {
940877
continue;
941878
}
942879
if (!track2.has_mcParticle()) {
@@ -972,10 +909,10 @@ struct Kstarpbpb {
972909
if (pdgcheck && std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892) {
973910
continue;
974911
}
975-
if (ispTdepPID && !(selectionPIDNew(track1, 0) || selectionPIDNew(track2, 1))) {
912+
if (!isTOFOnly && !(strategySelectionPID(track1, 0, strategyPID) || strategySelectionPID(track2, 1, strategyPID))) {
976913
continue;
977914
}
978-
if (!ispTdepPID && !(selectionPID(track1, 0) || selectionPID(track2, 1))) {
915+
if (isTOFOnly && !(selectionPID2(track1, 0) || selectionPID2(track2, 1))) {
979916
continue;
980917
}
981918
if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) {
@@ -1174,10 +1111,7 @@ struct Kstarpbpb {
11741111
continue;
11751112
}
11761113
// PID check
1177-
if (ispTdepPID && !isTOFOnly && (!strategySelectionPID(track1, 0, strategyPID) || !strategySelectionPID(track2, 1, strategyPID))) {
1178-
continue;
1179-
}
1180-
if (!ispTdepPID && !isTOFOnly && (!selectionPID(track1, 0) || !selectionPID(track2, 1))) {
1114+
if (!isTOFOnly && (!strategySelectionPID(track1, 0, strategyPID) || !strategySelectionPID(track2, 1, strategyPID))) {
11811115
continue;
11821116
}
11831117
if (isTOFOnly && (!selectionPID2(track1, 0) || !selectionPID2(track2, 1))) {

0 commit comments

Comments
 (0)