Skip to content

Commit fdd0590

Browse files
committed
Update kin+topo selection and counter histogram
1 parent 4a17e60 commit fdd0590

File tree

2 files changed

+117
-90
lines changed

2 files changed

+117
-90
lines changed

PWGHF/Core/SelectorCuts.h

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,8 @@ static const std::vector<std::string> labelsCutVar = {"m", "pT p", "pT K", "pT P
753753

754754
namespace hf_cuts_xic_to_xi_pi_pi
755755
{
756-
static constexpr int NBinsPt = 10;
757-
static constexpr int NCutVars = 12;
756+
static constexpr int NBinsPt = 13;
757+
static constexpr int NCutVars = 11;
758758
// default values for the pT bin edges (can be used to configure histogram axis)
759759
// offset by 1 from the bin numbers in cuts array
760760
constexpr double BinsPt[NBinsPt + 1] = {
@@ -765,23 +765,29 @@ constexpr double BinsPt[NBinsPt + 1] = {
765765
4.,
766766
5.,
767767
6.,
768+
7.,
768769
8.,
770+
9.,
771+
10.,
772+
11.,
769773
12.,
770-
24.,
771-
36.};
774+
20.};
772775
auto vecBinsPt = std::vector<double>{BinsPt, BinsPt + NBinsPt + 1};
773776

774-
// default values for the cuts m ptXi ptPi0 ptPi1 chi2PCA dL dLXY cosp cospXY impParXY Xi Pi0 Pi1
775-
constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 0 < pT < 1 */
776-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 1 < pT < 2 */
777-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 2 < pT < 3 */
778-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 3 < pT < 4 */
779-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 4 < pT < 5 */
780-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 5 < pT < 6 */
781-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 6 < pT < 8 */
782-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 8 < pT < 10 */
783-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}, /* 12 < pT < 24 */
784-
{0.4, 0.4, 0.4, 0.4, 1e-5, 0.5, 0.5, 0.9, 0.9, 0.1, 0.1, 0.1}}; /* 24 < pT < 36 */
777+
// default values for the cuts m Y Eta EtaDau ptPi0 ptPi1 chi2SV dL dLXY invMass Xi-Pi pairs
778+
constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 0 < pT < 1 */
779+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 1 < pT < 2 */
780+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 2 < pT < 3 */
781+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 3 < pT < 4 */
782+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 4 < pT < 5 */
783+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 5 < pT < 6 */
784+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 6 < pT < 7 */
785+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 7 < pT < 8 */
786+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 8 < pT < 9 */
787+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 9 < pT < 10 */
788+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 10 < pT < 11 */
789+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}, /* 11 < pT < 12 */
790+
{0.4, 0.8, 0.8, 0.8, 0.4, 0.4, 100, 0.5, 0.5, 2.4, 2.4}}; /* 12 < pT < 20 */
785791

786792
// row labels
787793
static const std::vector<std::string> labelsPt = {
@@ -794,10 +800,13 @@ static const std::vector<std::string> labelsPt = {
794800
"pT bin 6",
795801
"pT bin 7",
796802
"pT bin 8",
797-
"pT bin 9"};
803+
"pT bin 9",
804+
"pT bin 10",
805+
"pT bin 11",
806+
"pT bin 12"};
798807

799808
// column labels
800-
static const std::vector<std::string> labelsCutVar = {"m", "pT Xi", "pT Pi0", "pT Pi1", "chi2PCA", "max decay length", "max decay length XY", "cos pointing angle", "cos pointing angle XY", "max impParXY Xi", "max impParXY Pi0", "max impParXY Pi1"};
809+
static const std::vector<std::string> labelsCutVar = {"m", "y", "eta", "eta Daughters", "pT Pi0", "pT Pi1", "chi2SV", "min decay length", "min decay length XY", "max inv mass Xi-Pi0", "max inv mass Xi-Pi1"};
801810
} // namespace hf_cuts_xic_to_xi_pi_pi
802811

803812
namespace hf_cuts_xicc_to_p_k_pi_pi

PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx

Lines changed: 91 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include "Common/Core/TrackSelectorPID.h"
2525

26+
#include "CommonConstants/PhysicsConstants.h"
2627
#include "Framework/AnalysisTask.h"
2728
#include "Framework/runDataProcessing.h"
2829

