diff --git a/HLT/Trigger/TrigControl/TrigServices/share/TrigServicesEventLoopMgr.py b/HLT/Trigger/TrigControl/TrigServices/share/TrigServicesEventLoopMgr.py index 5c35f23b170f2ec711f0db90b3d74eb092c56e45..4ee0949303cc82279719e9253bfb6f2b6d10373e 100644 --- a/HLT/Trigger/TrigControl/TrigServices/share/TrigServicesEventLoopMgr.py +++ b/HLT/Trigger/TrigControl/TrigServices/share/TrigServicesEventLoopMgr.py @@ -146,6 +146,25 @@ if not hasattr(svcMgr, 'AthenaSealSvc'): svcMgr += AthenaServicesConf.AthenaSealSvc() theApp.CreateSvc += [svcMgr.AthenaSealSvc.getFullJobOptName()] +# ============================================================================== +# HLT result monitoring +# ============================================================================== +from TrigOutputHandling.TrigOutputHandlingConf import HLTResultMTMaker +hltResultMaker = HLTResultMTMaker() + +from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool, defineHistogram +hltResultMaker.MonTool = GenericMonitoringTool("MonOfHLTResultMTtest") +hltResultMaker.MonTool.HistPath = "OutputMonitoring" +hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPERT', type='TH1F', title='Time of result construction in;[micro seccond]', + xbins=100, xmin=0, xmax=1000 ), + defineHistogram( 'nstreams', path='EXPERT', type='TH1F', title='number of streams', + xbins=60, xmin=0, xmax=60 ), + defineHistogram( 'nfrags', path='EXPERT', type='TH1F', title='number of HLT results', + xbins=10, xmin=0, xmax=10 ), + defineHistogram( 'sizeMain', path='EXPERT', type='TH1F', title='Main (physics) HLT Result size;4B words', + xbins=100, xmin=-1, xmax=999 ) ] # 1000 k span + + # ============================================================================== # Message format # ============================================================================== @@ -163,6 +182,7 @@ HltEventLoopMgr.WhiteboardSvc = "EventDataSvc" HltEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() HltEventLoopMgr.EvtSel = evtSel HltEventLoopMgr.OutputCnvSvc = outputCnvSvc +HltEventLoopMgr.ResultMaker = hltResultMaker # configure here Level-1 CTP ROB identifier which is used in HLT diff --git a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h index 259f658ebe5d9e5a325fc5047218564e12bb3abb..a74339c4314b26610295e994f63563c2599cb445 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h +++ b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h @@ -6,7 +6,10 @@ #define TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H #include "TrigOutputHandling/HLTResultMT.h" +#include "TrigOutputHandling/HLTResultMTMakerTool.h" + #include "AthenaBaseComps/AthAlgTool.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" #include "StoreGate/WriteHandle.h" /** @class HLTResultMTMaker @@ -31,7 +34,14 @@ public: private: /// StoreGate key for the HLTResultMT - SG::WriteHandleKey<HLTResultMT> m_hltResultWHKey; + SG::WriteHandleKey<HLTResultMT> m_hltResultWHKey {this, "HLTResultWHKey", "HLTResultMT", + "Key of the output HLTResultMT object"}; + /// Tools filling the HLTResultMT object + ToolHandleArray<HLTResultMTMakerTool> m_makerTools {this, "MakerTools", {}, + "Set of tools that fill content of the HLTResultMT"}; + /// Monitoring tool + ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", + "Monitoring tool"}; }; #endif // TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx index c35ce6acfdbde3b2485568b3758a13174b8a7056..64b5d3547a9ffb116ec87f557cad6768a296db43 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx @@ -3,14 +3,13 @@ */ #include "TrigOutputHandling/HLTResultMTMaker.h" +#include "AthenaMonitoring/MonitoredScope.h" // ============================================================================= // Standard constructor // ============================================================================= HLTResultMTMaker::HLTResultMTMaker(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent) { - declareProperty("HLTResultWHKey", m_hltResultWHKey="HLTResult"); -} + : AthAlgTool(type, name, parent) {} // ============================================================================= // Standard destructor @@ -21,9 +20,8 @@ HLTResultMTMaker::~HLTResultMTMaker() {} // Implementation of IStateful::initialize // ============================================================================= StatusCode HLTResultMTMaker::initialize() { - ATH_MSG_VERBOSE("start of " << __FUNCTION__); ATH_CHECK(m_hltResultWHKey.initialize()); - ATH_MSG_VERBOSE("end of " << __FUNCTION__); + ATH_CHECK(m_monTool.retrieve()); return StatusCode::SUCCESS; } @@ -31,8 +29,7 @@ StatusCode HLTResultMTMaker::initialize() { // Implementation of IStateful::finalize // ============================================================================= StatusCode HLTResultMTMaker::finalize() { - ATH_MSG_VERBOSE("start of " << __FUNCTION__); - ATH_MSG_VERBOSE("end of " << __FUNCTION__); + ATH_CHECK(m_monTool.release()); return StatusCode::SUCCESS; } @@ -40,19 +37,30 @@ StatusCode HLTResultMTMaker::finalize() { // The main method of the tool // ============================================================================= StatusCode HLTResultMTMaker::makeResult(const EventContext& eventContext) const { - ATH_MSG_VERBOSE("start of " << __FUNCTION__); + + // Create and record the HLTResultMT object auto hltResult = SG::makeHandle(m_hltResultWHKey,eventContext); ATH_CHECK( hltResult.record(std::make_unique<HLTResultMT>()) ); ATH_MSG_DEBUG("Recorded HLTResultMT with key " << m_hltResultWHKey.key()); - // Dummy data for testing - hltResult->addStreamTag({"DummyStreamTag1",eformat::TagType::PHYSICS_TAG,true}); - hltResult->addStreamTag({"DummyStreamTag2",eformat::TagType::CALIBRATION_TAG,true}); - hltResult->addHltBitsWord(0x00000002); - hltResult->addHltBitsWord(0x00000020); - hltResult->addSerialisedData(0,{0x01234567,0x89ABCDEF}); - hltResult->addSerialisedData(5,{0xFEDCBA98,0x76543210}); + // Fill the object using the result maker tools + using namespace Monitored; + auto time = MonitoredTimer::declare("TIME_build" ); + for (auto& maker: m_makerTools) { + ATH_CHECK(maker->fill(*hltResult)); + } + time.stop(); + + // Fill monitoring histograms + auto nstreams = MonitoredScalar::declare("nstreams", hltResult->getStreamTags().size()); + auto bitWords = MonitoredScalar::declare("bitWords", hltResult->getHltBits().size()); + auto nfrags = MonitoredScalar::declare("nfrags", hltResult->getSerialisedData().size()); + auto sizeMain = MonitoredScalar::declare("sizeMain", -1.); + auto iter = hltResult->getSerialisedData().find(0); // this is the main fragment of the HLT result + if (iter != hltResult->getSerialisedData().end()) + sizeMain = double(iter->second.size()*sizeof(uint32_t))/1024; + + MonitoredScope::declare(m_monTool, time, nstreams, nfrags, sizeMain, bitWords); - ATH_MSG_VERBOSE("end of " << __FUNCTION__); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx index 19df7f2ceedaa98a47ffcfab653c60a2c4d3bb19..f73e203cec8a921b94c7025882674e5a0a5d282f 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -#include "AthenaMonitoring/MonitoredScope.h" + #include "HLTResultMTMakerAlg.h" HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* pSvcLocator) : @@ -10,42 +10,15 @@ HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* p HLTResultMTMakerAlg::~HLTResultMTMakerAlg() {} StatusCode HLTResultMTMakerAlg::initialize() { - ATH_CHECK( m_resultKey.initialize() ); - ATH_CHECK( m_monTool.retrieve() ); + ATH_CHECK( m_resultMaker.retrieve() ); return StatusCode::SUCCESS; } StatusCode HLTResultMTMakerAlg::finalize() { + ATH_CHECK( m_resultMaker.release() ); return StatusCode::SUCCESS; } StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const { - using namespace Monitored; - auto hltResult = std::make_unique<HLTResultMT>(); - - auto time = MonitoredTimer::declare( "TIME_build" ); - for ( auto& maker: m_makerTools ) { - ATH_CHECK( maker->fill( *hltResult ) ); - } - - - time.stop(); - // // monitoring - - - auto nstreams = MonitoredScalar::declare( "nstreams", hltResult->getStreamTags().size() ); - auto nfrags = MonitoredScalar::declare( "nfrags", hltResult->getSerialisedData().size() ); - auto sizeMain = MonitoredScalar::declare( "sizeMain", -1. ); - auto iter = hltResult->getSerialisedData().find( 0 ); // this is the main fragment of the HLT result - if ( iter != hltResult->getSerialisedData().end() ) - sizeMain = double(iter->second.size()*sizeof(uint32_t))/1024; - - auto bitWords = MonitoredScalar::declare( "bitWords", hltResult->getHltBits().size() ); - MonitoredScope::declare( m_monTool, time, nstreams, nfrags, sizeMain, bitWords ); - - - auto hltResultHandle = SG::makeHandle( m_resultKey, context ); - ATH_CHECK( hltResultHandle.record( std::move( hltResult ) ) ); - return StatusCode::SUCCESS; + return m_resultMaker->makeResult(context); } - diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.h b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.h index f3189bf31624f585b976be1dd1fc2b831808edaa..3a53f49c3530fec4b484e5df2d2b08bd2f3f90a5 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.h @@ -4,18 +4,13 @@ #ifndef TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H #define TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H -#include <string> +#include "TrigOutputHandling/HLTResultMTMaker.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "AthenaMonitoring/GenericMonitoringTool.h" - -#include "TrigOutputHandling/HLTResultMTMakerTool.h" - - /** * @class HLTResultMTMakerAlg - * @brief creates HLTResult and calls tools to fill the content, - * this is offline tester alg as notmally the same operation will be performed by HLTMPPU component + * @brief Simply calls the result maker tool to create HLTResultMT. The algorithm is meant to be used only offline. + * Online, the result maker is called directly by the event loop manager. **/ class HLTResultMTMakerAlg : public AthReentrantAlgorithm { public: @@ -27,9 +22,7 @@ public: virtual StatusCode finalize() override; private: - SG::WriteHandleKey<HLTResultMT> m_resultKey { this, "ResultKey", "HLTResultMT", "Key of the output object" }; - ToolHandleArray<HLTResultMTMakerTool> m_makerTools{ this, "MakerTools", {}, "set of tools that fill content of the HLTResultMT" }; - ToolHandle<GenericMonitoringTool> m_monTool { this, "MonTool", "", "Monitor" }; + ToolHandle<HLTResultMTMaker> m_resultMaker { this, "ResultMaker", "HLTResultMTMaker" }; }; diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index f081b55be0ee72f00fa9de82adce1557c5b6f534..a74807ac1116a52ed1df68e3375559aedfad80f4 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -334,7 +334,7 @@ StreamESD.ItemList += [ "ROIB::RoIBResult#*" ] print "ESD file content " print StreamESD.ItemList -from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg, HLTResultMTMakerAlg, StreamTagMakerTool, TriggerBitsMakerTool, TriggerEDMSerialiserTool +from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg, HLTResultMTMakerAlg, HLTResultMTMaker, StreamTagMakerTool, TriggerBitsMakerTool, TriggerEDMSerialiserTool summMaker = DecisionSummaryMakerAlg() summMaker.FinalDecisionKeys = [ theElectronHypo.HypoOutputDecisions ] summMaker.FinalStepDecisions = dict( [ ( tool.getName(), theElectronHypo.HypoOutputDecisions ) for tool in theElectronHypo.HypoTools ] ) @@ -361,7 +361,7 @@ bitsmaker.ChainDecisions = "HLTFinalDecisions" bitsmaker.ChainToBit = dict( [ (chain, 10*num) for num,chain in enumerate(testChains) ] ) bitsmaker.OutputLevel = DEBUG -hltResultMaker = HLTResultMTMakerAlg() +hltResultMaker = HLTResultMTMaker() hltResultMaker.MakerTools = [ stmaker, bitsmaker, serialiser ] hltResultMaker.OutputLevel = DEBUG @@ -377,6 +377,8 @@ hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPER defineHistogram( 'sizeMain', path='EXPERT', type='TH1F', title='Main (physics) HLT Result size;4B words', xbins=100, xmin=-1, xmax=999 ) ] # 1000 k span +hltResultMakerAlg = HLTResultMTMakerAlg() +hltResultMakerAlg.ResultMaker = hltResultMaker @@ -384,7 +386,7 @@ hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPER ################################################################################ # assemble top list of algorithms -hltTop = seqOR( "hltTop", [ steps, summMaker, mon, hltResultMaker, summary, StreamESD ] ) +hltTop = seqOR( "hltTop", [ steps, summMaker, mon, hltResultMakerAlg, summary, StreamESD ] ) topSequence += hltTop ###### Begin Cost Monitoring block