From 531ffda638ca42afd138ce527647ee21b68256f4 Mon Sep 17 00:00:00 2001 From: Bertrand Martin Date: Tue, 17 May 2022 03:55:16 +0200 Subject: [PATCH 1/3] Use GetClassification instead of GetResponse (MVAUtils) for Tau Trigger FTF BDT Hello, This MR is fixing a regression-vs-classification misconfiguration of a BDT classifier used in tau triggers. Currently, we evaluate a BDT classifier in "regression mode", with the GetResponse function of MVAUtils being called. However, for a classifier, this returns BDT scores that are not within the usual [0,1] range. And this leads to buggy behaviour in TrigTauTrackRoiUpdater, where we intend to select the track with the highest BDT score, but we assume the BDT score is always positive (BDTMax variable initialised to 0). As a consequence, unless we are lucky to get a track with a BDT score above 0 in the tauCore ROI of the Fast Track Finder, we fail to update the ROI for the tauIso step. In particular, the zedMinus and zedPlus of the tauIso ROI are not set to +/-7 mm, but we rather inherit the settings from the tauCore ROI, i.e. we scan again along the whole z axis in the tauIso step, which must waste CPU. This MR is changing the behaviour to "classification mode", which takes the sigmoid of GetResponse, and ensure the output is within [0,1]. A BDT helper method was added to tauRecTools. As the other such methods, all it does is sort the variables in the expected order as defined in the input ROOT file. Cheers, Bertrand --- Reconstruction/tauRecTools/Root/BDTHelper.cxx | 30 ++++++++++++++----- .../tauRecTools/tauRecTools/BDTHelper.h | 4 ++- .../src/TrigTauTrackRoiUpdater.cxx | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Reconstruction/tauRecTools/Root/BDTHelper.cxx b/Reconstruction/tauRecTools/Root/BDTHelper.cxx index 7ab666415ff..a92a558f5b5 100644 --- a/Reconstruction/tauRecTools/Root/BDTHelper.cxx +++ b/Reconstruction/tauRecTools/Root/BDTHelper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "tauRecTools/BDTHelper.h" @@ -79,7 +79,7 @@ std::vector BDTHelper::parseString(const TString& str, const TString& d return parsedString; } -std::vector BDTHelper::getInputVariables(const std::map &availableVariables) const { +std::vector BDTHelper::getInputVariables(const std::map& availableVariables) const { std::vector values; // sort the input variables by the order in varList (from BDT) @@ -96,7 +96,7 @@ std::vector BDTHelper::getInputVariables(const std::map & return values; } -std::vector BDTHelper::getInputVariables(const std::map &availableVariables) const { +std::vector BDTHelper::getInputVariables(const std::map& availableVariables) const { std::vector values; // sort the input variables by the order in varList (from BDT) @@ -133,8 +133,7 @@ std::vector BDTHelper::getInputVariables(const xAOD::TauJet& tau) const { } - -float BDTHelper::getGradBoostMVA(const std::map &availableVariables) const { +float BDTHelper::getGradBoostMVA(const std::map& availableVariables) const { std::vector values = getInputVariables(availableVariables); float score = -999; @@ -148,20 +147,37 @@ float BDTHelper::getGradBoostMVA(const std::map &availableVariab return score; } -float BDTHelper::getResponse(const std::map &availableVariables) const { + +float BDTHelper::getResponse(const std::map& availableVariables) const { std::vector values = getInputVariables(availableVariables); float score = -999; if (values.size() < m_inputVariableNames.size()) { ATH_MSG_ERROR("There are missing variables when calculating the BDT score, will return -999"); } - else { + else { score = m_BDT->GetResponse(values); } return score; } + +float BDTHelper::getClassification(const std::map& availableVariables) const { + std::vector values = getInputVariables(availableVariables); + + float score = -999; + if (values.size() < m_inputVariableNames.size()) { + ATH_MSG_ERROR("There are missing variables when calculating the BDT score, will return -999"); + } + else { + score = m_BDT->GetClassification(values); + } + + return score; +} + + float BDTHelper::getGradBoostMVA(const xAOD::TauJet& tau) const { std::vector values = getInputVariables(tau); diff --git a/Reconstruction/tauRecTools/tauRecTools/BDTHelper.h b/Reconstruction/tauRecTools/tauRecTools/BDTHelper.h index 12b375e35cd..f6adcd1c48f 100644 --- a/Reconstruction/tauRecTools/tauRecTools/BDTHelper.h +++ b/Reconstruction/tauRecTools/tauRecTools/BDTHelper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef TAURECTOOLS_BDTHELPER_H @@ -24,6 +24,8 @@ namespace tauRecTools { float getResponse(const std::map& availableVariables) const; + float getClassification(const std::map& availableVariables) const; + float getGradBoostMVA(const xAOD::TauJet& tau) const; MVAUtils::BDT* getBDT() const { return m_BDT.get(); } diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauTrackRoiUpdater.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauTrackRoiUpdater.cxx index 73918eea30c..b79490564d1 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauTrackRoiUpdater.cxx +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauTrackRoiUpdater.cxx @@ -240,7 +240,7 @@ double TrigTauTrackRoiUpdater::getBDTscore(const xAOD::TauJet* tau, const Trk::T vars.CaloHad_pt = tau_emscale_ptHad; vars.CaloEM_pt = tau_emscale_ptEM; - double BDTval = m_reader->getResponse(BDTvars); + double BDTval = m_reader->getClassification(BDTvars); return BDTval; } -- GitLab From 5e13f890314ccb9f8dc66b1f3606e3299b096051 Mon Sep 17 00:00:00 2001 From: Bertrand Martin Date: Tue, 17 May 2022 04:22:25 +0200 Subject: [PATCH 2/3] update trigger counts ref --- .../share/ref_RDOtoRDOTrig_v1Dev_build.ref | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref index 52777f27f79..dce9ae030b0 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref @@ -5249,7 +5249,7 @@ HLT_e26_lhtight_ivarloose_tau25_mediumRNN_tracktwoMVABDT_03dRAB_probe_L1EM22VHI: 9: 15 10: 4 HLT_e26_lhtight_ivarloose_tau25_mediumRNN_tracktwoMVABDT_03dRAB_probe_L1eEM26M: - eventCount: 1 + eventCount: 2 stepCounts: 0: 5 1: 5 @@ -5261,7 +5261,7 @@ HLT_e26_lhtight_ivarloose_tau25_mediumRNN_tracktwoMVABDT_03dRAB_probe_L1eEM26M: 7: 4 8: 4 9: 4 - 10: 1 + 10: 2 stepFeatures: 0: 5 1: 9 @@ -5273,7 +5273,7 @@ HLT_e26_lhtight_ivarloose_tau25_mediumRNN_tracktwoMVABDT_03dRAB_probe_L1eEM26M: 7: 23 8: 23 9: 23 - 10: 4 + 10: 5 HLT_e26_lhtight_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRAB_probe_L1EM22VHI: eventCount: 1 stepCounts: @@ -16436,7 +16436,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_L1RD0_FILLED: 1: 70 2: 70 3: 70 - 4: 10 + 4: 11 HLT_tau20_mediumRNN_tracktwoMVABDT_L1TAU8: eventCount: 7 stepCounts: @@ -16450,7 +16450,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_L1TAU8: 1: 70 2: 70 3: 70 - 4: 10 + 4: 11 HLT_tau20_mediumRNN_tracktwoMVABDT_L1eTAU12: eventCount: 7 stepCounts: @@ -16464,7 +16464,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_L1eTAU12: 1: 97 2: 97 3: 97 - 4: 10 + 4: 11 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j110_pf_ftf_preselj80_03dRAB_L1J30: eventCount: 4 stepCounts: @@ -16518,7 +16518,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j25_pf_ftf_03dRAB_L1RD0_FILLED: 3: 70 4: 70 5: 70 - 6: 10 + 6: 11 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j260_pf_ftf_preselj200_03dRAB_L1J75: eventCount: 1 stepCounts: @@ -16554,7 +16554,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j35_pf_ftf_03dRAB_L1RD0_FILLED: 3: 70 4: 70 5: 70 - 6: 10 + 6: 11 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j360_pf_ftf_preselj225_03dRAB_L1J100: eventCount: 1 stepCounts: @@ -16626,7 +16626,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j45_pf_ftf_preselj20_03dRAB_L1J15: 3: 66 4: 66 5: 66 - 6: 8 + 6: 9 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j60_pf_ftf_preselj50_03dRAB_L1J20: eventCount: 6 stepCounts: @@ -16644,7 +16644,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j60_pf_ftf_preselj50_03dRAB_L1J20: 3: 66 4: 66 5: 66 - 6: 8 + 6: 9 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j85_pf_ftf_preselj50_03dRAB_L1J20: eventCount: 4 stepCounts: @@ -16876,19 +16876,19 @@ HLT_tau25_mediumRNN_tracktwoLLP_L1TAU12IM: 3: 36 4: 8 HLT_tau25_mediumRNN_tracktwoLLP_L1cTAU20M: - eventCount: 8 + eventCount: 6 stepCounts: 0: 16 1: 16 2: 16 3: 16 - 4: 8 + 4: 6 stepFeatures: 0: 91 1: 91 2: 91 3: 91 - 4: 11 + 4: 10 HLT_tau25_mediumRNN_tracktwoMVABDT_L1TAU12IM: eventCount: 7 stepCounts: @@ -16904,19 +16904,19 @@ HLT_tau25_mediumRNN_tracktwoMVABDT_L1TAU12IM: 3: 36 4: 9 HLT_tau25_mediumRNN_tracktwoMVABDT_L1cTAU20M: - eventCount: 8 + eventCount: 9 stepCounts: 0: 16 1: 16 2: 16 3: 16 - 4: 8 + 4: 9 stepFeatures: 0: 91 1: 91 2: 91 3: 91 - 4: 14 + 4: 15 HLT_tau25_mediumRNN_tracktwoMVABDT_L1eTAU20: eventCount: 7 stepCounts: @@ -17018,12 +17018,13 @@ HLT_tau25_mediumRNN_tracktwoMVABDT_tau20_mediumRNN_tracktwoMVABDT_03dRAB_j70_j50 1: 4 2: 4 3: 4 + 4: 1 stepFeatures: 0: 57 1: 57 2: 57 3: 57 - 4: 6 + 4: 7 HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM: eventCount: 7 stepCounts: @@ -17131,7 +17132,7 @@ HLT_tau25_perf_tracktwoMVABDT_L1eTAU20: 1: 66 2: 66 3: 66 - 4: 22 + 4: 23 HLT_tau25_perf_tracktwoMVABDT_L1eTAU20M: eventCount: 12 stepCounts: @@ -17145,7 +17146,7 @@ HLT_tau25_perf_tracktwoMVABDT_L1eTAU20M: 1: 50 2: 50 3: 50 - 4: 19 + 4: 20 HLT_tau25_perf_tracktwoMVABDT_L1jTAU20: eventCount: 17 stepCounts: @@ -17159,7 +17160,7 @@ HLT_tau25_perf_tracktwoMVABDT_L1jTAU20: 1: 78 2: 78 3: 78 - 4: 28 + 4: 29 HLT_tau25_perf_tracktwoMVA_L1TAU12IM: eventCount: 13 stepCounts: @@ -17703,7 +17704,7 @@ HLT_tau35_perf_tracktwoMVABDT_L1cTAU30M: 1: 49 2: 49 3: 49 - 4: 14 + 4: 15 HLT_tau35_perf_tracktwoMVABDT_L1eTAU30: eventCount: 9 stepCounts: @@ -17717,7 +17718,7 @@ HLT_tau35_perf_tracktwoMVABDT_L1eTAU30: 1: 39 2: 39 3: 39 - 4: 13 + 4: 14 HLT_tau35_perf_tracktwoMVABDT_L1jTAU30: eventCount: 10 stepCounts: @@ -17731,7 +17732,7 @@ HLT_tau35_perf_tracktwoMVABDT_L1jTAU30: 1: 47 2: 47 3: 47 - 4: 14 + 4: 15 HLT_tau35_perf_tracktwoMVABDT_L1jTAU30M: eventCount: 10 stepCounts: @@ -17745,7 +17746,7 @@ HLT_tau35_perf_tracktwoMVABDT_L1jTAU30M: 1: 47 2: 47 3: 47 - 4: 14 + 4: 15 HLT_tau35_perf_tracktwoMVA_L1TAU20IM: eventCount: 9 stepCounts: -- GitLab From 66e21ff8c5d009bcdc9c480894c80a8512cbeb92 Mon Sep 17 00:00:00 2001 From: Bertrand Martin Date: Tue, 17 May 2022 12:23:19 +0200 Subject: [PATCH 3/3] forgot to update ref_v1Dev_decodeBS_build.ref --- .../share/ref_v1Dev_decodeBS_build.ref | 92 +++++++++---------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref index 89d34143efb..4cbabfd351f 100644 --- a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref +++ b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref @@ -5814,47 +5814,47 @@ HLT_tau200_tightRNN_tracktwoLLP_L1TAU100: HLT_tau200_tightRNN_tracktwoLLP_L1eTAU140: eventCount: 0 HLT_tau20_mediumRNN_tracktwoMVABDT_L1RD0_FILLED: - eventCount: 5 + eventCount: 4 stepCounts: 0: 24 1: 24 2: 24 3: 24 - 4: 5 + 4: 4 stepFeatures: 0: 35 1: 35 2: 35 3: 35 - 4: 5 + 4: 4 HLT_tau20_mediumRNN_tracktwoMVABDT_L1TAU8: - eventCount: 5 + eventCount: 4 stepCounts: 0: 24 1: 24 2: 24 3: 24 - 4: 5 + 4: 4 stepFeatures: 0: 35 1: 35 2: 35 3: 35 - 4: 5 + 4: 4 HLT_tau20_mediumRNN_tracktwoMVABDT_L1eTAU12: - eventCount: 6 + eventCount: 5 stepCounts: 0: 27 1: 27 2: 27 3: 27 - 4: 6 + 4: 5 stepFeatures: 0: 54 1: 54 2: 54 3: 54 - 4: 6 + 4: 5 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j110_pf_ftf_preselj80_03dRAB_L1J30: eventCount: 0 stepCounts: @@ -5890,7 +5890,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j25_pf_ftf_03dRAB_L1RD0_FILLED: 3: 35 4: 35 5: 35 - 6: 5 + 6: 4 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j260_pf_ftf_preselj200_03dRAB_L1J75: eventCount: 0 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j35_pf_ftf_03dRAB_L1RD0_FILLED: @@ -5910,7 +5910,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j35_pf_ftf_03dRAB_L1RD0_FILLED: 3: 32 4: 32 5: 32 - 6: 3 + 6: 2 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j360_pf_ftf_preselj225_03dRAB_L1J100: eventCount: 0 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j420_pf_ftf_preselj225_03dRAB_L1J100: @@ -5934,7 +5934,7 @@ HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j45_pf_ftf_preselj20_03dRAB_L1J15: 3: 24 4: 24 5: 24 - 6: 3 + 6: 2 HLT_tau20_mediumRNN_tracktwoMVABDT_probe_j60_pf_ftf_preselj50_03dRAB_L1J20: eventCount: 1 stepCounts: @@ -6080,19 +6080,19 @@ HLT_tau25_looseRNN_tracktwoLLP_L1TAU12IM: 3: 12 4: 5 HLT_tau25_looseRNN_tracktwoMVABDT_L1TAU12IM: - eventCount: 6 + eventCount: 5 stepCounts: 0: 10 1: 10 2: 10 3: 10 - 4: 6 + 4: 5 stepFeatures: 0: 12 1: 12 2: 12 3: 12 - 4: 7 + 4: 6 HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM: eventCount: 6 stepCounts: @@ -6136,19 +6136,19 @@ HLT_tau25_mediumRNN_tracktwoLLP_L1cTAU20M: 3: 15 4: 2 HLT_tau25_mediumRNN_tracktwoMVABDT_L1TAU12IM: - eventCount: 3 + eventCount: 2 stepCounts: 0: 10 1: 10 2: 10 3: 10 - 4: 3 + 4: 2 stepFeatures: 0: 12 1: 12 2: 12 3: 12 - 4: 3 + 4: 2 HLT_tau25_mediumRNN_tracktwoMVABDT_L1cTAU20M: eventCount: 1 stepCounts: @@ -6164,47 +6164,47 @@ HLT_tau25_mediumRNN_tracktwoMVABDT_L1cTAU20M: 3: 15 4: 1 HLT_tau25_mediumRNN_tracktwoMVABDT_L1eTAU20: - eventCount: 3 + eventCount: 2 stepCounts: 0: 16 1: 16 2: 16 3: 16 - 4: 3 + 4: 2 stepFeatures: 0: 21 1: 21 2: 21 3: 21 - 4: 3 + 4: 2 HLT_tau25_mediumRNN_tracktwoMVABDT_L1eTAU20M: - eventCount: 3 + eventCount: 2 stepCounts: 0: 12 1: 12 2: 12 3: 12 - 4: 3 + 4: 2 stepFeatures: 0: 16 1: 16 2: 16 3: 16 - 4: 3 + 4: 2 HLT_tau25_mediumRNN_tracktwoMVABDT_L1jTAU20: - eventCount: 3 + eventCount: 2 stepCounts: 0: 17 1: 17 2: 17 3: 17 - 4: 3 + 4: 2 stepFeatures: 0: 28 1: 28 2: 28 3: 28 - 4: 3 + 4: 2 HLT_tau25_mediumRNN_tracktwoMVABDT_probe_xe65_cell_xe90_pfopufit_L1XE50: eventCount: 0 stepFeatures: @@ -6340,19 +6340,17 @@ HLT_tau25_tightRNN_tracktwoLLP_L1TAU12IM: 3: 12 4: 3 HLT_tau25_tightRNN_tracktwoMVABDT_L1TAU12IM: - eventCount: 1 + eventCount: 0 stepCounts: 0: 10 1: 10 2: 10 3: 10 - 4: 1 stepFeatures: 0: 12 1: 12 2: 12 3: 12 - 4: 1 HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM: eventCount: 0 stepCounts: @@ -6450,19 +6448,19 @@ HLT_tau35_idperf_tracktwoMVA_L1TAU20IM: 3: 9 4: 9 HLT_tau35_looseRNN_tracktwoMVABDT_L1TAU20IM: - eventCount: 5 + eventCount: 4 stepCounts: 0: 7 1: 7 2: 7 3: 7 - 4: 5 + 4: 4 stepFeatures: 0: 9 1: 9 2: 9 3: 9 - 4: 6 + 4: 5 HLT_tau35_looseRNN_tracktwoMVA_L1TAU20IM: eventCount: 5 stepCounts: @@ -6478,19 +6476,19 @@ HLT_tau35_looseRNN_tracktwoMVA_L1TAU20IM: 3: 9 4: 6 HLT_tau35_mediumRNN_tracktwoMVABDT_L1TAU20IM: - eventCount: 2 + eventCount: 1 stepCounts: 0: 7 1: 7 2: 7 3: 7 - 4: 2 + 4: 1 stepFeatures: 0: 9 1: 9 2: 9 3: 9 - 4: 2 + 4: 1 HLT_tau35_mediumRNN_tracktwoMVABDT_L1cTAU30M: eventCount: 1 stepCounts: @@ -6506,47 +6504,47 @@ HLT_tau35_mediumRNN_tracktwoMVABDT_L1cTAU30M: 3: 7 4: 1 HLT_tau35_mediumRNN_tracktwoMVABDT_L1eTAU30: - eventCount: 2 + eventCount: 1 stepCounts: 0: 10 1: 10 2: 10 3: 10 - 4: 2 + 4: 1 stepFeatures: 0: 12 1: 12 2: 12 3: 12 - 4: 2 + 4: 1 HLT_tau35_mediumRNN_tracktwoMVABDT_L1jTAU30: - eventCount: 2 + eventCount: 1 stepCounts: 0: 11 1: 11 2: 11 3: 11 - 4: 2 + 4: 1 stepFeatures: 0: 13 1: 13 2: 13 3: 13 - 4: 2 + 4: 1 HLT_tau35_mediumRNN_tracktwoMVABDT_L1jTAU30M: - eventCount: 2 + eventCount: 1 stepCounts: 0: 11 1: 11 2: 11 3: 11 - 4: 2 + 4: 1 stepFeatures: 0: 13 1: 13 2: 13 3: 13 - 4: 2 + 4: 1 HLT_tau35_mediumRNN_tracktwoMVABDT_probe_xe65_cell_xe90_pfopufit_L1XE50: eventCount: 0 stepFeatures: @@ -6746,19 +6744,17 @@ HLT_tau35_perf_tracktwoMVA_L1TAU20IM: 3: 9 4: 7 HLT_tau35_tightRNN_tracktwoMVABDT_L1TAU20IM: - eventCount: 1 + eventCount: 0 stepCounts: 0: 7 1: 7 2: 7 3: 7 - 4: 1 stepFeatures: 0: 9 1: 9 2: 9 3: 9 - 4: 1 HLT_tau35_tightRNN_tracktwoMVA_L1TAU20IM: eventCount: 0 stepCounts: -- GitLab