@@ -38,13 +39,9 @@ struct HfCandidateSelectorXicToXiPiPi {
3839
Produces<aod::HfSelXicToXiPiPi> hfSelXicToXiPiPiCandidate;
3940
Produces<aod::HfMlXicToXiPiPi> hfMlXicToXiPiPiCandidate;
4041

41-
Configurable<float> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
42-
Configurable<float> ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"};
43-
// topological cuts
4442
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_xic_to_xi_pi_pi::vecBinsPt}, "pT bin limits"};
4543
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_xic_to_xi_pi_pi::Cuts[0], hf_cuts_xic_to_xi_pi_pi::NBinsPt, hf_cuts_xic_to_xi_pi_pi::NCutVars, hf_cuts_xic_to_xi_pi_pi::labelsPt, hf_cuts_xic_to_xi_pi_pi::labelsCutVar}, "Xicplus candidate selection per pT bin"};
46-
// QA switch
47-
Configurable<bool> activateQA{"activateQA", false, "Flag to enable QA histogram"};
44+
Configurable<bool> fillHistogram{"fillHistogram", false, "Flag to filling of counter histogram"};
4845
// Enable PID
4946
Configurable<bool> usePid{"usePid", true, "Switch for PID selection at track level"};
5047
Configurable<bool> useTpcPidOnly{"useTpcPidOnly", false, "Switch to use TPC PID only instead of TPC OR TOF)"};
@@ -77,6 +74,18 @@ struct HfCandidateSelectorXicToXiPiPi {
7774
o2::ccdb::CcdbApi ccdbApi;
7875
TrackSelectorPi selectorPion;
7976
TrackSelectorPr selectorProton;
77+
enum XicSelCriteria { All = 0,
78+
Pt,
79+
Mass,
80+
Rapidity,
81+
Eta,
82+
EtaDaughters,
83+
PtPionFromXicPlus,
84+
Chi2SV,
85+
MinDecayLength,
86+
MaxInvMassXiPiPairs,
87+
PidSelected,
88+
BdtSelected };
8089

8190
using TracksPidWithSel = soa::Join<aod::TracksWExtra, aod::TracksPidPi, aod::TracksPidPr, aod::TrackSelection>;
8291

@@ -101,19 +110,20 @@ struct HfCandidateSelectorXicToXiPiPi {
101110
selectorProton.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax);
102111
}
103112

104-
if (activateQA) {
105-
constexpr int kNBinsSelections = 1 + SelectionStep::NSelectionSteps;
106-
std::string labels[kNBinsSelections];
107-
labels[0] = "No selection";
108-
labels[1 + SelectionStep::RecoSkims] = "Skims selection";
109-
labels[1 + SelectionStep::RecoTopol] = "Skims & Topological selections";
110-
labels[1 + SelectionStep::RecoPID] = "Skims & Topological & PID selections";
111-
labels[1 + SelectionStep::RecoMl] = "Skims & Topological & PID & ML selections";
112-
static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""};
113-
registry.add("hSelections", "Selections;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSelections, {(std::vector<double>)binsPt, "#it{p}_{T} (GeV/#it{c})"}}});
114-
for (int iBin = 0; iBin < kNBinsSelections; ++iBin) {
115-
registry.get<TH2>(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data());
116-
}
113+
if (fillHistogram) {
114+
registry.add("hSelCandidates", ";;entries", {HistType::kTH1F, {{11, -0.5, 10.5}}});
115+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + All, "All");
116+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + Pt, "#it{p}_{T}");
117+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + Mass, "#Delta M");
118+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + Rapidity, "y");
119+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + Eta, "#eta");
120+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + EtaDaughters, "#eta final state daughters");
121+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + PtPionFromXicPlus, "#it{p}_{T} (#pi #leftarrow #Xi_{c}^{+})");
122+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + Chi2SV, "#chi^{2}_{SV}");
123+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + MinDecayLength, "Decay length");
124+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + MaxInvMassXiPiPairs, "M_{#Xi #pi}");
125+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + PidSelected, "PID selection");
126+
registry.get<TH1>(HIST("hSelCandidates"))->GetXaxis()->SetBinLabel(1 + BdtSelected, "BDT selection");
117127
}
118128

