Skip to content
Snippets Groups Projects
Commit fb802232 authored by Rafal Bielski's avatar Rafal Bielski :wave:
Browse files

Move HLT result making from alg to tool

Move the functionality from HLTResultMTMakerAlg to HLTResultMTMaker and make the alg only call the tool.
Adjust the job options accordingly.


Former-commit-id: 69f08f09
parent 7b73d722
No related branches found
No related tags found
No related merge requests found
...@@ -146,6 +146,25 @@ if not hasattr(svcMgr, 'AthenaSealSvc'): ...@@ -146,6 +146,25 @@ if not hasattr(svcMgr, 'AthenaSealSvc'):
svcMgr += AthenaServicesConf.AthenaSealSvc() svcMgr += AthenaServicesConf.AthenaSealSvc()
theApp.CreateSvc += [svcMgr.AthenaSealSvc.getFullJobOptName()] 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 # Message format
# ============================================================================== # ==============================================================================
...@@ -163,6 +182,7 @@ HltEventLoopMgr.WhiteboardSvc = "EventDataSvc" ...@@ -163,6 +182,7 @@ HltEventLoopMgr.WhiteboardSvc = "EventDataSvc"
HltEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() HltEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName()
HltEventLoopMgr.EvtSel = evtSel HltEventLoopMgr.EvtSel = evtSel
HltEventLoopMgr.OutputCnvSvc = outputCnvSvc HltEventLoopMgr.OutputCnvSvc = outputCnvSvc
HltEventLoopMgr.ResultMaker = hltResultMaker
# configure here Level-1 CTP ROB identifier which is used in HLT # configure here Level-1 CTP ROB identifier which is used in HLT
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#define TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H #define TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H
#include "TrigOutputHandling/HLTResultMT.h" #include "TrigOutputHandling/HLTResultMT.h"
#include "TrigOutputHandling/HLTResultMTMakerTool.h"
#include "AthenaBaseComps/AthAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h"
#include "AthenaMonitoring/GenericMonitoringTool.h"
#include "StoreGate/WriteHandle.h" #include "StoreGate/WriteHandle.h"
/** @class HLTResultMTMaker /** @class HLTResultMTMaker
...@@ -31,7 +34,14 @@ public: ...@@ -31,7 +34,14 @@ public:
private: private:
/// StoreGate key for the HLTResultMT /// 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 #endif // TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
*/ */
#include "TrigOutputHandling/HLTResultMTMaker.h" #include "TrigOutputHandling/HLTResultMTMaker.h"
#include "AthenaMonitoring/MonitoredScope.h"
// ============================================================================= // =============================================================================
// Standard constructor // Standard constructor
// ============================================================================= // =============================================================================
HLTResultMTMaker::HLTResultMTMaker(const std::string& type, const std::string& name, const IInterface* parent) HLTResultMTMaker::HLTResultMTMaker(const std::string& type, const std::string& name, const IInterface* parent)
: AthAlgTool(type, name, parent) { : AthAlgTool(type, name, parent) {}
declareProperty("HLTResultWHKey", m_hltResultWHKey="HLTResult");
}
// ============================================================================= // =============================================================================
// Standard destructor // Standard destructor
...@@ -21,9 +20,8 @@ HLTResultMTMaker::~HLTResultMTMaker() {} ...@@ -21,9 +20,8 @@ HLTResultMTMaker::~HLTResultMTMaker() {}
// Implementation of IStateful::initialize // Implementation of IStateful::initialize
// ============================================================================= // =============================================================================
StatusCode HLTResultMTMaker::initialize() { StatusCode HLTResultMTMaker::initialize() {
ATH_MSG_VERBOSE("start of " << __FUNCTION__);
ATH_CHECK(m_hltResultWHKey.initialize()); ATH_CHECK(m_hltResultWHKey.initialize());
ATH_MSG_VERBOSE("end of " << __FUNCTION__); ATH_CHECK(m_monTool.retrieve());
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -31,8 +29,7 @@ StatusCode HLTResultMTMaker::initialize() { ...@@ -31,8 +29,7 @@ StatusCode HLTResultMTMaker::initialize() {
// Implementation of IStateful::finalize // Implementation of IStateful::finalize
// ============================================================================= // =============================================================================
StatusCode HLTResultMTMaker::finalize() { StatusCode HLTResultMTMaker::finalize() {
ATH_MSG_VERBOSE("start of " << __FUNCTION__); ATH_CHECK(m_monTool.release());
ATH_MSG_VERBOSE("end of " << __FUNCTION__);
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -40,19 +37,30 @@ StatusCode HLTResultMTMaker::finalize() { ...@@ -40,19 +37,30 @@ StatusCode HLTResultMTMaker::finalize() {
// The main method of the tool // The main method of the tool
// ============================================================================= // =============================================================================
StatusCode HLTResultMTMaker::makeResult(const EventContext& eventContext) const { 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); auto hltResult = SG::makeHandle(m_hltResultWHKey,eventContext);
ATH_CHECK( hltResult.record(std::make_unique<HLTResultMT>()) ); ATH_CHECK( hltResult.record(std::make_unique<HLTResultMT>()) );
ATH_MSG_DEBUG("Recorded HLTResultMT with key " << m_hltResultWHKey.key()); ATH_MSG_DEBUG("Recorded HLTResultMT with key " << m_hltResultWHKey.key());
// Dummy data for testing // Fill the object using the result maker tools
hltResult->addStreamTag({"DummyStreamTag1",eformat::TagType::PHYSICS_TAG,true}); using namespace Monitored;
hltResult->addStreamTag({"DummyStreamTag2",eformat::TagType::CALIBRATION_TAG,true}); auto time = MonitoredTimer::declare("TIME_build" );
hltResult->addHltBitsWord(0x00000002); for (auto& maker: m_makerTools) {
hltResult->addHltBitsWord(0x00000020); ATH_CHECK(maker->fill(*hltResult));
hltResult->addSerialisedData(0,{0x01234567,0x89ABCDEF}); }
hltResult->addSerialisedData(5,{0xFEDCBA98,0x76543210}); 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; return StatusCode::SUCCESS;
} }
/* /*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/ */
#include "AthenaMonitoring/MonitoredScope.h"
#include "HLTResultMTMakerAlg.h" #include "HLTResultMTMakerAlg.h"
HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* pSvcLocator) : HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* pSvcLocator) :
...@@ -10,42 +10,15 @@ HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* p ...@@ -10,42 +10,15 @@ HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* p
HLTResultMTMakerAlg::~HLTResultMTMakerAlg() {} HLTResultMTMakerAlg::~HLTResultMTMakerAlg() {}
StatusCode HLTResultMTMakerAlg::initialize() { StatusCode HLTResultMTMakerAlg::initialize() {
ATH_CHECK( m_resultKey.initialize() ); ATH_CHECK( m_resultMaker.retrieve() );
ATH_CHECK( m_monTool.retrieve() );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode HLTResultMTMakerAlg::finalize() { StatusCode HLTResultMTMakerAlg::finalize() {
ATH_CHECK( m_resultMaker.release() );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const { StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const {
using namespace Monitored; return m_resultMaker->makeResult(context);
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;
} }
...@@ -4,18 +4,13 @@ ...@@ -4,18 +4,13 @@
#ifndef TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H #ifndef TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H
#define TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H #define TRIGOUTPUTHANDLING_HLTRESULMTMAKERALG_H
#include <string> #include "TrigOutputHandling/HLTResultMTMaker.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaMonitoring/GenericMonitoringTool.h"
#include "TrigOutputHandling/HLTResultMTMakerTool.h"
/** /**
* @class HLTResultMTMakerAlg * @class HLTResultMTMakerAlg
* @brief creates HLTResult and calls tools to fill the content, * @brief Simply calls the result maker tool to create HLTResultMT. The algorithm is meant to be used only offline.
* this is offline tester alg as notmally the same operation will be performed by HLTMPPU component * Online, the result maker is called directly by the event loop manager.
**/ **/
class HLTResultMTMakerAlg : public AthReentrantAlgorithm { class HLTResultMTMakerAlg : public AthReentrantAlgorithm {
public: public:
...@@ -27,9 +22,7 @@ public: ...@@ -27,9 +22,7 @@ public:
virtual StatusCode finalize() override; virtual StatusCode finalize() override;
private: private:
SG::WriteHandleKey<HLTResultMT> m_resultKey { this, "ResultKey", "HLTResultMT", "Key of the output object" }; ToolHandle<HLTResultMTMaker> m_resultMaker { this, "ResultMaker", "HLTResultMTMaker" };
ToolHandleArray<HLTResultMTMakerTool> m_makerTools{ this, "MakerTools", {}, "set of tools that fill content of the HLTResultMT" };
ToolHandle<GenericMonitoringTool> m_monTool { this, "MonTool", "", "Monitor" };
}; };
......
...@@ -334,7 +334,7 @@ StreamESD.ItemList += [ "ROIB::RoIBResult#*" ] ...@@ -334,7 +334,7 @@ StreamESD.ItemList += [ "ROIB::RoIBResult#*" ]
print "ESD file content " print "ESD file content "
print StreamESD.ItemList 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 = DecisionSummaryMakerAlg()
summMaker.FinalDecisionKeys = [ theElectronHypo.HypoOutputDecisions ] summMaker.FinalDecisionKeys = [ theElectronHypo.HypoOutputDecisions ]
summMaker.FinalStepDecisions = dict( [ ( tool.getName(), theElectronHypo.HypoOutputDecisions ) for tool in theElectronHypo.HypoTools ] ) summMaker.FinalStepDecisions = dict( [ ( tool.getName(), theElectronHypo.HypoOutputDecisions ) for tool in theElectronHypo.HypoTools ] )
...@@ -361,7 +361,7 @@ bitsmaker.ChainDecisions = "HLTFinalDecisions" ...@@ -361,7 +361,7 @@ bitsmaker.ChainDecisions = "HLTFinalDecisions"
bitsmaker.ChainToBit = dict( [ (chain, 10*num) for num,chain in enumerate(testChains) ] ) bitsmaker.ChainToBit = dict( [ (chain, 10*num) for num,chain in enumerate(testChains) ] )
bitsmaker.OutputLevel = DEBUG bitsmaker.OutputLevel = DEBUG
hltResultMaker = HLTResultMTMakerAlg() hltResultMaker = HLTResultMTMaker()
hltResultMaker.MakerTools = [ stmaker, bitsmaker, serialiser ] hltResultMaker.MakerTools = [ stmaker, bitsmaker, serialiser ]
hltResultMaker.OutputLevel = DEBUG hltResultMaker.OutputLevel = DEBUG
...@@ -377,6 +377,8 @@ hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPER ...@@ -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', defineHistogram( 'sizeMain', path='EXPERT', type='TH1F', title='Main (physics) HLT Result size;4B words',
xbins=100, xmin=-1, xmax=999 ) ] # 1000 k span 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 ...@@ -384,7 +386,7 @@ hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPER
################################################################################ ################################################################################
# assemble top list of algorithms # 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 topSequence += hltTop
###### Begin Cost Monitoring block ###### Begin Cost Monitoring block
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment