From e28c6186f780d86462c92037095290ece5ec16f9 Mon Sep 17 00:00:00 2001 From: Tim Martin <Tim.Martin@cern.ch> Date: Tue, 18 Dec 2018 13:22:16 +0100 Subject: [PATCH] Update clients of DecisionSummaryMakerAlg to read in data given that there might be more that one Decision object, and using global key HLTSummary --- .../TrigExPartialEB/share/MTCalibPeb.py | 4 +-- .../src/TrigSignatureMoniMT.cxx | 17 +++++++++-- .../src/TrigSignatureMoniMT.h | 7 +++-- .../TrigOutputHandling/TriggerBitsMakerTool.h | 2 +- .../src/StreamTagMakerTool.cxx | 28 ++++++++++++++++++- .../src/StreamTagMakerTool.h | 17 ++++++++--- .../src/TriggerBitsMakerTool.cxx | 16 ++++++++++- .../TrigUpgradeTest/share/egamma.withViews.py | 7 ++--- 8 files changed, 81 insertions(+), 17 deletions(-) diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py index c87f070860cf..8c2b30fa44a9 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/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.cxx index a2c1f78d1800..b2a79e4e0a41 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; diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h index b463032bf370..e4441b4de0d0 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoniMT.h @@ -36,7 +36,7 @@ class TrigSignatureMoniMT : public ::AthAlgorithm 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/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/TriggerBitsMakerTool.h index 79ff3293cdf2..4b8160744a04 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/StreamTagMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx index 65b2f5144889..bc271753d7c8 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 3debf49a80cd..b4be32d2a0ae 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 35b6efddb282..4daf544ebe4a 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/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index 5c586479d5fb..0bbc49a002d3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -230,7 +230,6 @@ egammaEFCaloStep = stepSeq("egammaEFCalotep", filterL2ElectronRoIsAlg, [ efClust from DecisionHandling.DecisionHandlingConf import TriggerSummaryAlg summaryStep0 = TriggerSummaryAlg( "TriggerSummaryStep1" ) summaryStep0.InputDecision = "L1DecoderSummary" -summaryStep0.HLTSummary = "MonitoringSummaryStep1" summaryStep0.FinalDecisions = [ caloHypoDecisions ] summaryStep0.OutputLevel = DEBUG @@ -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") -- GitLab