diff --git a/Control/AthenaMonitoring/python/DefineHistogram.py b/Control/AthenaMonitoring/python/DefineHistogram.py new file mode 100644 index 0000000000000000000000000000000000000000..7081bef351d82e567edb6d521ee16028f1067f15 --- /dev/null +++ b/Control/AthenaMonitoring/python/DefineHistogram.py @@ -0,0 +1,29 @@ +# +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# + +def defineHistogram(varname, type='TH1F', path='EXPERT', + title='Unspecified_title_for_the_histogram_is_truly_annoying,_because_this_default_is_long;unspecified_label;unspecified_label', + xbins=100, xmin=0, xmax=1, + ybins=None, ymin=None, ymax=None, zmin=None, zmax=None, opt='', labels=None): + """ Generates the histogram definition string which is digestable by GenericMonitoringTool. + + + Note that defaults are compleetly unreasonable. The title is made annoying intentionally. + For histograms types, paths and all the options have a look at GenericMonitoringTool documentation. + """ + coded = "%s, %s, %s, %s, %d, %f, %f" % (path, type, varname, title, xbins, xmin, xmax) + if ybins is not None: + coded += ",%d, %f, %f" % (ybins, ymin, ymax) + if zmin is not None: + coded += ", %f, %f" % (zmin, zmax) + if ybins is None and ymin is not None: + coded += ", %f, %f" % (ymin, ymax) + if labels is not None: + labels = labels.strip() # remove spurious white-spaces + if len(labels)>0: + if labels[-1]!=':': labels += ':' # C++ parser expects at least one ":" + coded += ",%s " % labels + coded += ", %s" % opt + + return coded diff --git a/Trigger/TrigMonitoring/TrigMonitorBase/python/TrigGenericMonitoringToolConfig.py b/Trigger/TrigMonitoring/TrigMonitorBase/python/TrigGenericMonitoringToolConfig.py index a3ac8ec2222d8bcb32b5f8c00e035998d0ad8f87..ef91cf401263d354ce6b36cd79d7ae5e3b7d4e2b 100755 --- a/Trigger/TrigMonitoring/TrigMonitorBase/python/TrigGenericMonitoringToolConfig.py +++ b/Trigger/TrigMonitoring/TrigMonitorBase/python/TrigGenericMonitoringToolConfig.py @@ -19,32 +19,8 @@ else: as TrigGenericMonitoringTool log.info("Using thread-safe TrigGenericMonitoringTool") - -def defineHistogram(varname, type='TH1F', path='EXPERT', - title='Unspecified_title_for_the_histogram_is_truly_annoying,_because_this_default_is_long;unspecified_label;unspecified_label', - xbins=100, xmin=0, xmax=1, - ybins=None, ymin=None, ymax=None, zmin=None, zmax=None, opt='', labels=None): - """ Generates the histogram definition string which is digestable by TrigGenericMonitoringTool. - - - Note that defaults are compleetly unreasonable. The tile is intentionally made annoying. - For histogras types supported and allowed paths have a look at TrigGenericMonitoringTool documentation. - """ - coded = "%s, %s, %s, %s, %d, %f, %f" % (path, type, varname, title, xbins, xmin, xmax) - if ybins is not None: - coded += ",%d, %f, %f" % (ybins, ymin, ymax) - if zmin is not None: - coded += ", %f, %f" % (zmin, zmax) - if ybins is None and ymin is not None: - coded += ", %f, %f" % (ymin, ymax) - if labels is not None: - labels = labels.strip() # remove spurious white-spaces - if len(labels)>0: - if labels[-1]!=':': labels += ':' # C++ parser expects at least one ":" - coded += ",%s " % labels - coded += ", %s" % opt - - return coded +from AthenaMonitoring.DefineHistogram import defineHistogram as __defineHistogram +defineHistogram = __defineHistogram class TrigGenericMonitoringToolConfig(TrigGenericMonitoringTool): diff --git a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt index 7711fd4b891f4b8550f7682403435dcec2f6816b..560d50baa503ddbae48d812599c90a21f352d657 100644 --- a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt +++ b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt @@ -52,6 +52,7 @@ atlas_add_component( L1Decoder L1DecoderLib ) +atlas_install_python_modules( python/*.py) # Install files from the package: atlas_install_headers( L1Decoder ) atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigSteer/L1Decoder/python/L1DecoderMonitoring.py b/Trigger/TrigSteer/L1Decoder/python/L1DecoderMonitoring.py new file mode 100644 index 0000000000000000000000000000000000000000..913e33b7532315729d31cf2d4386264fadbd3514 --- /dev/null +++ b/Trigger/TrigSteer/L1Decoder/python/L1DecoderMonitoring.py @@ -0,0 +1,30 @@ +# +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# +from AthenaMonitoring.AthenaMonitoringConf import GenericMonitoringTool +from AthenaMonitoring.DefineHistogram import defineHistogram +import math + +def CTPUnpackingMonitoring( maxItems, maxChains ): + tool = GenericMonitoringTool( 'CTPUnpackingMonitoring' ) + tool.HistogramsGroupName="L1Decoder"; + tool.Histograms = [defineHistogram( 'TAVItems', path='EXPERT', type='TH1F', title='Number of active L1 TAV items;N Items;N Events', + xbins=maxItems, xmin=0, xmax=maxItems ), + defineHistogram( 'Chains', path='EXPERT', type='TH1F', title='Number of activated Chains;N Chains;N Events', + xbins=maxChains, xmin=0, xmax=maxChains ) ] + return tool + + +def RoIsUnpackingMonitoring( prefix, maxCount, maxEta=3. ): + tool = GenericMonitoringTool( prefix+'RoIsUnpackingMonitoring' ) + tool.HistogramsGroupName="L1Decoder/RoIs"+prefix; + tool.Histograms = [ defineHistogram( 'count', path='EXPERT', type='TH1F', title='Number of RoIs;N RoIs;N Events', + xbins=maxCount, xmin=0, xmax=maxCount ), + defineHistogram( 'eta', path='EXPERT', type='TH1F', title='Eta distribution;eta;N RoIs', + xbins=60, xmin=-maxEta, xmax=maxEta ), + defineHistogram( 'phi', path='EXPERT', type='TH1F', title='Phi distribution;phi;N RoIs', + xbins=64, xmin=-math.pi, xmax=math.pi ), + defineHistogram( 'eta, phi', path='EXPERT', type='TH2F', title='RoIs map;eta;phi', + xbins=30, xmin=-maxEta, xmax=maxEta, + ybins=32, ymin=-math.pi, ymax=math.pi ) ] + return tool diff --git a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py index 12ca54b270c2f47d2426bfb087993c9624bfd5a5..ae75fbc75192a363e7fefd7fb3de352848878e84 100755 --- a/Trigger/TrigSteer/L1Decoder/share/decodeBS.py +++ b/Trigger/TrigSteer/L1Decoder/share/decodeBS.py @@ -60,6 +60,11 @@ if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc svcMgr += ByteStreamAddressProviderSvc() +if not hasattr(svcMgr, 'THistSvc'): + from GaudiSvc.GaudiSvcConf import THistSvc + svcMgr += THistSvc() +svcMgr.THistSvc.Output = ["EXPERT DATAFILE='expert-monitoring.root', OPT='RECREATE'"] + from TrigConfigSvc.TrigConfigSvcConf import TrigConf__LVL1ConfigSvc l1svc = TrigConf__LVL1ConfigSvc("LVL1ConfigSvc") @@ -83,31 +88,24 @@ if nThreads >= 1: topSequence += SGInputLoader( OutputLevel=INFO, ShowEventDump=False ) topSequence.SGInputLoader.Load = [ ('ROIB::RoIBResult','RoIBResult') ] - -doL1Emulation=False +from L1Decoder.L1DecoderMonitoring import CTPUnpackingMonitoring, RoIsUnpackingMonitoring from L1Decoder.L1DecoderConf import CTPUnpackingTool, EMRoIsUnpackingTool, L1Decoder, MURoIsUnpackingTool from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool l1Decoder = L1Decoder( OutputLevel=DEBUG ) -if doL1Emulation: - ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) -else: - ctpUnpacker = CTPUnpackingTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) +ctpUnpacker = CTPUnpackingTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) + l1Decoder.ctpUnpacker = ctpUnpacker +l1Decoder.ctpUnpacker.MonTool = CTPUnpackingMonitoring(512, 200) l1Decoder.ctpUnpacker.CTPToChainMapping = ["0:HLT_e3", "0:HLT_g5", "1:HLT_e7", "2:HLT_2e3", "15:HLT_mu6", "33:HLT_2mu6", "15:HLT_mu6idperf", "42:HLT_e15mu4"] # this are real IDs of L1_* items in pp_v5 menu -if doL1Emulation: - emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG ) -else: - emUnpacker = EMRoIsUnpackingTool( OutputLevel=DEBUG ) - +emUnpacker = EMRoIsUnpackingTool( OutputLevel=DEBUG ) emUnpacker.ThresholdToChainMapping = ["EM3 : HLT_e3", "EM3 : HLT_g5", "EM7 : HLT_e7", "EM15 : HLT_e15mu4" ] +emUnpacker.MonTool = RoIsUnpackingMonitoring( prefix="EM", maxCount=30 ) -if doL1Emulation: - muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG ) -else: - muUnpacker = MURoIsUnpackingTool( OutputLevel=DEBUG ) +muUnpacker = MURoIsUnpackingTool( OutputLevel=DEBUG ) muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU6 : HLT_mu6idperf", "MU4 : HLT_e15mu4"] +muUnpacker.MonTool = RoIsUnpackingMonitoring( prefix="MU", maxCount=20 ) # do not know yet how to configure the services for it l1Decoder.roiUnpackers = [emUnpacker] @@ -125,18 +123,6 @@ chainSeedingDumper.Decisions = "HLTChainsResult" topSequence += chainSeedingDumper - -# caloDecoder = L1CaloDecoder() # by default it is steered towards the RoIBResult of the name above -# caloDecoder.OutputLevel=VERBOSE -# topSequence += caloDecoder - -# #Dumper -# from ViewAlgs.ViewAlgsConf import DumpDecisions -# dumper = DumpDecisions("L1CaloDecisions") -# dumper.OutputLevel=VERBOSE -# topSequence += dumper - - #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL) #-------------------------------------------------------------- diff --git a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingEmulationTool.cxx b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingEmulationTool.cxx index ae46d87a9ec5682549ee3de4f9ead7a86a4ebaa4..9a52e7fb0a0ba4483119b5d51034d7b9a22da16e 100644 --- a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingEmulationTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingEmulationTool.cxx @@ -17,121 +17,73 @@ using namespace HLT; CTPUnpackingEmulationTool::CTPUnpackingEmulationTool( const std::string& type, const std::string& name, const IInterface* parent ) - : AthAlgTool(type, name, parent), - m_inputFileName("CTPEmulation.dat") -{ - declareProperty("CTPToChainMapping", m_ctpToChainProperty, "Mapping of the form: '34:HLT_x', '35:HLT_y', ..., both CTP ID and chain may appear many times"); - declareProperty("ForceEnableAllChains", m_forceEnable=false, "Enables all chains in each event, testing mode"); - declareProperty("InputFilename", m_inputFileName, "Fake CTP RoIb input filename"); + : AthAlgTool( type, name, parent ), + m_inputFileName( "CTPEmulation.dat" ) { + declareProperty( "CTPToChainMapping", m_ctpToChainProperty, "Mapping of the form: '34:HLT_x', '35:HLT_y', ..., both CTP ID and chain may appear many times" ); + declareProperty( "ForceEnableAllChains", m_forceEnable=false, "Enables all chains in each event, testing mode" ); + declareProperty( "InputFilename", m_inputFileName, "Fake CTP RoIb input filename" ); } -CTPUnpackingEmulationTool::~CTPUnpackingEmulationTool() -{} +CTPUnpackingEmulationTool::~CTPUnpackingEmulationTool() {} StatusCode CTPUnpackingEmulationTool::parseInputFile() { - std::ifstream inputFile(m_inputFileName); + std::ifstream inputFile( m_inputFileName ); if ( not inputFile.good() ) { - ATH_MSG_ERROR("Input file " << m_inputFileName << " inaccessible"); + ATH_MSG_ERROR( "Input file " << m_inputFileName << " inaccessible" ); return StatusCode::FAILURE; } std::string line; while ( std::getline( inputFile, line ) ) { - //check if commented out + if ( line[0] == '#' ) continue; - // std::size_t found = line.find("#"); - // if (found != std::string::npos) { - // std::string line; - // std::getline(inputFile, line); - // continue; - // } std::istringstream allChains( line ); HLT::IDVec ids; while ( allChains ) { std::string chainName; allChains >> chainName; if ( not chainName.empty() ) - ids.push_back( HLT::Identifier(chainName).numeric() ); + ids.push_back( HLT::Identifier( chainName ).numeric() ); } - // auto chainId = HLT::Identifier(chainName); - // std::map<size_t, HLT::IDVec>::iterator it;// IndexToIdentifiers; - // for(it=m_ctpToChain.begin();it!=m_ctpToChain.end();it++) { - // auto ctpId = it->first; - // HLT::IDVec chains= it->second; - // auto itr = find (chains.begin(), chains.end(), chainId); - // if ( itr != chains.end() ) { - // event.insert( ctpId ); - // } - // } if ( not ids.empty() ) m_events.push_back( ids ); // new event } inputFile.close(); - ATH_MSG_DEBUG("In input file "<<m_inputFileName<<" found "<<m_events.size()<<" chain sets"); + ATH_MSG_DEBUG( "In input file "<<m_inputFileName<<" found "<<m_events.size()<<" chain sets" ); return StatusCode::SUCCESS; } StatusCode CTPUnpackingEmulationTool::initialize() { - CHECK( decodeCTPToChainMapping()); + CHECK( decodeCTPToChainMapping() ); - for(auto ctpid : m_ctpToChain){ - for (auto chain : ctpid.second){ - ATH_MSG_DEBUG( ctpid.first << " " << chain); + for( auto ctpid : m_ctpToChain ){ + for ( auto chain : ctpid.second ){ + ATH_MSG_DEBUG( ctpid.first << " " << chain ); } } return parseInputFile(); } - - - StatusCode CTPUnpackingEmulationTool::decode( const ROIB::RoIBResult& /*roib*/, HLT::IDVec& enabledChains ) const { - size_t numberPfActivatedBits= 0; - - if (m_events.size() ==0){ - ATH_MSG_ERROR("No chain set found. Cannot decode CTP emulation"); + if ( m_events.size() ==0 ){ + ATH_MSG_ERROR( "No chain set found. Cannot decode CTP emulation" ); return StatusCode::FAILURE; } - - - const EventContext& context = Gaudi::Hive::currentContext(); - int line = context.evt() % m_events.size(); - // ATH_MSG_DEBUG("Getting chains for event "<<ctx<<": retrieve combination from line "<< line); - // auto tav = m_events[line]; - enabledChains = m_events[line]; - - // for ( const auto& ctpIndex : tav ) { - // // ATH_MSG_DEBUG("Enabling chain from CTP ID " << ctpIndex); - // auto itr = m_ctpToChain.find(ctpIndex); - // if ( itr != m_ctpToChain.end() ) { - // enabledChains.insert( enabledChains.end(), itr->second.begin(), itr->second.end() ); - // } - // numberPfActivatedBits++; - // } - - // for ( auto chain: enabledChains ) { - // ATH_MSG_DEBUG( "Enabling chain: " << chain ); - // } - // if ( numberPfActivatedBits == 0 ) { - // ATH_MSG_ERROR( "All CTP bits were disabled, this event shoudl not have shown here" ); - // return StatusCode::FAILURE; - // } return StatusCode::SUCCESS; } -StatusCode CTPUnpackingEmulationTool::finalize() -{ +StatusCode CTPUnpackingEmulationTool::finalize() { return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx index ff1d559876a0a614eaf02c0d5897237bc5a7ad16..d15026af6fba21510c912480740446f2d83d58cd 100644 --- a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.cxx @@ -11,20 +11,29 @@ using namespace HLT; CTPUnpackingTool::CTPUnpackingTool( const std::string& type, const std::string& name, const IInterface* parent ) - : AthAlgTool(type, name, parent) { + : AthAlgTool(type, name, parent), + m_monTool("GenericMonitoringTool/MonTool", this) { declareProperty("CTPToChainMapping", m_ctpToChainProperty, "Mapping of the form: '34:HLT_x', '35:HLT_y', ..., both CTP ID and chain may appear many times"); declareProperty("ForceEnableAllChains", m_forceEnable=false, "Enables all chains in each event, testing mode"); + declareProperty("MonTool", m_monTool=ToolHandle<GenericMonitoringTool>("", this), "Basic Monitoring"); } - CTPUnpackingTool::~CTPUnpackingTool() {} +StatusCode CTPUnpackingTool::initialize() { + if ( not m_monTool.name().empty() ) + CHECK( m_monTool.retrieve() ); + return decodeCTPToChainMapping(); +} + StatusCode CTPUnpackingTool::decode( const ROIB::RoIBResult& roib, HLT::IDVec& enabledChains ) const { - size_t numberPfActivatedBits= 0; - + using namespace Monitored; + auto nTAVItems = MonitoredScalar::declare("TAVItems", 0); + auto nChains = MonitoredScalar::declare("Chains", 0); + auto monitorit = MonitoredScope::declare(m_monTool, nTAVItems, nChains); auto tav = roib.cTPResult().TAV(); const size_t tavSize = tav.size(); @@ -34,19 +43,24 @@ StatusCode CTPUnpackingTool::decode( const ROIB::RoIBResult& roib, HLT::IDVec& const bool decision = ( tav[wordCounter].roIWord() & (1 << bitCounter) ) > 0; if ( decision == true or m_forceEnable ) { - if ( decision ) + if ( decision ) { + nTAVItems = nTAVItems + 1; ATH_MSG_DEBUG( "L1 item " << ctpIndex << " active, enabling chains"); - numberPfActivatedBits++; + } + auto itr = m_ctpToChain.find(ctpIndex); - if ( itr != m_ctpToChain.end() ) + if ( itr != m_ctpToChain.end() ) { enabledChains.insert( enabledChains.end(), itr->second.begin(), itr->second.end() ); + + } } } } + nChains = enabledChains.size(); for ( auto chain: enabledChains ) { ATH_MSG_DEBUG( "Enabling chain: " << chain ); } - if ( numberPfActivatedBits == 0 ) { + if ( nTAVItems == 0 ) { ATH_MSG_ERROR( "All CTP bits were disabled, this event shoudl not have shown here" ); return StatusCode::FAILURE; } diff --git a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h index dffc7967c6478b43ef85355bb2e473cc0de57726..3c4f412affa6a37c4874f8b1c92eab713d3ac99b 100644 --- a/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/CTPUnpackingTool.h @@ -9,6 +9,7 @@ #include "GaudiKernel/IAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "DecisionHandling/HLTIdentifier.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" #include "./ICTPUnpackingTool.h" @@ -17,6 +18,8 @@ namespace ROIB { } + + class CTPUnpackingTool: public AthAlgTool, virtual public ::ICTPUnpackingTool{ public: @@ -35,12 +38,12 @@ public: */ StatusCode decode(const ROIB::RoIBResult& roib, HLT::IDVec& enabledChains) const override; - StatusCode initialize() override { return decodeCTPToChainMapping(); } + StatusCode initialize() override; private: - + ToolHandle<GenericMonitoringTool> m_monTool; }; diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx index 0f2546bfebeb715c1ac7a0c0d24c82374b1ba196..65d600ca06610b048fe92d8afb7f949f6fbb515f 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx @@ -17,13 +17,15 @@ EMRoIsUnpackingTool::EMRoIsUnpackingTool( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool ( type, name, parent ), - m_configSvc( "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name ) { + m_configSvc( "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name ), + m_monTool( "GenericMonitoringTool/MonTool", this ) { declareProperty( "Decisions", m_decisionsKey="EMRoIDecisions", "Decisions for each RoI" ); - declareProperty( "ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3 : HLT_e5', 'EM3 : HLT_e5tight', ..., (note spaces)" ); + declareProperty( "ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3 : HLT_e5', 'EM3 : HLT_e5tight', ..., ( note spaces )" ); declareProperty( "OutputTrigRoIs", m_trigRoIsKey="EMRoIs", "Name of the RoIs object produced by the unpacker" ); declareProperty( "OutputRecRoIs", m_recRoIsKey="RecEMRoIs", "Name of the RoIs object produced by the unpacker" ); declareProperty( "RoIWidth", m_roIWidth = 0.1, "Size of RoI in eta/ phi" ); + declareProperty( "MonTool", m_monTool=ToolHandle<GenericMonitoringTool>( "", this ), "Monitoring tool" ); } @@ -36,8 +38,10 @@ StatusCode EMRoIsUnpackingTool::initialize() { CHECK( m_decisionsKey.initialize() ); CHECK( m_trigRoIsKey.initialize() ); CHECK( m_recRoIsKey.initialize() ); + if ( not m_monTool.name().empty() ) + CHECK( m_monTool.retrieve() ); - if (decodeMapping().isFailure() ) { + if ( decodeMapping().isFailure() ) { ATH_MSG_ERROR( "Failed to decode threshold to chains mapping, is the format th : chain?" ); return StatusCode::FAILURE; } @@ -50,10 +54,10 @@ StatusCode EMRoIsUnpackingTool::updateConfiguration() { const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); auto filteredThresholds= thresholdConfig->getThresholdVector( L1DataDef::EM ); ATH_MSG_DEBUG( "Number of filtered thresholds " << filteredThresholds.size() ); - for (auto th : filteredThresholds ) { + for ( auto th : filteredThresholds ) { if ( th != nullptr ) { - ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); - m_emThresholds.push_back(th); + ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier( th->name() ).numeric() ); + m_emThresholds.push_back( th ); } else { ATH_MSG_DEBUG( "Nullptr to the threshold" ); } @@ -74,10 +78,11 @@ StatusCode EMRoIsUnpackingTool::unpack( const EventContext& ctx, using namespace TrigCompositeUtils; auto decisionOutput = std::make_unique<DecisionContainer>(); auto decisionAux = std::make_unique<DecisionAuxContainer>(); - decisionOutput->setStore(decisionAux.get()); + decisionOutput->setStore( decisionAux.get() ); auto trigRoIs = std::make_unique< TrigRoiDescriptorCollection >(); auto recRoIs = std::make_unique< DataVector<LVL1::RecEmTauRoI> >(); + // RoIBResult contains vector of EM fragments for ( auto& emTauFragment : roib.eMTauResult() ) { for ( auto& roi : emTauFragment.roIVec() ) { @@ -95,38 +100,46 @@ StatusCode EMRoIsUnpackingTool::unpack( const EventContext& ctx, recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth ); trigRoIs->push_back( trigRoI ); - ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << MSG::dec ); + ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw( 8 ) << roIWord << MSG::dec ); auto decision = TrigCompositeUtils::newDecisionIn( decisionOutput.get() ); for ( auto th: m_emThresholds ) { ATH_MSG_VERBOSE( "Checking if the threshold " << th->name() << " passed" ); if ( recRoI->passedThreshold( th->thresholdNumber() ) ) { - ATH_MSG_DEBUG("Passed Threshold name " << th->name()); + ATH_MSG_DEBUG( "Passed Threshold name " << th->name() ); addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains ); } } - // TODO would be nice to have this. Requires modifying the TC class: decision->setDetail("Thresholds", passedThresholds); // record passing threshold names (for easy debugging) - decision->setObjectLink( "initialRoI", ElementLink<TrigRoiDescriptorCollection>(m_trigRoIsKey.key(), trigRoIs->size()-1 ) ); - decision->setObjectLink( "initialRecRoI", ElementLink<DataVector<LVL1::RecEmTauRoI>>(m_recRoIsKey.key(), recRoIs->size()-1) ); + // TODO would be nice to have this. Requires modifying the TC class: decision->setDetail( "Thresholds", passedThresholds ); // record passing threshold names ( for easy debugging ) + decision->setObjectLink( "initialRoI", ElementLink<TrigRoiDescriptorCollection>( m_trigRoIsKey.key(), trigRoIs->size()-1 ) ); + decision->setObjectLink( "initialRecRoI", ElementLink<DataVector<LVL1::RecEmTauRoI>>( m_recRoIsKey.key(), recRoIs->size()-1 ) ); } } for ( auto roi: *trigRoIs ) { - ATH_MSG_DEBUG("RoI Eta: " << roi->eta() << " Phi: " << roi->phi() << " RoIWord: " << roi->roiWord()); + ATH_MSG_DEBUG( "RoI Eta: " << roi->eta() << " Phi: " << roi->phi() << " RoIWord: " << roi->roiWord() ); + } + // monitoring + { + using namespace Monitored; + auto RoIsCount = MonitoredScalar::declare( "count", trigRoIs->size() ); + auto RoIsPhi = MonitoredCollection::declare( "phi", *trigRoIs.get(), &TrigRoiDescriptor::phi ); + auto RoIsEta = MonitoredCollection::declare( "eta", *trigRoIs.get(), &TrigRoiDescriptor::eta ); + MonitoredScope::declare( m_monTool, RoIsCount, RoIsEta, RoIsPhi ); } // recording { - SG::WriteHandle<TrigRoiDescriptorCollection> handle(m_trigRoIsKey, ctx); - CHECK( handle.record (std::move(trigRoIs)) ); + SG::WriteHandle<TrigRoiDescriptorCollection> handle( m_trigRoIsKey, ctx ); + CHECK( handle.record ( std::move( trigRoIs ) ) ); } { - SG::WriteHandle<DataVector<LVL1::RecEmTauRoI>> handle(m_recRoIsKey, ctx); - CHECK( handle.record( std::move(recRoIs)) ); + SG::WriteHandle<DataVector<LVL1::RecEmTauRoI>> handle( m_recRoIsKey, ctx ); + CHECK( handle.record( std::move( recRoIs ) ) ); } { - auto handle = SG::makeHandle(m_decisionsKey, ctx); + auto handle = SG::makeHandle( m_decisionsKey, ctx ); CHECK ( handle.record( std::move( decisionOutput ), std::move( decisionAux ) ) ); } return StatusCode::SUCCESS; // what else diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h index cfd48eff417a414bdfa57cf8dc423d127e73d8e0..e07af275f1aeefcad445075cca27e7574c7bdd3e 100644 --- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.h @@ -12,6 +12,7 @@ #include "TrigConfL1Data/TriggerThreshold.h" #include "TrigT1Interfaces/RecEmTauRoI.h" #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" // FrameWork includes #include "AthenaBaseComps/AthAlgTool.h" @@ -47,6 +48,7 @@ class EMRoIsUnpackingTool : virtual public AthAlgTool, virtual public IRoIsUnpac SG::WriteHandleKey< DataVector<LVL1::RecEmTauRoI> > m_recRoIsKey; ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc; float m_roIWidth; + ToolHandle<GenericMonitoringTool> m_monTool; }; #endif //> !L1DECODER_EMROISUNPACKINGTOOL_H diff --git a/Trigger/TrigSteer/L1Decoder/src/FakeCTP.cxx b/Trigger/TrigSteer/L1Decoder/src/FakeCTP.cxx index fcb7fbf0c7d3f6fcdea3ccd096f9991c8abaaf6b..fffa8998f5268b8b455295a7e5020db35eb63206 100644 --- a/Trigger/TrigSteer/L1Decoder/src/FakeCTP.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/FakeCTP.cxx @@ -49,6 +49,9 @@ StatusCode FakeCTP::execute() { m_decisions = CxxUtils::make_unique< xAOD::TrigCompositeContainer >(); m_decisionsAux = CxxUtils::make_unique< xAOD::TrigCompositeAuxContainer>(); m_decisions->setStore(m_decisionsAux.ptr()); + + + for ( const auto& chain : m_events[m_currentEvent] ) { ATH_MSG_DEBUG("Enabling chain " << TrigConf::HLTUtils::hash2string(chain, "chain")); diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx index 5b4749c3100ad3adaffbe80c44a887d2c62dc45c..14a38c9e9136e9a5bfe5d644cd39efdc4972234b 100644 --- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.cxx @@ -7,7 +7,6 @@ #include "IRoIsUnpackingTool.h" - IRoIsUnpackingTool::~IRoIsUnpackingTool() {} diff --git a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h index d402cac5839f5b18c73a862aef6644c0e7807c35..c15a9dc9b5145d1279187a0cca456b5f5ac92f5f 100644 --- a/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/IRoIsUnpackingTool.h @@ -9,11 +9,11 @@ #include "DecisionHandling/TrigCompositeUtils.h" #include "DecisionHandling/HLTIdentifier.h" + namespace ROIB { class RoIBResult; } - static const InterfaceID IID_IRoIsUnpackingTool("IRoIsUnpackingTool", 1, 0); class IRoIsUnpackingTool @@ -21,6 +21,8 @@ class IRoIsUnpackingTool { public: + + /** Destructor: */ virtual ~IRoIsUnpackingTool(); @@ -52,6 +54,7 @@ protected: std::vector<std::string> m_thresholdToChainProperty; std::map<HLT::Identifier, HLT::IDVec> m_thresholdToChainMapping; + StatusCode decodeMapping(); void addChainsToDecision( HLT::Identifier thresholdId, TrigCompositeUtils::Decision* d, diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx index 70b364b1094ab48dea43a54e2eea866d0df6194f..99b6b241852ef006bfaa85169e824924ef2f74b1 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.cxx @@ -19,13 +19,15 @@ MURoIsUnpackingTool::MURoIsUnpackingTool( const std::string& type, : AthAlgTool ( type, name, parent ), m_configSvc( "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name ), m_recRpcRoISvc( "LVL1RPC::RPCRecRoiSvc/RPCRecRoiSvc", name ), - m_recTgcRoISvc( "LVL1TGC::TGCRecRoiSvc/TGCRecRoiSvc", name ) { + m_recTgcRoISvc( "LVL1TGC::TGCRecRoiSvc/TGCRecRoiSvc", name ), + m_monTool( "GenericMonitoringTool/MonTool", this ) { declareProperty( "Decisions", m_decisionsKey="MURoIDecisions", "Decisions for each RoI" ); declareProperty( "ThresholdToChainMapping", m_thresholdToChainProperty, "Mapping from the threshold name to chain in the form: 'EM3:HLT_e5', 'EM3:HLT_e5tight', ..." ); declareProperty( "OutputTrigRoIs", m_trigRoIsKey="MURoIs", "Name of the RoIs object produced by the unpacker" ); declareProperty( "OutputRecRoIs", m_recRoIsKey ="RecMURoIs", "Name of the RoIs object produced by the unpacker" ); declareProperty( "RoIWidth", m_roIWidth = 0.1, "Size of RoI in eta/ phi" ); + declareProperty( "MonTool", m_monTool=ToolHandle<GenericMonitoringTool>( "", this ), "Monitoring tool" ); } // Destructor @@ -41,7 +43,10 @@ StatusCode MURoIsUnpackingTool::initialize() { CHECK( m_recRoIsKey.initialize() ); CHECK( m_recRpcRoISvc.retrieve() ); CHECK( m_recTgcRoISvc.retrieve() ); - if (decodeMapping().isFailure() ) { + if ( not m_monTool.name().empty() ) + CHECK( m_monTool.retrieve() ); + + if ( decodeMapping().isFailure() ) { ATH_MSG_ERROR( "Failed to decode threshold to chains mapping, is the format th : chain?" ); return StatusCode::FAILURE; } @@ -51,10 +56,10 @@ StatusCode MURoIsUnpackingTool::initialize() { StatusCode MURoIsUnpackingTool::updateConfiguration() { using namespace TrigConf; const ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - for (TriggerThreshold * th : thresholdConfig->getThresholdVector( L1DataDef::MUON ) ) { + for ( TriggerThreshold * th : thresholdConfig->getThresholdVector( L1DataDef::MUON ) ) { if ( th != nullptr ) { - ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier(th->name()).numeric() ); - m_muonThresholds.push_back(th); + ATH_MSG_DEBUG( "Found threshold in the configuration: " << th->name() << " of ID: " << HLT::Identifier( th->name() ).numeric() ); + m_muonThresholds.push_back( th ); } } return StatusCode::SUCCESS; @@ -70,7 +75,7 @@ StatusCode MURoIsUnpackingTool::unpack( const EventContext& ctx, using namespace TrigCompositeUtils; auto decisionOutput = std::make_unique<DecisionContainer>(); auto decisionAux = std::make_unique<DecisionAuxContainer>(); - decisionOutput->setStore(decisionAux.get()); + decisionOutput->setStore( decisionAux.get() ); auto trigRoIs = std::make_unique< TrigRoiDescriptorCollection >(); auto recRoIs = std::make_unique< DataVector<LVL1::RecMuonRoI> >(); @@ -83,14 +88,14 @@ StatusCode MURoIsUnpackingTool::unpack( const EventContext& ctx, << thresholdNumber << ", force setting it to 1" ); thresholdNumber = 1; } - LVL1::RecMuonRoI* recRoI = new LVL1::RecMuonRoI(roIWord, m_recRpcRoISvc.get(), m_recTgcRoISvc.get(), &m_muonThresholds); - recRoIs->push_back(recRoI); + LVL1::RecMuonRoI* recRoI = new LVL1::RecMuonRoI( roIWord, m_recRpcRoISvc.get(), m_recTgcRoISvc.get(), &m_muonThresholds ); + recRoIs->push_back( recRoI ); auto trigRoI = new TrigRoiDescriptor( roIWord, 0u ,0u, recRoI->eta(), recRoI->eta()-m_roIWidth, recRoI->eta()+m_roIWidth, recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth ); trigRoIs->push_back( trigRoI ); - ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << ", threshold pattern "); + ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw( 8 ) << roIWord << ", threshold pattern " ); auto decision = TrigCompositeUtils::newDecisionIn( decisionOutput.get() ); @@ -101,19 +106,26 @@ StatusCode MURoIsUnpackingTool::unpack( const EventContext& ctx, } } } - + // monitoring + { + using namespace Monitored; + auto RoIsCount = MonitoredScalar::declare( "count", trigRoIs->size() ); + auto RoIsPhi = MonitoredCollection::declare( "phi", *trigRoIs.get(), &TrigRoiDescriptor::phi ); + auto RoIsEta = MonitoredCollection::declare( "eta", *trigRoIs.get(), &TrigRoiDescriptor::eta ); + MonitoredScope::declare( m_monTool, RoIsCount, RoIsEta, RoIsPhi ); + } // recording { auto handle = SG::makeHandle( m_trigRoIsKey, ctx ); - CHECK( handle.record( std::move(trigRoIs) ) ); + CHECK( handle.record( std::move( trigRoIs ) ) ); } { auto handle = SG::makeHandle( m_recRoIsKey, ctx ); - CHECK( handle.record( std::move(recRoIs) ) ); + CHECK( handle.record( std::move( recRoIs ) ) ); } { auto handle = SG::makeHandle( m_decisionsKey, ctx ); - CHECK( handle.record( std::move(decisionOutput) ) ); + CHECK( handle.record( std::move( decisionOutput ) ) ); } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h index 7ee84dbdf37a6704b6157a314e193edca1e2a915..c7c18fa0db5e150f93364516be25936c191ce9c2 100644 --- a/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h +++ b/Trigger/TrigSteer/L1Decoder/src/MURoIsUnpackingTool.h @@ -18,7 +18,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "TrigT1Interfaces/RecMuonRoiSvc.h" - +#include "AthenaMonitoring/GenericMonitoringTool.h" #include "IRoIsUnpackingTool.h" @@ -62,6 +62,7 @@ private: ServiceHandle<LVL1::RecMuonRoiSvc> m_recRpcRoISvc; ServiceHandle<LVL1::RecMuonRoiSvc> m_recTgcRoISvc; float m_roIWidth; + ToolHandle<GenericMonitoringTool> m_monTool; }; // I/O operators diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt index 207226f2f1673b4e0f464a710af3bae039b46b20..afb053fcc79973dfc3e64a2b497a935dac436b2b 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -40,7 +40,8 @@ atlas_add_test( GraphView2 SCRIPT scripts/GraphView.sh atlas_add_test( GraphView64 SCRIPT scripts/GraphView.sh ENVIRONMENT THREADS=64 ) -atlas_add_test( creatingEVTest SCRIPT ../../TrigSteer/ViewAlgsTest/scripts/creatingEVTest.sh ) +# out untill we find a way to properly invoke tests from other packages +# atlas_add_test( creatingEVTest SCRIPT forward.sh ViewAlgsTest/scripts/creatingEVTest.sh ) atlas_add_test( mergeTest SCRIPT scripts/mergeTest.sh) @@ -58,5 +59,7 @@ atlas_add_test( caloRunData SCRIPT scripts/caloRunData.sh atlas_add_test( EmuL1DecodingTest SCRIPT scripts/EmuL1DecodingTest.sh) +atlas_add_test( DataL1DecodingTest SCRIPT scripts/DataL1DecodingTest.sh ) + atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/scripts/DataL1DecodingTest.sh b/Trigger/TrigValidation/TrigUpgradeTest/scripts/DataL1DecodingTest.sh new file mode 100755 index 0000000000000000000000000000000000000000..56c20b088502c5324c1c81615fe0f5105c5926cc --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/scripts/DataL1DecodingTest.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh + +get_files -xmls LVL1config_Physics_pp_v5.xml +ln -s /afs/cern.ch/atlas/project/trigger/pesa-sw/validation/atn-test/data15_13TeV.00266904.physics_EnhancedBias.merge.RAW._lb0452._SFO-1._0001.1 input.data + +athena.py --threads=1 L1Decoder/decodeBS.py + +cat <<EOF > hasStat.C +void hasStat( const char* hname) { + + TH1* h = (TH1*)_file0->Get( hname ); + if ( h == 0 ) { + cout << "Missing histogram " << hname << "\n"; + exit (EXIT_FAILURE); + } + Long_t entries = h->GetEntries(); + if ( entries == 0 ) { + cout << "Histogram " << hname << " has ) entries \n"; + exit (EXIT_FAILURE); + } + cout << "Histogram " << hname << " has " << entries << " entries \n"; +} +EOF + + +root -b -q expert-monitoring.root 'hasStat.C("L1Decoder/TAVItems")' +root -b -q expert-monitoring.root 'hasStat.C("L1Decoder/Chains")' diff --git a/Trigger/TrigValidation/TrigUpgradeTest/scripts/EmuL1DecodingTest.sh b/Trigger/TrigValidation/TrigUpgradeTest/scripts/EmuL1DecodingTest.sh index e465237de8d3e80382cce9e298afee3febc60105..30f0f8b3de3db5f898e331b6c55ed8fbefb3fca4 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/scripts/EmuL1DecodingTest.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/scripts/EmuL1DecodingTest.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -get_files -xmls LVL1config_Physics_pp_v5.xml +#get_files -xmls LVL1config_Physics_pp_v5.xml #get_files -data CTPEmulation.dat -ln -s /afs/cern.ch/atlas/project/trigger/pesa-sw/validation/atn-test/data15_13TeV.00266904.physics_EnhancedBias.merge.RAW._lb0452._SFO-1._0001.1 input.data +#ln -s /afs/cern.ch/atlas/project/trigger/pesa-sw/validation/atn-test/data15_13TeV.00266904.physics_EnhancedBias.merge.RAW._lb0452._SFO-1._0001.1 input.data athena.py --threads=1 TrigUpgradeTest/EmuL1DecodingTest.py diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py index b0230b84c0a615cbefcd98f79a5a3a9bf4b6395a..53663aaff37398467e7c5d2b15cbe652cebbe932 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuL1DecodingTest.py @@ -2,30 +2,13 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # -# -# get_files LVL1config_Physics_pp_v5.xml -# ln -s /afs/cern.ch/atlas/project/trigger/pesa-sw/validation/atn-test/data15_13TeV.00266904.physics_EnhancedBias.merge.RAW._lb0452._SFO-1._0001.1 input.data -# exact config for this data is: https://atlas-trigconf.cern.ch/run2/smkey/2142/l1key/1077/hltkey/765/ - import os.path -assert os.path.isfile('input.data'), 'No input file: see the JO to see how to get it' - -## @file L1Topo_ReadBS_test.py -## @brief Example job options file to read BS file to test a converter -## $Id: decodeBS.parallel.py 717359 2016-01-12 14:40:21Z bwynne $ -############################################################### -# -# This Job option: -# ---------------- -# 1. Read ByteStream test data file and decode the L1Topo part -# -#============================================================== ## basic job configuration import AthenaCommon.AtlasUnixStandardJob #import AthenaCommon.AtlasThreadedJob -include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) +#include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) ## get a handle on the ServiceManager from AthenaCommon.AppMgr import ServiceMgr as svcMgr @@ -46,79 +29,34 @@ if nThreads >= 1: from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() -# older file, has wrong ROD id: svcMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/user/m/mzinser/public/l1calo-event.sim"] -#svcMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/user/m/mzinser/public/InputSimon/Mode7/l1calo-event.sim" ] -svcMgr.ByteStreamInputSvc.FullFileName = [ "./input.data" ] -#svcMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/user/s/sgeorge/atlaspublic/L1TopoCnv/mergedsim._0001.data" ] - -svcMgr.ByteStreamInputSvc.ValidateEvent = True -svcMgr.EventSelector.ProcessBadEvent = True - - - -if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): - from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc - svcMgr += ByteStreamAddressProviderSvc() - - -from TrigConfigSvc.TrigConfigSvcConf import TrigConf__LVL1ConfigSvc -l1svc = TrigConf__LVL1ConfigSvc("LVL1ConfigSvc") -l1svc.XMLMenuFile = "LVL1config_Physics_pp_v5.xml" -svcMgr += l1svc - - -# This is the list of proxies to set up so that retrieval attempt will trigger the BS conversion -svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ - "ROIB::RoIBResult/RoIBResult" ] - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# Load "user algorithm" top algorithms to be run, and the libraries that house them - - -if nThreads >= 1: - #Retrieve input data - from SGComps.SGCompsConf import SGInputLoader - topSequence += SGInputLoader( OutputLevel=INFO, ShowEventDump=False ) - topSequence.SGInputLoader.Load = [ ('ROIB::RoIBResult','RoIBResult') ] - - -doL1Emulation=True from L1Decoder.L1DecoderConf import CTPUnpackingTool, EMRoIsUnpackingTool, L1Decoder, MURoIsUnpackingTool from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool l1Decoder = L1Decoder( OutputLevel=DEBUG ) -if doL1Emulation: - data = {} - data['CTPEmulation'] = ['HLT_e3 HLT_g5 HLT_e7 HLT_2e3 HLT_mu6 HLT_2mu6 HLT_mu6idperf HLT_e15mu4'] - data['RoIEmulation'] = ['1.3,2.9,2704088841,EM3,EM7; 1.2,3.1,2972524297,EM3,EM7,EM10,EM15; -3.2,-2.0,3103727387,MU0,MU4,MU6,MU8', - '1.2,1.9,2733969453,MU0,MU4,MU6,MU8,MU10;2.2,1.0,2733969453,MU0,MU4,MU6', - '-3.2,3.0,2704088841,MU0,MU4,MU6,MU8;3.0,1.6,2972524297,MU0,MU4', - '1.3,1.9,3103727387,MU0,MU10;1.2,2.6,2733969453,MU6;-1.1,2.6,2972524297,MU6; -1.2,2.6,2704088842,MU20'] +l1Decoder.RoIBResult="" - from TrigUpgradeTest.TestUtils import writeEmulationFiles - writeEmulationFiles(data) +data = {} +data['CTPEmulation'] = ['HLT_e3 HLT_g5 HLT_e7 HLT_2e3 HLT_mu6 HLT_2mu6 HLT_mu6idperf HLT_e15mu4', + 'HLT_e3 HLT_g5 HLT_mu6 HLT_2mu6 HLT_mu6idperf HLT_e15mu4', + 'HLT_e3 HLT_g5 HLT_e7 HLT_2e3 HLT_mu6 HLT_2mu6', + 'HLT_mu6 HLT_2mu6 HLT_mu6idperf HLT_e15mu4', ] # just to see some change +data['RoIEmulation'] = ['1.3,2.9,2704088841,EM3,EM7; 1.2,3.1,2972524297,EM3,EM7,EM10,EM15; -3.2,-2.0,3103727387,MU0,MU4,MU6,MU8', + '1.2,1.9,2733969453,MU0,MU4,MU6,MU8,MU10;2.2,1.0,2733969453,MU0,MU4,MU6', + '-3.2,3.0,2704088841,MU0,MU4,MU6,MU8;3.0,1.6,2972524297,MU0,MU4', + '1.3,1.9,3103727387,MU0,MU10;1.2,2.6,2733969453,MU6;-1.1,2.6,2972524297,MU6; -1.2,2.6,2704088842,MU20'] +from TrigUpgradeTest.TestUtils import writeEmulationFiles +writeEmulationFiles(data) - ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) -else: - ctpUnpacker = CTPUnpackingTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) +ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=True ) l1Decoder.ctpUnpacker = ctpUnpacker l1Decoder.ctpUnpacker.CTPToChainMapping = ["0:HLT_e3", "0:HLT_g5", "1:HLT_e7", "2:HLT_2e3", "15:HLT_mu6", "33:HLT_2mu6", "15:HLT_mu6idperf", "42:HLT_e15mu4"] # this are real IDs of L1_* items in pp_v5 menu -if doL1Emulation: - emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG ) -else: - emUnpacker = EMRoIsUnpackingTool( OutputLevel=DEBUG ) - +emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG ) emUnpacker.ThresholdToChainMapping = ["EM3 : HLT_e3", "EM3 : HLT_g5", "EM7 : HLT_e7", "EM15 : HLT_e15mu4" ] -if doL1Emulation: - muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG ) -else: - muUnpacker = MURoIsUnpackingTool( OutputLevel=DEBUG ) +muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG ) muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU6 : HLT_mu6idperf", "MU4 : HLT_e15mu4"] # do not know yet how to configure the services for it @@ -138,15 +76,6 @@ topSequence += chainSeedingDumper -# caloDecoder = L1CaloDecoder() # by default it is steered towards the RoIBResult of the name above -# caloDecoder.OutputLevel=VERBOSE -# topSequence += caloDecoder - -# #Dumper -# from ViewAlgs.ViewAlgsConf import DumpDecisions -# dumper = DumpDecisions("L1CaloDecisions") -# dumper.OutputLevel=VERBOSE -# topSequence += dumper #-------------------------------------------------------------- @@ -157,18 +86,15 @@ svcMgr.MessageSvc.Format = "% F%42W%S%7W%R%T %0W%M" svcMgr.MessageSvc.verboseLimit = 0 svcMgr.StoreGateSvc.OutputLevel = INFO svcMgr.StoreGateSvc.Dump=False #This is required to avoid a bug in bytestream decoding in AthenaMT mode -svcMgr.ByteStreamAddressProviderSvc.OutputLevel = INFO -svcMgr.ByteStreamCnvSvc.OutputLevel = INFO -svcMgr.ByteStreamInputSvc.OutputLevel = INFO +# svcMgr.ByteStreamAddressProviderSvc.OutputLevel = INFO +# svcMgr.ByteStreamCnvSvc.OutputLevel = INFO +# svcMgr.ByteStreamInputSvc.OutputLevel = INFO svcMgr.AthDictLoaderSvc.OutputLevel = INFO svcMgr.EventPersistencySvc.OutputLevel = INFO -svcMgr.ROBDataProviderSvc.OutputLevel = INFO +#svcMgr.ROBDataProviderSvc.OutputLevel = INFO print svcMgr - -theApp.EvtMax = 100 -if doL1Emulation: - theApp.EvtMax = len(data['RoIEmulation']) +theApp.EvtMax = len(data['RoIEmulation']) print "topSequence dump:", topSequence #