Skip to content

Commit 9256063

Browse files
authored
[PWGCF] fix logic issue in K0/Lambda selection/efficiency (#17039)
1 parent 059b496 commit 9256063

1 file changed

Lines changed: 32 additions & 27 deletions

File tree

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ struct FlowGenericFramework {
200200
O2_DEFINE_CONFIGURABLE(cfgGlobalT0ALowSigma, float, -3., "Number of sigma deviations below expected value in global vs T0A correlation");
201201
O2_DEFINE_CONFIGURABLE(cfgGlobalT0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs T0A correlation");
202202
} cfgMultCorrCuts;
203+
Configurable<LabeledArray<float>> nSigmas{"nSigmas", {LongArrayFloat.front().data(), 6, 3, {"pos_pi", "pos_ka", "pos_pr", "neg_pi", "neg_ka", "neg_pr"}, {"TPC", "TOF", "ITS"}}, "Labeled array for n-sigma values for TPC, TOF, ITS for pions, kaons, protons (positive and negative)"};
204+
Configurable<LabeledArray<float>> resonanceCuts{"resonanceCuts", {LongArrayFloat.front().data(), 14, 3, {"cos_PAs", "massMin", "massMax", "PosTrackPt", "NegTrackPt", "DCAPosToPVMin", "DCANegToPVMin", "DCAxDaughters", "Lifetime", "RadiusMin", "RadiusMax", "Rapidity", "ArmPodMin", "MassRejection"}, {"K0", "Lambda", "Phi"}}, "Labeled array (float) for various cuts on resonances"};
205+
Configurable<LabeledArray<int>> resonanceSwitches{"resonanceSwitches", {LongArrayInt.front().data(), 8, 3, {"UseParticle", "UseCosPA", "NMassBins", "UseDCAxDaughters", "UseProperLifetime", "UseV0Radius", "UseArmPodCut", "UseCompetingMassRejection"}, {"K0", "Lambda", "Phi"}}, "Labeled array (int) for various cuts on resonances"};
206+
203207
struct : ConfigurableGroup {
204-
Configurable<LabeledArray<float>> nSigmas{"nSigmas", {LongArrayFloat.front().data(), 6, 3, {"pos_pi", "pos_ka", "pos_pr", "neg_pi", "neg_ka", "neg_pr"}, {"TPC", "TOF", "ITS"}}, "Labeled array for n-sigma values for TPC, TOF, ITS for pions, kaons, protons (positive and negative)"};
205-
Configurable<LabeledArray<float>> resonanceCuts{"resonanceCuts", {LongArrayFloat.front().data(), 14, 3, {"cos_PAs", "massMin", "massMax", "PosTrackPt", "NegTrackPt", "DCAPosToPVMin", "DCANegToPVMin", "DCAxDaughters", "Lifetime", "RadiusMin", "RadiusMax", "Rapidity", "ArmPodMin", "MassRejection"}, {"K0", "Lambda", "Phi"}}, "Labeled array (float) for various cuts on resonances"};
206-
Configurable<LabeledArray<int>> resonanceSwitches{"resonanceSwitches", {LongArrayInt.front().data(), 8, 3, {"UseParticle", "UseCosPA", "NMassBins", "UseDCAxDaughters", "UseProperLifetime", "UseV0Radius", "UseArmPodCut", "UseCompetingMassRejection"}, {"K0", "Lambda", "Phi"}}, "Labeled array (int) for various cuts on resonances"};
207208
O2_DEFINE_CONFIGURABLE(cfgUseLsPhi, bool, true, "Use LikeSign for Phi v2")
208209
O2_DEFINE_CONFIGURABLE(cfgUseOnlyTPC, bool, true, "Use only TPC PID for daughter selection")
209210
O2_DEFINE_CONFIGURABLE(cfgFakeKaonCut, float, 0.1f, "Maximum difference in measured momentum and TPC inner ring momentum of particle")
@@ -553,9 +554,9 @@ struct FlowGenericFramework {
553554
gfwMemberCache.multGlobalV0ACutPars = cfgMultCorrCuts.cfgMultGlobalV0ACutPars;
554555
gfwMemberCache.multGlobalT0ACutPars = cfgMultCorrCuts.cfgMultGlobalT0ACutPars;
555556

556-
projectMatrix(cfgPIDCuts.nSigmas->getData(), tpcNsigmaCut, tofNsigmaCut, itsNsigmaCut);
557-
readMatrix(cfgPIDCuts.resonanceCuts->getData(), resoCutVals);
558-
readMatrix(cfgPIDCuts.resonanceSwitches->getData(), resoSwitchVals);
557+
projectMatrix(nSigmas->getData(), tpcNsigmaCut, tofNsigmaCut, itsNsigmaCut);
558+
readMatrix(resonanceCuts->getData(), resoCutVals);
559+
readMatrix(resonanceSwitches->getData(), resoSwitchVals);
559560
printResoCuts();
560561

561562
const auto& ptPtGaps = cfgPtPtGaps->getData();
@@ -608,8 +609,10 @@ struct FlowGenericFramework {
608609
AxisSpec v0aAxis = {1800, 0, 180000, "N_{ch} (V0A)"};
609610
AxisSpec multpvAxis = {3500, 0, 3500, "N_{ch} (PV)"};
610611
AxisSpec occAxis = {500, 0, 5000, "occupancy"};
611-
AxisSpec multAxis = (doprocessOnTheFly && !cfgUseNch) ? bAxis : (cfgUseNch) ? nchAxis
612-
: centAxis;
612+
AxisSpec multAxis = (doprocessOnTheFly) ? bAxis : centAxis;
613+
if (cfgUseNch) {
614+
multAxis = nchAxis;
615+
}
613616
AxisSpec dcaZAXis = {200, -2, 2, "DCA_{z} (cm)"};
614617
AxisSpec dcaXYAXis = {200, -1, 1, "DCA_{xy} (cm)"};
615618
AxisSpec singleCount = {1, 0, 1};
@@ -1000,21 +1003,21 @@ struct FlowGenericFramework {
10001003
nSigmaVals[i][1] = tofNsigmaCut[i]; // TOF
10011004
nSigmaVals[i][2] = itsNsigmaCut[i]; // ITS
10021005
}
1003-
printTable(cfgPIDCuts.nSigmas.value, nSigmaVals, "nSigma PID Cuts");
1006+
printTable(nSigmas.value, nSigmaVals, "nSigma PID Cuts");
10041007

10051008
// ----- Resonance Cuts -----
10061009
std::vector<std::vector<float>> resoCutsVals(resoCutVals.size());
10071010
for (size_t r = 0; r < resoCutVals.size(); ++r) {
10081011
resoCutsVals[r] = std::vector<float>(resoCutVals[r].begin(), resoCutVals[r].end());
10091012
}
1010-
printTable(cfgPIDCuts.resonanceCuts.value, resoCutsVals, "Resonance Cuts");
1013+
printTable(resonanceCuts.value, resoCutsVals, "Resonance Cuts");
10111014

10121015
// ----- Resonance Switches -----
10131016
std::vector<std::vector<float>> resoSwitchValsF(resoSwitchVals.size());
10141017
for (size_t r = 0; r < resoSwitchVals.size(); ++r) {
10151018
resoSwitchValsF[r] = std::vector<float>(resoSwitchVals[r].begin(), resoSwitchVals[r].end());
10161019
}
1017-
printTable(cfgPIDCuts.resonanceSwitches.value, resoSwitchValsF, "Resonance Switches");
1020+
printTable(resonanceSwitches.value, resoSwitchValsF, "Resonance Switches");
10181021
}
10191022
enum QAFillTime {
10201023
Before,
@@ -1086,7 +1089,7 @@ struct FlowGenericFramework {
10861089
if (cfg.mEfficiency == nullptr) {
10871090
LOGF(fatal, "Could not load efficiency histogram from %s", cfgEfficiency.cfgEfficiencyPath.value.c_str());
10881091
}
1089-
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.cfgEfficiencyPath.value.c_str(), (void*)cfg.mEfficiency);
1092+
LOGF(info, "Loaded efficiency histogram from %s", cfgEfficiency.cfgEfficiencyPath.value.c_str());
10901093
} else {
10911094
std::vector<std::string> species = {"ch", "pi", "ka", "pr", "k0", "lambda"};
10921095
for (const auto& sp : species) {
@@ -2298,12 +2301,12 @@ struct FlowGenericFramework {
22982301
return selection;
22992302
}
23002303
registryQA.fill(HIST("K0/hK0Count"), FillDaughterPt);
2301-
if (massK0s < resoCutVals[MassMin][K0] && massK0s > resoCutVals[MassMax][K0]) {
2304+
if (massK0s < resoCutVals[MassMin][K0] || massK0s > resoCutVals[MassMax][K0]) {
23022305
return selection;
23032306
}
23042307
registryQA.fill(HIST("K0/hK0Count"), FillMassCut);
23052308
// Rapidity correction
2306-
if (v0.yK0Short() > resoCutVals[Rapidity][K0]) {
2309+
if (std::abs(v0.yK0Short()) > resoCutVals[Rapidity][K0]) {
23072310
return selection;
23082311
}
23092312
registryQA.fill(HIST("K0/hK0Count"), FillRapidityCut);
@@ -2387,7 +2390,7 @@ struct FlowGenericFramework {
23872390
registryQA.fill(HIST("Lambda/hLambdaCount"), FillMassCut);
23882391

23892392
// Rapidity correction
2390-
if (v0.yLambda() > resoCutVals[Rapidity][Lambda]) {
2393+
if (std::abs(v0.yLambda()) > resoCutVals[Rapidity][Lambda]) {
23912394
return selection;
23922395
}
23932396
registryQA.fill(HIST("Lambda/hLambdaCount"), FillRapidityCut);
@@ -3002,6 +3005,11 @@ struct FlowGenericFramework {
30023005
return;
30033006
}
30043007
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencyMotherRapidity);
3008+
auto selection = selectK0(collision, v0, tracks);
3009+
if (!selection.selected) {
3010+
return;
3011+
}
3012+
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencySelection);
30053013
if (!areGeneratedDaughtersWithinEfficiencyEtaAcceptance(posMother)) {
30063014
return;
30073015
}
@@ -3010,12 +3018,8 @@ struct FlowGenericFramework {
30103018
return;
30113019
}
30123020
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencyRecoDaughterEta);
3013-
auto selection = selectK0(collision, v0, tracks);
3014-
if (selection.selected) {
3015-
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencySelection);
3016-
registry.fill(HIST("Efficiency/efficiencyHist"), posMother.pt(), centrality, EfficiencyK0, EfficiencyReconstructed);
3017-
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencyFilled);
3018-
}
3021+
registry.fill(HIST("Efficiency/efficiencyHist"), posMother.pt(), centrality, EfficiencyK0, EfficiencyReconstructed);
3022+
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyK0, V0EfficiencyFilled);
30193023
return;
30203024
}
30213025

@@ -3026,6 +3030,11 @@ struct FlowGenericFramework {
30263030
return;
30273031
}
30283032
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencyMotherRapidity);
3033+
auto selection = selectLambda(collision, v0, tracks);
3034+
if (!selection.selected) {
3035+
return;
3036+
}
3037+
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencySelection);
30293038
if (!areGeneratedDaughtersWithinEfficiencyEtaAcceptance(posMother)) {
30303039
return;
30313040
}
@@ -3034,12 +3043,8 @@ struct FlowGenericFramework {
30343043
return;
30353044
}
30363045
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencyRecoDaughterEta);
3037-
auto selection = selectLambda(collision, v0, tracks);
3038-
if (selection.selected) {
3039-
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencySelection);
3040-
registry.fill(HIST("Efficiency/efficiencyHist"), posMother.pt(), centrality, EfficiencyLambda, EfficiencyReconstructed);
3041-
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencyFilled);
3042-
}
3046+
registry.fill(HIST("Efficiency/efficiencyHist"), posMother.pt(), centrality, EfficiencyLambda, EfficiencyReconstructed);
3047+
fillV0EfficiencyRecoDebug(posMother.pt(), centrality, EfficiencyLambda, V0EfficiencyFilled);
30433048
return;
30443049
}
30453050
}

0 commit comments

Comments
 (0)