diff --git a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/CalibrationDataInterface/CalibrationDataInterfaceROOT.h b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/CalibrationDataInterface/CalibrationDataInterfaceROOT.h index ce49d8b0f53d172f308ba7242309f53ec4e8c0bf..9b74937eab337dd80b46b3aa4a64b8b50b90e6ec 100644 --- a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/CalibrationDataInterface/CalibrationDataInterfaceROOT.h +++ b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/CalibrationDataInterface/CalibrationDataInterfaceROOT.h @@ -461,7 +461,7 @@ namespace Analysis double m_maxAbsEta; OutOfBoundsStrategy m_absEtaStrategy; OutOfBoundsStrategy m_otherStrategy; - void checkAbsEta(const CalibrationDataVariables& variables, unsigned int index); + [[nodiscard]] bool checkAbsEta(const CalibrationDataVariables& variables, unsigned int index); /** counters for flagging out-of-bound cases */ std::vector<unsigned int> m_etaCounters; std::vector<unsigned int> m_mainCounters; diff --git a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/Root/CalibrationDataInterfaceROOT.cxx b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/Root/CalibrationDataInterfaceROOT.cxx index 9ab6903080dfd18157b775f21216c2c5f17b058e..02336ca7c64636412d2f8ef5225e38d419664580 100644 --- a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/Root/CalibrationDataInterfaceROOT.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface/Root/CalibrationDataInterfaceROOT.cxx @@ -802,7 +802,10 @@ Analysis::CalibrationDataInterfaceROOT::getScaleFactor (const CalibrationDataVar } // perform out-of-bound check of jet eta - checkAbsEta(variables, indexSF); + if (!checkAbsEta(variables, indexSF)) { + cerr << "Jet |eta| is outside of the boundary!" << endl; + return Analysis::kRange; + } // retrieve the MC/MC scale factor double MCMCSF = m_useMCMCSF ? getMCMCScaleFactor(variables, indexSF, indexEff) : 1; @@ -988,7 +991,11 @@ Analysis::CalibrationDataInterfaceROOT::getMCEfficiency (const CalibrationDataVa if (! container) return Analysis::kError; // perform out-of-bound check of jet eta - checkAbsEta(variables, index); + if (!checkAbsEta(variables, index)) { + cerr << "Jet |eta| is outside of the boundary!" << endl; + return Analysis::kRange; + } + // always retrieve the result itself double value; @@ -1546,7 +1553,10 @@ Analysis::CalibrationDataInterfaceROOT::getWeightScaleFactor (const CalibrationD checkWeightScaleFactors(indexSF, indexEff); // perform out-of-bound check of jet eta - checkAbsEta(variables, indexSF); + if (!checkAbsEta(variables, indexSF)) { + cerr << "Jet |eta| is outside of the boundary!" << endl; + return Analysis::kRange; + } // Always retrieve the result itself double value; @@ -1900,22 +1910,28 @@ Analysis::CalibrationDataInterfaceROOT::checkWeightScaleFactors(unsigned int ind } //________________________________________________________________________________ -void +bool Analysis::CalibrationDataInterfaceROOT::checkAbsEta(const CalibrationDataVariables& variables, unsigned int index) { // Check whether the jet eta value is outside the range of validity, subject to the strategy // specified in the configuration file. - - if (m_absEtaStrategy == Ignore) return; + bool pass = true; + if (m_absEtaStrategy == Ignore) return pass; + switch (m_absEtaStrategy) { case GiveUp: - assert(!(std::fabs(variables.jetEta) > m_maxAbsEta)); break; + if (std::fabs(variables.jetEta) > m_maxAbsEta) { + pass = false; + } + break; case Flag: default: - if (std::fabs(variables.jetEta) > m_maxAbsEta) + if (std::fabs(variables.jetEta) > m_maxAbsEta) { increaseCounter(index, Eta); + } } + return pass; } //________________________________________________________________________________