119129
if (applyMl) {
@@ -133,62 +143,72 @@ struct HfCandidateSelectorXicToXiPiPi {
133143
/// \param candidate is candidate
134144
/// \return true if candidate passes all cuts
135145
template <typename T1>
136-
bool selectionTopol(const T1& hfCandXic)
146+
bool isSelectedXic(const T1& hfCandXic)
137147
{
138148
auto candpT = hfCandXic.pt();
139149
int pTBin = findBin(binsPt, candpT);
140150
if (pTBin == -1) {
141151
return false;
142152
}
143-
144-
// check that the candidate pT is within the analysis range
145-
if (candpT < ptCandMin || candpT >= ptCandMax) {
146-
return false;
153+
if (fillHistogram) {
154+
registry.fill(HIST("hSelCandidates"), Pt);
147155
}
148156

149-
// check candidate mass is within a defined mass window
157+
// check whether candidate mass is within a defined mass window
150158
if (std::abs(hfCandXic.invMassXicPlus() - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) {
151159
return false;
152160
}
153-
154-
// cosine of pointing angle
155-
if (hfCandXic.cpa() <= cuts->get(pTBin, "cos pointing angle")) {
156-
return false;
161+
if (fillHistogram) {
162+
registry.fill(HIST("hSelCandidates"), Mass);
157163
}
158164

159-
// cosine of pointing angle XY
160-
if (hfCandXic.cpaXY() <= cuts->get(pTBin, "cos pointing angle XY")) {
165+
// cut on candidate rapidity
166+
if (std::abs(hfCandXic.y(o2::constants::physics::MassXiCPlus)) > cuts->get(pTBin, "y")) {
161167
return false;
162168
}
169+
if (fillHistogram) {
170+
registry.fill(HIST("hSelCandidates"), Rapidity);
171+
}
163172

164-
// candidate maximum decay length
165-
if (hfCandXic.decayLength() > cuts->get(pTBin, "max decay length")) {
173+
// cut on candidate pseudorapidity
174+
if (std::abs(hfCandXic.eta()) > cuts->get(pTBin, "eta")) {
166175
return false;
167176
}
177+
if (fillHistogram) {
178+
registry.fill(HIST("hSelCandidates"), Eta);
179+
}
168180

169-
// candidate maximum decay length XY
170-
if (hfCandXic.decayLengthXY() > cuts->get(pTBin, "max decay length XY")) {
181+
// cut on pion pT
182+
if (hfCandXic.ptProng1() < cuts->get(pTBin, "pT Pi0") || hfCandXic.ptProng2() < cuts->get(pTBin, "pT Pi1")) {
171183
return false;
172184
}
185+
if (fillHistogram) {
186+
registry.fill(HIST("hSelCandidates"), PtPionFromXicPlus);
187+
}
173188

174-
// candidate chi2PC
175-
if (hfCandXic.chi2PCA() > cuts->get(pTBin, "chi2PCA")) {
189+
// cut on chi2 of secondary vertex
190+
if (hfCandXic.chi2PCA() > cuts->get(pTBin, "chi2SV")) {
176191
return false;
177192
}
193+
if (fillHistogram) {
194+
registry.fill(HIST("hSelCandidates"), Chi2SV);
195+
}
178196

179-
// maximum DCA of daughters
180-
if ((std::abs(hfCandXic.impactParameter0()) > cuts->get(pTBin, "max impParXY Xi")) ||
181-
(std::abs(hfCandXic.impactParameter1()) > cuts->get(pTBin, "max impParXY Pi0")) ||
182-
(std::abs(hfCandXic.impactParameter2()) > cuts->get(pTBin, "max impParXY Pi1"))) {
197+
// cut on candidate decay length
198+
if (hfCandXic.decayLength() < cuts->get(pTBin, "min decay length") || hfCandXic.decayLengthXY() < cuts->get(pTBin, "min decay length XY")) {
183199
return false;
184200
}
201+
if (fillHistogram) {
202+
registry.fill(HIST("hSelCandidates"), MinDecayLength);
203+
}
185204

186-
// cut on daughter pT
187-
if (hfCandXic.ptProng0() < cuts->get(pTBin, "pT Xi") ||
188-
hfCandXic.ptProng1() < cuts->get(pTBin, "pT Pi0") ||
189-
hfCandXic.ptProng2() < cuts->get(pTBin, "pT Pi1")) {
205+
// cut on invariant mass of Xi-pion pairs
206+
if (hfCandXic.invMassXiPi0() > cuts->get(pTBin, "max inv mass Xi-Pi0") || hfCandXic.invMassXiPi1() > cuts->get(pTBin, "max inv mass Xi-Pi1")) {
190207
return false;
191208
}
209+
if (fillHistogram) {
210+
registry.fill(HIST("hSelCandidates"), MaxInvMassXiPiPairs);
211+
}
192212

193213
return true;
194214
}
@@ -225,33 +245,25 @@ struct HfCandidateSelectorXicToXiPiPi {
225245
{
226246
for (const auto& hfCandXic : hfCandsXic) {
227247
int statusXicToXiPiPi = 0;
228-
229-
outputMlXicToXiPiPi.clear();
230-
231-
auto ptCandXic = hfCandXic.pt();
232-
233-
if (activateQA) {
234-
registry.fill(HIST("hSelections"), 1, ptCandXic);
248+
if (applyMl) {
249+
outputMlXicToXiPiPi.clear();
235250
}
236251

252+
// get candidate pT
253+
float ptCandXic = hfCandXic.pt();
254+
237255
// No hfflag -> by default skim selected
238256
SETBIT(statusXicToXiPiPi, SelectionStep::RecoSkims); // RecoSkims = 0 --> statusXicToXiPiPi = 1
239-
if (activateQA) {
240-
registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoSkims, ptCandXic);
241-
}
242257

243-
// topological cuts
244-
if (!selectionTopol(hfCandXic)) {
258+
// kinematic and topological selection
259+
if (!isSelectedXic(hfCandXic)) {
245260
hfSelXicToXiPiPiCandidate(statusXicToXiPiPi);
246261
if (applyMl) {
247262
hfMlXicToXiPiPiCandidate(outputMlXicToXiPiPi);
248263
}
249264
continue;
250265
}
251266
SETBIT(statusXicToXiPiPi, SelectionStep::RecoTopol); // RecoTopol = 1 --> statusXicToXiPiPi = 3
252-
if (activateQA) {
253-
registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoTopol, ptCandXic);
254-
}
255267

256268
// track-level PID selection
257269
if (usePid) {
@@ -275,17 +287,17 @@ struct HfCandidateSelectorXicToXiPiPi {
275287
}
276288

277289
if (useTpcPidOnly) {
278-
TrackSelectorPID::Status statusPidPi0 = selectorPion.statusTpc(trackPi0);
279-
TrackSelectorPID::Status statusPidPi1 = selectorPion.statusTpc(trackPi1);
280-
TrackSelectorPID::Status statusPidPiXi = selectorPion.statusTpc(trackPiFromXi);
281-
TrackSelectorPID::Status statusPidPrLam = selectorProton.statusTpc(trackPr);
282-
TrackSelectorPID::Status statusPidPiLam = selectorPion.statusTpc(trackPiFromLam);
290+
statusPidPi0 = selectorPion.statusTpc(trackPi0);
291+
statusPidPi1 = selectorPion.statusTpc(trackPi1);
292+
statusPidPiXi = selectorPion.statusTpc(trackPiFromXi);
293+
statusPidPrLam = selectorProton.statusTpc(trackPr);
294+
statusPidPiLam = selectorPion.statusTpc(trackPiFromLam);
283295
} else {
284-
TrackSelectorPID::Status statusPidPi0 = selectorPion.statusTpcOrTof(trackPi0);
285-
TrackSelectorPID::Status statusPidPi1 = selectorPion.statusTpcOrTof(trackPi1);
286-
TrackSelectorPID::Status statusPidPiXi = selectorPion.statusTpcOrTof(trackPiFromXi);
287-
TrackSelectorPID::Status statusPidPrLam = selectorProton.statusTpcOrTof(trackPr);
288-
TrackSelectorPID::Status statusPidPiLam = selectorPion.statusTpcOrTof(trackPiFromLam);
296+
statusPidPi0 = selectorPion.statusTpcOrTof(trackPi0);
297+
statusPidPi1 = selectorPion.statusTpcOrTof(trackPi1);
298+
statusPidPiXi = selectorPion.statusTpcOrTof(trackPiFromXi);
299+
statusPidPrLam = selectorProton.statusTpcOrTof(trackPr);
300+
statusPidPiLam = selectorPion.statusTpcOrTof(trackPiFromLam);
289301
}
290302

291303
if (!selectionPid(statusPidPi0, statusPidPi1, statusPidPiXi, statusPidPrLam, statusPidPiLam, useTpcPidOnly.value)) {
@@ -296,10 +308,13 @@ struct HfCandidateSelectorXicToXiPiPi {
296308
continue;
297309
}
298310
SETBIT(statusXicToXiPiPi, SelectionStep::RecoPID); // RecoPID = 2 --> statusXicToXiPiPi = 7
299-
if (activateQA) {
300-
registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoPID, ptCandXic);
311+
if (fillHistogram) {
312+
registry.fill(HIST("hSelCandidates"), PidSelected);
301313
}
302314
}
315+
if (!usePid && fillHistogram) {
316+
registry.fill(HIST("hSelCandidates"), PidSelected);
317+
}
303318

304319
// ML selection
305320
if (applyMl) {
@@ -315,10 +330,13 @@ struct HfCandidateSelectorXicToXiPiPi {
315330
continue;
316331
}
317332
SETBIT(statusXicToXiPiPi, aod::SelectionStep::RecoMl);
318-
if (activateQA) {
319-
registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoMl, ptCandXic);
333+
if (fillHistogram) {
334+
registry.fill(HIST("hSelCandidates"), BdtSelected);
320335
}
321336
}
337+
if (!applyMl && fillHistogram) {
338+
registry.fill(HIST("hSelCandidates"), BdtSelected);
339+
}
322340

323341
hfSelXicToXiPiPiCandidate(statusXicToXiPiPi);
324342
}

0 commit comments

Comments
 (0)