From b5577de2ac52786cabc341896ac7068efd4b032e Mon Sep 17 00:00:00 2001 From: zhangbiao-phy Date: Tue, 19 Mar 2024 09:35:48 +0100 Subject: [PATCH 1/5] PWGHF: remove the redundant Configurable and keep using the Filter --- PWGHF/D2H/Tasks/taskLc.cxx | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index b2ea1bb75b0..d728cd1061a 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}); @@ -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); @@ -658,7 +652,7 @@ struct HfTaskLc { } } - void processMcStd(LcCandidatesMc const&, + void processMcStd(LcCandidatesMc const& selectedLcCandidatesMc, soa::Join const& mcParticles, aod::TracksWMc const& tracksWithMc) { @@ -666,7 +660,7 @@ struct HfTaskLc { } PROCESS_SWITCH(HfTaskLc, processMcStd, "Process MC with the standard method", false); - void processMcWithMl(LcCandidatesMlMc const&, + void processMcWithMl(LcCandidatesMlMc const& selectedLcCandidatesMcMl, soa::Join const& mcParticles, aod::TracksWMc const& tracksWithMc) { From 3ec4f13c42b58e6b40ece9c0d52b7c127752e643 Mon Sep 17 00:00:00 2001 From: BiaoZhang <52267892+zhangbiao-phy@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:07:19 +0100 Subject: [PATCH 2/5] Update PWGHF/D2H/Tasks/taskLc.cxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/D2H/Tasks/taskLc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index d728cd1061a..6359c97ff71 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -660,7 +660,7 @@ struct HfTaskLc { } PROCESS_SWITCH(HfTaskLc, processMcStd, "Process MC with the standard method", false); - void processMcWithMl(LcCandidatesMlMc const& selectedLcCandidatesMcMl, + void processMcWithMl(LcCandidatesMlMc const& selectedLcCandidatesMlMc, soa::Join const& mcParticles, aod::TracksWMc const& tracksWithMc) { From cade64e45a2771942d2b20b5189ec9784822b1db Mon Sep 17 00:00:00 2001 From: BiaoZhang <52267892+zhangbiao-phy@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:12:11 +0100 Subject: [PATCH 3/5] replace "applyMl" to "fillMl" --- PWGHF/D2H/Tasks/taskLc.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 6359c97ff71..e8db4afca76 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -282,7 +282,7 @@ struct HfTaskLc { } } - template + template void processData(aod::Collision const& collision, CandType const& candidates, aod::TracksWDca const& tracks) @@ -367,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,7 +384,7 @@ struct HfTaskLc { if (candidate.isSelLcToPiKP() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPiKP().size() == 3) { @@ -419,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&) @@ -579,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,7 +596,7 @@ struct HfTaskLc { if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (applyMl) { + if constexpr (fillMl) { if (candidate.mlProbLcToPiKP().size() == 3) { From a78db9fe830c5f9f1eeacee00d57cd9a4214b0d6 Mon Sep 17 00:00:00 2001 From: BiaoZhang <52267892+zhangbiao-phy@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:09:45 +0100 Subject: [PATCH 4/5] Update taskLc.cxx --- PWGHF/D2H/Tasks/taskLc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index e8db4afca76..49fd2d59342 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -664,7 +664,7 @@ struct HfTaskLc { 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); }; From 8654f171fb6936be5284107dd44abda13d6ccc7b Mon Sep 17 00:00:00 2001 From: BiaoZhang <52267892+zhangbiao-phy@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:05:19 +0100 Subject: [PATCH 5/5] Fix typo of Axis of ThnSparse --- PWGHF/D2H/Tasks/taskLc.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 49fd2d59342..ae66c2a2e65 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -378,7 +378,7 @@ 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) { @@ -590,7 +590,7 @@ 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) {