diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py index 532cd77119c09657053c083b43baf2b7e45dd2fc..8e9c601b0ea3d6300075cbb41cea3e61c61f6607 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py @@ -41,33 +41,21 @@ monitoring_tau = [ ] monitoring_tau_pp = [ - 'tau0_perf_ptonly_L1TAU12', - 'tau0_perf_ptonly_L1TAU60', + 'tau80_medium1_tracktwo_L1TAU60', 'tau0_perf_ptonly_L1TAU100', - 'tau35_mediumRNN_tracktwoMVA_L1TAU12IM', - 'tau25_idperf_track_L1TAU12IM', - 'tau25_idperf_tracktwo_L1TAU12IM', - 'tau25_perf_tracktwo_L1TAU12IM', - 'tau25_medium1_tracktwo_L1TAU12IM', - 'tau25_idperf_tracktwoMVA_L1TAU12IM', - 'tau25_perf_tracktwoMVA_L1TAU12IM', - 'tau25_medium1_tracktwoMVA_L1TAU12IM', - 'tau25_verylooseRNN_tracktwoMVA_L1TAU12IM', - 'tau25_looseRNN_tracktwoMVA_L1TAU12IM', - 'tau25_mediumRNN_tracktwoMVA_L1TAU12IM', - 'tau25_tightRNN_tracktwoMVA_L1TAU12IM', - 'tau25_verylooseRNN_tracktwo_L1TAU12IM', - 'tau25_looseRNN_tracktwo_L1TAU12IM', - 'tau25_mediumRNN_tracktwo_L1TAU12IM', - 'tau25_tightRNN_tracktwo_L1TAU12IM', - 'tau25_medium1_tracktwoEF_L1TAU12IM', 'tau160_idperf_track_L1TAU100', 'tau160_idperf_tracktwo_L1TAU100', 'tau160_perf_tracktwo_L1TAU100', 'tau160_idperf_tracktwoMVA_L1TAU100', 'tau160_perf_tracktwoMVA_L1TAU100', - 'tau160_mediumRNN_tracktwoMVA_L1TAU100' - + 'tau160_mediumRNN_tracktwoMVA_L1TAU100', + 'tau160_medium1_tracktwo_L1TAU100', + 'tau160_medium1_tracktwoEF_L1TAU100', + 'tau200_medium1_tracktwoEF_L1TAU100', + 'tau200_mediumRNN_tracktwoMVA_L1TAU100', + 'tau80_mediumRNN_tracktwoMVA_tau60_mediumRNN_tracktwoMVA_L1TAU60_2TAU40', + 'tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I', + 'tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1DR-TAU20ITAU12I-J25' ] monitoring_tau_validation = [ diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py index 39bb1eb68b9ecf35e8ef9ada2ffdaad95e1a1f45..b2d5fc270f6130a0d02701bfee64a489a5ec1d22 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py @@ -75,7 +75,23 @@ class TrigTauMonAlgBuilder: self.configureHistograms() + def getTrigInfo( self, trigger ): + class TrigTauInfo(object): + + def __init__(self, trigger): + self.__chain = trigger + + def chain(self): + return self.__chain + + def isL1Item(self): + return True if self.chain().startswith('L1') else False + + def isRNN(self): + return True if "RNN" in self.chain() else False + + return TrigTauInfo(trigger) def get_monitoring_mode(self): @@ -119,7 +135,24 @@ class TrigTauMonAlgBuilder: def setDefaultProperties(self): # This will be removed for future. - monitoring_tau = ['HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM'] + monitoring_tau = [ + 'HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM', + 'HLT_tau80_medium1_tracktwo_L1TAU60', + 'HLT_tau0_perf_ptonly_L1TAU100', + 'HLT_tau160_idperf_track_L1TAU100', + 'HLT_tau160_idperf_tracktwo_L1TAU100', + 'HLT_tau160_perf_tracktwo_L1TAU100', + 'HLT_tau160_idperf_tracktwoMVA_L1TAU100', + 'HLT_tau160_perf_tracktwoMVA_L1TAU100', + 'HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100', + 'HLT_tau160_medium1_tracktwo_L1TAU100', + 'HLT_tau160_medium1_tracktwoEF_L1TAU100', + 'HLT_tau200_medium1_tracktwoEF_L1TAU100', + 'HLT_tau200_mediumRNN_tracktwoMVA_L1TAU100', + 'HLT_tau80_mediumRNN_tracktwoMVA_tau60_mediumRNN_tracktwoMVA_L1TAU60_2TAU40', + 'HLT_tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I', + 'HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1DR-TAU20ITAU12I-J25' + ] self.tauList = monitoring_tau @@ -149,8 +182,11 @@ class TrigTauMonAlgBuilder: self.__logger.info( "Booking all histograms for alg: %s", monAlg.name ) for trigger in triggers: - self.bookRNNInputVars( monAlg, trigger, online=True ) - self.bookRNNInputVars( monAlg, trigger, online=False ) + info = self.getTrigInfo(trigger) + + if info.isRNN() is True: + self.bookRNNInputVars( monAlg, trigger, online=True ) + self.bookRNNInputVars( monAlg, trigger, online=False ) # diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauInfo.h b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..504ee9d4f5daa49a9f98063f61fdb9736b8367c8 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauInfo.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +// Trigger Information struct +typedef struct _trigtauinfo +{ + std::string trigName; //Trigger Name + std::string trigWP; //Trigger ID working point + std::string trigL1Item; //L1 item for HLT + std::string trigL1Type; //VHI + std::string trigType; //Chain Type + bool isL1; // Level1 Trigger + bool isRNN; // is RNN chain + bool isBDT; // is BDT chain + bool isPerf; // Performance chain + float HLTthr; // HLT Et threshold + float L1thr; // L1 Et threshold + bool trigIsEmulation; +} TrigInfo; diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx index 25472995aabe69b5ed351da5e908bc280c124447..464d909b135c4e0162e89b252ccb89134dfec8dc 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx @@ -23,6 +23,19 @@ StatusCode TrigTauMonitorAlgorithm::initialize() { ATH_CHECK( m_hltTauJetCaloOnlyKey.initialize() ); ATH_CHECK( m_trigDecTool.retrieve() ); + for(const auto& trigName:m_trigInputList) + { + if(getTrigInfoMap().count(trigName) != 0){ + ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); + }else { + ATH_MSG_INFO("Filling trigger info map"); + m_trigList.push_back(trigName); + ATH_MSG_INFO("Check1"); + setTrigInfo(trigName); + ATH_MSG_INFO("Check2"); + } + } + return AthMonitorAlgorithm::initialize(); } @@ -37,13 +50,15 @@ StatusCode TrigTauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co return StatusCode::SUCCESS; } - ATH_MSG_DEBUG("Chains for Analysis " << m_trigInputList); + ATH_MSG_DEBUG("Chains for Analysis " << m_trigList); std::vector< std::pair<const xAOD::TauJet*, const TrigCompositeUtils::Decision*>> pairObjs; - for(const auto& trigger : m_trigInputList){ + for(const auto& trigger : m_trigList){ + + const TrigInfo info = getTrigInfo(trigger); - if ( executeNavigation( ctx, trigger,25,"mediumRNN", pairObjs).isFailure() ) + if ( executeNavigation( ctx, info.trigName,info.HLTthr,info.trigWP, pairObjs).isFailure() ) { ATH_MSG_WARNING("executeNavigation failed"); return StatusCode::SUCCESS; @@ -107,6 +122,8 @@ StatusCode TrigTauMonitorAlgorithm::executeNavigation( const EventContext& ctx, void TrigTauMonitorAlgorithm::fillDistributions(std::vector< std::pair< const xAOD::TauJet*, const TrigCompositeUtils::Decision * >> pairObjs, std::string trigger) const { + const TrigInfo info = getTrigInfo(trigger); + // Offline std::vector<const xAOD::TauJet*> tau_vec; for( auto pairObj: pairObjs ) @@ -115,7 +132,20 @@ void TrigTauMonitorAlgorithm::fillDistributions(std::vector< std::pair< const xA } // Offline - fillRNNInputVars( trigger, tau_vec, false ); + if(info.isRNN && tau_vec.size()>0) fillRNNInputVars( trigger, tau_vec, false ); + + tau_vec.clear(); + + auto vec = m_trigDecTool->features<xAOD::TauJetContainer>(trigger,TrigDefs::includeFailedDecisions ,"HLT_TrigTauRecMerged_MVA" ); + for( auto &featLinkInfo : vec ){ + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + // If not pass, continue + tau_vec.push_back(feat); + } + if(info.isRNN && tau_vec.size()>0) fillRNNInputVars( trigger, tau_vec, true ); + + } @@ -165,7 +195,51 @@ void TrigTauMonitorAlgorithm::fillRNNInputVars(const std::string trigger, std::v }return detail;}); auto ptDetectorAxis = Monitored::Collection("ptDetectorAxis", tau_vec, [] (const xAOD::TauJet* tau){ return TMath::Log10(std::min(tau->ptDetectorAxis() / 1000.0, 100.0));}); - + fill(monGroup, centFrac,etOverPtLeadTrk,dRmax,absipSigLeadTrk,sumPtTrkFrac,emPOverTrkSysP,ptRatioEflowApprox,mEflowApprox,ptDetectorAxis); } + + +TrigInfo TrigTauMonitorAlgorithm::getTrigInfo(const std::string trigger) const{ + return m_trigInfo.at(trigger); +} + + +void TrigTauMonitorAlgorithm::setTrigInfo(const std::string trigger) +{ + + std::string idwp="",type="",l1item="",l1type=""; + float hlthr=0.,l1thr=0.; + bool isRNN=false,isBDT=false,isPerf=false,isL1=false; + + size_t l=trigger.length(); + size_t pos=trigger.find("_"); + std::string substr =trigger.substr(pos+1,l); + std::vector<std::string> names; + names.push_back(trigger.substr(0,pos)); + + while(substr.find("_")!=std::string::npos) + { + pos = substr.find("_"); + names.push_back(substr.substr(0,pos)); + substr = substr.substr(pos+1,substr.length()); + } + + names.push_back(substr); + + hlthr = std::stof(names[1].substr(3,names[1].length())); + idwp=names[2]; + + if(idwp=="perf" || idwp=="idperf") isPerf=true; + else if(idwp.find("RNN")!=std::string::npos) isRNN=true; + else isBDT=true; + + type=names[4]; + if(names[0].find("L1")!=std::string::npos) isL1=true; + + TrigInfo info{trigger,idwp,l1item,l1type,type,isL1,isRNN,isBDT,isPerf,hlthr,l1thr,false}; + + m_trigInfo[trigger] = info; +} + diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h index 1e38d15898d16a6cd58dce85b6f0b536e735ef13..7cb7e0f663f21bcb127ba4cc8045894e626c3940 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h @@ -10,6 +10,7 @@ #include "xAODTau/TauxAODHelpers.h" #include "xAODTau/TauJetContainer.h" +#include "TrigTauInfo.h" #include "AthenaMonitoring/AthMonitorAlgorithm.h" #include "AthenaMonitoringKernel/Monitored.h" @@ -23,8 +24,21 @@ class TrigTauMonitorAlgorithm : public AthMonitorAlgorithm { virtual StatusCode initialize() override; virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + std::map<std::string,TrigInfo> m_trigInfo; + + std::map<std::string,TrigInfo> getTrigInfoMap() { return m_trigInfo; } + + TrigInfo getTrigInfo(const std::string) const; + + void setTrigInfo(const std::string); + + /*! List of triggers to study */ + std::vector<std::string> m_trigList; + /*! List of triggers from menu */ Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}};