diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx index 19b411cac90579ec66c7c934770d998eec775aeb..b7fe4807c598bc760e408ad73f3eaeed222e6065 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx @@ -60,6 +60,20 @@ StatusCode TrigL2MuonSA::MmDataPreparator::prepareData(const TrigRoiDescriptor* std::vector<IdentifierHash> mmHashList; std::vector<IdentifierHash> mmHashList_cache; + // Get MM container + if(m_mmPrepContainerKey.empty()) { + ATH_MSG_INFO("no mmPrepContainerKey"); + return StatusCode::SUCCESS; + } + auto mmPrepContainerHandle = SG::makeHandle(m_mmPrepContainerKey); + if (!mmPrepContainerHandle.isValid()) { + ATH_MSG_ERROR("Cannot retrieve MM PRD Container key: " << m_mmPrepContainerKey.key()); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG("MM PRD Container retrieved with key: " << m_mmPrepContainerKey.key()); + } + const Muon::MMPrepDataContainer* mmPrds = mmPrepContainerHandle.cptr(); + if (m_use_RoIBasedDataAccess) { // ATH_MSG_ERROR("RoI based data access is not available yet"); @@ -75,62 +89,44 @@ StatusCode TrigL2MuonSA::MmDataPreparator::prepareData(const TrigRoiDescriptor* std::vector<uint32_t> mmRobList; m_regionSelector->ROBIDList(*iroi, mmRobList); - } - else { - ATH_MSG_DEBUG("Use full data access"); + if (!mmHashList.empty()) { - TrigRoiDescriptor fullscan_roi( true ); - m_regionSelector->HashIDList(fullscan_roi, mmHashList); - ATH_MSG_DEBUG("mmHashList.size()=" << mmHashList.size()); + // Get MM collections + for(const IdentifierHash& id : mmHashList) { - std::vector<uint32_t> mmRobList; - m_regionSelector->ROBIDList(fullscan_roi, mmRobList); - if(m_doDecoding) { - if(m_decodeBS) { - // if ( m_rawDataProviderTool->convert(mmRobList).isFailure()) { - // ATH_MSG_WARNING("Conversion of BS for decoding of MMs failed"); - // } - ATH_MSG_ERROR("Conversion of BS for decoding of MMs is not available yet"); - } - if ( m_mmPrepDataProvider->decode(mmRobList).isFailure() ) { - ATH_MSG_WARNING("Problems when preparing MM PrepData "); + Muon::MMPrepDataContainer::const_iterator MMcoll = mmPrds->indexFind(id); + + if( MMcoll == mmPrds->end() ) { + continue; + } + + if( (*MMcoll)->size() == 0) { + ATH_MSG_DEBUG("Empty MM list"); + continue; + } + + mmHashList_cache.push_back(id); + mmCols.push_back(*MMcoll); } - }//do decoding + } } + else { + ATH_MSG_DEBUG("Use full data access"); - if (!mmHashList.empty()) { - - // Get MM container - const Muon::MMPrepDataContainer* mmPrds; - auto mmPrepContainerHandle = SG::makeHandle(m_mmPrepContainerKey); - mmPrds = mmPrepContainerHandle.cptr(); - if (!mmPrepContainerHandle.isValid()) { - ATH_MSG_ERROR("Cannot retrieve MM PRD Container key: " << m_mmPrepContainerKey.key()); + if(m_doDecoding || m_decodeBS) { + ATH_MSG_ERROR("decoding of MMs is not available yet"); return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("MM PRD Container retrieved with key: " << m_mmPrepContainerKey.key()); } // Get MM collections - for(const IdentifierHash& id : mmHashList) { - - Muon::MMPrepDataContainer::const_iterator MMcoll = mmPrds->indexFind(id); - - if( MMcoll == mmPrds->end() ) { - continue; - } - - if( (*MMcoll)->size() == 0) { - ATH_MSG_DEBUG("Empty MM list"); - continue; - } - - mmHashList_cache.push_back(id); - mmCols.push_back(*MMcoll); + for(const auto& mmcoll : *mmPrds) { + mmCols.push_back(mmcoll); } + } + for( const Muon::MMPrepDataCollection* mm : mmCols ){ mmHits.reserve( mmHits.size() + mm->size() ); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx index a4b7e4022703c63e677ae395ffb82525e865d820..cfcd83590e00437aaf003a52a028bc3d718e264b 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx @@ -60,6 +60,20 @@ StatusCode TrigL2MuonSA::StgcDataPreparator::prepareData(const TrigRoiDescriptor std::vector<IdentifierHash> stgcHashList; std::vector<IdentifierHash> stgcHashList_cache; + // Get sTGC container + if(m_stgcPrepContainerKey.empty()) { + ATH_MSG_INFO("no stgcPrepContainerKey"); + return StatusCode::SUCCESS; + } + auto stgcPrepContainerHandle = SG::makeHandle(m_stgcPrepContainerKey); + if (!stgcPrepContainerHandle.isValid()) { + ATH_MSG_ERROR("Cannot retrieve sTgc PRD Container key: " << m_stgcPrepContainerKey.key()); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG("sTgc PRD Container retrieved with key: " << m_stgcPrepContainerKey.key()); + } + const Muon::sTgcPrepDataContainer* stgcPrds = stgcPrepContainerHandle.cptr(); + if (m_use_RoIBasedDataAccess) { // ATH_MSG_ERROR("RoI based data access is not available yet"); @@ -85,60 +99,41 @@ StatusCode TrigL2MuonSA::StgcDataPreparator::prepareData(const TrigRoiDescriptor } }//do decoding - } - else { - ATH_MSG_DEBUG("Use full data access"); + if (!stgcHashList.empty()) { - TrigRoiDescriptor fullscan_roi( true ); - m_regionSelector->HashIDList(fullscan_roi, stgcHashList); - ATH_MSG_DEBUG("stgcHashList.size()=" << stgcHashList.size()); + // Get sTGC collections + for(const IdentifierHash& id : stgcHashList) { - std::vector<uint32_t> stgcRobList; - m_regionSelector->ROBIDList(fullscan_roi, stgcRobList); - if(m_doDecoding) { - if(m_decodeBS) { - if ( m_rawDataProviderTool->convert(stgcRobList).isFailure()) { - ATH_MSG_WARNING("Conversion of BS for decoding of sTgcs failed"); - } - ATH_MSG_ERROR("Conversion of BS for decoding of sTgcs is not available yet"); - } - if ( m_stgcPrepDataProvider->decode(stgcRobList).isFailure() ) { - ATH_MSG_WARNING("Problems when preparing sTgc PrepData "); - } - }//do decoding + Muon::sTgcPrepDataContainer::const_iterator STGCcoll = stgcPrds->indexFind(id); - } + if( STGCcoll == stgcPrds->end() ) { + continue; + } - if (!stgcHashList.empty()) { + if( (*STGCcoll)->size() == 0) { + ATH_MSG_DEBUG("Empty STGC list"); + continue; + } - // Get sTGC container - const Muon::sTgcPrepDataContainer* stgcPrds; - auto stgcPrepContainerHandle = SG::makeHandle(m_stgcPrepContainerKey); - stgcPrds = stgcPrepContainerHandle.cptr(); - if (!stgcPrepContainerHandle.isValid()) { - ATH_MSG_ERROR("Cannot retrieve sTgc PRD Container key: " << m_stgcPrepContainerKey.key()); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("sTgc PRD Container retrieved with key: " << m_stgcPrepContainerKey.key()); - } - - // Get sTGC collections - for(const IdentifierHash& id : stgcHashList) { - - Muon::sTgcPrepDataContainer::const_iterator STGCcoll = stgcPrds->indexFind(id); + stgcHashList_cache.push_back(id); + stgcCols.push_back(*STGCcoll); + } + } - if( STGCcoll == stgcPrds->end() ) { - continue; - } + } + else { + ATH_MSG_DEBUG("Use full data access"); - if( (*STGCcoll)->size() == 0) { - ATH_MSG_DEBUG("Empty STGC list"); - continue; - } + if(m_doDecoding || m_decodeBS) { + ATH_MSG_ERROR("decoding of sTGCs is not available yet"); + return StatusCode::FAILURE; + } - stgcHashList_cache.push_back(id); - stgcCols.push_back(*STGCcoll); + // Get sTgc collections + for(const auto& stgccoll : *stgcPrds) { + stgcCols.push_back(stgccoll); } + } for( const Muon::sTgcPrepDataCollection* stgc : stgcCols ){