diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx index 978e8c215fec9fbaa8e34a326a5096ee7ea088ec..7fbaefe5ffd397a8303388f935c74f23107b3f59 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/DecisionSummaryMakerAlg.cxx @@ -35,7 +35,7 @@ StatusCode DecisionSummaryMakerAlg::execute_r(const EventContext& context) const auto aux = std::make_unique<TrigCompositeUtils::DecisionAuxContainer>(); container->setStore( aux.get() ); - ATH_CHECK( outputHandle.record( std::move( container), std::move( aux )) ); + TrigCompositeUtils::Decision* output = TrigCompositeUtils::newDecisionIn( container.get(), "HLTSummary" ); for ( auto& key: m_finalDecisionKeys ) { @@ -65,6 +65,8 @@ StatusCode DecisionSummaryMakerAlg::execute_r(const EventContext& context) const } ATH_MSG_DEBUG( "Number of positive decisions " << TrigCompositeUtils::decisionIDs( output ).size() ); + ATH_CHECK( outputHandle.record( std::move( container), std::move( aux )) ); + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx index 804858e73e711de308cd3f6a62388805059caa75..50a204bbd5c458552d25cbe4cd2dc995998fc953 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMakerAlg.cxx @@ -5,53 +5,44 @@ #include "HLTResultMTMakerAlg.h" HLTResultMTMakerAlg::HLTResultMTMakerAlg(const std::string& name, ISvcLocator* pSvcLocator) : - AthReentrantAlgorithm(name, pSvcLocator) -{ -} + AthReentrantAlgorithm(name, pSvcLocator) {} -HLTResultMTMakerAlg::~HLTResultMTMakerAlg() -{ -} +HLTResultMTMakerAlg::~HLTResultMTMakerAlg() {} -StatusCode HLTResultMTMakerAlg::initialize() -{ - //ATH_MSG_DEBUG("Use macros for logging!"); +StatusCode HLTResultMTMakerAlg::initialize() { + ATH_CHECK( m_resultKey.initialize() ); + ATH_CHECK( m_monTool.retrieve() ); return StatusCode::SUCCESS; } -StatusCode HLTResultMTMakerAlg::finalize() -{ +StatusCode HLTResultMTMakerAlg::finalize() { return StatusCode::SUCCESS; } -StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const -{ +StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const { using namespace Monitored; - - - auto hltResult = SG::makeHandle(m_resultKey, context); - ATH_CHECK( hltResult.record(std::make_unique<HLT::HLTResultMT>()) ); - - auto time = MonitoredTimer::declare("TIME_build"); + auto hltResult = std::make_unique<HLT::HLTResultMT>(); + + auto time = MonitoredTimer::declare( "TIME_build" ); for ( auto& maker: m_makerTools ) { - maker->fill( *hltResult ); + ATH_CHECK( maker->fill( *hltResult ) ); } time.stop(); - // monitoring + // // monitoring auto nstreams = MonitoredScalar::declare( "nstreams", hltResult->getStreamTags().size() ); - auto nfrags = MonitoredScalar::declare( "nfrags", hltResult->getSerialisedData().size() ); - auto sizeMain = MonitoredScalar::declare( "sizeMain", -1 ); - + 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 = iter->second.size(); - - //auto sizeAll = MonitoredScalar::declare( "sizeAll", [&]() { return std::accumulate( hltResult->getSerialisedData().begin(), hltResult->getSerialisedData().end(), 0 ); } ); + if ( iter != hltResult->getSerialisedData().end() ) + sizeMain = double(iter->second.size()*sizeof(uint32_t))/1024; MonitoredScope::declare( m_monTool, time, nstreams, nfrags, sizeMain ); + + auto hltResultHandle = SG::makeHandle( m_resultKey, context ); + ATH_CHECK( hltResultHandle.record( std::move( hltResult ) ) ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx index af8307bffe2fb247864f2c150311250341071fca..3096820e152ec6cbd7f2ebdb704e4fa6e6e2b811 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx @@ -5,19 +5,19 @@ #include "DecisionHandling/HLTIdentifier.h" #include "StreamTagMakerTool.h" -StreamTagMakerTool::StreamTagMakerTool(const std::string& type, const std::string& name, const IInterface* parent) : - base_class(type, name, parent) -{ -} +StreamTagMakerTool::StreamTagMakerTool( const std::string& type, const std::string& name, const IInterface* parent ): + base_class( type, name, parent ) {} -StreamTagMakerTool::~StreamTagMakerTool() { -} +StreamTagMakerTool::~StreamTagMakerTool() {} StatusCode StreamTagMakerTool::initialize() { // decode mapping + ATH_CHECK( m_finalChainDecisions.initialize() ); for ( auto& chainAndStream: m_chainToStreamProperty ) { struct { std::string chain, stream; } conf { chainAndStream.first, chainAndStream.second }; + ATH_MSG_DEBUG( "Chain " << conf.chain << " accepts events to stream " << conf.stream ); m_mapping[ HLT::Identifier( conf.chain ) ] = eformat::helper::StreamTag( conf.stream, "physics", true ); + } return StatusCode::SUCCESS; @@ -35,11 +35,11 @@ StatusCode StreamTagMakerTool::fill( HLT::HLTResultMT& resultToFill ) const { std::vector<eformat::helper::StreamTag> streams; // for each accepted chain lookup the map of chainID -> ST - for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( chainsHandle->at(0)) ) { + for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( chainsHandle->at( 0 )) ) { auto mappingIter = m_mapping.find( chain ); // each chain has to have stream if( mappingIter == m_mapping.end() ) { - ATH_MSG_ERROR("Each chain has to have stream associated whereas the " << HLT::Identifier(chain) << " does not" ); + ATH_MSG_ERROR("Each chain has to have stream associated whereas the " << HLT::Identifier( chain ) << " does not" ); return StatusCode::FAILURE; } streams.push_back( mappingIter->second ); // TODO assume nultiple streams per chain @@ -48,8 +48,10 @@ StatusCode StreamTagMakerTool::fill( HLT::HLTResultMT& resultToFill ) const { // push back ST vector to HLTResultMT // make sure ST vector contains only unique content std::sort( streams.begin(), streams.end() ); - streams.erase( std::unique( streams.begin(), streams.end() ), streams.end() ); + auto endUnique = std::unique( streams.begin(), streams.end() ); + streams.erase( endUnique, streams.end() ); resultToFill.setStreamTags( streams ); + ATH_MSG_DEBUG("Number of streams for event " << streams.size() ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index 34fa6bf7f6559507b04f8d6912a1fc55f0c98390..9ecf8491577e67b9eee1bd95a1c53fc05b1e79b4 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -34,10 +34,10 @@ if globalflags.InputFormat.is_bytestream(): topSequence.L1DecoderTest.roiUnpackers[0].OutputLevel=DEBUG CTPToChainMapping = {"HLT_e3_etcut": "L1_EM3", - "HLT_e5_etcut": "L1_EM3", - "HLT_e7_etcut": "L1_EM7", - "HLT_2e3_etcut": "L1_2EM3", - "HLT_e3e5_etcut":"L1_2EM3"} + "HLT_e5_etcut": "L1_EM3", + "HLT_e7_etcut": "L1_EM7", + "HLT_2e3_etcut": "L1_2EM3", + "HLT_e3e5_etcut":"L1_2EM3"} topSequence.L1DecoderTest.prescaler.Prescales = ["HLT_e3_etcut:2", "HLT_2e3_etcut:2.5"] @@ -287,8 +287,11 @@ step2filter = parOR("step2filter", [ findAlgorithm(egammaEFCaloStep, "filterL2El step0rfilter = parOR("step0rfilter", [ findAlgorithm(egammaCaloStepRR, "Rerurn_filterL1RoIsAlg") ] ) + steps = seqAND("HLTSteps", [ step0filter, step0, step1filter, step1, step2filter, step2, step0rfilter, step0r ] ) + + from TrigSteerMonitor.TrigSteerMonitorConf import TrigSignatureMoniMT, DecisionCollectorTool mon = TrigSignatureMoniMT() mon.FinalDecisions = [ "ElectronL2Decisions", "MuonL2Decisions", "WhateverElse" ] @@ -305,6 +308,8 @@ step2Collector.Decisions = ["ElectronL2Decisions"] mon.CollectorTools = [step1Collector, step2Collector] + + import AthenaPoolCnvSvc.WriteAthenaPool from OutputStreamAthenaPool.OutputStreamAthenaPool import createOutputStream StreamESD=createOutputStream("StreamESD","myESD.pool.root",True) @@ -316,7 +321,6 @@ def addTC(name): for tc in egammaViewsMerger.TrigCompositeContainer: addTC( tc + "_remap" ) -addTC("HLTSummary") StreamESD.ItemList += [ "xAOD::TrigElectronContainer#HLT_xAOD__TrigElectronContainer_L2ElectronFex", "xAOD::TrackParticleContainer#HLT_xAOD_TrackParticleContainer_L2ElectronTracks", @@ -339,7 +343,43 @@ StreamESD.ItemList += [ "ROIB::RoIBResult#*" ] print "ESD file content " print StreamESD.ItemList -hltTop = seqOR( "hltTop", [ steps, mon, summary, StreamESD ] ) +from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg, HLTResultMTMakerAlg, StreamTagMakerTool +summMaker = DecisionSummaryMakerAlg() +summMaker.FinalDecisionKeys = [ theElectronHypo.HypoOutputDecisions ] +summMaker.FinalStepDecisions = dict( [ ( tool.getName(), theElectronHypo.HypoOutputDecisions ) for tool in theElectronHypo.HypoTools ] ) +summMaker.OutputLevel=DEBUG +print summMaker + +################################################################################ +# test online HLT Result maker + +stmaker = StreamTagMakerTool() +stmaker.OutputLevel = DEBUG +stmaker.ChainDecisions = "HLTFinalDecisions" +stmaker.ChainToStream = dict( [(c, "Main") for c in testChains ] ) +stmaker.ChainToStream["HLT_e5_etcut"] = "PhotonPerf" # just made up the name +hltResultMaker = HLTResultMTMakerAlg() +hltResultMaker.MakerTools = [ stmaker ] +hltResultMaker.OutputLevel = DEBUG + +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 + + + +################################################################################ +# assemble top list of algorithms + +hltTop = seqOR( "hltTop", [ steps, mon, summary, StreamESD, summMaker, hltResultMaker ] ) topSequence += hltTop from AthenaCommon.AlgSequence import dumpSequence