diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h index 09af13401ed7e575c3b13e29142c07639044eaac..2e4819408ea3d15847b0c7c0f824b631415f2c97 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h @@ -293,7 +293,16 @@ namespace TrigConf { **************************************/ class Selection { public: - enum class WP { NONE = 0, LOOSE = 1, MEDIUM = 2, TIGHT = 3, HADLOOSE = 4, HADMEDIUM = 5, HADTIGHT = 6, HAD = 7 }; // HAD = HADMEDIUM for backward compatibility + enum class WP { + NONE = 0, + LOOSE = 1, MEDIUM = 2, TIGHT = 3, + HADLOOSE = 4, HADMEDIUM = 5, HADTIGHT = 6, HAD = 7, // HAD = HADMEDIUM for backward compatibility + + // cTAU-specific WPs + LOOSE12 = 8, LOOSE20 = 9, LOOSE30 = 10, LOOSE35 = 11, + MEDIUM12 = 12, MEDIUM20 = 13, MEDIUM30 = 14, MEDIUM35 = 15, + TIGHT12 = 16, TIGHT20 = 17, TIGHT30 = 18, TIGHT35 = 19 + }; static std::string wpToString(WP); static WP stringToWP(const std::string &); }; diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx index 84303239e5c3b109449b19fabff1e6e0fb360354..589a74b6df0eb0b7c3bec28005ee1483e75babba 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx @@ -362,6 +362,30 @@ TrigConf::Selection::wpToString(TrigConf::Selection::WP wp) return "HadTight"; if (wp == Selection::WP::HAD) // Had = HadMedium for backward compatibility return "HadMedium"; + if (wp == Selection::WP::LOOSE12) + return "Loose12"; + if (wp == Selection::WP::LOOSE20) + return "Loose20"; + if (wp == Selection::WP::LOOSE30) + return "Loose30"; + if (wp == Selection::WP::LOOSE35) + return "Loose35"; + if (wp == Selection::WP::MEDIUM12) + return "Medium12"; + if (wp == Selection::WP::MEDIUM20) + return "Medium20"; + if (wp == Selection::WP::MEDIUM30) + return "Medium30"; + if (wp == Selection::WP::MEDIUM35) + return "Medium35"; + if (wp == Selection::WP::TIGHT12) + return "Tight12"; + if (wp == Selection::WP::TIGHT20) + return "Tight20"; + if (wp == Selection::WP::TIGHT30) + return "Tight30"; + if (wp == Selection::WP::TIGHT35) + return "Tight35"; throw std::runtime_error("Unknown working point " + std::to_string(int(wp))); } @@ -384,5 +408,29 @@ TrigConf::Selection::stringToWP(const std::string & wpStr) return Selection::WP::HADTIGHT; if (wpStr == "Had") // Had = HadMedium for backward compatibility return Selection::WP::HADMEDIUM; + if (wpStr == "Loose12") + return Selection::WP::LOOSE12; + if (wpStr == "Loose20") + return Selection::WP::LOOSE20; + if (wpStr == "Loose30") + return Selection::WP::LOOSE30; + if (wpStr == "Loose35") + return Selection::WP::LOOSE35; + if (wpStr == "Medium12") + return Selection::WP::MEDIUM12; + if (wpStr == "Medium20") + return Selection::WP::MEDIUM20; + if (wpStr == "Medium30") + return Selection::WP::MEDIUM30; + if (wpStr == "Medium35") + return Selection::WP::MEDIUM35; + if (wpStr == "Tight12") + return Selection::WP::TIGHT12; + if (wpStr == "Tight20") + return Selection::WP::TIGHT20; + if (wpStr == "Tight30") + return Selection::WP::TIGHT30; + if (wpStr == "Tight35") + return Selection::WP::TIGHT35; throw std::runtime_error("Unknown working point name " + wpStr); } diff --git a/Trigger/TrigSteer/HLTSeeding/src/cTauRoIThresholdsTool.cxx b/Trigger/TrigSteer/HLTSeeding/src/cTauRoIThresholdsTool.cxx index 7dcfe892322be17c9af4a12e4281af0317585d3f..0d683b2cab4c2a5f8bdecc186db704ba84f2c7f2 100644 --- a/Trigger/TrigSteer/HLTSeeding/src/cTauRoIThresholdsTool.cxx +++ b/Trigger/TrigSteer/HLTSeeding/src/cTauRoIThresholdsTool.cxx @@ -9,21 +9,6 @@ #include "L1TopoCoreSim/TopoSteeringStructure.h" -namespace { - // TODO: avoid hard-coding the WP->int mapping by having cTauMultiplicity::convertIsoToBit return TrigConf::Selection::WP - bool isocut(TrigConf::Selection::WP WP, const unsigned int bit) { - // ctauWp will take values 0 (None)/ 1 (Loose)/ 2 (Medium)/ 3 (Tight) - unsigned int value = 0; - if ( WP == TrigConf::Selection::WP::NONE ) {value = 0;} - else if ( WP == TrigConf::Selection::WP::LOOSE ) {value = 1;} - else if ( WP == TrigConf::Selection::WP::MEDIUM ) {value = 2;} - else if ( WP == TrigConf::Selection::WP::TIGHT ) {value = 3;} - // TODO Add a printout in case the WP is not found - if (bit >= value) {return true;} - else {return false;} - }; -} - StatusCode cTauRoIThresholdsTool::initialize() { ATH_CHECK(RoIThresholdsTool::initialize()); ATH_CHECK(m_jTauLinkKey.initialize()); @@ -33,6 +18,15 @@ StatusCode cTauRoIThresholdsTool::initialize() { uint64_t cTauRoIThresholdsTool::getPattern(const xAOD::eFexTauRoI& eTau, const RoIThresholdsTool::ThrVec& menuThresholds, const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const { + + std::map<std::string, int> isoFW_CTAU, isoFW_CTAU_jTAUCoreScale; + TCS::TopoSteeringStructure::setIsolationFW_CTAU(isoFW_CTAU, isoFW_CTAU_jTAUCoreScale, menuExtraInfo); + + unsigned int eFexEt{eTau.etTOB()}; // eTAU Et in units of 100 MeV + int eFexEta{eTau.iEta()}; + + unsigned int jFexCoreEt = 0, jFexIsoEt = 0; // jTAU core and isolation Et in units of 200 MeV + // Get the jTau matched to the eTau using jTauLink_t = ElementLink<xAOD::jFexTauRoIContainer>; SG::ReadDecorHandle<xAOD::eFexTauRoIContainer, jTauLink_t> jTauLinkAcc{m_jTauLinkKey, Gaudi::Hive::currentContext()}; @@ -43,33 +37,21 @@ uint64_t cTauRoIThresholdsTool::getPattern(const xAOD::eFexTauRoI& eTau, jTauLink_t jTauLink = jTauLinkAcc(eTau); bool matched{jTauLink.isValid()}; - // Variables needed to form a cTau - // pT in units of 100 MeV - unsigned int eFexEt{eTau.etTOB()}; - int eFexEta{eTau.iEta()}; - unsigned int isolation_score{0}; - if (matched) { const xAOD::jFexTauRoI* jTau = *jTauLink; - // core and isolation energy in units of 200 MeV - unsigned int jFexIso{jTau->tobIso()}; - unsigned int jFexCoreEt{jTau->tobEt()}; - - std::map<std::string, int> isoFW_CTAU, isoFW_CTAU_jTAUCoreScale; - TCS::TopoSteeringStructure::setIsolationFW_CTAU( isoFW_CTAU, isoFW_CTAU_jTAUCoreScale, menuExtraInfo ); - - // The core and isolation E_T values are multiplied by 2 to normalise to 100 MeV/counts units - isolation_score = TCS::cTauMultiplicity::convertIsoToBit( isoFW_CTAU, isoFW_CTAU_jTAUCoreScale, 2*static_cast<float>(jFexCoreEt), 2*static_cast<float>(jFexIso), static_cast<float>(eFexEt) ); + jFexIsoEt = jTau->tobIso(); + jFexCoreEt = jTau->tobEt(); ATH_MSG_DEBUG("eFex tau eta,phi = " << eTau.iEta() << ", " << eTau.iPhi() << ", jFex tau eta,phi = " << jTau->globalEta() << ", " << jTau->globalPhi() - << ", eFex et (100 MeV/counts) = " << eFexEt << ", jFex iso (200 MeV/counts) = " << jFexIso); + << ", eFex et (100 MeV/counts) = " << eFexEt << ", jFex et (200 MeV/counts) = " << jTau->tobEt() << ", jFex iso (200 MeV/counts) = " << jTau->tobIso()); } else { ATH_MSG_DEBUG("eFex tau eta,phi = " << eTau.iEta() << ", " << eTau.iPhi() << ", eFex et (100 MeV/counts) = " << eFexEt << ", no matching jTau found"); } + uint64_t thresholdMask{0}; // Iterate through thresholds and see which ones are passed @@ -77,7 +59,8 @@ uint64_t cTauRoIThresholdsTool::getPattern(const xAOD::eFexTauRoI& eTau, std::shared_ptr<TrigConf::L1Threshold_cTAU> thr = std::static_pointer_cast<TrigConf::L1Threshold_cTAU>(thrBase); // Check isolation threshold - unmatched eTau treated as perfectly isolated, ATR-25927 - bool passIso = matched ? isocut(TrigConf::Selection::WP(thr->isolation()), isolation_score ) : true; + // The core and isolation E_T values are multiplied by 2 to normalise to 100 MeV/counts units + bool passIso = matched ? TCS::cTauMultiplicity::checkIsolationWP(isoFW_CTAU, isoFW_CTAU_jTAUCoreScale, 2*static_cast<float>(jFexCoreEt), 2*static_cast<float>(jFexIsoEt), static_cast<float>(eFexEt), TrigConf::Selection::wpToString(thr->isolation())) : true; // Check pt threshold - using iEta coordinate for the eFEX ensures a 0.1 granularity of the eta coordinate, // as expected from the menu method thrValue100MeV diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/cTauMultiplicity.h b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/cTauMultiplicity.h index 480a14f4b9adc1b173f2ae6bbe3784d002d2632d..6c1f59721a1dd264cfa40cca914b1b7b371fa186 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/cTauMultiplicity.h +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/cTauMultiplicity.h @@ -31,32 +31,45 @@ namespace TCS { virtual StatusCode initialize() override; - virtual StatusCode processBitCorrect( const TCS::InputTOBArray & input, Count & count ) override final ; + virtual StatusCode processBitCorrect(const TCS::InputTOBArray& input, Count& count) override final; - virtual StatusCode process( const TCS::InputTOBArray & input, Count & count ) override final ; + virtual StatusCode process(const TCS::InputTOBArray& input, Count& count ) override final; #ifndef TRIGCONF_STANDALONE // Functions for HLT seeding // Returns index of jtau matched to etau - static size_t cTauMatching( const xAOD::eFexTauRoI & eTau, const xAOD::jFexTauRoIContainer & jTauRoIs ); + static size_t cTauMatching(const xAOD::eFexTauRoI& eTau, const xAOD::jFexTauRoIContainer& jTauRoIs); // Returns true when a matching is found - static bool cTauMatching( const xAOD::eFexTauRoI & eTau, const xAOD::jFexTauRoI & jTau ); + static bool cTauMatching(const xAOD::eFexTauRoI& eTau, const xAOD::jFexTauRoI& jTau); // Converts the isolation score to bit to be used for the working point assignement - static unsigned int convertIsoToBit( const std::map<std::string, int>& isoFW_CTAU, const std::map<std::string, int>& isoFW_CTAU_jTAUCoreScale, const float jTauCoreEt, const float jTauIso, const float eTauEt ); + static bool checkIsolationWP(const std::map<std::string, int>& isoFW_CTAU, const std::map<std::string, int>& isoFW_CTAU_jTAUCoreScale, const float jTauCoreEt, const float jTauIsoEt, const float eTauEt, const std::string& isolation_wp); #endif private: - TrigConf::L1Threshold const * m_threshold{nullptr}; + const TrigConf::L1Threshold_cTAU* m_threshold{nullptr}; std::map<std::string, int> m_isoFW_CTAU; std::map<std::string, int> m_isoFW_CTAU_jTAUCoreScale; // This function is used to map the ctau isolation working points into a common format with eFEX EM and taus. // This allows us to use same functionalities from ConfigurableAlg (L1TopoInterfaces) to apply isolation cuts in multiplicity algorithms for all flavour of TOBS - unsigned int convertIsoToBit( const TCS::cTauTOB * etauCand, const TCS::cTauTOB * jtauCand ) const; + bool checkIsolationWP(const TCS::cTauTOB* etauCand, const TCS::cTauTOB* jtauCand, const std::string& isolation_wp) const; // Matching function for L1Topo - bool cTauMatching( const TCS::cTauTOB * etauCand, const TCS::cTauTOB * jtauCand ) const; + bool cTauMatching(const TCS::cTauTOB* etauCand, const TCS::cTauTOB* jtauCand) const; + + // cTau monitoring histograms + std::vector<std::string> m_histcTauEt; + std::vector<std::string> m_histcTauPhiEta; + std::vector<std::string> m_histcTauEtEta; + std::vector<std::string> m_histcTauPartialIsoLoose; + std::vector<std::string> m_histcTauPartialIsoMedium; + std::vector<std::string> m_histcTauPartialIsoMedium12; + std::vector<std::string> m_histcTauPartialIsoMedium20; + std::vector<std::string> m_histcTauPartialIsoMedium30; + std::vector<std::string> m_histcTauPartialIsoMedium35; + std::vector<std::string> m_histcTauPartialIsoTight; + std::vector<std::string> m_histcTauIsoMatchedPass; }; diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/cTauMultiplicity.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/cTauMultiplicity.cxx index b409aba3dfc3e69d1e46d474d4a406a9b82935c6..66044574e8f28e73552a55c1979041c4e6abec4b 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/cTauMultiplicity.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/cTauMultiplicity.cxx @@ -16,22 +16,20 @@ REGISTER_ALG_TCS(cTauMultiplicity) -// constructor TCS::cTauMultiplicity::cTauMultiplicity(const std::string & name) : CountingAlg(name) { setNumberOutputBits(12); //To-Do: Make this flexible to adapt to the menu. Each counting requires more than one bit } -// destructor TCS::cTauMultiplicity::~cTauMultiplicity() {} -TCS::StatusCode -TCS::cTauMultiplicity::initialize() { +TCS::StatusCode TCS::cTauMultiplicity::initialize() { + m_threshold = dynamic_cast<const TrigConf::L1Threshold_cTAU*>(getThreshold()); - m_threshold = getThreshold(); m_isoFW_CTAU = isolationFW_CTAU(); m_isoFW_CTAU_jTAUCoreScale = isolationFW_CTAU_jTAUCoreScale(); + TRG_MSG_DEBUG("Initializing cTauMultiplicity L1Topo Algorithm"); for(const auto& [wp, iso] : m_isoFW_CTAU) { TRG_MSG_DEBUG("WP \"" << wp << "\": R=" << iso << ", jTAUCoreScale=" << m_isoFW_CTAU_jTAUCoreScale[wp]); @@ -51,30 +49,28 @@ TCS::cTauMultiplicity::initialize() { bookHistMult(m_histcTauEtEta, "cTauTOBEtEta", "Matched cTau TOB Et vs eta", "#eta#times40", "E_{t} [GeV]", 200, -200, 200, 200, 0, 400); bookHistMult(m_histcTauPartialIsoLoose, "cTauTOBPartialIsoLoose", "Matched cTau Loose partial isolation", "Loose isolation", 200, 0, 10); bookHistMult(m_histcTauPartialIsoMedium, "cTauTOBPartialIsoMedium", "Matched cTau Medium partial isolation", "Medium isolation", 200, 0, 10); + bookHistMult(m_histcTauPartialIsoMedium12, "cTauTOBPartialIsoMedium12", "Matched cTau Medium12 partial isolation", "Medium12 isolation", 200, 0, 10); + bookHistMult(m_histcTauPartialIsoMedium20, "cTauTOBPartialIsoMedium20", "Matched cTau Medium20 partial isolation", "Medium20 isolation", 200, 0, 10); + bookHistMult(m_histcTauPartialIsoMedium30, "cTauTOBPartialIsoMedium30", "Matched cTau Medium30 partial isolation", "Medium30 isolation", 200, 0, 10); + bookHistMult(m_histcTauPartialIsoMedium35, "cTauTOBPartialIsoMedium35", "Matched cTau Medium35 partial isolation", "Medium35 isolation", 200, 0, 10); bookHistMult(m_histcTauPartialIsoTight, "cTauTOBPartialIsoTight", "Matched cTau Tight partial isolation", "Tight isolation", 200, 0, 10); - bookHistMult(m_histcTauIsoScore, "cTauTOBIsoScore", "Matched cTau isolation score", "isolation score", 4, 0, 4); + bookHistMult(m_histcTauIsoMatchedPass, "cTauTOBIsoMatchedPass", "Matched cTau isolation pass", "isolation pass", 2, 0, 2); return StatusCode::SUCCESS; } // To be implemented -TCS::StatusCode -TCS::cTauMultiplicity::processBitCorrect( const TCS::InputTOBArray & input, Count & count) +TCS::StatusCode TCS::cTauMultiplicity::processBitCorrect(const TCS::InputTOBArray& input, Count& count) { return process(input, count); } -TCS::StatusCode -TCS::cTauMultiplicity::process( const TCS::InputTOBArray & input, Count & count ) +TCS::StatusCode TCS::cTauMultiplicity::process( const TCS::InputTOBArray & input, Count & count ) { - - // Grab the threshold and cast it into the right type - const auto& cTauThr = dynamic_cast<const TrigConf::L1Threshold_cTAU &>(*m_threshold); - - const cTauTOBArray & cTaus = dynamic_cast<const cTauTOBArray&>(input); + const cTauTOBArray& cTaus = dynamic_cast<const cTauTOBArray&>(input); int counting = 0; // Loop over eTau candidates @@ -86,64 +82,72 @@ TCS::cTauMultiplicity::process( const TCS::InputTOBArray & input, Count & count bool isMatched = false; // Is the eTau matched to a jTau? bool isIsolated = false; // If matched: does the resulting cTau pass the isolation cut? float isolation_partial_loose = 0; // cTau Loose partial isolation (0 if no match is found) - float isolation_partial_medium = 0; // cTau Medium partial isolation (0 if no match is found) + float isolation_partial_medium = 0; // cTau Medium partial isolation (0 if no match is found) + float isolation_partial_medium12 = 0; // cTau Medium12 partial isolation (0 if no match is found) + float isolation_partial_medium20 = 0; // cTau Medium20 partial isolation (0 if no match is found) + float isolation_partial_medium30 = 0; // cTau Medium30 partial isolation (0 if no match is found) + float isolation_partial_medium35 = 0; // cTau Medium35 partial isolation (0 if no match is found) float isolation_partial_tight = 0; // cTau Tight partial isolation (0 if no match is found) - unsigned int isoScore = 0; // cTau isolation score (0 if no match is found) // Loop over jTau candidates - for(cTauTOBArray::const_iterator jtauCand = cTaus.begin(); jtauCand != cTaus.end(); ++jtauCand ) { + for(cTauTOBArray::const_iterator jtauCand = cTaus.begin(); jtauCand != cTaus.end(); ++jtauCand) { if((*jtauCand)->tobType() != TCS::JTAU) continue; isMatched = cTauMatching( *etauCand, *jtauCand ); - if (isMatched) { + if(isMatched) { // Updated isolation condition, WP-dependent (ATR-28641) // "Partial" isolation formula: I = (E_T^{jTAU Iso} + jTAUCoreScale * E_T^{jTAU Core}) / E_T^{eTAU} // This formula is missing the eTAU Core substraction from the numerator, grouped with the isolation cut value isolation_partial_loose = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Loose")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring - isolation_partial_medium = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring + isolation_partial_loose = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring + isolation_partial_medium12 = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium12")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring + isolation_partial_medium20 = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium20")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring + isolation_partial_medium30 = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium30")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring + isolation_partial_medium35 = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Medium35")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring isolation_partial_tight = (static_cast<float>((*jtauCand)->EtIso()) + m_isoFW_CTAU_jTAUCoreScale.at("Tight")/1024.0 * static_cast<float>((*jtauCand)->Et())) / static_cast<float>((*etauCand)->Et()); // Internal variable for monitoring // Old isolation condition coded as in firmware: https://indico.cern.ch/event/1079697/contributions/4541419/attachments/2315137/3940824/cTAU_FirmwareAlgoProposal.pdf page 8 - isoScore = convertIsoToBit( *etauCand, *jtauCand ); - isIsolated = isocut( TrigConf::Selection::wpToString(cTauThr.isolation()), isoScore ); + isIsolated = checkIsolationWP(*etauCand, *jtauCand, TrigConf::Selection::wpToString(m_threshold->isolation())); break; // Break loop when a match is found } } // End of jTau loop // Fill cTau TOB histograms before threshold cuts (matched cTaus only) - if (isMatched) { - fillHist1D( m_histcTauEt[0], (*etauCand)->EtDouble() ); - fillHist2D( m_histcTauPhiEta[0], (*etauCand)->eta(), (*etauCand)->phi() ); - fillHist2D( m_histcTauEtEta[0], (*etauCand)->eta(), (*etauCand)->EtDouble() ); - fillHist1D( m_histcTauPartialIsoLoose[0], isolation_partial_loose ); - fillHist1D( m_histcTauPartialIsoMedium[0], isolation_partial_medium ); - fillHist1D( m_histcTauPartialIsoTight[0], isolation_partial_tight ); - fillHist1D( m_histcTauIsoScore[0], isoScore ); + if(isMatched) { + fillHist1D(m_histcTauEt[0], (*etauCand)->EtDouble()); + fillHist2D(m_histcTauPhiEta[0], (*etauCand)->eta(), (*etauCand)->phi()); + fillHist2D(m_histcTauEtEta[0], (*etauCand)->eta(), (*etauCand)->EtDouble()); + fillHist1D(m_histcTauPartialIsoLoose[0], isolation_partial_loose); + fillHist1D(m_histcTauPartialIsoMedium[0], isolation_partial_medium); + fillHist1D(m_histcTauPartialIsoMedium12[0], isolation_partial_medium12); + fillHist1D(m_histcTauPartialIsoMedium20[0], isolation_partial_medium20); + fillHist1D(m_histcTauPartialIsoMedium30[0], isolation_partial_medium30); + fillHist1D(m_histcTauPartialIsoMedium35[0], isolation_partial_medium35); + fillHist1D(m_histcTauPartialIsoTight[0], isolation_partial_tight); + fillHist1D(m_histcTauIsoMatchedPass[0], isMatched && isIsolated); } - // This is a good cTau - if ( isMatched && isIsolated ) { accept = true; } - // This is a non-matched eTau - if ( not isMatched ) { accept = true; } + if(isMatched && isIsolated) accept = true; // This is a good matched cTau + if(!isMatched) accept = true; // This is a non-matched eTau // Menu threshold uses 0.1 eta granularity but eFex objects have 0.025 eta granularity // eFex eta is calculated as 4*eta_tower (0.1 gran.) + seed (0.025 gran.), eta from -25 to 24 int eta_thr; - if ( (*etauCand)->eta()%4 >= 0 ) { eta_thr = (*etauCand)->eta() - (*etauCand)->eta()%4; } - else { eta_thr = (*etauCand)->eta() - (*etauCand)->eta()%4 - 4; } + if((*etauCand)->eta()%4 >= 0) eta_thr = (*etauCand)->eta() - (*etauCand)->eta()%4; + else eta_thr = (*etauCand)->eta() - (*etauCand)->eta()%4 - 4; - accept = accept && (*etauCand)->Et() > cTauThr.thrValue100MeV(eta_thr/4); // Convert eta_thr to units of 0.1 to pass as an argument - if (accept) { + accept = accept && (*etauCand)->Et() > m_threshold->thrValue100MeV(eta_thr/4); // Convert eta_thr to units of 0.1 to pass as an argument + if(accept) { counting++; - fillHist2D( m_histAccept[0], (*etauCand)->eta(), (*etauCand)->EtDouble() ); + fillHist2D(m_histAccept[0], (*etauCand)->eta(), (*etauCand)->EtDouble()); } } // End of eTau loop - fillHist1D( m_histAccept[1], counting); + fillHist1D(m_histAccept[1], counting); // Pass counting to TCS::Count object - output bits are composed there @@ -154,21 +158,14 @@ TCS::cTauMultiplicity::process( const TCS::InputTOBArray & input, Count & count } -unsigned int -TCS::cTauMultiplicity::convertIsoToBit(const TCS::cTauTOB * etauCand, const TCS::cTauTOB * jtauCand) const { - unsigned int bit = 0; - - // Assign the tightest accept WP as default bit - if( jtauCand->EtIso()*1024 + jtauCand->Et()*m_isoFW_CTAU_jTAUCoreScale.at("Loose") < etauCand->Et()*m_isoFW_CTAU.at("Loose") ) bit = 1; - if( jtauCand->EtIso()*1024 + jtauCand->Et()*m_isoFW_CTAU_jTAUCoreScale.at("Medium") < etauCand->Et()*m_isoFW_CTAU.at("Medium") ) bit = 2; - if( jtauCand->EtIso()*1024 + jtauCand->Et()*m_isoFW_CTAU_jTAUCoreScale.at("Tight") < etauCand->Et()*m_isoFW_CTAU.at("Tight") ) bit = 3; - - return bit; +bool TCS::cTauMultiplicity::checkIsolationWP(const TCS::cTauTOB* etauCand, const TCS::cTauTOB* jtauCand, const std::string& isolation_wp) const { + if(isolation_wp == "None") return true; + if(jtauCand->EtIso()*1024 + jtauCand->Et()*m_isoFW_CTAU_jTAUCoreScale.at(isolation_wp) < etauCand->Et()*m_isoFW_CTAU.at(isolation_wp)) return true; + return false; } -bool -TCS::cTauMultiplicity::cTauMatching(const TCS::cTauTOB * etauCand, const TCS::cTauTOB * jtauCand) const { +bool TCS::cTauMultiplicity::cTauMatching(const TCS::cTauTOB* etauCand, const TCS::cTauTOB* jtauCand) const { bool matching = false; @@ -177,11 +174,11 @@ TCS::cTauMultiplicity::cTauMatching(const TCS::cTauTOB * etauCand, const TCS::cT // eTau eta = 4*eta_tower + seed, eta from -25 to 24 int eTauEtaTower; - if (etauCand->eta()%4 >= 0 ) { eTauEtaTower = etauCand->eta() - etauCand->eta()%4; } - else { eTauEtaTower = etauCand->eta() - etauCand->eta()%4 - 4; } + if(etauCand->eta()%4 >= 0 ) eTauEtaTower = etauCand->eta() - etauCand->eta()%4; + else eTauEtaTower = etauCand->eta() - etauCand->eta()%4 - 4; int jTauEtaTower; - if (jtauCand->eta()%4 >= 0 ) { jTauEtaTower = jtauCand->eta() - jtauCand->eta()%4; } - else { jTauEtaTower = jtauCand->eta() - jtauCand->eta()%4 - 4; } + if (jtauCand->eta()%4 >= 0 ) jTauEtaTower = jtauCand->eta() - jtauCand->eta()%4; + else jTauEtaTower = jtauCand->eta() - jtauCand->eta()%4 - 4; //int jTauEtaTower = jtauCand->eta(); // jTau eta = 4*eta_tower unsigned int eTauPhiTower = etauCand->phi() >> 1; // eTau phi = 2*phi_tower @@ -196,32 +193,31 @@ TCS::cTauMultiplicity::cTauMatching(const TCS::cTauTOB * etauCand, const TCS::cT // Functions used by the HLT seeding #ifndef TRIGCONF_STANDALONE -size_t -TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI & eTau, const xAOD::jFexTauRoIContainer & jTauRoIs) { +size_t TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI& eTau, const xAOD::jFexTauRoIContainer& jTauRoIs) { // Return the index of the matched jTau if existent (otherwise return std::numeric_limits<size_t>::max()) size_t i_matched{std::numeric_limits<size_t>::max()}; size_t i_jTau{0}; int eTauEtaTower; - if (eTau.iEtaTopo()%4 >= 0 ) { eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4; } - else { eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4 - 4; } + if(eTau.iEtaTopo()%4 >= 0 ) eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4; + else eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4 - 4; - for (const xAOD::jFexTauRoI* jTau : jTauRoIs) { + for(const xAOD::jFexTauRoI* jTau : jTauRoIs) { // eFEX: etaTower = iEta, phiTower = iPhi // jFEX: etaTower = globalEta, phiTower = globalPhi int jTauEtaTopo = TSU::toTopoEta(jTau->eta()); int jTauEtaTower; - if (jTauEtaTopo%4 >= 0 ) { jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4; } - else { jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4 - 4; } + if(jTauEtaTopo%4 >= 0 ) jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4; + else jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4 - 4; unsigned int jTauPhiTower = TSU::toTopoPhi(jTau->phi()) >> 1; //ignore lowest bit as jTau coordinates are taken at tower center unsigned int eTauPhiTower = static_cast<unsigned int>(eTau.iPhiTopo()) >> 1; //shift eTau location in the same way to stay consistent bool matching = ( eTauEtaTower == jTauEtaTower ) && ( eTauPhiTower == jTauPhiTower ); - if ( matching ) { + if(matching) { i_matched = i_jTau; break; // Break the loop when a match is found } @@ -232,20 +228,19 @@ TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI & eTau, const xAOD::j } -bool -TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI & eTau, const xAOD::jFexTauRoI & jTau) { +bool TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI& eTau, const xAOD::jFexTauRoI& jTau) { // eFEX: etaTower = iEta, phiTower = iPhi // jFEX: etaTower = globalEta, phiTower = globalPhi int eTauEtaTower; - if (eTau.iEtaTopo()%4 >= 0 ) { eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4; } - else { eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4 - 4; } + if(eTau.iEtaTopo()%4 >= 0 ) eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4; + else eTauEtaTower = eTau.iEtaTopo() - eTau.iEtaTopo()%4 - 4; int jTauEtaTopo = TSU::toTopoEta(jTau.eta()); int jTauEtaTower; - if (jTauEtaTopo%4 >= 0 ) { jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4; } - else { jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4 - 4; } + if(jTauEtaTopo%4 >= 0 ) jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4; + else jTauEtaTower = jTauEtaTopo - jTauEtaTopo%4 - 4; unsigned int jTauPhiTower = TSU::toTopoPhi(jTau.phi()) >> 1; //ignore lowest bit as jTau coordinates are taken at tower center unsigned int eTauPhiTower = static_cast<unsigned int>(eTau.iPhiTopo()) >> 1; //shift eTau location in the same way to stay consistent @@ -255,14 +250,11 @@ TCS::cTauMultiplicity::cTauMatching(const xAOD::eFexTauRoI & eTau, const xAOD::j } -unsigned int -TCS::cTauMultiplicity::convertIsoToBit(const std::map<std::string, int>& isoFW_CTAU, const std::map<std::string, int>& isoFW_CTAU_jTAUCoreScale, const float jTauCore, const float jTauIso, const float eTauEt){ - unsigned int bit = 0; - // Assign the tightest accept WP as default bit - if( jTauIso*1024 + jTauCore*isoFW_CTAU_jTAUCoreScale.at("Loose") < eTauEt*isoFW_CTAU.at("Loose") ) bit = 1; - if( jTauIso*1024 + jTauCore*isoFW_CTAU_jTAUCoreScale.at("Medium") < eTauEt*isoFW_CTAU.at("Medium") ) bit = 2; - if( jTauIso*1024 + jTauCore*isoFW_CTAU_jTAUCoreScale.at("Tight") < eTauEt*isoFW_CTAU.at("Tight") ) bit = 3; - return bit; +bool +TCS::cTauMultiplicity::checkIsolationWP(const std::map<std::string, int>& isoFW_CTAU, const std::map<std::string, int>& isoFW_CTAU_jTAUCoreScale, const float jTauCoreEt, const float jTauIsoEt, const float eTauEt, const std::string& isolation_wp) { + if(isolation_wp == "None") return true; + if(jTauIsoEt*1024 + jTauCoreEt*isoFW_CTAU_jTAUCoreScale.at(isolation_wp) < eTauEt*isoFW_CTAU.at(isolation_wp)) return true; + return false; } #endif diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx index d7d98d80fdc5c88d6492cac0de90d9fbfbf17c12..f15675b3d3a0163115aec36f4d790972d21cd0c0 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx @@ -497,6 +497,7 @@ TopoSteeringStructure::sortingConnector(const std::string & connectorName) const } + TCS::DecisionConnector * TCS::TopoSteeringStructure::outputConnector(const std::string & output) { auto c = m_outputLookup.find(output); @@ -519,37 +520,26 @@ TCS::TopoSteeringStructure::countingConnector(const std::string & output) { void TCS::TopoSteeringStructure::setIsolationFW_CTAU(const TrigConf::L1Menu& l1menu) { - const TrigConf::L1ThrExtraInfo_cTAU &ctauExtraInfo = l1menu.thrExtraInfo().cTAU(); - - int CTAU_iso_fw_loose = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::LOOSE, 0).isolation_fw()); - int CTAU_iso_fw_medium = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::MEDIUM, 0).isolation_fw()); - int CTAU_iso_fw_tight = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::TIGHT, 0).isolation_fw()); + const TrigConf::L1ThrExtraInfo_cTAU &cTauExtraInfo = l1menu.thrExtraInfo().cTAU(); - m_isolationFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::LOOSE)] = CTAU_iso_fw_loose; - m_isolationFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::MEDIUM)] = CTAU_iso_fw_medium; - m_isolationFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::TIGHT)] = CTAU_iso_fw_tight; + using WP = TrigConf::Selection::WP; + for(const WP wp : {WP::LOOSE, WP::MEDIUM, WP::TIGHT, WP::LOOSE12, WP::LOOSE20, WP::LOOSE30, WP::LOOSE35, WP::MEDIUM12, WP::MEDIUM20, WP::MEDIUM30, WP::MEDIUM35, WP::TIGHT12, WP::TIGHT20, WP::TIGHT30, WP::TIGHT35}) { + const TrigConf::L1ThrExtraInfo_cTAU::WorkingPoints_cTAU& isol = cTauExtraInfo.isolation(wp, 0); - int CTAU_iso_fw_jTAUCoreScale_loose = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::LOOSE, 0).isolation_jTAUCoreScale_fw()); - int CTAU_iso_fw_jTAUCoreScale_medium = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::MEDIUM, 0).isolation_jTAUCoreScale_fw()); - int CTAU_iso_fw_jTAUCoreScale_tight = static_cast<int>(ctauExtraInfo.isolation(TrigConf::Selection::WP::TIGHT, 0).isolation_jTAUCoreScale_fw()); - - m_isolationFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::LOOSE)] = CTAU_iso_fw_jTAUCoreScale_loose; - m_isolationFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::MEDIUM)] = CTAU_iso_fw_jTAUCoreScale_medium; - m_isolationFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::TIGHT)] = CTAU_iso_fw_jTAUCoreScale_tight; + m_isolationFW_CTAU[TrigConf::Selection::wpToString(wp)] = static_cast<int>(isol.isolation_fw()); + m_isolationFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(wp)] = static_cast<int>(isol.isolation_jTAUCoreScale_fw()); + } } void TCS::TopoSteeringStructure::setIsolationFW_JTAU(const TrigConf::L1Menu& l1menu) { - const TrigConf::L1ThrExtraInfo_jTAU &jtauExtraInfo = l1menu.thrExtraInfo().jTAU(); - - int JTAU_iso_fw_loose = static_cast<int>(jtauExtraInfo.isolation(TrigConf::Selection::WP::LOOSE, 0).isolation_fw()); - int JTAU_iso_fw_medium = static_cast<int>(jtauExtraInfo.isolation(TrigConf::Selection::WP::MEDIUM, 0).isolation_fw()); - int JTAU_iso_fw_tight = static_cast<int>(jtauExtraInfo.isolation(TrigConf::Selection::WP::TIGHT, 0).isolation_fw()); + const TrigConf::L1ThrExtraInfo_jTAU &jTauExtraInfo = l1menu.thrExtraInfo().jTAU(); - m_isolationFW_JTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::LOOSE)] = JTAU_iso_fw_loose; - m_isolationFW_JTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::MEDIUM)] = JTAU_iso_fw_medium; - m_isolationFW_JTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::TIGHT)] = JTAU_iso_fw_tight; + using WP = TrigConf::Selection::WP; + for(const WP wp : {WP::LOOSE, WP::MEDIUM, WP::TIGHT}) { + m_isolationFW_JTAU[TrigConf::Selection::wpToString(wp)] = static_cast<int>(jTauExtraInfo.isolation(wp, 0).isolation_fw()); + } } @@ -560,21 +550,13 @@ void TCS::TopoSteeringStructure::setIsolationFW_CTAU(std::map<std::string, int>& isoFW_CTAU, std::map<std::string, int>& isoFW_CTAU_jTAUCoreScale, const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) { const TrigConf::L1ThrExtraInfo_cTAU& cTauExtraInfo = dynamic_cast<const TrigConf::L1ThrExtraInfo_cTAU&>(menuExtraInfo); - int CTAU_iso_fw_loose = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::LOOSE, 0).isolation_fw()); - int CTAU_iso_fw_medium = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::MEDIUM, 0).isolation_fw()); - int CTAU_iso_fw_tight = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::TIGHT, 0).isolation_fw()); - - isoFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::LOOSE)] = CTAU_iso_fw_loose; - isoFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::MEDIUM)] = CTAU_iso_fw_medium; - isoFW_CTAU[TrigConf::Selection::wpToString(TrigConf::Selection::WP::TIGHT)] = CTAU_iso_fw_tight; + using WP = TrigConf::Selection::WP; + for(const WP wp : {WP::LOOSE, WP::MEDIUM, WP::TIGHT, WP::LOOSE12, WP::LOOSE20, WP::LOOSE30, WP::LOOSE35, WP::MEDIUM12, WP::MEDIUM20, WP::MEDIUM30, WP::MEDIUM35, WP::TIGHT12, WP::TIGHT20, WP::TIGHT30, WP::TIGHT35}) { + const TrigConf::L1ThrExtraInfo_cTAU::WorkingPoints_cTAU& isol = cTauExtraInfo.isolation(wp, 0); - int CTAU_iso_fw_jTAUCoreScale_loose = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::LOOSE, 0).isolation_jTAUCoreScale_fw()); - int CTAU_iso_fw_jTAUCoreScale_medium = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::MEDIUM, 0).isolation_jTAUCoreScale_fw()); - int CTAU_iso_fw_jTAUCoreScale_tight = static_cast<int>(cTauExtraInfo.isolation(TrigConf::Selection::WP::TIGHT, 0).isolation_jTAUCoreScale_fw()); - - isoFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::LOOSE)] = CTAU_iso_fw_jTAUCoreScale_loose; - isoFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::MEDIUM)] = CTAU_iso_fw_jTAUCoreScale_medium; - isoFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(TrigConf::Selection::WP::TIGHT)] = CTAU_iso_fw_jTAUCoreScale_tight; + isoFW_CTAU[TrigConf::Selection::wpToString(wp)] = static_cast<int>(isol.isolation_fw()); + isoFW_CTAU_jTAUCoreScale[TrigConf::Selection::wpToString(wp)] = static_cast<int>(isol.isolation_jTAUCoreScale_fw()); + } } #endif diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/CountingAlg.h b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/CountingAlg.h index b206da4a02d7a66e67e2cd03629f873d7406299e..008faf4cd2f1370f59ee7e4cc1e3bd29957ea20c 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/CountingAlg.h +++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/CountingAlg.h @@ -50,15 +50,6 @@ namespace TCS { std::vector<std::string> m_histAccept; // vector of strings for histogram names - // cTau monitoring histograms - std::vector<std::string> m_histcTauEt; - std::vector<std::string> m_histcTauPhiEta; - std::vector<std::string> m_histcTauEtEta; - std::vector<std::string> m_histcTauPartialIsoLoose; - std::vector<std::string> m_histcTauPartialIsoMedium; - std::vector<std::string> m_histcTauPartialIsoTight; - std::vector<std::string> m_histcTauIsoScore; - private: virtual StatusCode doReset(); diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py index 37af2f38cfe4cb5190c9c2fe8f0841ebe75886c4..c1907cff91ea88b83f067e3687f54d4c3f751729 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py @@ -797,7 +797,7 @@ class cTauThreshold( Threshold ): return self def setIsolation(self, isolation = "None"): - allowed = [ "None", "Loose", "Medium", "Tight" ] + allowed = [ "None", "Loose", "Medium", "Tight", "Loose12", "Loose20", "Loose30", "Loose35", "Medium12", "Medium20", "Medium30", "Medium35", "Tight12", "Tight20", "Tight30", "Tight35"] if isolation not in allowed: raise RuntimeError("Threshold %s of type %s: isolation wp %s not allowed for isolation, must be one of %s", self.name, self.ttype, isolation, ', '.join(allowed) ) self.isolation = isolation diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py index 8083a98a4aedb8e0ba69a3ba05cb235d3bedf8c5..2d84eaa2cd962ffad11e79c1673248b54583cf64 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py @@ -193,7 +193,7 @@ class ThresholdDef: # cTAU cTAU_cuts = [12, 20, 30, 35] for thrV in cTAU_cuts: - cTauThreshold('cTAU%iM' % thrV, 'cTAU').setEt(get_threshold_cut('cTAU', thrV)).setIsolation( isolation = "Medium" ) + cTauThreshold('cTAU%iM' % thrV, 'cTAU').setEt(get_threshold_cut('cTAU', thrV)).setIsolation( isolation = f'Medium{thrV}' ) # cTAU SPARES for thrV in range(1,3): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py index 1f771b65c80f58a1cbb492354677af9a3612324d..317bb5c4a0b88902edf091747e414b9d02fbe00e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py @@ -420,54 +420,68 @@ getConfig_eTAU = L1Config_eTAU() @dataclass -class L1Config_cTAU(): +class L1Config_cTAU: # cTAU isolation parameters (ATR-28621): # isolation: 12 bits (0 - 4095) # jTAUCoreScale: 11 bits (0 - 2047) # (jTAU.EtIso + isolation_jTAUCoreScale_fw/1024 * jTAU.Et) / eTAU.Et < isolation_fw/1024 -> pass + # Generic L, M and T WPs, for the cTAUSpare1/2 isolation_fw_loose: int = 410 - isolation_fw_medium: int = 358 - isolation_fw_tight: int = 307 - isolation_jTAUCoreScale_fw_loose: int = 0 + + isolation_fw_medium: int = 410 isolation_jTAUCoreScale_fw_medium: int = 0 + + isolation_fw_tight: int = 307 isolation_jTAUCoreScale_fw_tight: int = 0 + # Dedicated M thresholds for the primary items: + #cTAU12M (Medium12) + isolation_fw_medium12: int = 358 + isolation_jTAUCoreScale_fw_medium12: int = 0 + + #cTAU20M (Medium20) + isolation_fw_medium20: int = 358 + isolation_jTAUCoreScale_fw_medium20: int = 0 + + #cTAU30M (Medium30) + isolation_fw_medium30: int = 358 + isolation_jTAUCoreScale_fw_medium30: int = 0 + + #cTAU35M (Medium35) + isolation_fw_medium35: int = 358 + isolation_jTAUCoreScale_fw_medium35: int = 0 + + def __post_init__(self): + # By default, duplicate the configs of isolation_fw_loose and isolation_fw_tight: + for default_wp, wp_list in {'Loose': ['Loose12', 'Loose20', 'Loose30', 'Loose35'], 'Tight': ['Tight12', 'Tight20', 'Tight30', 'Tight35']}.items(): + for wp in wp_list: + setattr(self, f'isolation_fw_{wp.lower()}', getattr(self, f'isolation_fw_{default_wp.lower()}')) + setattr(self, f'isolation_jTAUCoreScale_fw_{wp.lower()}', getattr(self, f'isolation_jTAUCoreScale_fw_{default_wp.lower()}')) def __call__(self) -> odict: confObj = odict() - confObj["workingPoints"] = odict() - confObj["workingPoints"]["Loose"] = [ + confObj['workingPoints'] = odict() - odict([("isolation", cTAUfwToFlowConversion(self.isolation_fw_loose)), ("isolation_fw", self.isolation_fw_loose), - ("isolation_jTAUCoreScale", cTAUfwToFlowConversion(self.isolation_jTAUCoreScale_fw_loose)), ("isolation_jTAUCoreScale_fw", self.isolation_jTAUCoreScale_fw_loose)]), - ] - confObj["workingPoints"]["Medium"] = [ - odict([("isolation", cTAUfwToFlowConversion(self.isolation_fw_medium)), ("isolation_fw", self.isolation_fw_medium), - ("isolation_jTAUCoreScale", cTAUfwToFlowConversion(self.isolation_jTAUCoreScale_fw_medium)), ("isolation_jTAUCoreScale_fw", self.isolation_jTAUCoreScale_fw_medium)]), - ] - confObj["workingPoints"]["Tight"] = [ - odict([("isolation", cTAUfwToFlowConversion(self.isolation_fw_tight)), ("isolation_fw", self.isolation_fw_tight), - ("isolation_jTAUCoreScale", cTAUfwToFlowConversion(self.isolation_jTAUCoreScale_fw_tight)), ("isolation_jTAUCoreScale_fw", self.isolation_jTAUCoreScale_fw_tight)]), - ] - confObj["resolutionMeV"] = 100 + for wp in ['Loose', 'Medium', 'Tight', 'Loose12', 'Loose20', 'Loose30', 'Loose35', 'Medium12', 'Medium20', 'Medium30', 'Medium35', 'Tight12', 'Tight20', 'Tight30', 'Tight35']: + confObj['workingPoints'][wp] = [ + odict([('isolation', cTAUfwToFlowConversion(getattr(self, f'isolation_fw_{wp.lower()}'))), ('isolation_fw', getattr(self, f'isolation_fw_{wp.lower()}')), + ('isolation_jTAUCoreScale', cTAUfwToFlowConversion(getattr(self, f'isolation_jTAUCoreScale_fw_{wp.lower()}'))), ('isolation_jTAUCoreScale_fw', getattr(self, f'isolation_jTAUCoreScale_fw_{wp.lower()}'))]), + ] + + confObj['resolutionMeV'] = 100 # Check that FW values are integers - for wp in confObj["workingPoints"]: - for ssthr in confObj["workingPoints"][wp]: + for wp in confObj['workingPoints']: + for ssthr in confObj['workingPoints'][wp]: for ssthr_i in ssthr: - if "_fw" in ssthr_i: + if '_fw' in ssthr_i: if not isinstance(ssthr[ssthr_i], int): - raise RuntimeError("Threshold %s in cTAU configuration is not an integer!", ssthr_i ) + raise RuntimeError(f'Threshold {ssthr_i} in cTAU configuration is not an integer!') elif ssthr[ssthr_i] < 0: - raise RuntimeError("Threshold %s in cTAU configuration is negative!", ssthr_i ) + raise RuntimeError('Threshold {ssthr_i} in cTAU configuration is negative!') - # Check that T >= M >= L [ATR-27796] - # Ordering is inverted here: larger value is looser - for var in ["isolation_fw"]: - validate_ordering(var,"Medium","Loose",confObj["workingPoints"]) - validate_ordering(var,"Tight","Medium",confObj["workingPoints"]) return confObj getConfig_cTAU = L1Config_cTAU()