From d0e7ee515d7a24261284b546cb23baeb8db27d04 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Fri, 20 Oct 2023 11:29:17 +0200 Subject: [PATCH] PWGHF: fix filling of histograms for ML application debug --- PWGHF/TableProducer/candidateSelectorD0.cxx | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index c2906f6f2ce..4c0d035597f 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -60,6 +60,7 @@ struct HfCandidateSelectorD0 { Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::cuts[0], hf_cuts_ml::nBinsPt, hf_cuts_ml::nCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; Configurable nClassesMl{"nClassesMl", (int8_t)hf_cuts_ml::nCutScores, "Number of classes in ML model"}; + Configurable enableDebugMl{"enableDebugMl", false, "Flag to enable histograms to monitor BDT application"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable modelPathsCCDB{"modelPathsCCDB", "EventFiltering/PWGHF/BDTD0", "Path on CCDB"}; @@ -89,7 +90,7 @@ struct HfCandidateSelectorD0 { LOGP(fatal, "Only one process function can be enabled at a time."); } - if (applyMl) { + if (applyMl && enableDebugMl) { registry.add("DebugBdt/hBdtScore1VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); registry.add("DebugBdt/hBdtScore2VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); registry.add("DebugBdt/hBdtScore3VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); @@ -378,14 +379,19 @@ struct HfCandidateSelectorD0 { statusD0 = 0; statusD0bar = 0; } - registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMl[0], statusD0); - registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMl[0], statusD0bar); - registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMl[1], statusD0); - registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMl[1], statusD0bar); - registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMl[2], statusD0); - registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMl[2], statusD0bar); - if (statusD0 != 0 || statusD0bar != 0) { - registry.fill(HIST("DebugBdt/hMassDmesonSel"), hfHelper.invMassD0ToPiK(candidate)); + if (enableDebugMl) { + registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMl[0], statusD0); + registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMl[0], statusD0bar); + registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMl[1], statusD0); + registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMl[1], statusD0bar); + registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMl[2], statusD0); + registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMl[2], statusD0bar); + if (statusD0 > 0) { + registry.fill(HIST("DebugBdt/hMassDmesonSel"), hfHelper.invMassD0ToPiK(candidate)); + } + if (statusD0bar > 0) { + registry.fill(HIST("DebugBdt/hMassDmesonSel"), hfHelper.invMassD0barToKPi(candidate)); + } } } hfSelD0Candidate(statusD0, statusD0bar, statusHFFlag, statusTopol, statusCand, statusPID);