From 3c905514de673463168a6760f1131a92bcbf047e Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Wed, 17 Jun 2020 10:49:05 -0700 Subject: [PATCH] Functional example writing xAOD from BS --- Event/FaserByteStreamCnvSvc/README.md | 12 + .../share/jobOptions_faserBSToRDO.py | 55 +++ .../FaserROBDataProviderSvc.h | 30 +- .../IFaserROBDataProviderSvc.h | 8 +- .../share/BSAddProvSvc_jobOptions.py | 12 + .../src/FaserROBDataProviderSvc.cxx | 326 +----------------- 6 files changed, 91 insertions(+), 352 deletions(-) create mode 100644 Event/FaserByteStreamCnvSvc/README.md create mode 100644 Event/FaserByteStreamCnvSvc/share/jobOptions_faserBSToRDO.py create mode 100644 Event/FaserByteStreamCnvSvcBase/share/BSAddProvSvc_jobOptions.py diff --git a/Event/FaserByteStreamCnvSvc/README.md b/Event/FaserByteStreamCnvSvc/README.md new file mode 100644 index 00000000..27fa77df --- /dev/null +++ b/Event/FaserByteStreamCnvSvc/README.md @@ -0,0 +1,12 @@ +This package provides the infrastructure to read in FASER raw data files and convert the raw information to transient data classes. Related packages include: + +Event/FaserByteStreamCnvSvcBase - home of the ROBDataProvider +Event/FaserEventStorage - low-level file handling routines +faser-common/EventFormats - bytestream formaat definition used online + +A test job to read in a raw data file and write Raw Data Objects to xAOD can be found in: + +Event/FaserByteStreamCnvSvc/share/jobOptions_faserBSToRDO.py + +Copy this file locally, update to point to a FASER raw data file, and run with: +athena.py jobOptions_faserBSToRDO.py diff --git a/Event/FaserByteStreamCnvSvc/share/jobOptions_faserBSToRDO.py b/Event/FaserByteStreamCnvSvc/share/jobOptions_faserBSToRDO.py new file mode 100644 index 00000000..490d31af --- /dev/null +++ b/Event/FaserByteStreamCnvSvc/share/jobOptions_faserBSToRDO.py @@ -0,0 +1,55 @@ +# +# Read in bytestream and write Raw Data Objects to xAOD +# +# Useful to set this to see ERS messages (low-level file reading): +# export TDAQ_ERS_DEBUG_LEVEL=1 +# +# Set debug level up to 5 for even more output +# + +# +# Configure ByteStream Input +from FaserByteStreamCnvSvc import ReadByteStream + +# Provide converters +include( "FaserByteStreamCnvSvcBase/BSAddProvSvc_jobOptions.py" ) + +# Read single file +# svcMgr.FaserEventSelector.Input = [ "data/Faser-Physics-000000-00000.raw" ] + +# Read multiple files +svcMgr.FaserEventSelector.Input = [ "data/Faser-Physics-000000-00000.raw", + "data/Faser-Physics-000000-00001.raw", + "data/Faser-Physics-000000-00002.raw"] + +# Uncomment to dump out each raw event as read +# svcMgr.FaserByteStreamInputSvc.DumpFlag = True + +from AthenaCommon.AppMgr import theApp +theApp.EvtMax = -1 + +from AthenaCommon.AlgSequence import AthSequencer +topSequence = AthSequencer("AthAlgSeq") + +# Produces lots of output... +# MessageSvc.OutputLevel = DEBUG + +svcMgr.FaserEventSelector.OutputLevel = DEBUG +svcMgr.FaserByteStreamInputSvc.OutputLevel = DEBUG +svcMgr.FaserByteStreamCnvSvc.OutputLevel = DEBUG +svcMgr.FaserByteStreamAddressProviderSvc.OutputLevel = DEBUG + +# For debugging CLID errors +svcMgr.ClassIDSvc.OutputLevel = DEBUG + +# Try writing out xAOD +from OutputStreamAthenaPool.MultipleStreamManager import MSMgr +xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", "xAOD_test.pool.root" ) +xaodStream.AddItem( "xAOD::EventInfo#*" ) +xaodStream.AddItem( "xAOD::EventAuxInfo#*" ) +xaodStream.Print() + +#ServiceMgr.StoreGateSvc.Dump=True +from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr +ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval = 100) +ServiceMgr.MessageSvc.defaultLimit = 1000 diff --git a/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/FaserROBDataProviderSvc.h b/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/FaserROBDataProviderSvc.h index 7e880d92..2bf10dc2 100644 --- a/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/FaserROBDataProviderSvc.h +++ b/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/FaserROBDataProviderSvc.h @@ -53,18 +53,9 @@ public: /// Gaudi queryInterface method. // virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface); - /// Add ROBFragments to cache for given ROB ids, ROB fragments may be retrieved with DataCollector - virtual void addROBData(const std::vector<uint32_t>& robIds, const std::string_view callerName="UNKNOWN") override; - - /// Add a given LVL1/LVL2 ROBFragment to cache - //virtual void setNextEvent(const std::vector<ROBF>& result) override; - /// Add all ROBFragments of a RawEvent to cache virtual void setNextEvent(const DAQFormats::EventFull* re) override; - /// Retrieve ROBFragments for given ROB ids from cache - //virtual void getROBData(const std::vector<uint32_t>& robIds, std::vector<const ROBF*>& robFragments, const std::string_view callerName="UNKNOWN") override; - /// Retrieve the whole event. virtual const DAQFormats::EventFull* getEvent() override; @@ -76,44 +67,25 @@ public: /// MT variants - virtual void addROBData(const EventContext& context, const std::vector<uint32_t>& robIds, const std::string_view callerName="UNKNOWN") override; - //virtual void setNextEvent(const EventContext& context, const std::vector<OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment>& result) override; + virtual void setNextEvent(const EventContext& context, const DAQFormats::EventFull* re) override; - //virtual void getROBData(const EventContext& context, const std::vector<uint32_t>& robIds, VROBFRAG& robFragments, - // const std::string_view callerName="UNKNOWN") override; virtual const DAQFormats::EventFull* getEvent(const EventContext& context) override; virtual void setEventStatus(const EventContext& context, uint32_t status) override; virtual uint32_t getEventStatus(const EventContext& context) override; -//virtual void processCachedROBs(const EventContext& context, -// const std::function< void(const ROBF* )>& fn ) const override; - virtual bool isEventComplete(const EventContext& /*context*/) const override { return true; } virtual int collectCompleteEventData(const EventContext& /*context*/, const std::string_view /*callerName*/ ) override { return 0; } protected: - /// vector of ROBFragment class - //typedef std::vector<ROBF*> VROBF; - - /// map for all the ROB fragments - //typedef std::map<uint32_t, const ROBF*, std::less<uint32_t> > ROBMAP; struct EventCache { ~EventCache(); const DAQFormats::EventFull* event = 0; uint32_t eventStatus = 0; uint32_t currentLvl1ID = 0; - //ROBMAP robmap; - }; SG::SlotSpecificObj<EventCache> m_eventsCache; - /// Remaining attributes are for configuration - /// vector of Source ids and status words to be ignored for the ROB map - typedef SimpleProperty< std::vector< std::pair<int, int> > > ArrayPairIntProperty; - -private: // - //static void robmapClear(ROBMAP& toclear); }; #endif diff --git a/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/IFaserROBDataProviderSvc.h b/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/IFaserROBDataProviderSvc.h index 213c6b93..fa113740 100644 --- a/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/IFaserROBDataProviderSvc.h +++ b/Event/FaserByteStreamCnvSvcBase/FaserByteStreamCnvSvcBase/IFaserROBDataProviderSvc.h @@ -36,7 +36,7 @@ public: DeclareInterfaceID(IFaserROBDataProviderSvc, 1, 1); /// Add ROBFragments to cache for given ROB ids, ROB fragments may be retrieved with DataCollector - virtual void addROBData(const std::vector<uint32_t>& robIds, const std::string_view callerName="UNKNOWN") = 0 ; + // virtual void addROBData(const std::vector<uint32_t>& robIds, const std::string_view callerName="UNKNOWN") = 0 ; /// Add a given LVL1/LVL2 ROBFragment to cache //virtual void setNextEvent(const std::vector<ROBF>& result) = 0 ; @@ -63,9 +63,9 @@ public: // variants for MT, it has an implementation for now in order not to require change in all implementations yet, they will all become pure virtual methods - virtual void addROBData(const EventContext& /*context*/, const std::vector<uint32_t>& /*robIds*/, const std::string_view callerName="UNKNOWN") { - throw std::runtime_error( std::string(callerName)+ std::string(" is using unimplemented ") + __FUNCTION__ ) ; - } + //virtual void addROBData(const EventContext& /*context*/, const std::vector<uint32_t>& /*robIds*/, const std::string_view callerName="UNKNOWN") { + // throw std::runtime_error( std::string(callerName)+ std::string(" is using unimplemented ") + __FUNCTION__ ) ; + // } //virtual void setNextEvent(const EventContext& /*context*/, const std::vector<ROBF>& /*result*/) { // throw std::runtime_error( std::string("Unimplemented ") + __FUNCTION__ ); //} diff --git a/Event/FaserByteStreamCnvSvcBase/share/BSAddProvSvc_jobOptions.py b/Event/FaserByteStreamCnvSvcBase/share/BSAddProvSvc_jobOptions.py new file mode 100644 index 00000000..72467141 --- /dev/null +++ b/Event/FaserByteStreamCnvSvcBase/share/BSAddProvSvc_jobOptions.py @@ -0,0 +1,12 @@ +svcMgr = theApp.serviceMgr() +if not hasattr( svcMgr, "FaserByteStreamAddressProviderSvc" ): + from FaserByteStreamCnvSvcBase.FaserByteStreamCnvSvcBaseConf import FaserByteStreamAddressProviderSvc + svcMgr += FaserByteStreamAddressProviderSvc() + +# +# Add converter types here as they become available +# svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ +# "PixelRDO_Container/PixelRDOs", +# ] + + diff --git a/Event/FaserByteStreamCnvSvcBase/src/FaserROBDataProviderSvc.cxx b/Event/FaserByteStreamCnvSvcBase/src/FaserROBDataProviderSvc.cxx index 35dc3e01..a897e516 100644 --- a/Event/FaserByteStreamCnvSvcBase/src/FaserROBDataProviderSvc.cxx +++ b/Event/FaserByteStreamCnvSvcBase/src/FaserROBDataProviderSvc.cxx @@ -105,150 +105,11 @@ StatusCode FaserROBDataProviderSvc::initialize() { } m_eventsCache = SG::SlotSpecificObj<EventCache>( SG::getNSlots() ); - /* - for (unsigned int i = 0; i < m_filterRobWithStatus.value().size(); i++) { - eformat::helper::SourceIdentifier tmpsrc(m_filterRobWithStatus.value()[i].first); - if (tmpsrc.human_detector() != "UNKNOWN") { - m_filterRobMap[tmpsrc.code()].push_back(m_filterRobWithStatus.value()[i].second); - } - } - for (unsigned int i = 0; i < m_filterSubDetWithStatus.value().size(); i++) { - eformat::helper::SourceIdentifier tmpsrc((eformat::SubDetector)m_filterSubDetWithStatus.value()[i].first, 0); - if (tmpsrc.human_detector() != "UNKNOWN") { - m_filterSubDetMap[tmpsrc.subdetector_id()].push_back(m_filterSubDetWithStatus.value()[i].second); - } - } - ATH_MSG_INFO(" ---> Filter out empty ROB fragments = " << m_filterEmptyROB); - ATH_MSG_INFO(" ---> Filter out specific ROBs by Status Code: # ROBs = " << m_filterRobMap.size()); - for (FilterRobMap::const_iterator it = m_filterRobMap.begin(), itEnd = m_filterRobMap.end(); - it != itEnd; it++) { - eformat::helper::SourceIdentifier tmpsrc(it->first); - ATH_MSG_INFO(" RobId=0x" << MSG::hex << it->first << " -> in Sub Det = " << tmpsrc.human_detector()); - for (std::vector<uint32_t>::const_iterator it_status = (*it).second.begin(), it_statusEnd = (*it).second.end(); - it_status != it_statusEnd; it_status++) { - eformat::helper::Status tmpstatus(*it_status); - ATH_MSG_INFO(" Status Code=0x" - << MSG::hex << std::setfill( '0' ) << std::setw(8) << tmpstatus.code() - << " Generic Part=0x" << std::setw(4) << tmpstatus.generic() - << " Specific Part=0x" << std::setw(4) << tmpstatus.specific()); - } - } - - ATH_MSG_INFO(" ---> Filter out Sub Detector ROBs by Status Code: # Sub Detectors = " << m_filterSubDetMap.size()); - for (FilterSubDetMap::const_iterator it = m_filterSubDetMap.begin(), itEnd = m_filterSubDetMap.end(); - it != itEnd; it++) { - eformat::helper::SourceIdentifier tmpsrc(it->first, 0); - ATH_MSG_INFO(" SubDetId=0x" << MSG::hex << it->first << " -> " << tmpsrc.human_detector()); - for (std::vector<uint32_t>::const_iterator it_status = (*it).second.begin(), it_statusEnd = (*it).second.end(); - it_status != it_statusEnd; it_status++) { - eformat::helper::Status tmpstatus(*it_status); - ATH_MSG_INFO(" Status Code=0x" - << MSG::hex << std::setfill( '0' ) << std::setw(8) << tmpstatus.code() - << " Generic Part=0x" << std::setw(4) << tmpstatus.generic() - << " Specific Part=0x" << std::setw(4) << tmpstatus.specific()); - } - } - */ return(StatusCode::SUCCESS); } -// /// Query interface -// StatusCode FaserROBDataProviderSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { -// if (IFaserROBDataProviderSvc::interfaceID().versionMatch(riid)) { -// *ppvInterface = dynamic_cast<IFaserROBDataProviderSvc*>(this); -// } else { -// // Interface is not directly available: try out a base class -// return(::AthService::queryInterface(riid, ppvInterface)); -// } -// addRef(); -// return(StatusCode::SUCCESS); -// } - -/** - - in offline only check that given ROB ids are in the map, issue an - error if not -*/ - - - -void FaserROBDataProviderSvc::addROBData(const std::vector<uint32_t>& robIds, const std::string_view callerName) { - const EventContext context{ Gaudi::Hive::currentContext() }; - return addROBData( context, robIds, callerName ); -} - -void FaserROBDataProviderSvc::addROBData(const EventContext& context, const std::vector<uint32_t>& robIds, const std::string_view callerName) { - EventCache* cache = m_eventsCache.get( context ); - - // Copy missing ROB ids to vector with pthread allocator - ATH_MSG_DEBUG(" ---> Number of ROB Id s requested : " << robIds.size() << ", Caller Name = " << callerName); - // for offline running all requested ROBs should be found in cache - // if not issue error - for (std::vector<uint32_t>::const_iterator it = robIds.begin(), it_end = robIds.end(); it != it_end; it++) { - // uint32_t id = (*it); - - // mask off the module ID for L2 and EF result for Run 1 data - /* - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - // TB if it is inconsistent we should not continue like this? - if ( !m_maskL2EFModuleID ) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - ( m_maskL2EFModuleID ) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - */ - /* - ROBMAP& robmap( cache->robmap ); - ROBMAP::iterator map_it = robmap.find(id) ; - if (map_it != robmap.end()) { - ATH_MSG_DEBUG(" ---> Found ROB Id : 0x" << MSG::hex << (*map_it).second->source_id() - << MSG::dec << " in cache"); - } else { - ATH_MSG_DEBUG(" ---> ROB Id : 0x" << MSG::hex << id - << MSG::dec << " not found in cache for running mode OFFLINE (method addROBData),"); - ATH_MSG_DEBUG(" Lvl1 id = " << cache->currentLvl1ID); - } - */ - } - return; -} -/** - this is the online method to add the LVL1/LVL2 result - - this version of FaserROBDataProviderSvc does not support it - - this version is for offline use only -*/ -/* -void FaserROBDataProviderSvc::setNextEvent(const std::vector<ROBF>& result) { - const EventContext context{ Gaudi::Hive::currentContext() }; - return setNextEvent( context, result ); -} -*/ -/* -void FaserROBDataProviderSvc::setNextEvent(const EventContext& context, const std::vector<ROBF>& result) { - // clear the old map - // TB honestly, why do any action if this is FATAL mistake - // robmapClear( m_eventsCache.get(context)->robmap ); - - // This method should never be used by offline - ATH_MSG_FATAL(" +-----------------------------------------------------------------+ "); - ATH_MSG_FATAL(" | The method FaserROBDataProviderSvc::setNextEvent(const ROBF* result) | "); - ATH_MSG_FATAL(" | is not implemented for this version of FaserROBDataProviderSvc | "); - ATH_MSG_FATAL(" | Use the version from the HLT repository if you need it. | "); - ATH_MSG_FATAL(" +-----------------------------------------------------------------+ "); - ATH_MSG_FATAL(" ---> The " << result.size() << " ROB fragments in the call will not be used."); - return; -} -*/ - - -/** - add a new Raw event - - rebuild the map -*/ +// - add a new Raw event void FaserROBDataProviderSvc::setNextEvent(const EventFull* re) { // obtain context and redirect to the real implementation const EventContext context{ Gaudi::Hive::currentContext() }; @@ -256,145 +117,24 @@ void FaserROBDataProviderSvc::setNextEvent(const EventFull* re) { } void FaserROBDataProviderSvc::setNextEvent( const EventContext& context, const EventFull* re ) { - EventCache* cache = m_eventsCache.get( context ); - - cache->event = re; - // clear the old map - //robmapClear( cache->robmap ); - // set the LVL1 id - //cache->currentLvl1ID = re->lvl1_id(); - // set flag for masking L2/EF module ID, this is only necessary for the separate L2 and EF systems from Run 1 - //m_maskL2EFModuleID = (re->nlvl2_trigger_info() != 0); - // get all the ROBFragments - /* - const size_t MAX_ROBFRAGMENTS = 2048; - OFFLINE_FRAGMENTS_NAMESPACE::PointerType robF[MAX_ROBFRAGMENTS]; - OFFLINE_FRAGMENTS_NAMESPACE::PointerType rePointer; - re->start(rePointer); - size_t robcount = re->children(robF, MAX_ROBFRAGMENTS); - if (robcount == MAX_ROBFRAGMENTS) { - ATH_MSG_ERROR("ROB buffer overflow"); - } - // loop over all ROBs - for (size_t irob = 0; irob < robcount; irob++) { - // add to the map - const ROBF* rob = new ROBF(robF[irob]); - uint32_t id = rob->source_id(); - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - if ((rob->rod_ndata() == 0) && (m_filterEmptyROB)) { - ATH_MSG_DEBUG( " ---> Empty ROB Id = 0x" << MSG::hex << id << MSG::dec - << " removed for L1 Id = " << cache->currentLvl1ID); - delete rob; - } else if (filterRobWithStatus(rob)) { - if (rob->nstatus() > 0) { - const uint32_t* it_status; - rob->status(it_status); - eformat::helper::Status tmpstatus(*it_status); - ATH_MSG_DEBUG(" ---> ROB Id = 0x" << MSG::hex << id << std::setfill('0') - << " with Generic Status Code = 0x" << std::setw(4) << tmpstatus.generic() - << " and Specific Status Code = 0x" << std::setw(4) << tmpstatus.specific() << MSG::dec - << " removed for L1 Id = " << cache->currentLvl1ID); - } - delete rob; - } else { - - ROBMAP::const_iterator it = cache->robmap.find(id); - if (it != cache->robmap.end()) { - ATH_MSG_WARNING(" FaserROBDataProviderSvc:: Duplicate ROBID 0x" << MSG::hex << id - << " found. " << MSG::dec << " Overwriting the previous one "); - delete cache->robmap[id]; - cache->robmap[id] = rob; - } else { - cache->robmap[id] = rob; - } - - } - } -*/ - ATH_MSG_DEBUG(" ---> setNextEvent offline for " << name() ); - ATH_MSG_DEBUG(" current LVL1 id = " << cache->currentLvl1ID ); - //ATH_MSG_DEBUG(" size of ROB cache = " << cache->robmap.size() ); - return; -} -/** return ROBData for ROBID - */ -/* -void FaserROBDataProviderSvc::getROBData(const std::vector<uint32_t>& ids, std::vector<const ROBF*>& v, const std::string_view callerName) { - const EventContext context{ Gaudi::Hive::currentContext() }; - return getROBData( context, ids, v, callerName ); -} -*/ -/* -void FaserROBDataProviderSvc::getROBData(const EventContext& context, const std::vector<uint32_t>& ids, std::vector<const ROBF*>& v, - const std::string_view callerName) { EventCache* cache = m_eventsCache.get( context ); - for (std::vector<uint32_t>::const_iterator it = ids.begin(), it_end = ids.end(); it != it_end; it++) { - uint32_t id = (*it); - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - ROBMAP::iterator map_it = cache->robmap.find(id); - if (map_it != cache->robmap.end()) { - v.push_back((*map_it).second); - } else { - ATH_MSG_DEBUG("Failed to find ROB for id 0x" << MSG::hex << id << MSG::dec << ", Caller Name = " << callerName); -#ifndef NDEBUG - int nrob = 0; - ATH_MSG_VERBOSE(" --- Dump of ROB cache ids --- total size = " << cache->robmap.size()); - for (ROBMAP::iterator cache_it = cache->robmap.begin(), cache_end = cache->robmap.end(); - cache_it != cache_end; cache_it++) { - ++nrob; - ATH_MSG_VERBOSE(" # = " << nrob << " id = 0x" << MSG::hex << (*cache_it).second->source_id() << MSG::dec); - } -#endif - } - } - return; -} -*/ + cache->event = re; -/** - clear ROB map - */ -/* -void FaserROBDataProviderSvc::robmapClear( ROBMAP& toclear) { - for (ROBMAP::const_iterator it = toclear.begin(), itE = toclear.end(); it != itE; ++it) { - delete it->second; - } - toclear.clear(); + ATH_MSG_DEBUG(" ---> setNextEvent offline for " << name() ); + ATH_MSG_DEBUG(" current LVL1 id = " << cache->currentLvl1ID ); + + return; } -*/ /// Retrieve the whole event. const EventFull* FaserROBDataProviderSvc::getEvent() { const EventContext context{ Gaudi::Hive::currentContext() }; return getEvent( context ); } + const EventFull* FaserROBDataProviderSvc::getEvent( const EventContext& context ) { - return m_eventsCache.get( context )->event; } @@ -418,58 +158,6 @@ uint32_t FaserROBDataProviderSvc::getEventStatus( const EventContext& context ) return m_eventsCache.get( context )->eventStatus; } -/* -void FaserROBDataProviderSvc::processCachedROBs(const EventContext& context, - const std::function< void(const ROBF* )>& fn ) const { - for ( const auto& el : m_eventsCache.get( context )->robmap ) { - fn( el.second ); - } -} -*/ - - -/** - filter ROB with Sub Detector Id and Status Code -*/ -/* -bool FaserROBDataProviderSvc::filterRobWithStatus(const ROBF* rob) { - // No filter criteria defined - if ((m_filterRobMap.size() == 0) && (m_filterSubDetMap.size() == 0)) { - return(false); - } - // There should be at least one status element if there was an error - // in case there are 0 status elements then there was no known error - // (see event format document ATL-D-ES-0019 (EDMS)) - if (rob->nstatus() == 0) { - return(false); - } - // The ROB has at least one status element, access it via an iterator - const uint32_t* rob_it_status; - rob->status(rob_it_status); - // Build the full ROB Sourceidentifier - eformat::helper::SourceIdentifier tmpsrc(rob->rob_source_id()); - // Check if there is a ROB specific filter rule defined for this ROB Id and match the status code - FilterRobMap::iterator map_it_rob = m_filterRobMap.find(tmpsrc.code()); - if (map_it_rob != m_filterRobMap.end()) { - for (std::vector<uint32_t>::const_iterator it_status = (*map_it_rob).second.begin(), - it_statusEnd = (*map_it_rob).second.end(); it_status != it_statusEnd; it_status++) { - if (*rob_it_status == *it_status) { - return(true); - } - } - } - // Check if there is a sub detector specific filter rule defined for this ROB Id and match the status code - FilterSubDetMap::iterator map_it_subdet = m_filterSubDetMap.find(tmpsrc.subdetector_id()); - if (map_it_subdet != m_filterSubDetMap.end()) { - for (std::vector<uint32_t>::const_iterator it_status = (*map_it_subdet).second.begin(), - it_statusEnd = (*map_it_subdet).second.end(); it_status != it_statusEnd; it_status++) { - if (*rob_it_status == *it_status) { - return(true); - } - } - } - return(false); -} -*/ FaserROBDataProviderSvc::EventCache::~EventCache() { delete event; -- GitLab