Skip to content

Commit 4f9e921

Browse files
authored
[PWGLF] Fixed the bug in storing track PID information. (#18763)
1 parent e1a48f4 commit 4f9e921

2 files changed

Lines changed: 43 additions & 21 deletions

File tree

‎PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,13 @@ struct lambdaspincorrelation {
372372
tpcNegNClsCrossedRows.push_back(negtrack1.tpcNClsCrossedRows());
373373
ctau.push_back(ctauLambda);
374374

375-
tpcNsigmaPos.push_back(std::abs(postrack1.tpcNSigmaPr()));
376-
tpcNsigmaNeg.push_back(std::abs(negtrack1.tpcNSigmaPi()));
375+
if (lambdaTag) {
376+
tpcNsigmaPos.push_back(std::abs(postrack1.tpcNSigmaPr()));
377+
tpcNsigmaNeg.push_back(std::abs(negtrack1.tpcNSigmaPi()));
378+
} else if (aLambdaTag) {
379+
tpcNsigmaPos.push_back(std::abs(postrack1.tpcNSigmaPi()));
380+
tpcNsigmaNeg.push_back(std::abs(negtrack1.tpcNSigmaPr()));
381+
}
377382

378383
mK0Short.push_back(v0.mK0Short());
379384

‎PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx‎

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ struct lambdaspincorrderived {
352352
Configurable<int> cfgV5NeighborEta{"cfgV5NeighborEta", 0, "v5: neighbor bins in eta (use symmetric ±N, edge-safe)"};
353353
Configurable<int> cfgV5NeighborPhi{"cfgV5NeighborPhi", 0, "v5: neighbor bins in phi (use symmetric ±N, periodic wrap)"};
354354
Configurable<int> cfgV5MaxMatches{"cfgV5MaxMatches", 50, "v5: max ME replacements per SE pair (after all cuts)"};
355+
356+
Configurable<int> cfgV6MinMatches{"cfgV6MinMatches", 5, "Minimum accepted ME pairs per replacement branch; <=0 disables threshold"};
357+
355358
Configurable<uint64_t> cfgMixSeed{"cfgMixSeed", 0xdecafbadULL, "RNG seed for downsampling matches (deterministic)"};
356359
Configurable<bool> cfgV6CarryUnmatched{"cfgV6CarryUnmatched", false, "Carry data and MC V6 replacement branches with zero matches to later data frames"};
357360
Configurable<int> cfgV6MaxPendingBranches{"cfgV6MaxPendingBranches", 0, "Maximum retained V6 branches per data or MC buffer; <=0 means unlimited"};
@@ -617,6 +620,9 @@ struct lambdaspincorrderived {
617620
histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true);
618621
histos.add("hNMEperSE_leg1", "ME replacements per SE pair, leg1", HistType::kTH1D, {{12, -0.5, 11.5}}, true);
619622
histos.add("hNMEperSE_leg2", "ME replacements per SE pair, leg2", HistType::kTH1D, {{12, -0.5, 11.5}}, true);
623+
624+
histos.add("hNMEperSE_leg1_aftercut", "ME replacements per SE pair, leg1", HistType::kTH1D, {{12, -0.5, 11.5}}, true);
625+
histos.add("hNMEperSE_leg2_aftercut", "ME replacements per SE pair, leg2", HistType::kTH1D, {{12, -0.5, 11.5}}, true);
620626
}
621627

622628
if (fillHistConfig.fillWeightQAHistos) {
@@ -934,30 +940,25 @@ struct lambdaspincorrderived {
934940
}
935941

936942
if (v0Configurations.useAdditionalCut) {
937-
// additional cuts
938-
if (candidate.v0Status() == 0 && (std::abs(candidate.tpcNsigmaPos()) > v0Configurations.maxTpcNsigma || std::abs(candidate.tpcNsigmaNeg()) > v0Configurations.maxTpcNsigma)) {
939-
return false;
940-
}
941-
if (candidate.v0Status() == 1 && (std::abs(candidate.tpcNsigmaNeg()) > v0Configurations.maxTpcNsigma || std::abs(candidate.tpcNsigmaPos()) > v0Configurations.maxTpcNsigma)) {
942-
return false;
943-
}
944943

945-
if (candidate.tpcPosNClsCrossedRows() < v0Configurations.minTpcNClsCrossedRows) {
944+
if (std::abs(candidate.tpcNsigmaPos()) > v0Configurations.maxTpcNsigma ||
945+
std::abs(candidate.tpcNsigmaNeg()) > v0Configurations.maxTpcNsigma) {
946946
return false;
947947
}
948948

949-
if (candidate.tpcNegNClsCrossedRows() < v0Configurations.minTpcNClsCrossedRows) {
949+
if (candidate.tpcPosNClsCrossedRows() < v0Configurations.minTpcNClsCrossedRows ||
950+
candidate.tpcNegNClsCrossedRows() < v0Configurations.minTpcNClsCrossedRows) {
950951
return false;
951952
}
952953

953-
if (candidate.ctau() > v0Configurations.maxCtau) {
954+
if (std::abs(candidate.ctau()) > v0Configurations.maxCtau) {
954955
return false;
955956
}
956957

957-
if (v0Configurations.useK0sRejection) {
958-
if (std::abs(candidate.mK0Short() - o2::constants::physics::MassK0Short) < v0Configurations.confK0sMassWindow) {
959-
return false;
960-
}
958+
if (v0Configurations.useK0sRejection &&
959+
std::abs(candidate.mK0Short() - o2::constants::physics::MassK0Short) <
960+
v0Configurations.confK0sMassWindow) {
961+
return false;
961962
}
962963
}
963964

@@ -1914,7 +1915,7 @@ struct lambdaspincorrderived {
19141915
}
19151916
}
19161917
}
1917-
PROCESS_SWITCH(lambdaspincorrderived, processDataSys, "Process Sys analysis", true);
1918+
PROCESS_SWITCH(lambdaspincorrderived, processDataSys, "Process Sys analysis", false);
19181919

19191920
template <typename LV>
19201921
void fillReplacementControlMap(int tag1, int tag2, int leg, bool isTarget, LV const& particle, float weight)
@@ -3146,7 +3147,9 @@ struct lambdaspincorrderived {
31463147
++nAccepted;
31473148
}
31483149

3149-
if (nAccepted == 0) {
3150+
const int minRequired = cfgV6MinMatches.value > 0 ? cfgV6MinMatches.value : 1;
3151+
3152+
if (nAccepted < minRequired) {
31503153
++it;
31513154
continue;
31523155
}
@@ -3282,12 +3285,12 @@ struct lambdaspincorrderived {
32823285
const auto hasPendingSpace = [&]() {
32833286
return cfgV6MaxPendingBranches.value <= 0 || static_cast<int>(v6Pending.data.size()) < cfgV6MaxPendingBranches.value;
32843287
};
3285-
if (doMixLeg1 && nFill1 == 0 && hasPendingSpace()) {
3288+
if (doMixLeg1 && nFill1 < (cfgV6MinMatches.value > 0 ? cfgV6MinMatches.value : 1) && hasPendingSpace()) {
32863289
v6Pending.data.push_back({storeV6Candidate(t1, curColIdx), storeV6Candidate(t2, curColIdx), colBin, 1, 0,
32873290
static_cast<uint64_t>(t1.globalIndex()) ^ splitmix64(static_cast<uint64_t>(t2.globalIndex())) ^ splitmix64(static_cast<uint64_t>(curColIdx))});
32883291
++pendingAdded;
32893292
}
3290-
if (doMixLeg2 && nFill2 == 0 && hasPendingSpace()) {
3293+
if (doMixLeg2 && nFill2 < (cfgV6MinMatches.value > 0 ? cfgV6MinMatches.value : 1) && hasPendingSpace()) {
32913294
v6Pending.data.push_back({storeV6Candidate(t2, curColIdx), storeV6Candidate(t1, curColIdx), colBin, 2, 0,
32923295
static_cast<uint64_t>(t2.globalIndex()) ^ splitmix64(static_cast<uint64_t>(t1.globalIndex())) ^ splitmix64(static_cast<uint64_t>(curColIdx))});
32933296
++pendingAdded;
@@ -3296,9 +3299,23 @@ struct lambdaspincorrderived {
32963299
histos.fill(HIST("hNMEperSE_leg2"), nFill2);
32973300
histos.fill(HIST("hNMEperSE_leg1"), nFill1);
32983301

3302+
// Reject branches with fewer accepted mixed pairs than required.
3303+
if (cfgV6MinMatches.value > 0) {
3304+
if (nFill1 < cfgV6MinMatches.value) {
3305+
nFill1 = 0;
3306+
}
3307+
if (nFill2 < cfgV6MinMatches.value) {
3308+
nFill2 = 0;
3309+
}
3310+
}
3311+
32993312
if (nFill1 <= 0 && nFill2 <= 0) {
33003313
continue;
33013314
}
3315+
3316+
histos.fill(HIST("hNMEperSE_leg2_aftercut"), nFill2);
3317+
histos.fill(HIST("hNMEperSE_leg1_aftercut"), nFill1);
3318+
33023319
// Residual-weight QA needs a leg-specific normalization:
33033320
// TGT_leg is filled once per same-event target candidate with weight 1.
33043321
// REP_leg is the average replacement distribution for that same target.
@@ -3423,7 +3440,7 @@ struct lambdaspincorrderived {
34233440
pendingAtStart, pendingMatched, pendingExpired, pendingAdded, v6Pending.data.size());
34243441
}
34253442
}
3426-
PROCESS_SWITCH(lambdaspincorrderived, processMEV6, "Process data ME v6 with radius buffer", false);
3443+
PROCESS_SWITCH(lambdaspincorrderived, processMEV6, "Process data ME v6 with radius buffer", true);
34273444

34283445
void processMEV6Sys(EventCandidates const& collisions, AllTrackCandidates const& V0s)
34293446
{

0 commit comments

Comments
 (0)