diff --git a/Event/xAOD/xAODTrigger/Root/TrigDecisionAuxInfo_v1.cxx b/Event/xAOD/xAODTrigger/Root/TrigDecisionAuxInfo_v1.cxx index e7de0c899e4961dfbcf945f81554e82113c18250..e958f4b05636f8431b09f23dc6f09337a3810161 100644 --- a/Event/xAOD/xAODTrigger/Root/TrigDecisionAuxInfo_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/TrigDecisionAuxInfo_v1.cxx @@ -37,10 +37,6 @@ namespace xAOD { AUX_VARIABLE( lvl2Resurrected ); AUX_VARIABLE( efResurrected ); - // Extended July 2018 - AUX_VARIABLE( chainMTPassedRaw ); - AUX_VARIABLE( chainMTPrescaled ); - AUX_VARIABLE( chainMTRerun ); } } // namespace xAOD diff --git a/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx b/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx index 0855fa74a82039765cde7f0036a4363862802eb6..9cf1dca6cd4394890cb7c16626cc60f5394a39dd 100644 --- a/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx @@ -94,74 +94,6 @@ namespace xAOD { // ///////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////// - // - // Additions for AthenaMT Trigger / Run 3 - - - const std::vector< ::TrigCompositeUtils::DecisionID >& TrigDecision_v1::chainMTPassedRaw() const { - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTPassedRaw" ); - return acc( *this ); - } - - void TrigDecision_v1::setChainMTPassedRaw( std::vector< ::TrigCompositeUtils::DecisionID > value ) { - std::sort(value.begin(), value.end()); // Clone vector and enforce weak ordering to be able to binary_search - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTPassedRaw" ); - acc( *this ) = value; - return; - } - - const std::vector< ::TrigCompositeUtils::DecisionID >& TrigDecision_v1::chainMTPrescaled() const { - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTPrescaled" ); - return acc( *this ); - } - - void TrigDecision_v1::setChainMTPrescaled( std::vector< ::TrigCompositeUtils::DecisionID > value ) { - std::sort(value.begin(), value.end()); // Clone vector and enforce weak ordering to be able to binary_search - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTPrescaled" ); - acc( *this ) = value; - return; - } - - const std::vector< ::TrigCompositeUtils::DecisionID >& TrigDecision_v1::chainMTRerun() const { - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTRerun" ); - return acc( *this ); - } - - void TrigDecision_v1::setChainMTRerun( std::vector< ::TrigCompositeUtils::DecisionID > value ) { - std::sort(value.begin(), value.end()); // Clone vector and enforce weak ordering to be able to binary_search - static Accessor< std::vector< ::TrigCompositeUtils::DecisionID > > acc( "chainMTRerun" ); - acc( *this ) = value; - return; - } - - bool TrigDecision_v1::isPassed( ::TrigCompositeUtils::DecisionID id ) const { - return std::binary_search(chainMTPassedRaw().begin(), chainMTPassedRaw().end(), id); - } - - bool TrigDecision_v1::isPassed( const std::string& hltChainName ) const { - return isPassed(::TrigConf::HLTUtils::string2hash( hltChainName, "Identifier" )); - } - - bool TrigDecision_v1::isPrescaled( ::TrigCompositeUtils::DecisionID id ) const { - return std::binary_search(chainMTPrescaled().begin(), chainMTPrescaled().end(), id); - } - - bool TrigDecision_v1::isPrescaled( const std::string& hltChainName ) const { - return isPrescaled(::TrigConf::HLTUtils::string2hash( hltChainName, "Identifier" )); - } - - bool TrigDecision_v1::isRerun( ::TrigCompositeUtils::DecisionID id ) const { - return std::binary_search(chainMTRerun().begin(), chainMTRerun().end(), id); - } - - bool TrigDecision_v1::isRerun( const std::string& hltChainName ) const { - return isRerun(::TrigConf::HLTUtils::string2hash( hltChainName, "Identifier" )); - } - - // - ///////////////////////////////////////////////////////////////////////////// - } // namespace xAOD /// Prints space separated positions of set bits from input bitset stored in vector @@ -190,8 +122,11 @@ std::ostream& operator<<(std::ostream& s, const xAOD::TrigDecision_v1& td) { writeBits(s, td.tav()); s << " Error Bits: L2Err=" << td.lvl2ErrorBits() << " L2Truncated=" << td.lvl2Truncated(); s << " EF/HLTErr=" << td.efErrorBits() << " EF/HLTTrucated=" << td.efTruncated() << std::endl; - // Run 1 & 2 support - if (td.lvl2PassedPhysics().size()) { + // Run 1 + bool r1 = false; + if (td.lvl2Prescaled().size() || td.lvl2PassedPhysics().size() || td.lvl2PassedRaw().size() + || td.lvl2Resurrected().size() || td.lvl2PassedThrough().size() ) { + r1 = true; s << " L2 Prescaled: "; writeBits(s, td.lvl2Prescaled()); s << " L2 Passed Physics: "; @@ -202,27 +137,24 @@ std::ostream& operator<<(std::ostream& s, const xAOD::TrigDecision_v1& td) { writeBits(s, td.lvl2Resurrected()); s << " L2 Passedthrough: "; writeBits(s, td.lvl2PassedThrough()); + } else { + s << " No L2 Bits" << std::endl; } - const std::string level = (td.lvl2PassedPhysics().size() ? "EF" : "HLT"); - if (td.efPassedPhysics().size()) { // Run 1: EF, Run 2: HLT - s << " " << level << " Prescaled: "; + const std::string level = (r1 ? " EF" : " HLT"); + if (td.efPrescaled().size() || td.efPassedPhysics().size() || td.efPassedRaw().size() + || td.efResurrected().size() || td.efPassedThrough().size() ) { // Run 1: EF, Runs 2, 3: HLT + s << level << " Prescaled: "; writeBits(s, td.efPrescaled()); - s << " " << level << " Passed Physics: "; + s << level << " Passed Physics: "; writeBits(s, td.efPassedPhysics()); - s << " " << level << " Passed Raw: "; + s << level << " Passed Raw: "; writeBits(s, td.efPassedRaw()); - s << " " << level << " Resurrected/Rerun: "; + s << level << " Resurrected/Rerun: "; writeBits(s, td.efResurrected()); - s << " " << level << " Passedthrough: "; + s << level << " Passedthrough: "; writeBits(s, td.efPassedThrough()); - } else { // Run 3 - s << " HLT Prescaled: "; - for (::TrigCompositeUtils::DecisionID ID : td.chainMTPrescaled()) s << ID << " "; - s << std::endl << " HLT Passed Raw: "; - for (::TrigCompositeUtils::DecisionID ID : td.chainMTPassedRaw()) s << ID << " "; - s << std::endl << " HLT Resurrected/Rerun: "; - for (::TrigCompositeUtils::DecisionID ID : td.chainMTRerun()) s << ID << " "; - s << std::endl; + } else { + s << " No EF/HLT Bits" << std::endl; } return s; } diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecisionAuxInfo_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecisionAuxInfo_v1.h index ced77f2a735419b2f5732a662bd7a241065cea47..e3b7761a4bd8bff1988ec5fbf2b3cb00f841137d 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecisionAuxInfo_v1.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecisionAuxInfo_v1.h @@ -70,14 +70,6 @@ namespace xAOD { std::vector< uint32_t > efResurrected; /// @} - /// @name HLT result variables. Run 3. Extended July 2018 - /// @{ - // typedef unsigned int DecisionID; - std::vector< ::TrigCompositeUtils::DecisionID > chainMTPassedRaw; - std::vector< ::TrigCompositeUtils::DecisionID > chainMTPrescaled; - std::vector< ::TrigCompositeUtils::DecisionID > chainMTRerun; - /// @} - }; // class TrigDecisionAuxInfo_v1 } // namespace xAOD diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecision_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecision_v1.h index b4b542765448837d84bfe300105d79a8fe55b85e..5ffece7a6eeec89317ade60fa2735aa981a1f834 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecision_v1.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigDecision_v1.h @@ -157,35 +157,6 @@ namespace xAOD { /// @} - /// @name AthenaMT accessors - /// @{ - - /// Get the passed-raw chains - const std::vector< ::TrigCompositeUtils::DecisionID >& chainMTPassedRaw() const; - /// Set the EF passed-raw items - void setChainMTPassedRaw( std::vector< ::TrigCompositeUtils::DecisionID > value ); - /// Basic access modes. Performs binary search for id on ordered vector of DecisionIDs - bool isPassed( ::TrigCompositeUtils::DecisionID id ) const; - bool isPassed( const std::string& hltChainName ) const; - - /// Get the EF prescaled items - const std::vector< ::TrigCompositeUtils::DecisionID >& chainMTPrescaled() const; - /// Set the EF prescaled items - void setChainMTPrescaled( std::vector< ::TrigCompositeUtils::DecisionID > value ); - /// Basic access modes. Performs binary search for id on ordered vector of DecisionIDs - bool isPrescaled( ::TrigCompositeUtils::DecisionID id ) const; - bool isPrescaled( const std::string& hltChainName ) const; - - /// Get the EF resurrected items - const std::vector< ::TrigCompositeUtils::DecisionID >& chainMTRerun() const; - /// Set the EF resurrected items - void setChainMTRerun( std::vector< ::TrigCompositeUtils::DecisionID > value ); - /// Basic access modes. Performs binary search for id on ordered vector of DecisionIDs - bool isRerun( ::TrigCompositeUtils::DecisionID id ) const; - bool isRerun( const std::string& hltChainName ) const; - - /// @} - }; // class TrigDecision_v1 std::ostream& operator<<(std::ostream& s, const xAOD::TrigDecision_v1& td); diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py index c87f070860cf15bfd38cffa7674e582a283450c1..8c2b30fa44a9f1a273bd27c14c08e7f420f97711 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py @@ -90,7 +90,7 @@ serialiser.CollectionsToSerialize = ["xAOD::TrigCompositeContainer_v1#MTCalibPeb # Tool adding stream tags to HLT result stmaker = StreamTagMakerTool() -stmaker.ChainDecisions = "HLTFinalDecisions" +stmaker.ChainDecisions = "HLTSummary" stmaker.ChainToStream = {} stmaker.ChainToStream["HLT_MTCalibPeb1"] = "DataScouting_05_Jets" stmaker.ChainToStream["HLT_MTCalibPeb2"] = "Main" @@ -101,7 +101,7 @@ stmaker.StreamRobs["Main"] = [0x42002e, 0x420060, 0x420064] # Tool adding HLT bits to HLT result bitsmaker = TriggerBitsMakerTool() -bitsmaker.ChainDecisions = "HLTFinalDecisions" +bitsmaker.ChainDecisions = "HLTSummary" bitsmaker.ChainToBit = {} bitsmaker.ChainToBit["HLT_MTCalibPeb1"] = 3 bitsmaker.ChainToBit["HLT_MTCalibPeb2"] = 50 diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt b/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt index 825687d2f4b8ea3fb8fb1aca00a76bb9707d0e7d..ceb3ed216bb010f0ceeb6cf505f4d0e67d035508 100644 --- a/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PRIVATE GaudiKernel Trigger/TrigConfiguration/TrigConfInterfaces Trigger/TrigConfiguration/TrigConfL1Data + Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigEvent/TrigDecisionEvent Trigger/TrigEvent/TrigSteeringEvent Trigger/TrigSteer/TrigSteering @@ -25,7 +26,7 @@ atlas_depends_on_subdirs( PRIVATE atlas_add_component( TrigDecisionMaker src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps DecisionHandling StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfL1Data TrigDecisionEvent TrigSteeringEvent TrigSteeringLib TrigT1Result xAODTrigger ) + LINK_LIBRARIES AthenaBaseComps DecisionHandling StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfL1Data TrigConfHLTData TrigDecisionEvent TrigSteeringEvent TrigSteeringLib TrigT1Result xAODTrigger ) # Install files from the package: atlas_install_python_modules( python/__init__.py python/TrigDecisionMakerConfig.py ) diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx index 53a9b8cc4b22b0d3984f9dcfb1525f942ba66b73..bc66f9d1c6a124588fef52cae471146b296f4894 100644 --- a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx +++ b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx @@ -24,6 +24,8 @@ #include "TrigConfInterfaces/ITrigConfigSvc.h" #include "TrigConfL1Data/BunchGroupSet.h" +#include "TrigConfHLTData/HLTChainList.h" +#include "TrigConfHLTData/HLTUtils.h" #include "GaudiKernel/Incident.h" @@ -31,8 +33,8 @@ using namespace TrigDec; TrigDecisionMakerMT::TrigDecisionMakerMT(const std::string &name, ISvcLocator *pSvcLocator) : ::AthReentrantAlgorithm(name, pSvcLocator), - m_trigConfigSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name), - m_lvl1Tool("HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", this) + m_trigConfigSvc("", name), + m_lvl1Tool("", this) {} TrigDecisionMakerMT::~TrigDecisionMakerMT() {} @@ -45,7 +47,9 @@ StatusCode TrigDecisionMakerMT::initialize() ATH_CHECK( m_trigDecisionKeyOut.initialize() ); + m_lvl1Tool.setTypeAndName(m_lvl1ToolLocation); ATH_CHECK( m_lvl1Tool.retrieve() ); + m_trigConfigSvc.setTypeAndName(m_trigConfigLocation); ATH_CHECK( m_trigConfigSvc.retrieve() ); return StatusCode::SUCCESS; @@ -97,26 +101,55 @@ StatusCode TrigDecisionMakerMT::execute(const EventContext& context) const trigDec->setTBP(l1Result->itemsBeforePrescale()); } + // Output bitsets (stored in a vector<uint32_t>) + std::vector<uint32_t> hltPassBits; + std::vector<uint32_t> hltPrescaledBits; + std::vector<uint32_t> hltRerunBits; + + std::set< std::vector<uint32_t>* > outputVectors; + outputVectors.insert( &hltPassBits ); + outputVectors.insert( &hltPrescaledBits ); + outputVectors.insert( &hltRerunBits ); + if (hltResult) { - ATH_MSG_DEBUG("Got a DecisionContainer '" << m_HLTSummaryKeyIn.key() << "' of size " << hltResult->size()); - TrigCompositeUtils::DecisionIDContainer allPassedSet; - // Expect only one object in this container, but allow many. - // Accumulate in a set to preserve ordering and remove any duplicates + ATH_MSG_DEBUG("Got a DecisionContainer '" << m_HLTSummaryKeyIn.key() << "' of size " << hltResult->size() << " (typically expect size=3)"); + TrigCompositeUtils::DecisionIDContainer passRawInput; //!< The chains which returned a positive decision + TrigCompositeUtils::DecisionIDContainer prescaledInput; //!< The chains which did not run due to being prescaled out + TrigCompositeUtils::DecisionIDContainer rerunInput; //!< The chains which were activate only in the rerun (not physics decisions) + + // Read the sets of chain IDs for (const TrigCompositeUtils::Decision* decisionObject : *hltResult) { - // Collect all decisions (IDs of passed chains) from decisionObject into allPassedSet - TrigCompositeUtils::decisionIDs(decisionObject, allPassedSet); + // Collect all decisions (IDs of passed/prescaled/rerun chains) from named decisionObjects + if (decisionObject->name() == "HLTPassRaw") { + TrigCompositeUtils::decisionIDs(decisionObject, passRawInput); + } else if (decisionObject->name() == "HLTPrescaled") { + TrigCompositeUtils::decisionIDs(decisionObject, prescaledInput); + } else if (decisionObject->name() == "HLTRerun") { + TrigCompositeUtils::decisionIDs(decisionObject, rerunInput); + } else { + ATH_MSG_WARNING("TrigDecisionMakerMT encountered an unknown set of decisions with name '" << decisionObject->name() << "'"); + } } - if (allPassedSet.size()) { + if (passRawInput.size()) { ++m_hltPassed; } - std::vector<TrigCompositeUtils::DecisionID> toRecordPassed(allPassedSet.begin(), allPassedSet.end()); - trigDec->setChainMTPassedRaw(toRecordPassed); + + // Make bitmap for passed raw + size_t countHltPass = makeBitMap(passRawInput, hltPassBits, outputVectors); + ATH_MSG_DEBUG ("Number of HLT chains passed raw: " << countHltPass); + trigDec->setEFPassedRaw(hltPassBits); + + // Make bitmap for prescaled + size_t countHltPrescaled = makeBitMap(prescaledInput, hltPrescaledBits, outputVectors); + ATH_MSG_DEBUG ("Number of HLT chains prescaled out: " << countHltPrescaled); + trigDec->setEFPrescaled(hltPrescaledBits); + + // Make bitmap for rerun a.k.a. resurrection + size_t countHLTRerun = makeBitMap(rerunInput, hltRerunBits, outputVectors); + ATH_MSG_DEBUG ("Number of HLT chains in rerun / second pass / resurrection : " << countHLTRerun); + trigDec->setEFResurrected(hltRerunBits); } - // TODO prescaled - - // TODO resurrected - // get the bunch crossing id const xAOD::EventInfo* eventInfo = SG::get(m_EventInfoKeyIn, context); const char bgByte = getBGByte(eventInfo->bcid()); @@ -175,3 +208,53 @@ char TrigDecisionMakerMT::getBGByte(int BCId) const { } return bgs->bgPattern()[BCId]; } + + +size_t TrigDecisionMakerMT::makeBitMap( + const TrigCompositeUtils::DecisionIDContainer& passedIDs, + std::vector<uint32_t>& bitsVector, + std::set< std::vector<uint32_t>* >& allOutputVectors) const +{ + size_t count = 0; + for (const TrigCompositeUtils::DecisionID id : passedIDs) { + const int32_t chainCounter = getChainCounter(id); + if (chainCounter == -1) continue; // Could not decode, prints error + resizeVectors(chainCounter, allOutputVectors); // Make sure we have enough room to be able to set the required bit + setBit(chainCounter, bitsVector); + ++count; + } + return count; +} + + +void TrigDecisionMakerMT::resizeVectors(const size_t bit, const std::set< std::vector<uint32_t>* >& vectors) const { + const size_t block = bit / std::numeric_limits<uint32_t>::digits; + const size_t requiredSize = block + 1; + for (std::vector<uint32_t>* vecPtr : vectors) { + vecPtr->resize(requiredSize, 0); + } + return; +} + + +void TrigDecisionMakerMT::setBit(const size_t bit, std::vector<uint32_t>& bits) const { + const size_t block = bit / std::numeric_limits<uint32_t>::digits; // = 32 + const size_t offset = bit % std::numeric_limits<uint32_t>::digits; + bits.at(block) |= static_cast<uint32_t>(1) << offset; +} + + +int32_t TrigDecisionMakerMT::getChainCounter(const TrigCompositeUtils::DecisionID chainID) const { + // Need to go from hash-ID to chain-counter. HLTChain counter currently does not give this a category + const std::string chainName = TrigConf::HLTUtils::hash2string(chainID); + if (chainName == "UNKNOWN HASH ID" || chainName == "UNKNOWN CATEGORY") { + ATH_MSG_ERROR("Unable to locate chain with hashID:" << chainID << " in the TrigConf, the error reported was: " << chainName); + return -1; + } + const TrigConf::HLTChain* chain = m_trigConfigSvc->chains().chain(chainName); + if (chain == nullptr) { + ATH_MSG_ERROR("Unable to fetch HLTChain object for chain with hashID:" << chainID << " and name:'" << chainName << "' (number of chains:" << m_trigConfigSvc->chains().size() << ")"); + return -1; + } + return chain->chain_counter(); +} diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h index 4a9866733263c9d6959af6dc777241d7a6026e8d..61113509413836fda0f9a0f10139414064351b29 100644 --- a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h +++ b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h @@ -86,12 +86,43 @@ namespace TrigDec { private: + /** + * @brief Ensures that the supplied vectors have sufficient capacity to store the given bit, where bits are packed into uint32_t. + * @param bit The bit we wish the vectors to be large enough to store + * @param vectors Set of pointers to all vectors which need resizing. Note, while the set of pointers is const, the vectors are not const. + **/ + void resizeVectors(const size_t bit, const std::set< std::vector<uint32_t>* >& vectors) const; + + /** + * @param bit The bit to set to 1 (bit 0 equates to the first bit). Requires the vector to have already been resized to be large enough. + * @param bits The vector to set the bit in. + **/ + void setBit(const size_t bit, std::vector<uint32_t>& bits) const; + + /** + * @param chainID The identifier (name hash) of the chain to fetch the ChainCounter for. + * @return the Chain Counter or -1 if error. + **/ + int32_t getChainCounter(const TrigCompositeUtils::DecisionID chainID) const; + + /** + * @param passedIDs Set of IDs of passed chains. + * @param bitsVector Vector to set passed-bits in based off of passedIDs + * @param allOutputVectors Set of pointers to *all* output vectors, keeps them all the same size + * @return the number of positive bits set in the vector, should be the same as passedIDs.size() + **/ + size_t makeBitMap(const TrigCompositeUtils::DecisionIDContainer& passedIDs, + std::vector<uint32_t>& bitsVector, std::set< std::vector<uint32_t>* >& allOutputVectors) const; + Gaudi::Property<bool> m_doL1{this, "doL1", true, "Read L1 trigger information"}; Gaudi::Property<bool> m_doHLT{this, "doHLT", true, "Read HLT trigger information"}; // Tools & services ServiceHandle<TrigConf::ITrigConfigSvc> m_trigConfigSvc; //!< handle to the full (L1 & HLT) trigger config service + Gaudi::Property<std::string> m_trigConfigLocation{this, "TrigConfigLocation", "TrigConf::TrigConfigSvc/TrigConfigSvc", "Trigger configuration service to fetch"}; + ToolHandle<HLT::ILvl1ResultAccessTool> m_lvl1Tool; //!< tool to ease the access to the L1 results (RoIs, items, etc) + Gaudi::Property<std::string> m_lvl1ToolLocation{this, "Lvl1ToolLocation", "HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", "L1 tool to fetch"}; // Input keys configuration SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_HLTSummaryKeyIn {this, "HLTSummary", "HLTSummary", "HLT summary container Key"}; diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfigSvc/CMakeLists.txt index 516eca89edbc0ec5aa19477da23f309d0d302684..6c8f13f5a9d9181afeedc6929424e2a05eb2e43c 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/CMakeLists.txt +++ b/Trigger/TrigConfiguration/TrigConfigSvc/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigEvent/TrigSteeringEvent PRIVATE Control/AthenaKernel + Control/AthAnalysisBaseComps Database/AthenaPOOL/AthenaPoolUtilities Database/IOVDbDataModel Event/EventInfo diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx index c572425756c040f7426303f5a445517a27299ff8..964563b2b71e9b69076ae09ab511a4c10f5518a5 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx +++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx @@ -27,7 +27,7 @@ ConfigSvcBase::~ConfigSvcBase() void ConfigSvcBase::declareCommonProperties() { declareProperty( "ConfigSource", m_configSourceString, - "Source of trigger configuration; can be \"XML\", \"MySQL\", \"Oracle\", or \"DBLookup\" "); + "Source of trigger configuration; can be \"XML\", \"MySQL\", \"Oracle\", \"DBLookup\" or \"RUN3_DUMMY\" "); declareProperty( "XMLMenuFile", m_xmlFile, "XML file containing the trigger configuration."); declareProperty( "DBServer", m_dbServer, @@ -59,7 +59,10 @@ ConfigSvcBase::initialize() { ATH_MSG_INFO("================================="); string s(boost::to_lower_copy(m_configSourceString)); // lower case - if(s != "xml") { + + if (s == "run3_dummy") { + ATH_MSG_WARNING("Configured to use Run-3 Dummy menu. This should never be seen in production"); + } else if(s != "xml") { TrigDBConnectionConfig::DBType dbtype(TrigDBConnectionConfig::DBLookup); if (s == "oracle") { dbtype = TrigDBConnectionConfig::Oracle; } else if (s == "mysql") { dbtype = TrigDBConnectionConfig::MySQL; } diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx index c49c176827df57fcd9909c1fd798496de795d0b3..0f33f7cf0dc46a48861a9ef47c2b68d1e456b074 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx +++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx @@ -117,7 +117,45 @@ HLTConfigSvc::initialize() { CHECK(ConfigSvcBase::initialize()); - if( !fromDB() and m_xmlFile=="NONE" ) { + ////////////////////////////////////////////////////////////// + // BEGIN RUN-3 TESTING BLOCK - THIS SHOULD BE TEMPORARY + ////////////////////////////////////////////////////////////// + string s(boost::to_lower_copy(m_configSourceString)); // lower case + if (s == "run3_dummy") { + + std::map<std::string, std::string> dummyChains; + dummyChains["HLT_e3_etcut1step"] = "L1_EM3"; + dummyChains["HLT_e3_etcut"] = "L1_EM3"; + dummyChains["HLT_e5_etcut"] = "L1_EM3"; + dummyChains["HLT_e7_etcut"] = "L1_EM3"; + dummyChains["HLT_g5_etcut"] = "L1_EM3"; + dummyChains["HLT_g10_etcut"] = "L1_EM7"; + dummyChains["HLT_g15_etcut"] = "L1_EM12"; + dummyChains["HLT_mu6"] = "L1_MU6"; + dummyChains["HLT_2mu6"] = "L1_MU6"; + dummyChains["HLT_mu6Comb"] = "L1_MU6"; + dummyChains["HLT_2mu6Comb"] = "L1_MU6"; + dummyChains["HLT_j85"] = "L1_J20"; + dummyChains["HLT_j100"] = "L1_J20"; + dummyChains["HLT_e3_etcut_mu6"] = "L1_EM8I_MU10"; + m_HLTFrame.setMergedHLT( m_setMergedHLT ); + for (const auto& mapPair : dummyChains) { + const std::string& chainName = mapPair.first; + const std::string& chainSeed = mapPair.second; + const int chainCounter = std::distance(dummyChains.begin(), dummyChains.find(chainName)); + HLTChain* chain = new HLTChain( chainName, chainCounter, 1, "HLT", chainSeed, 0, vector<HLTSignature*>() ); + // Note: the ownership of chain is transfered to the frame, the frame will delete it on deconstruct. + m_HLTFrame.theHLTChainList().addHLTChain( chain ); + ATH_MSG_INFO(" RUN 3 TESTING MODE! Adding dummy chain with hash:" << chain->chain_hash_id() << " : " << chainName << " [" << chainCounter << "] <- " << chainSeed); + } + ATH_MSG_INFO(" RUN 3 TESTING MODE! Total number of chains: " << m_HLTFrame.chains().size()); + + return StatusCode::SUCCESS; + + ////////////////////////////////////////////////////////////// + // END RUN-3 TESTING BLOCK - THIS SHOULD BE TEMPORARY + ////////////////////////////////////////////////////////////// + } else if( !fromDB() and m_xmlFile=="NONE" ) { ATH_MSG_INFO("xml file set to NONE, will not load HLT Menu"); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx index 3f1ab96c81977b3662dcfcd8c26e0971fe819cfe..d7cc5c27f6e3d6b1abf0259cc6cda1b1e3ffccd2 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx +++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx @@ -4,6 +4,8 @@ #include "GaudiKernel/ServiceHandle.h" +#include "AthAnalysisBaseComps/AthAnalysisHelper.h" // for AAH::setProperty. Header only, not linked + #include "TrigConfigSvc/TrigConfigSvc.h" #include "TrigConfigSvc/HLTConfigSvc.h" #include "TrigConfHLTData/HLTChainList.h" @@ -50,6 +52,24 @@ TrigConfigSvc::initialize() { ATH_MSG_INFO(" => " << testsvc); + ////////////////////////////////////////////////////////////// + // BEGIN RUN-3 TESTING BLOCK - THIS SHOULD BE TEMPORARY + ////////////////////////////////////////////////////////////// + if ( testsvc == "run3_dummy" ) { + ATH_CHECK( AAH::setProperty( m_hltSvc, "ConfigSource", testsvc ) ); + if (m_hltSvc.retrieve().isSuccess()) { + m_hltservice = m_hltSvc.operator->(); + ATH_MSG_WARNING("Got HLT Svc " << m_hltSvc.typeAndName() << ", will use R3 dummy menu"); + hltfromxml = true; + } else { + ATH_MSG_FATAL("failed to retrieve HLT ConfigSvc: " << m_hltSvc << " using R3 dummy menu"); + return StatusCode::FAILURE; + } + } + ////////////////////////////////////////////////////////////// + // END RUN-3 TESTING BLOCK - THIS SHOULD BE TEMPORARY + ////////////////////////////////////////////////////////////// + if ( testsvc == "ds" ) { if (m_dsSvc.retrieve().isSuccess()) { if(m_l1service==0) m_l1service = m_dsSvc.operator->(); diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx index b383cc9c9d900e70bdf20a388b60bc15d6407576..b2a79e4e0a4144f0a463094f1c02b3b3bcc28fc1 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx @@ -123,8 +123,21 @@ StatusCode TrigSignatureMoniMT::fillCount(const std::vector<TrigCompositeUtils:: StatusCode TrigSignatureMoniMT::execute() { auto l1Decisions = SG::makeHandle( m_l1DecisionsKey ); - CHECK( l1Decisions->at( 0 )->name() == "l1seeded" ); - CHECK( l1Decisions->at( 1 )->name() == "unprescaled" ); // see L1Decoder implementation + + const TrigCompositeUtils::Decision* l1SeededChains = nullptr; // Activated by L1 + const TrigCompositeUtils::Decision* unprescaledChains = nullptr; // Activated and passed prescale check + for (const TrigCompositeUtils::Decision* d : *l1Decisions) { + if (d->name() == "l1seeded") { + l1SeededChains = d; + } else if (d->name() == "unprescaled") { + unprescaledChains = d; + } + } + + if (l1SeededChains == nullptr || unprescaledChains == nullptr) { + ATH_MSG_ERROR("Unable to read in the summary from the L1Decoder."); + return StatusCode::FAILURE; + } auto fillL1 = [&]( int index ) -> StatusCode { TrigCompositeUtils::DecisionIDContainer ids; @@ -153,9 +166,12 @@ StatusCode TrigSignatureMoniMT::execute() { const int row = m_passHistogram->GetYaxis()->GetNbins(); auto finalDecisionsHandle = SG::makeHandle( m_finalDecisionKey ); ATH_CHECK( finalDecisionsHandle.isValid() ); - ATH_CHECK( finalDecisionsHandle->size() == 1 ); TrigCompositeUtils::DecisionIDContainer finalIDs; - TrigCompositeUtils::decisionIDs( finalDecisionsHandle->at(0), finalIDs ); + for (const TrigCompositeUtils::Decision* decisionObject : *finalDecisionsHandle) { + if (decisionObject->name() == "HLTPassRaw") { + TrigCompositeUtils::decisionIDs(decisionObject, finalIDs); + } + } ATH_CHECK( fillPass( finalIDs, row ) ); if ( not finalIDs.empty() ) { diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h index efae5dc32066d8f9c8028e0edf14ea64d8fa2a62..e4441b4de0d0a8ba20850efefcb12319b3ca6c04 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h @@ -33,10 +33,10 @@ class TrigSignatureMoniMT : public ::AthAlgorithm private: TrigSignatureMoniMT(); - SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_l1DecisionsKey{ this, "L1Decisions", "HLTChainsResult", "Chains activated after the L1" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_l1DecisionsKey{ this, "L1Decisions", "L1DecoderSummary", "Chains activated after the L1" }; - SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalDecisionKey{ this, "FinalDecisionKey", "HLTFinalDecisions", "Final stage of all decisions" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalDecisionKey{ this, "FinalDecisionKey", "HLTSummary", "Final stage of all decisions" }; Gaudi::Property<std::vector<std::string> > m_allChains{ this, "ChainsList", {}, "List of all configured chains" }; @@ -51,12 +51,15 @@ class TrigSignatureMoniMT : public ::AthAlgorithm ToolHandleArray<DecisionCollectorTool> m_collectorTools{ this, "CollectorTools", {}, "Tools that collect decisions for steps" }; - int nBinsX() const { return m_allChains.size() +1; } + int nBinsX() const; int nBinsY() const; StatusCode initHist(TH2*); StatusCode fillCount(const std::vector<TrigCompositeUtils::DecisionID>& dc, int row); StatusCode fillPass(const TrigCompositeUtils::DecisionIDContainer& dc, int row); }; +inline int TrigSignatureMoniMT::nBinsX() const { + return m_allChains.size() +1; +} #endif //> !TRIGSTEERMONITOR_TRIGSIGNATUREMONIMT_H diff --git a/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.cxx b/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.cxx index 332b3dd1692d94d51b956e1320f533e6d3e154df..4fe676cadd73f72bf3af8e6ad14090b55d4f2966 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.cxx @@ -4,10 +4,6 @@ #include "GaudiKernel/Property.h" #include "TriggerSummaryAlg.h" -//#include "TrigSteerEvent/Chain.h" - - - TriggerSummaryAlg::TriggerSummaryAlg( const std::string& name, ISvcLocator* pSvcLocator ) : @@ -19,8 +15,6 @@ TriggerSummaryAlg::~TriggerSummaryAlg() StatusCode TriggerSummaryAlg::initialize() { - // processing of the chains mapping - CHECK( m_inputDecisionKey.initialize() ); renounceArray( m_finalDecisionKeys ); @@ -31,17 +25,10 @@ StatusCode TriggerSummaryAlg::initialize() ATH_MSG_DEBUG( " "<<input.key() ); } - CHECK( m_summaryKey.initialize() ); - CHECK( m_startStampKey.initialize() ); CHECK( m_outputTools.retrieve() ); - if (m_enableCostMonitoring) { - CHECK( m_trigCostSvcHandle.retrieve() ); - CHECK( m_costWriteHandleKey.initialize() ); - } - return StatusCode::SUCCESS; } @@ -67,25 +54,7 @@ StatusCode TriggerSummaryAlg::execute(const EventContext& context) const for ( TrigCompositeUtils::DecisionID id : allPassingIDs ) { ATH_MSG_DEBUG( " +++ " << HLT::Identifier( id ) ); } - - // check for an evident error, this is HLT chain not mentioned at the L1 - // that is the only reason we pull the L1 here - - SG::WriteHandle<TrigCompositeUtils::DecisionContainer> summaryHandle = TrigCompositeUtils::createAndStore(m_summaryKey, context ); - auto summaryCont = summaryHandle.ptr(); - - auto summaryObj = TrigCompositeUtils::newDecisionIn( summaryCont ); - summaryObj->setName( "passing" ); - for ( auto id: allPassingIDs ) { - TrigCompositeUtils::addDecisionID( id, summaryObj ); - } - - // if ( ! m_hltResultKey.empty() ) { - // auto result = std::make_unique<HLT::HLTResult>(); - // CHECK( buildHLTResult( result ) ); - // } - for ( auto& tool: m_outputTools ) { CHECK( tool->createOutput( context ) ); } @@ -93,12 +62,5 @@ StatusCode TriggerSummaryAlg::execute(const EventContext& context) const auto timeStampHandle = SG::makeHandle( m_startStampKey, context ); ATH_MSG_DEBUG( "Time since the start of L1 decoding " << timeStampHandle.cptr()->millisecondsSince() << " ms" ); - // Do cost monitoring - if (m_enableCostMonitoring) { - SG::WriteHandle<xAOD::TrigCompositeContainer> costMonOutput = TrigCompositeUtils::createAndStore(m_costWriteHandleKey, context); - // Populate collection (assuming monitored event, otherwise collection will remain empty) - ATH_CHECK(m_trigCostSvcHandle->endEvent(context, costMonOutput)); - } - return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.h b/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.h index e1e58dce8d2424457e1f6a97d0b65eeca52de3eb..320a5a2144adb86ca76e71807037c815119797f7 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.h +++ b/Trigger/TrigSteer/DecisionHandling/src/TriggerSummaryAlg.h @@ -15,8 +15,10 @@ #include "TrigCostMonitorMT/ITrigCostMTSvc.h" /** - * @class An algorithm reading partial decisions and storing them in an HLTResult - * @brief In addition a merged decisions collection is prepared + * @class TriggerSummaryAlg + * @brief In addition, a merged decisions collection is prepared. But not currently written. + * An algorithm reading partial decisions and print them. Use to debug at the end of a sequence. + * @see DecisionSummaryMakerAlg for the class which assembles the final summary after HLT execution **/ class TriggerSummaryAlg : public ::AthReentrantAlgorithm { @@ -28,19 +30,13 @@ class TriggerSummaryAlg : public ::AthReentrantAlgorithm { virtual StatusCode initialize() override; virtual StatusCode execute( const EventContext& context ) const override; - private: - //Gaudi::Propert std::vector<m_chainCounters> { this, "ChainCounters", {}, - // "Chain names maping to counters. In the form of: name counter" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_inputDecisionKey{ this, "InputDecision", "", "Partial decisions from the last stage of chains processing, they nay be missing from event to event"}; - SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_finalDecisionKeys{ this, "FinalDecisions", {}, - "Object ontaining all the HLT input and outpu decision sets"}; - - SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_summaryKey { this, "HLTSummary", "HLTSummary", "Output summary" }; - // SG::WriteHandleKey m_hltResultKey{ this, "HLTResult", "", "Output HLT Result" }; + "Object containing all the HLT input and output decision sets"}; SG::ReadHandleKey<TrigTimeStamp> m_startStampKey{ this, "StartStampKey", "L1DecoderStart", "Object with the time stamp when decoding started" }; @@ -48,18 +44,9 @@ class TriggerSummaryAlg : public ::AthReentrantAlgorithm { typedef short ChainCounter_t; std::map<HLT::Identifier, ChainCounter_t> m_chainIdToChainCounter; + // TODO (tamartin / tbold) move this to DecisionSummaryMakerAlg ? ToolHandleArray<IHLTOutputTool> m_outputTools{ this, "OutputTools", {}, "Set of tools to prepare make HLT output ready for writing out" }; - ServiceHandle<ITrigCostMTSvc> m_trigCostSvcHandle { this, "TrigCostMTSvc", "TrigCostMTSvc", - "The trigger cost service" }; - - SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_costWriteHandleKey { this, "CostWriteHandleKey", "TrigCostContainer", - "Trig composite collections summarising the HLT execution" }; - - Gaudi::Property<bool> m_enableCostMonitoring{this, "EnableCostMonitoring", false, - "Enables end-of-event cost monitoring behavior. Only to be enabled on the very final summary alg."}; - }; - #endif //> !DECISIONHANDLING_TRIGGERSUMMARY_H diff --git a/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py b/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py index 0096975f780b8f2ebc11b80e8e8ee81f294067ee..019c415cda5dc5e2dbf5074a4bc537565050fd26 100644 --- a/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py +++ b/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py @@ -14,7 +14,7 @@ def L1DecoderCfg(flags): acc = ComponentAccumulator() decoderAlg = L1Decoder() - decoderAlg.Chains = recordable("L1Seeds") + decoderAlg.L1DecoderSummaryKey = recordable("L1DecoderSummary") decoderAlg.ctpUnpacker = CTPUnpackingTool( ForceEnableAllChains = flags.Trigger.L1Decoder.forceEnableAllChains, MonTool = CTPUnpackingMonitoring(512, 200) ) diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx index 7a48e1618f1bc5066457cfc076105810a3ed24a5..6bd7da0517b5e6ec3352537e5764a6ed48b107e8 100644 --- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.cxx @@ -14,6 +14,7 @@ L1Decoder::L1Decoder(const std::string& name, ISvcLocator* pSvcLocator) { } + StatusCode L1Decoder::initialize() { ATH_MSG_INFO( "Reading RoIB infromation from: "<< m_RoIBResultKey.objKey() << " : " << m_RoIBResultKey.fullKey() << " : " << m_RoIBResultKey.key() ); @@ -22,7 +23,7 @@ StatusCode L1Decoder::initialize() { else ATH_CHECK( m_RoIBResultKey.initialize( ) ); - ATH_CHECK( m_chainsKey.initialize() ); + ATH_CHECK( m_summaryKey.initialize() ); ATH_CHECK( m_startStampKey.initialize() ); ATH_CHECK( m_ctpUnpacker.retrieve() ); @@ -63,6 +64,7 @@ StatusCode L1Decoder::readConfiguration() { return StatusCode::SUCCESS; } + StatusCode L1Decoder::execute (const EventContext& ctx) const { { auto timeStampHandle = SG::makeHandle( m_startStampKey, ctx ); @@ -88,7 +90,7 @@ StatusCode L1Decoder::execute (const EventContext& ctx) const { } - SG::WriteHandle<DecisionContainer> handle = TrigCompositeUtils::createAndStore( m_chainsKey, ctx ); + SG::WriteHandle<DecisionContainer> handle = TrigCompositeUtils::createAndStore( m_summaryKey, ctx ); auto chainsInfo = handle.ptr(); /* @@ -104,18 +106,21 @@ StatusCode L1Decoder::execute (const EventContext& ctx) const { ATH_CHECK( m_ctpUnpacker->decode( *roib, l1SeededChains ) ); sort( l1SeededChains.begin(), l1SeededChains.end() ); // do so that following scaling is reproducible - HLT::IDVec activeChains; + HLT::IDVec activeChains; // Chains which are activated to run in the first pass (seeded and pass prescale) + HLT::IDVec prescaledChains; // Chains which are activated but do not run in the first pass (seeded but prescaled out) + + std::set_difference( l1SeededChains.begin(), l1SeededChains.end(), + activeChains.begin(), activeChains.end(), + std::back_inserter(prescaledChains) ); ATH_CHECK( m_prescaler->prescaleChains( ctx, l1SeededChains, activeChains ) ); ATH_CHECK( saveChainsInfo( l1SeededChains, chainsInfo, "l1seeded", ctx ) ); ATH_CHECK( saveChainsInfo( activeChains, chainsInfo, "unprescaled", ctx ) ); + ATH_CHECK( saveChainsInfo( prescaledChains, chainsInfo, "prescaled", ctx ) ); + //Note: 'prescaled' can be deduced from 'l1seeded' and 'unprescaled'. This non-persistent collection is provided for convenience. - // for now all the chains that were pre-scaled are st to re-run - HLT::IDVec rerunChains; - std::set_difference( l1SeededChains.begin(), l1SeededChains.end(), - activeChains.begin(), activeChains.end(), - std::back_inserter(rerunChains) ); - + // for now all the chains that were pre-scaled out are set to re-run in the second pass + HLT::IDVec rerunChains = prescaledChains; // Perform copy of vector<uint32_t> ATH_CHECK( saveChainsInfo( rerunChains, chainsInfo, "rerun", ctx ) ); // Do cost monitoring, this utilises the HLT_costmonitor chain @@ -131,7 +136,6 @@ StatusCode L1Decoder::execute (const EventContext& ctx) const { for ( auto unpacker: m_roiUnpackers ) { ATH_CHECK( unpacker->unpack( ctx, *roib, activeChainSet ) ); } - ATH_MSG_DEBUG( "Unpacking RoIs for re-running" ); HLT::IDSet rerunChainSet( rerunChains.begin(), rerunChains.end() ); @@ -139,7 +143,6 @@ StatusCode L1Decoder::execute (const EventContext& ctx) const { ATH_CHECK( unpacker->unpack( ctx, *roib, rerunChainSet ) ); } - return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h index 21d7b7791891fcb00b1957e9322f94dfaca66e21..2e5b55a1cfe42e219dabdf9904fc517a4d590bb1 100644 --- a/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h +++ b/Trigger/TrigSteer/L1Decoder/src/L1Decoder.h @@ -49,37 +49,39 @@ private: SG::ReadHandleKey<ROIB::RoIBResult> m_RoIBResultKey{this, "RoIBResult", "RoIBResult", "Name of RoIBResult"}; - SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_chainsKey{this, "Chains", "HLTChains", - "Chains status after L1 and prescaling"}; + SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_summaryKey{this, "L1DecoderSummaryKey", "L1DecoderSummary", + "Chains status after L1 and prescaling"}; // Note: was previously property 'Chains' with default value 'HLTChains' SG::WriteHandleKey<TrigTimeStamp> m_startStampKey{ this, "StartStampKey", "L1DecoderStart", "Object with the time stamp when decoding started" }; - ToolHandle<ICTPUnpackingTool> m_ctpUnpacker{this, "ctpUnpacker", "CTPUnpackingTool/CTPUnpackingTool", - "Tool used to unpack the CTP info"}; + SG::WriteHandleKey<TrigRoiDescriptorCollection> m_trigFSRoIKey{ + this, "OutputFSTrigRoI", "FSRoI", "Name of the RoIs object containing the single FS RoI tagged with all jet chains produced by the unpacker"}; - ToolHandleArray<IRoIsUnpackingTool> m_roiUnpackers{this, "roiUnpackers", {}, - "Tools unpacking RoIs"}; - ToolHandle<IPrescalingTool> m_prescaler{this, "prescaler", "PrescalingEmulationTool/PrescalingEmulationTool", "Prescaling tool"}; + Gaudi::Property<bool> m_enableCostMonitoring{this, "EnableCostMonitoring", false, + "Enables start-of-event cost monitoring behavior."}; - ToolHandleArray<IRoIsUnpackingTool> m_rerunRoiUnpackers{this, "rerunRoiUnpackers", {}, "Unpackers that unpack RoIs into separate collections"}; - ///@} + Gaudi::Property<std::string> m_costMonitoringChain{this, "CostMonitoringChain", "HLT_costmonitor", + "Name of the chain which should enable HLT cost montoring."}; Gaudi::Property<std::map<std::string, std::string>> m_chainToCTPProperty{ this, "ChainToCTPMapping", {}, "Seeding in the form: HLT_chain : L1_item"}; + ///@} ServiceHandle<ITrigCostMTSvc> m_trigCostSvcHandle { this, "TrigCostMTSvc", "TrigCostMTSvc", - "The trigger cost service" }; + "The trigger cost service" }; - Gaudi::Property<bool> m_enableCostMonitoring{this, "EnableCostMonitoring", false, - "Enables start-of-event cost monitoring behavior."}; + ToolHandle<ICTPUnpackingTool> m_ctpUnpacker{this, "ctpUnpacker", "CTPUnpackingTool/CTPUnpackingTool", + "Tool used to unpack the CTP info"}; - Gaudi::Property<std::string> m_costMonitoringChain{this, "CostMonitoringChain", "HLT_costmonitor", - "Name of the chain which should enable HLT cost montoring."}; + ToolHandleArray<IRoIsUnpackingTool> m_roiUnpackers{this, "roiUnpackers", {}, + "Tools unpacking RoIs"}; - SG::WriteHandleKey<TrigRoiDescriptorCollection> m_trigFSRoIKey{ - this, "OutputFSTrigRoI", "FSRoI", "Name of the RoIs object containing the single FS RoI tagged with all jet chains produced by the unpacker"}; + ToolHandle<IPrescalingTool> m_prescaler{this, "prescaler", "PrescalingEmulationTool/PrescalingEmulationTool", + "Prescaling tool"}; + ToolHandleArray<IRoIsUnpackingTool> m_rerunRoiUnpackers{this, "rerunRoiUnpackers", {}, + "Unpackers that unpack RoIs into separate collections"}; }; diff --git a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt index 84a8943df99b198ac0a8e13e1042572450bb8d98..8ed4dd5efb61d88271c10241385f37bc22efd5bc 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODMuon Trigger/TrigSteer/DecisionHandling Control/AthenaMonitoring + Trigger/TrigMonitoring/TrigCostMonitorMT ) find_package( tdaq-common ) find_package( Boost ) diff --git a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h index 79ff3293cdf2df219efe09f852558d23434fcbb2..4b8160744a043d0a2326b7b8291c0413e016d501 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h +++ b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h @@ -26,7 +26,7 @@ public: virtual StatusCode finalize() override; private: - SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalChainDecisions { this, "ChainDecisions", "UNDEFINED", "Container with final chain decisions" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalChainDecisions { this, "ChainDecisions", "HLTSummary", "Container with final chain decisions" }; Gaudi::Property<std::map<std::string, int>> m_chainToStreamProperty { this, "ChainToBit", {}, "Mapping from the chain name to bit position in trigger bits array"}; diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx index b39c0a242a603c7ca1177ca803032b366d252a70..5f459c4f257f6e7638e8e1abad441b7642ede953 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx @@ -14,12 +14,18 @@ StatusCode DecisionSummaryMakerAlg::initialize() { renounceArray( m_finalDecisionKeys ); ATH_CHECK( m_finalDecisionKeys.initialize() ); ATH_CHECK( m_summaryKey.initialize() ); + ATH_CHECK( m_l1SummaryKey.initialize() ); for ( auto& pair: m_lastStepForChain ) { struct { std::string chain, collection; } conf { pair.first, pair.second }; m_collectionFilter[ conf.collection ].insert( HLT::Identifier( conf.chain).numeric() ); ATH_MSG_DEBUG( "Final decision of the chain " << conf.chain << " will be read from " << conf.collection ); } + + if (m_enableCostMonitoring) { + CHECK( m_trigCostSvcHandle.retrieve() ); + CHECK( m_costWriteHandleKey.initialize() ); + } return StatusCode::SUCCESS; } @@ -29,11 +35,17 @@ StatusCode DecisionSummaryMakerAlg::finalize() { } StatusCode DecisionSummaryMakerAlg::execute(const EventContext& context) const { - SG::WriteHandle<TrigCompositeUtils::DecisionContainer> outputHandle = TrigCompositeUtils::createAndStore( m_summaryKey, context ); + + using namespace TrigCompositeUtils; + + SG::WriteHandle<DecisionContainer> outputHandle = createAndStore( m_summaryKey, context ); auto container = outputHandle.ptr(); - TrigCompositeUtils::Decision* output = TrigCompositeUtils::newDecisionIn( container, "HLTSummary" ); - + Decision* passRawOutput = newDecisionIn( container, "HLTPassRaw" ); + Decision* prescaledOutput = newDecisionIn( container, "HLTPrescaled" ); + Decision* rerunOutput = newDecisionIn( container, "HLTRerun" ); + + // Collate final decisions into the passRawOutput object for ( auto& key: m_finalDecisionKeys ) { auto handle{ SG::makeHandle(key, context) }; if ( not handle.isValid() ) { @@ -42,31 +54,82 @@ StatusCode DecisionSummaryMakerAlg::execute(const EventContext& context) const { } const auto thisCollFilter = m_collectionFilter.find( key.key() ); if ( thisCollFilter == m_collectionFilter.end() ) { - ATH_MSG_WARNING( "The colleciton " << key.key() << " is not configured to contain any final decision, remove it from the configuration of " << name() << " to save time" ); + ATH_MSG_WARNING( "The collection " << key.key() << " is not configured to contain any final decision," + << "remove it from the configuration of " << name() << " to save time" ); continue; } - TrigCompositeUtils::DecisionIDContainer sum; - for ( const TrigCompositeUtils::Decision* decisionObject: *handle ) { - sum.insert( TrigCompositeUtils::decisionIDs(decisionObject).begin(), TrigCompositeUtils::decisionIDs(decisionObject).end() ); // copy from vector + DecisionIDContainer sum; + for ( const Decision* decisionObject: *handle ) { + sum.insert( decisionIDs(decisionObject).begin(), decisionIDs(decisionObject).end() ); // copy from vector } - TrigCompositeUtils::DecisionIDContainer finalIDs; - std::set_intersection( sum.begin(), sum.end(), - thisCollFilter->second.begin(), thisCollFilter->second.end(), - std::inserter(finalIDs, finalIDs.begin() ) ); // should be faster than remove_if + DecisionIDContainer finalIDs; + std::set_intersection( sum.begin(), sum.end(), + thisCollFilter->second.begin(), thisCollFilter->second.end(), + std::inserter(finalIDs, finalIDs.begin() ) ); // should be faster than remove_if - TrigCompositeUtils::decisionIDs( output ).insert( TrigCompositeUtils::decisionIDs( output ).end(), - finalIDs.begin(), finalIDs.end() ); + decisionIDs( passRawOutput ).insert( decisionIDs( passRawOutput ).end(), + finalIDs.begin(), finalIDs.end() ); // Copy decisions set into passRawOutput's persistent vector } if ( msgLvl( MSG::DEBUG ) ) { - ATH_MSG_DEBUG( "Number of positive decisions " << TrigCompositeUtils::decisionIDs( output ).size() << " passing chains"); - for ( auto d: TrigCompositeUtils::decisionIDs( output ) ) { + ATH_MSG_DEBUG( "Number of positive decisions " << decisionIDs( passRawOutput ).size() << " passing chains"); + for ( auto d: decisionIDs( passRawOutput ) ) { ATH_MSG_DEBUG( HLT::Identifier( d ) ); } } + // TODO collate final rerun decisions into the rerunOutput object + + // Get the data from the L1 decoder, this is where prescales were applied + SG::ReadHandle<DecisionContainer> l1DecoderSummary( m_l1SummaryKey, context ); + const Decision* l1SeededChains = nullptr; // Activated by L1 + const Decision* activeChains = nullptr; // Activated and passed prescale check + const Decision* prescaledChains = nullptr; // Activated but failed prescale check + const Decision* rerunChains = nullptr; // Set to activate in the second pass + for (const Decision* d : *l1DecoderSummary) { + if (d->name() == "l1seeded") { + l1SeededChains = d; + } else if (d->name() == "unprescaled") { + activeChains = d; + } else if (d->name() == "prescaled") { + prescaledChains = d; + } else if (d->name() == "rerun") { + rerunChains = d; + } else { + ATH_MSG_WARNING("DecisionSummaryMakerAlg encountered an unknown set of decisions from the L1Decoder, name '" << d->name() << "'"); + } + } + + if (l1SeededChains == nullptr || activeChains == nullptr || prescaledChains == nullptr || rerunChains == nullptr) { + ATH_MSG_ERROR("Unable to read in the summary from the L1Decoder. Cannot write to the HLT output summary the prescale status of HLT chains."); + return StatusCode::FAILURE; + } + + // l1SeededChains is not currently used here + + // activeChains is not currently used here + + // Get chains which were prescaled out. This is the set of chains which were seeded but which were NOT active (in the first pass) + DecisionIDContainer prescaledIDs; + decisionIDs( prescaledChains, prescaledIDs ); // Extract from prescaledChains (a Decision*) into prescaledIDs (a set<int>) + decisionIDs( prescaledOutput ).insert( decisionIDs( prescaledOutput ).end(), + prescaledIDs.begin(), prescaledIDs.end() ); // Save this to the output + + // Save the set of chains which were flagged as only executing in rerun. + DecisionIDContainer rerunIDs; + decisionIDs( rerunChains, rerunIDs ); + decisionIDs( rerunOutput ).insert( decisionIDs( rerunOutput ).end(), + rerunIDs.begin(), rerunIDs.end() ); + + // Do cost monitoring + if (m_enableCostMonitoring) { + SG::WriteHandle<xAOD::TrigCompositeContainer> costMonOutput = createAndStore(m_costWriteHandleKey, context); + // Populate collection (assuming monitored event, otherwise collection will remain empty) + ATH_CHECK(m_trigCostSvcHandle->endEvent(context, costMonOutput)); + } + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.h b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.h index ab6e7740a364448a9f8a45ac9320710742cd0499..337f0819612087e957df36305304889b68c481d5 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.h @@ -7,11 +7,14 @@ #include <string> #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "DecisionHandling/TrigCompositeUtils.h" +#include "TrigCostMonitorMT/ITrigCostMTSvc.h" /** * @class DecisionsSummaryMakerAlg - * @brief makes one decision object containing only one decision ID per accepted chain + * @brief Executes after both the first-pass and secon-pass (rerun) chains have finished. + * Makes decision objects containing decision IDs per passing chain, prescaled chain and rerun chain. + * Sends end-of-HLT processing trigger to cost monitoring. Writes HLTSummary container. **/ class DecisionSummaryMakerAlg : public AthReentrantAlgorithm { public: @@ -23,12 +26,27 @@ public: virtual StatusCode finalize() override; private: - SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_summaryKey{ this, "DecisionsSummaryKey", "HLTFinalDecisions", + SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_summaryKey{ this, "DecisionsSummaryKey", "HLTSummary", "location of final decision" }; + SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_finalDecisionKeys{ this, "FinalDecisionKeys", {}, "Final stage of all decisions" }; + + SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_costWriteHandleKey { this, "CostWriteHandleKey", "TrigCostContainer", + "Trig composite collections summarising the HLT execution" }; + + SG::ReadHandleKey<xAOD::TrigCompositeContainer> m_l1SummaryKey { this, "L1DecoderSummaryKey", "L1DecoderSummary", + "Chains status after L1 and prescaling" }; + + ServiceHandle<ITrigCostMTSvc> m_trigCostSvcHandle { this, "TrigCostMTSvc", "TrigCostMTSvc", + "The trigger cost service" }; + Gaudi::Property< std::map< std::string, std::string > > m_lastStepForChain{ this, "FinalStepDecisions", {}, - "The map of chain name to name of the collection in which the final decision is found" }; + "The map of chain name to name of the collection in which the final decision is found" }; + + Gaudi::Property<bool> m_enableCostMonitoring{this, "EnableCostMonitoring", false, + "Enables end-of-event cost monitoring behavior."}; + std::map<std::string, TrigCompositeUtils::DecisionIDContainer> m_collectionFilter; }; diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx index 65b2f51448895e8a70ccdb6485434b333305b323..bc271753d7c86095c768399b83a3464dbb680912 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx @@ -44,10 +44,36 @@ StatusCode StreamTagMakerTool::finalize() { StatusCode StreamTagMakerTool::fill( HLT::HLTResultMT& resultToFill ) const { // obtain chain decisions, + using namespace TrigCompositeUtils; auto chainsHandle = SG::makeHandle( m_finalChainDecisions ); + const Decision* passRawChains = nullptr; + const Decision* rerunChains = nullptr; + for (const Decision* d : *chainsHandle) { + if (d->name() == "HLTPassRaw") { + passRawChains = d; + } else if (d->name() == "HLTRerun") { + rerunChains = d; + } + } + + if (passRawChains == nullptr || rerunChains == nullptr) { + ATH_MSG_ERROR("Unable to read in the HLTSummary from the DecisionSummaryMakerAlg"); + return StatusCode::FAILURE; + } + // for each accepted chain lookup the map of chainID -> ST - for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( chainsHandle->at( 0 )) ) { + for ( DecisionID chain: decisionIDs( passRawChains ) ) { + + // Note: The default is to NOT allow rerun chains to add a stream tag + if (!m_allowRerunChains) { + const auto iterator = std::find(decisionIDs(rerunChains).begin(), decisionIDs(rerunChains).end(), chain); + if ( iterator != decisionIDs(rerunChains).end() ) { + // This chain has entries in both the passedRaw and rerun sets. As we are not allowing rerun chains, we skip this one. + continue; + } + } + auto mappingIter = m_mapping.find( chain ); // each chain has to have stream if( mappingIter == m_mapping.end() ) { diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.h b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.h index 3debf49a80cdb107ce3a2a05787137b081a7d303..b4be32d2a0aeb5788cb088aa1a6fcffff4ce2be3 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.h @@ -28,11 +28,20 @@ public: virtual StatusCode finalize() override; private: - SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalChainDecisions { this, "ChainDecisions", "UNDEFINED", "Container with final chain decisions" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalChainDecisions { this, "ChainDecisions", "HLTSummary", + "Container with final chain decisions" }; - Gaudi::Property<std::map<std::string, std::string>> m_chainToStreamProperty { this, "ChainToStream", {}, "Mapping from the chain name to string name (temporary solution, will be replaced)"}; - Gaudi::Property<std::map<std::string, std::vector<uint32_t>>> m_streamSubDets { this, "StreamSubDets", {}, "Mapping from the stream name to subdetector IDs (temporary solution, will be replaced)"}; - Gaudi::Property<std::map<std::string, std::vector<uint32_t>>> m_streamRobs { this, "StreamRobs", {}, "Mapping from the stream name to ROB IDs (temporary solution, will be replaced)"}; + Gaudi::Property<bool> m_allowRerunChains { this, "AllowRerunChains", false, + "Normally false, but if set to true this will allow resurrected chains which ran in the second pass to also add stream tags"}; + + Gaudi::Property<std::map<std::string, std::string>> m_chainToStreamProperty { this, "ChainToStream", {}, + "Mapping from the chain name to string name (temporary solution, will be replaced)"}; + + Gaudi::Property<std::map<std::string, std::vector<uint32_t>>> m_streamSubDets { this, "StreamSubDets", {}, + "Mapping from the stream name to subdetector IDs (temporary solution, will be replaced)"}; + + Gaudi::Property<std::map<std::string, std::vector<uint32_t>>> m_streamRobs { this, "StreamRobs", {}, + "Mapping from the stream name to ROB IDs (temporary solution, will be replaced)"}; typedef std::map< TrigCompositeUtils::DecisionID, eformat::helper::StreamTag> ChainToStreamMap; ChainToStreamMap m_mapping; diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx index 35b6efddb282611508224dc384689e19ecb3d9f4..4daf544ebe4ad49043be32e289b2eb2b778cc694 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx @@ -25,7 +25,21 @@ StatusCode TriggerBitsMakerTool::initialize() { StatusCode TriggerBitsMakerTool::fill( HLT::HLTResultMT& resultToFill ) const { auto chainsHandle = SG::makeHandle( m_finalChainDecisions ); - for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( chainsHandle->at( 0 )) ) { + + const TrigCompositeUtils::Decision* passRawChains = nullptr; + for (const TrigCompositeUtils::Decision* d : *chainsHandle) { + if (d->name() == "HLTPassRaw") { + passRawChains = d; + break; + } + } + + if (passRawChains == nullptr) { + ATH_MSG_ERROR("Unable to read in the HLTSummary from the DecisionSummaryMakerAlg"); + return StatusCode::FAILURE; + } + + for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( passRawChains ) ) { auto mappingIter = m_mapping.find( chain ); // each chain has to have stream if( mappingIter == m_mapping.end() ) { diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py index 7c4410791055a32ae006142348228287ca751045..a453a7574225ebb2b757f2d8f47b5028ccd4ba74 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py @@ -106,7 +106,7 @@ class L1DecoderTest(L1Decoder) : SourceDecisions="L1MU", Decisions="RerunL1MU" ) ] - self.Chains = "HLTChainsResult" + self.L1DecoderSummaryKey = "L1DecoderSummary" # L1 emulation for RDO @@ -168,7 +168,7 @@ class L1EmulationTest(L1Decoder) : 'MU6 : HLT_mu8_e8'] self.roiUnpackers += [muUnpacker] - self.Chains="HLTChainsResult" + self.L1DecoderSummaryKey = "L1DecoderSummary" if __name__ == "__main__": from AthenaCommon.Constants import DEBUG diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py index 8c5ec84e8d21619bf73f153f3cfb24d571eaa56b..e53135f61537618e1868cbe9d1db8103da556cb8 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py @@ -66,7 +66,7 @@ muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU6 : HLT_mu6idperf", "M # do not know yet how to configure the services for it l1Decoder.roiUnpackers = [emUnpacker] -l1Decoder.Chains="HLTChainsResult" +l1Decoder.L1DecoderSummaryKey = "L1DecoderSummary" topSequence += l1Decoder #Run calo decoder @@ -76,7 +76,7 @@ emDecisionsDumper.Decisions = "EMRoIDecisions" topSequence += emDecisionsDumper chainSeedingDumper = DumpDecisions("ChainSeedingDumper", OutputLevel=DEBUG) -chainSeedingDumper.Decisions = "HLTChainsResult" +chainSeedingDumper.Decisions = "L1DecoderSummary" topSequence += chainSeedingDumper diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py index 7fb58271d707592a7a8eb2ca9167f6daf8cf65bd..953a2d98bd7cadbbb0c6d7dec98c98957c2d7d0e 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py @@ -157,7 +157,7 @@ from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmul l1Decoder = L1Decoder( OutputLevel=DEBUG, RoIBResult="" ) l1Decoder.prescaler.EventInfo="" l1Decoder.ChainToCTPMapping = EnabledChainNamesToCTP -l1Decoder.Chains="HLTChainsResult" +l1Decoder.L1DecoderSummaryKey = "L1DecoderSummary" ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=False , InputFilename="ctp.dat" ) l1Decoder.ctpUnpacker = ctpUnpacker diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py b/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py index dc54edce230829415b666ae7b76a42590e0dca81..0bc28a313c97d6b3cef1b9b2b764a5cad0f00b55 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py @@ -10,13 +10,8 @@ checker.doDumpAll = False checker.doDumpxAODTrigElectronContainer = False checker.doDumpxAODTrackParticle = True checker.doDumpTrigCompsiteNavigation = True +checker.doDumpAllTrigComposite = True checker.doDumpStoreGate = True -# this list was obtained by: checkxAOD.py myESD.pool.root | grep Composite | tr -s " "| cut -d" " -f10 | awk '{print "\""$1"\""}' | tr "\n" "," > f -# Note that now there is also a flag to look at all of them at runtime. We may want to move to this in the future. -tcContainers = [ "FilteredEMRoIDecisions", "L2CaloLinks", "L2ElectronLinks", "EgammaCaloDecisions", "FilteredEgammaCaloDecisions", "filterCaloRoIsAlg", "ElectronL2Decisions", "MuonL2Decisions", "METRoIDecisions", "MURoIDecisions", "HLTChainsResult", "JRoIDecisions", "MonitoringSummaryStep1", "RerunEMRoIDecisions", "RerunMURoIDecisions", "TAURoIDecisions", "EMRoIDecisions" ] - -for container in tcContainers: - checker.dumpTrigCompositeContainers += [ "remap_" + container ] from AthenaCommon.AppMgr import topSequence @@ -30,3 +25,9 @@ topSequence += checker from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionMakerMT topSequence+=TrigDecisionMakerMT() topSequence.TrigDecMakerMT.OutputLevel = DEBUG + +# Note that for now we don't properly configure the trigger configuration service yet. So we give the "run3_dummy" property here first +# which will load some hard-coded items from HLTConfigSvc.cxx for testing. +from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc +ServiceMgr += TrigConfigSvc("TrigConfigSvc") +ServiceMgr.TrigConfigSvc.PriorityList = ["run3_dummy", "ds", "xml"] diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index 936adeb829fae699e8081326d708688f0bca0098..963be4a6522612c38355317c751f50226a324210 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -229,8 +229,7 @@ egammaEFCaloStep = stepSeq("egammaEFCalotep", filterL2ElectronRoIsAlg, [ efClust from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summaryStep0 = TriggerSummaryAlg( "TriggerSummaryStep1" ) -summaryStep0.InputDecision = "HLTChains" -summaryStep0.HLTSummary = "MonitoringSummaryStep1" +summaryStep0.InputDecision = "L1DecoderSummary" summaryStep0.FinalDecisions = [ caloHypoDecisions ] summaryStep0.OutputLevel = DEBUG @@ -245,12 +244,12 @@ egammaCaloStepRR = createFastCaloSequence( rerun=True ) step0r = parOR("step0r", [ egammaCaloStepRR ]) summary = TriggerSummaryAlg( "TriggerSummaryAlg" ) -summary.InputDecision = "HLTChains" +summary.InputDecision = "L1DecoderSummary" summary.FinalDecisions = [ "ElectronL2Decisions", "MuonL2Decisions" ] from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator egammaViewsMerger = HLTEDMCreator("egammaViewsMerger") -egammaViewsMerger.TrigCompositeContainer = [ "filterCaloRoIsAlg", "EgammaCaloDecisions","ElectronL2Decisions", "MuonL2Decisions", "EMRoIDecisions", "METRoIDecisions", "MURoIDecisions", "HLTChainsResult", "JRoIDecisions", "MonitoringSummaryStep1", "RerunEMRoIDecisions", "RerunMURoIDecisions", "TAURoIDecisions", "L2CaloLinks", "FilteredEMRoIDecisions", "FilteredEgammaCaloDecisions" ] +egammaViewsMerger.TrigCompositeContainer = [ "filterCaloRoIsAlg", "EgammaCaloDecisions","ElectronL2Decisions", "MuonL2Decisions", "EMRoIDecisions", "METRoIDecisions", "MURoIDecisions", "L1DecoderSummary", "JRoIDecisions", "MonitoringSummaryStep1", "RerunEMRoIDecisions", "RerunMURoIDecisions", "TAURoIDecisions", "L2CaloLinks", "FilteredEMRoIDecisions", "FilteredEgammaCaloDecisions" ] egammaViewsMerger.TrackParticleContainerViews = [ l2ElectronViewsMaker.Views ] egammaViewsMerger.TrackParticleContainerInViews = [ TrackParticlesName ] @@ -359,11 +358,11 @@ serialiser.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#remap_Ega stmaker = StreamTagMakerTool() stmaker.OutputLevel = DEBUG -stmaker.ChainDecisions = "HLTFinalDecisions" +stmaker.ChainDecisions = "HLTSummary" stmaker.ChainToStream = dict( [(c, "Main") for c in testChains ] ) stmaker.ChainToStream["HLT_e5_etcut"] = "PhotonPerf" # just made up the name bitsmaker = TriggerBitsMakerTool() -bitsmaker.ChainDecisions = "HLTFinalDecisions" +bitsmaker.ChainDecisions = "HLTSummary" bitsmaker.ChainToBit = dict( [ (chain, 10*num) for num,chain in enumerate(testChains) ] ) bitsmaker.OutputLevel = DEBUG @@ -433,7 +432,7 @@ ServiceMgr += AuditorSvc() # This triggers the L1 decoder to signal the start of processing, # and the HLT summary alg to signal end of processing and handle the writing of data. topSequence.L1DecoderTest.EnableCostMonitoring = True -summary.EnableCostMonitoring = True +summMaker.EnableCostMonitoring = True # Write out the data at the end addTC("TrigCostContainer") diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py index bbb34aa48762f09786816688b5f5cb38a8d2d36d..528f0562e493fc7f219311b3c1eb8cea6a00d53f 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py @@ -324,8 +324,7 @@ if TriggerFlags.doMuon: def summarySteps ( name, decisions ): from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summarySteps = TriggerSummaryAlg( "TriggerSummary"+name ) - summarySteps.InputDecision = "HLTChains" - summarySteps.HLTSummary = "MonitoringSummary"+name + summarySteps.InputDecision = "L1DecoderSummary" summarySteps.OutputLevel = DEBUG summarySteps.FinalDecisions = decisions return summarySteps @@ -334,7 +333,7 @@ def summarySteps ( name, decisions ): def muonViewsMergers( name ): from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator muonViewsMerger = HLTEDMCreator("muonViewsMerger_" + name ) - muonViewsMerger.TrigCompositeContainer = [ "MURoIDecisions", "HLTChainsResult", "MonitoringSummaryStep1", "MonitoringSummaryStep2", "MonitoringSummaryStep3"] + muonViewsMerger.TrigCompositeContainer = [ "MURoIDecisions", "L1DecoderSummary", "MonitoringSummaryStep1", "MonitoringSummaryStep2", "MonitoringSummaryStep3"] muonViewsMerger.OutputLevel = VERBOSE if doL2SA==True: diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py index d2b7b25eb7af9c8158f3673e8f15a099f341d3f3..404bba95223de0a52b10af3aea3deeacd12651f8 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py @@ -121,8 +121,7 @@ egammaIDStep = stepSeq("egammaIDStep", filterCaloRoIsAlg, [ photonSequence ] ) from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summaryStep0 = TriggerSummaryAlg( "TriggerSummaryStep1" ) -summaryStep0.InputDecision = "HLTChains" -summaryStep0.HLTSummary = "MonitoringSummaryStep1" +summaryStep0.InputDecision = "L1DecoderSummary" summaryStep0.FinalDecisions = [ caloHypoDecisions ] summaryStep0.OutputLevel = DEBUG @@ -136,11 +135,11 @@ egammaCaloStepRR = createFastCaloSequence( rerun=True ) step0r = parOR("step0r", [ egammaCaloStepRR ]) summary = TriggerSummaryAlg( "TriggerSummaryAlg" ) -summary.InputDecision = "HLTChains" +summary.InputDecision = "L1DecoderSummary" summary.FinalDecisions = [ "PhotonL2Decisions" ] from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator edmCreator = HLTEDMCreator() -edmCreator.TrigCompositeContainer = [ "EgammaCaloDecisions", "PhotonL2Decisions", "EMRoIDecisions", "HLTChainsResult" ] +edmCreator.TrigCompositeContainer = [ "EgammaCaloDecisions", "PhotonL2Decisions", "EMRoIDecisions", "L1DecoderSummary" ] egammaViewsMerger = HLTEDMCreator("egammaViewsMerger") diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py index 4775d3ff7c97ef5a3e5f4c7dea6532a2529df2fa..e5fb55effd1252ee26ad63eba5d0ab4c092e8288 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py @@ -85,8 +85,7 @@ if TriggerFlags.doCalo: def summarySteps ( name, decisions ): from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summarySteps = TriggerSummaryAlg( "TriggerSummary"+name ) - summarySteps.InputDecision = "HLTChains" - summarySteps.HLTSummary = "MonitoringSummary"+name + summarySteps.InputDecision = "L1DecoderSummary" summarySteps.OutputLevel = DEBUG summarySteps.FinalDecisions = decisions return summarySteps diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index d77cc717b2b4a037c4ab013f399eb642d60f4e4f..b9d1ad7ebafa2ae42e8a391bded383fdeed131a5 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -39,11 +39,11 @@ TriggerHLTList = [ - ('xAOD::TrigCompositeContainer#L1Seeds', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('xAOD::TrigCompositeContainer#L1EM', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('xAOD::TrigCompositeContainer#L1MU', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('xAOD::TrigCompositeContainer#L1MET', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('xAOD::TrigCompositeContainer#L1J', 'BS ESD AODFULL AODSLIM', 'Steer'), + ('xAOD::TrigCompositeContainer#L1DecoderSummary', 'BS ESD AODFULL AODSLIM', 'Steer'), + ('xAOD::TrigCompositeContainer#L1EM', 'BS ESD AODFULL AODSLIM', 'Steer'), + ('xAOD::TrigCompositeContainer#L1MU', 'BS ESD AODFULL AODSLIM', 'Steer'), + ('xAOD::TrigCompositeContainer#L1MET', 'BS ESD AODFULL AODSLIM', 'Steer'), + ('xAOD::TrigCompositeContainer#L1J', 'BS ESD AODFULL AODSLIM', 'Steer'), diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index bc543c45a55865e0d5a765f888cb713c8ea3e5e9..511d4d3333088233b477a3e6d88ae0d4f1b04fc3 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -106,7 +106,7 @@ def triggerSummaryCfg(flags, hypos): __log.info("Final decision of chain " + c + " will be red from " + cont ) decisionSummaryAlg.FinalDecisionKeys = list(set(allChains.values())) decisionSummaryAlg.FinalStepDecisions = allChains - decisionSummaryAlg.DecisionsSummaryKey ="HLTSummary" + decisionSummaryAlg.DecisionsSummaryKey = "HLTSummary" # Output return acc, decisionSummaryAlg @@ -118,8 +118,8 @@ def triggerMonitoringCfg(flags, hypos, l1Decoder): acc = ComponentAccumulator() from TrigSteerMonitor.TrigSteerMonitorConf import TrigSignatureMoniMT, DecisionCollectorTool mon = TrigSignatureMoniMT() - mon.L1Decisions="HLTChains" - mon.FinalDecisionKey="HLTSummary" + mon.L1Decisions = "L1DecoderSummary" + mon.FinalDecisionKey = "HLTSummary" # Input if len(hypos) == 0: __log.warning("Menu is not configured") return acc, mon @@ -138,7 +138,7 @@ def triggerMonitoringCfg(flags, hypos, l1Decoder): #mon.FinalChainStep = allChains - mon.L1Decisions = l1Decoder.getProperties()['Chains'] if l1Decoder.getProperties()['Chains'] != '<no value>' else l1Decoder.getDefaultProperty('Chains') + mon.L1Decisions = l1Decoder.getProperties()['L1DecoderSummaryKey'] if l1Decoder.getProperties()['L1DecoderSummaryKey'] != '<no value>' else l1Decoder.getDefaultProperty('L1DecoderSummary') allChains.update( l1Decoder.ChainToCTPMapping.keys() ) mon.ChainsList = list( allChains ) return acc, mon @@ -157,7 +157,6 @@ def triggerOutputStreamCfg( flags, decObj, outputType ): # the rest of triger EDM itemsToRecord.extend( __TCKeys( "HLTSummary" ) ) - from TrigEDMConfig.TriggerEDMRun3 import TriggerHLTList EDMCollectionsToRecord=filter( lambda x: outputType in x[1] and "TrigCompositeContainer" not in x[0], TriggerHLTList ) itemsToRecord.extend( [ el[0] for el in EDMCollectionsToRecord ] ) @@ -174,8 +173,7 @@ def triggerAddMissingEDMCfg( flags, decObj ): from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg EDMFillerAlg = TriggerSummaryAlg( "EDMFillerAlg" ) - EDMFillerAlg.InputDecision = "HLTChains" - EDMFillerAlg.HLTSummary = "HLTSummaryOutput" # we do not care about this object, configure in order not to clash + EDMFillerAlg.InputDecision = "L1DecoderSummary" from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator DecisionObjectsFiller = HLTEDMCreator("DecisionObjectsFiller") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index 481ddb7b98aecfece23f125c18446ccc80d28234..4ba69190c4d6435db5a953b67033629269306d67 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -21,10 +21,9 @@ def makeSummary(name, flatDecisions): """ Returns a TriggerSummaryAlg connected to given decisions""" from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summary = TriggerSummaryAlg( name, OutputLevel = 2 ) - summary.InputDecision = "HLTChains" + summary.InputDecision = "L1DecoderSummary" summary.FinalDecisions = flatDecisions - summary.HLTSummary = "MonitoringSummary" + name return summary