diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index b2ea1bb75b0..ae66c2a2e65 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -40,7 +40,6 @@ struct HfTaskLc { Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; // ThnSparse for ML outputScores and Vars Configurable enableTHn{"enableTHn", false, "enable THn for Lc"}; - Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {72, 0, 36}, ""}; ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {300, 1.98, 2.58}, ""}; ConfigurableAxis thnConfigAxisPtProng{"thnConfigAxisPtProng", {100, 0, 20}, ""}; @@ -53,18 +52,13 @@ struct HfTaskLc { ConfigurableAxis thnConfigAxisCanType{"thnConfigAxisCanType", {5, 0., 5.}, ""}; HfHelper hfHelper; + Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - using LcCandidates = soa::Join; - using LcCandidatesMl = soa::Join; + using LcCandidates = soa::Filtered>; + using LcCandidatesMl = soa::Filtered>; - using LcCandidatesMc = soa::Join; - using LcCandidatesMlMc = soa::Join; - - Partition selectedLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - Partition selectedLcCandidatesMl = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; - - Partition selectedLcCandidatesMc = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc; - Partition selectedLcCandidatesMcMl = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc; + using LcCandidatesMc = soa::Filtered>; + using LcCandidatesMlMc = soa::Filtered>; HistogramRegistry registry{ "registry", @@ -280,7 +274,7 @@ struct HfTaskLc { const AxisSpec thnAxisBdtScoreLcNonPrompt{thnConfigAxisBdtScoreSignal, "BDT non-prompt score (Lc)"}; const AxisSpec thnAxisCanType{thnConfigAxisCanType, "candidates type"}; - if (applyMl) { + if (doprocessDataWithMl || doprocessMcWithMl) { registry.add("hnLcVarsWithBdt", "THn for Lambdac candidates with BDT scores", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisMultiplicity, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisCanType}); } else { registry.add("hnLcVars", "THn for Lambdac candidates", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisMultiplicity, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisCanType}); @@ -288,7 +282,7 @@ struct HfTaskLc { } } - template + template void processData(aod::Collision const& collision, CandType const& candidates, aod::TracksWDca const& tracks) @@ -373,7 +367,7 @@ struct HfTaskLc { if (candidate.isSelLcToPKPi() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPKPi(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPKPi().size() == 3) { @@ -384,13 +378,13 @@ struct HfTaskLc { /// Fill the ML outputScores and variables of candidate registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, nTracks, outputBkg, outputPrompt, outputFD, 0); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, ptProng0, ptProng1, ptProng2, nTracks, chi2PCA, decayLength, decayLengthXY, cpa, cpaXY, outputBkg, outputFD, 0); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, nTracks, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, 0); } } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPiKP().size() == 3) { @@ -409,7 +403,7 @@ struct HfTaskLc { } void processDataStd(aod::Collision const& collision, - LcCandidates const&, + LcCandidates const& selectedLcCandidates, aod::TracksWDca const& tracks) { processData(collision, selectedLcCandidates, tracks); @@ -417,7 +411,7 @@ struct HfTaskLc { PROCESS_SWITCH(HfTaskLc, processDataStd, "Process Data with the standard method", true); void processDataWithMl(aod::Collision const& collision, - LcCandidatesMl const&, + LcCandidatesMl const& selectedLcCandidatesMl, aod::TracksWDca const& tracks) { processData(collision, selectedLcCandidatesMl, tracks); @@ -425,7 +419,7 @@ struct HfTaskLc { PROCESS_SWITCH(HfTaskLc, processDataWithMl, "Process Data with the ML method", false); /// Fills MC histograms. - template + template void processMc(CandType const& candidates, soa::Join const& mcParticles, aod::TracksWMc const&) @@ -585,7 +579,7 @@ struct HfTaskLc { if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { massLc = hfHelper.invMassLcToPKPi(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPKPi().size() == 3) { @@ -596,13 +590,13 @@ struct HfTaskLc { /// Fill the ML outputScores and variables of candidate (todo: add multiplicity) registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, 0, outputBkg, outputPrompt, outputFD, originType); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, ptProng0, ptProng1, ptProng2, 0, chi2PCA, decayLength, decayLengthXY, cpa, cpaXY, outputBkg, outputFD, originType); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, 0, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); } } if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPiKP().size() == 3) { @@ -658,7 +652,7 @@ struct HfTaskLc { } } - void processMcStd(LcCandidatesMc const&, + void processMcStd(LcCandidatesMc const& selectedLcCandidatesMc, soa::Join const& mcParticles, aod::TracksWMc const& tracksWithMc) { @@ -666,11 +660,11 @@ struct HfTaskLc { } PROCESS_SWITCH(HfTaskLc, processMcStd, "Process MC with the standard method", false); - void processMcWithMl(LcCandidatesMlMc const&, + void processMcWithMl(LcCandidatesMlMc const& selectedLcCandidatesMlMc, soa::Join const& mcParticles, aod::TracksWMc const& tracksWithMc) { - processMc(selectedLcCandidatesMcMl, mcParticles, tracksWithMc); + processMc(selectedLcCandidatesMlMc, mcParticles, tracksWithMc); } PROCESS_SWITCH(HfTaskLc, processMcWithMl, "Process Mc with the ML method", false); };