Skip to content

Commit 5bc5c26

Browse files
authored
[PWGLF] Safeguard check on efficiencies and polished selection of phi's daughter track and pion track candidates (#11963)
1 parent 41103b3 commit 5bc5c26

File tree

1 file changed

+52
-31
lines changed

1 file changed

+52
-31
lines changed

PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct Phik0shortanalysis {
9191
// Configurables for track selection (not necessarily common for trigger and the two associated particles)
9292
struct : ConfigurableGroup {
9393
Configurable<float> cfgCutCharge{"cfgCutCharge", 0.0f, "Cut on charge"};
94-
Configurable<bool> cfgPrimaryTrack{"cfgPrimaryTrack", false, "Primary track selection"};
9594
Configurable<bool> cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"};
9695
Configurable<bool> cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"};
9796
Configurable<float> cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"};
@@ -115,9 +114,9 @@ struct Phik0shortanalysis {
115114
Configurable<float> nSigmaCutCombinedKa{"nSigmaCutCombinedKa", 3.0f, "Value of the TOF Nsigma cut for Kaons"};
116115

117116
Configurable<float> nSigmaCutTPCPion{"nSigmaCutTPCPion", 4.0f, "Value of the TPC Nsigma cut for Pions"};
118-
Configurable<float> cMinPionPtcut{"cMinPionPtcut", 0.3f, "Track minimum pt cut"};
117+
Configurable<float> cMinPionPtcut{"cMinPionPtcut", 0.2f, "Track minimum pt cut"};
119118
Configurable<int> minTPCnClsFound{"minTPCnClsFound", 70, "min number of found TPC clusters"};
120-
Configurable<int> minNCrossedRowsTPC{"minNCrossedRowsTPC", 80, "min number of TPC crossed rows"};
119+
Configurable<int> minNCrossedRowsTPC{"minNCrossedRowsTPC", 70, "min number of TPC crossed rows"};
121120
Configurable<float> maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"};
122121
Configurable<int> minITSnCls{"minITSnCls", 4, "min number of ITS clusters"};
123122
Configurable<float> maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"};
@@ -724,10 +723,8 @@ struct Phik0shortanalysis {
724723

725724
// Topological track selection
726725
template <bool isMC, typename T>
727-
bool selectionTrackResonance(const T& track, bool isQA)
726+
bool selectionTrackResonance(const T& track, bool doQA)
728727
{
729-
if (trackConfigs.cfgPrimaryTrack && !track.isPrimaryTrack())
730-
return false;
731728
if (trackConfigs.cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA())
732729
return false;
733730
if (trackConfigs.cfgPVContributor && !track.isPVContributor())
@@ -738,10 +735,8 @@ struct Phik0shortanalysis {
738735

739736
if (track.pt() < trackConfigs.cMinKaonPtcut)
740737
return false;
741-
if (std::abs(track.eta()) > trackConfigs.etaMax)
742-
return false;
743738

744-
if (isQA) {
739+
if (doQA) {
745740
if constexpr (!isMC) {
746741
dataPhiHist.fill(HIST("h2DauTracksPhiDCAxyPreCutData"), track.pt(), track.dcaXY());
747742
dataPhiHist.fill(HIST("h2DauTracksPhiDCAzPreCutData"), track.pt(), track.dcaZ());
@@ -752,7 +747,7 @@ struct Phik0shortanalysis {
752747
}
753748
if (std::abs(track.dcaXY()) > trackConfigs.cMaxDCArToPV1Phi + (trackConfigs.cMaxDCArToPV2Phi / std::pow(track.pt(), trackConfigs.cMaxDCArToPV3Phi)))
754749
return false;
755-
if (isQA) {
750+
if (doQA) {
756751
if constexpr (!isMC) {
757752
dataPhiHist.fill(HIST("h2DauTracksPhiDCAxyPostCutData"), track.pt(), track.dcaXY());
758753
dataPhiHist.fill(HIST("h2DauTracksPhiDCAzPostCutData"), track.pt(), track.dcaZ());
@@ -802,35 +797,25 @@ struct Phik0shortanalysis {
802797

803798
// Topological selection for pions
804799
template <bool isTOFChecked, bool isMC, typename T>
805-
bool selectionPion(const T& track, bool isQA)
800+
bool selectionPion(const T& track, bool doQA)
806801
{
807-
if (!track.hasITS())
808-
return false;
809-
if (track.itsNCls() < trackConfigs.minITSnCls)
810-
return false;
811-
if (track.itsChi2NCl() > trackConfigs.maxChi2ITS)
802+
if (!track.isGlobalTrackWoDCA())
812803
return false;
813804

814-
if (!track.hasTPC())
805+
if (track.itsNCls() < trackConfigs.minITSnCls)
815806
return false;
816807
if (track.tpcNClsFound() < trackConfigs.minTPCnClsFound)
817808
return false;
818-
if (track.tpcNClsCrossedRows() < trackConfigs.minNCrossedRowsTPC)
819-
return false;
820-
if (track.tpcChi2NCl() > trackConfigs.maxChi2TPC)
821-
return false;
822809

823810
if (track.pt() < trackConfigs.cMinPionPtcut)
824811
return false;
825-
if (std::abs(track.eta()) > trackConfigs.etaMax)
826-
return false;
827812

828813
if constexpr (isTOFChecked) {
829814
if (track.pt() >= trackConfigs.pTToUseTOF && !track.hasTOF())
830815
return false;
831816
}
832817

833-
if (isQA) {
818+
if (doQA) {
834819
if constexpr (!isMC) {
835820
dataPionHist.fill(HIST("h2TracksPiDCAxyPreCutData"), track.pt(), track.dcaXY());
836821
dataPionHist.fill(HIST("h2TracksPiDCAzPreCutData"), track.pt(), track.dcaZ());
@@ -841,7 +826,7 @@ struct Phik0shortanalysis {
841826
}
842827
if (std::abs(track.dcaXY()) > trackConfigs.cMaxDCArToPV1Pion + (trackConfigs.cMaxDCArToPV2Pion / std::pow(track.pt(), trackConfigs.cMaxDCArToPV3Pion)))
843828
return false;
844-
if (isQA) {
829+
if (doQA) {
845830
if constexpr (!isMC) {
846831
dataPionHist.fill(HIST("h2TracksPiDCAxyPostCutData"), track.pt(), track.dcaXY());
847832
dataPionHist.fill(HIST("h2TracksPiDCAzPostCutData"), track.pt(), track.dcaZ());
@@ -2515,7 +2500,13 @@ struct Phik0shortanalysis {
25152500
isCountedPhi = true;
25162501
}
25172502

2518-
float weightPhi = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity())) : 1.0f;
2503+
float efficiencyPhi = 1.0f;
2504+
if (applyEfficiency) {
2505+
efficiencyPhi = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity());
2506+
if (efficiencyPhi == 0)
2507+
efficiencyPhi = 1.0f;
2508+
}
2509+
float weightPhi = applyEfficiency ? 1.0f / efficiencyPhi : 1.0f;
25192510
dataPhiHist.fill(HIST("h3PhiDataNewProc"), multiplicity, recPhi.Pt(), recPhi.M(), weightPhi);
25202511

25212512
// V0 already reconstructed by the builder
@@ -2543,7 +2534,13 @@ struct Phik0shortanalysis {
25432534
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
25442535
continue;
25452536

2546-
float weightPhiK0S = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(multiplicity, v0.pt(), v0.yK0Short())) : 1.0f;
2537+
float efficiencyPhiK0S = 1.0f;
2538+
if (applyEfficiency) {
2539+
efficiencyPhiK0S = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(multiplicity, v0.pt(), v0.yK0Short());
2540+
if (efficiencyPhiK0S == 0)
2541+
efficiencyPhiK0S = 1.0f;
2542+
}
2543+
float weightPhiK0S = applyEfficiency ? 1.0f / efficiencyPhiK0S : 1.0f;
25472544
dataPhiK0SHist.fill(HIST("h5PhiK0SDataNewProc"), v0.yK0Short() - recPhi.Rapidity(), multiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), weightPhiK0S);
25482545
}
25492546

@@ -2559,7 +2556,13 @@ struct Phik0shortanalysis {
25592556

25602557
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
25612558

2562-
float weightPhiPion = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(multiplicity, track.pt(), track.rapidity(massPi))) : 1.0f;
2559+
float efficiencyPhiPion = 1.0f;
2560+
if (applyEfficiency) {
2561+
efficiencyPhiPion = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(multiplicity, track.pt(), track.rapidity(massPi));
2562+
if (efficiencyPhiPion == 0)
2563+
efficiencyPhiPion = 1.0f;
2564+
}
2565+
float weightPhiPion = applyEfficiency ? 1.0f / efficiencyPhiPion : 1.0f;
25632566
dataPhiPionHist.fill(HIST("h6PhiPiDataNewProc"), track.rapidity(massPi) - recPhi.Rapidity(), multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), weightPhiPion);
25642567
}
25652568
}
@@ -2615,7 +2618,13 @@ struct Phik0shortanalysis {
26152618
isCountedPhi = true;
26162619
}
26172620

2618-
float weightPhi = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity())) : 1.0f;
2621+
float efficiencyPhi = 1.0f;
2622+
if (applyEfficiency) {
2623+
efficiencyPhi = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity());
2624+
if (efficiencyPhi == 0)
2625+
efficiencyPhi = 1.0f;
2626+
}
2627+
float weightPhi = applyEfficiency ? 1.0f / efficiencyPhi : 1.0f;
26192628
closureMCPhiHist.fill(HIST("h3PhiMCClosureNewProc"), genmultiplicity, recPhi.Pt(), recPhi.M(), weightPhi);
26202629

26212630
// V0 already reconstructed by the builder
@@ -2639,7 +2648,13 @@ struct Phik0shortanalysis {
26392648
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
26402649
continue;
26412650

2642-
float weightPhiK0S = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(genmultiplicity, v0.pt(), v0.yK0Short())) : 1.0f;
2651+
float efficiencyPhiK0S = 1.0f;
2652+
if (applyEfficiency) {
2653+
efficiencyPhiK0S = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(genmultiplicity, v0.pt(), v0.yK0Short());
2654+
if (efficiencyPhiK0S == 0)
2655+
efficiencyPhiK0S = 1.0f;
2656+
}
2657+
float weightPhiK0S = applyEfficiency ? 1.0f / efficiencyPhiK0S : 1.0f;
26432658
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosureNewProc"), v0.yK0Short() - recPhi.Rapidity(), genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), weightPhiK0S);
26442659
}
26452660

@@ -2661,7 +2676,13 @@ struct Phik0shortanalysis {
26612676

26622677
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
26632678

2664-
float weightPhiPion = applyEfficiency ? 1.0f / (effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(genmultiplicity, track.pt(), track.rapidity(massPi))) : 1.0f;
2679+
float efficiencyPhiPion = 1.0f;
2680+
if (applyEfficiency) {
2681+
efficiencyPhiPion = effMapPhi->Interpolate(genmultiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPion->Interpolate(genmultiplicity, track.pt(), track.rapidity(massPi));
2682+
if (efficiencyPhiPion == 0)
2683+
efficiencyPhiPion = 1.0f;
2684+
}
2685+
float weightPhiPion = applyEfficiency ? 1.0f / efficiencyPhiPion : 1.0f;
26652686
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosureNewProc"), track.rapidity(massPi) - recPhi.Rapidity(), genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), weightPhiPion);
26662687
}
26672688
}

0 commit comments

Comments
 (0)