Skip to content

Commit 3ae08a7

Browse files
cterrevoalibuild
andauthored
[PWGHF] fix bug in Selector, and tune axis in task (#9926)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent dc5cfa0 commit 3ae08a7

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

PWGHF/D2H/Tasks/taskXic.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ struct HfTaskXic {
7777
"registry", // histo not in pt bins
7878
{
7979
{"Data/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, // pt Xic
80-
{"Data/hEta", "3-prong candidates;candidate #it{eta};entries", {HistType::kTH1D, {{100, -5., 5.}}}}, // eta Xic
80+
{"Data/hEta", "3-prong candidates;candidate #it{eta};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, // eta Xic
8181
{"Data/hPhi", "3-prong candidates;candidate #varphi;entries", {HistType::kTH1D, {{72, 0., constants::math::TwoPI}}}}, // phi Xic
82-
{"Data/hMass", "3-prong candidates; inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 2.18, 2.58}}}}, // mass Xic
82+
{"Data/hMass", "3-prong candidates; inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 1.98, 2.58}}}}, // mass Xic
8383
{"Data/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1D, {{1000, 0., 1000.}}}},
8484
{"MC/generated/signal/hPtGenSig", "3-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}},
8585
{"MC/generated/signal/hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}},

PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ struct HfCandidateSelectorXicToPKPi {
7373
Configurable<std::vector<std::string>> onnxFileNames{"onnxFileNames", std::vector<std::string>{"ModelHandler_onnx_XicToPKPi.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"};
7474
Configurable<int64_t> timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"};
7575
Configurable<bool> loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"};
76+
// QA switch
77+
Configurable<bool> activateQA{"activateQA", true, "Flag to enable QA histogram"};
78+
79+
HistogramRegistry registry{"registry"};
7680

7781
o2::analysis::HfMlResponseXicToPKPi<float> hfMlResponse;
7882
std::vector<float> outputMlXicToPKPi = {};
@@ -96,6 +100,21 @@ struct HfCandidateSelectorXicToPKPi {
96100
selectorKaon = selectorPion;
97101
selectorProton = selectorPion;
98102

103+
if (activateQA) {
104+
constexpr int kNBinsSelections = 1 + aod::SelectionStep::NSelectionSteps;
105+
std::string labels[kNBinsSelections];
106+
labels[0] = "No selection";
107+
labels[1 + aod::SelectionStep::RecoSkims] = "Skims selection";
108+
labels[1 + aod::SelectionStep::RecoTopol] = "Skims & Topological selections";
109+
labels[1 + aod::SelectionStep::RecoPID] = "Skims & Topological & PID selections";
110+
labels[1 + aod::SelectionStep::RecoMl] = "ML selection";
111+
static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""};
112+
registry.add("hSelections", "Selections;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSelections, {(std::vector<double>)binsPt, "#it{p}_{T} (GeV/#it{c})"}}});
113+
for (int iBin = 0; iBin < kNBinsSelections; ++iBin) {
114+
registry.get<TH2>(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data());
115+
}
116+
}
117+
99118
if (applyMl) {
100119
hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl);
101120
if (loadModelsFromCCDB) {
@@ -216,18 +235,24 @@ struct HfCandidateSelectorXicToPKPi {
216235
outputMlXicToPKPi.clear();
217236
outputMlXicToPiKP.clear();
218237

238+
auto ptCand = candidate.pt();
239+
219240
if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::XicToPKPi)) {
220241
hfSelXicToPKPiCandidate(statusXicToPKPi, statusXicToPiKP);
221242
if (applyMl) {
222243
hfMlXicToPKPiCandidate(outputMlXicToPKPi, outputMlXicToPiKP);
223244
}
245+
if (activateQA) {
246+
registry.fill(HIST("hSelections"), 1, ptCand);
247+
}
224248
continue;
225249
}
250+
if (activateQA) {
251+
registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoSkims, ptCand);
252+
}
226253
SETBIT(statusXicToPKPi, aod::SelectionStep::RecoSkims);
227254
SETBIT(statusXicToPiKP, aod::SelectionStep::RecoSkims);
228255

229-
auto ptCand = candidate.pt();
230-
231256
auto trackPos1 = candidate.prong0_as<TracksSel>(); // positive daughter (negative for the antiparticles)
232257
auto trackNeg = candidate.prong1_as<TracksSel>(); // negative daughter (positive for the antiparticles)
233258
auto trackPos2 = candidate.prong2_as<TracksSel>(); // positive daughter (negative for the antiparticles)
@@ -262,6 +287,10 @@ struct HfCandidateSelectorXicToPKPi {
262287
SETBIT(statusXicToPiKP, aod::SelectionStep::RecoTopol);
263288
}
264289

290+
if (activateQA) {
291+
registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoTopol, candidate.pt());
292+
}
293+
265294
auto pidXicToPKPi = -1;
266295
auto pidXicToPiKP = -1;
267296

@@ -277,6 +306,7 @@ struct HfCandidateSelectorXicToPKPi {
277306
TrackSelectorPID::Status pidTrackPos2Pion = TrackSelectorPID::Accepted;
278307
TrackSelectorPID::Status pidTrackNegKaon = TrackSelectorPID::Accepted;
279308
if (usePidTpcAndTof) {
309+
280310
pidTrackPos1Proton = selectorProton.statusTpcAndTof(trackPos1);
281311
pidTrackPos2Proton = selectorProton.statusTpcAndTof(trackPos2);
282312
pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1);
@@ -324,6 +354,9 @@ struct HfCandidateSelectorXicToPKPi {
324354
if ((pidXicToPiKP == -1 || pidXicToPiKP == 1) && topolXicToPiKP) {
325355
SETBIT(statusXicToPiKP, aod::SelectionStep::RecoPID);
326356
}
357+
if (activateQA) {
358+
registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoPID, candidate.pt());
359+
}
327360

328361
if (applyMl) {
329362
// ML selections
@@ -350,7 +383,10 @@ struct HfCandidateSelectorXicToPKPi {
350383
SETBIT(statusXicToPKPi, aod::SelectionStep::RecoMl);
351384
}
352385
if (isSelectedMlXicToPiKP) {
353-
SETBIT(statusXicToPKPi, aod::SelectionStep::RecoMl);
386+
SETBIT(statusXicToPiKP, aod::SelectionStep::RecoMl);
387+
}
388+
if (activateQA) {
389+
registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoMl, candidate.pt());
354390
}
355391
}
356392

0 commit comments

Comments
 (0)