From c73b607dae2d15f2d9085b21f6ecd5ba59f545dc Mon Sep 17 00:00:00 2001 From: Ian Connelly <ian.connelly@cern.ch> Date: Fri, 8 Mar 2019 16:43:37 +0000 Subject: [PATCH] WIP for debugging RPC changes --- .../MuonByteStream/src/MuonCacheCreator.cxx | 1 + .../src/RPC_RawDataProviderTool.cxx | 133 ++++++------ .../src/RPC_RawDataProviderTool.h | 2 + .../MuonRPC_CnvTools/src/RpcROD_Decoder.cxx | 2 +- .../MuonRPC_CnvTools/src/RpcROD_Decoder.h | 204 +++++++++++------- .../src/RpcROD_Decoder_v302.C | 60 ++++-- 6 files changed, 242 insertions(+), 160 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx index ba1cd2df8a6b..9bf38bb166c3 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx @@ -63,6 +63,7 @@ StatusCode MuonCacheCreator::execute (const EventContext& ctx) const { // Create the CSC cache container ATH_CHECK(createContainer(m_CscCacheKey, m_cscIdHelper->module_hash_max(), ctx)); // Create the RPC cache container + // Max should match 600 (hardcoded in RPC_RawDataProviderTool) ATH_CHECK(createContainer(m_RpcCacheKey, m_rpcIdHelper->module_hash_max(), ctx)); // Create the TGC cache container ATH_CHECK(createContainer(m_TgcCacheKey, m_tgcIdHelper->module_hash_max(), ctx)); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx index 66c2d78ab4a6..96f98cbef9e2 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx @@ -33,11 +33,13 @@ Muon::RPC_RawDataProviderTool::RPC_RawDataProviderTool( AthAlgTool(t, n, p), m_decoder("Muon::RpcROD_Decoder/RpcROD_Decoder", this), m_AllowCreation(false), - m_robDataProvider ("ROBDataProviderSvc",n) + m_robDataProvider ("ROBDataProviderSvc",n), + m_WriteOutRpcSectorLogic(true) { declareInterface<IMuonRawDataProviderTool>(this); declareProperty("Decoder", m_decoder); - declareProperty ("RpcContainerCacheKey", m_rdoContainerCacheKey, "Optional external cache for the RPC container"); + declareProperty("RpcContainerCacheKey", m_rdoContainerCacheKey, "Optional external cache for the RPC container"); + declareProperty("WriteOutRpcSectorLogic", m_WriteOutRpcSectorLogic, "Turn on/off RpcSectorLogic writing"); } @@ -59,6 +61,13 @@ StatusCode Muon::RPC_RawDataProviderTool::initialize() ATH_CHECK( m_rdoContainerCacheKey.initialize( !m_rdoContainerCacheKey.key().empty() ) ); + // We should only turn off the sector logic when running with cached data a la trigger mode + if(!m_rdoContainerCacheKey.key().empty() && m_WriteOutRpcSectorLogic){ + ATH_MSG_FATAL("Cannot write out RpcSectorLogic while running with cached RpcPad containers" + " as the RpcSectorLogic is not cached at the same time and the written containers will desync." + " Please turn off RpcSectorLogic writing when running with cached bytestream container"); + } + if (m_decoder.retrieve().isFailure()) { ATH_MSG_FATAL( "Failed to retrieve tool " << m_decoder ); @@ -154,11 +163,6 @@ StatusCode Muon::RPC_RawDataProviderTool::initialize() } } else has_bytestream = true; - //{ - // msg(MSG::FATAL) << "Cannot get the job configuration" << endmsg; - //return StatusCode::FAILURE; - //} - // register the container only when the imput from ByteStream is set up m_activeStore->setStore( &*evtStore() ); @@ -232,78 +236,85 @@ StatusCode Muon::RPC_RawDataProviderTool::convert(const std::vector<IdentifierHa } // the old one StatusCode Muon::RPC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs, - const std::vector<IdentifierHash>& collections) + const std::vector<IdentifierHash>& collections) { //CALLGRIND_START_INSTRUMENTATION // retrieve the container through the MuonRdoContainerManager becasue // if the MuonByteStream CNV has to be used, the container must have been // registered there! - m_activeStore->setStore( &*evtStore() ); - - if(m_AllowCreation == false) - { - ATH_MSG_WARNING( "Container create disabled due to byte stream"); - + m_activeStore->setStore( &*evtStore() ); + + if(m_AllowCreation == false) + { + ATH_MSG_WARNING( "Container create disabled due to byte stream"); + return StatusCode::SUCCESS; // Maybe it should be false to stop the job // because the convert method should not // have been called .... but this depends // on the user experience - } + } - SG::WriteHandle<RpcPadContainer> rdoContainerHandle(m_containerKey); - if (rdoContainerHandle.isPresent()) - return StatusCode::SUCCESS; + SG::WriteHandle<RpcPadContainer> rdoContainerHandle(m_containerKey); + if (rdoContainerHandle.isPresent()) + return StatusCode::SUCCESS; - // Split the methods to have one where we use the cache and one where we just setup the container - const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty(); - if(!externalCacheRDO){ - ATH_CHECK( rdoContainerHandle.record(std::make_unique<RpcPadContainer> (padMaxIndex) ) ); - ATH_MSG_DEBUG( "Created RpcPadContainer" ); - } - else{ - SG::UpdateHandle<RpcPad_Cache> update(m_rdoContainerCacheKey); - ATH_CHECK(update.isValid()); - ATH_CHECK(rdoContainerHandle.record (std::make_unique<RpcPadContainer>( update.ptr() ))); - ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key()); - } + // Split the methods to have one where we use the cache and one where we just setup the container + const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty(); + if(!externalCacheRDO){ + ATH_CHECK( rdoContainerHandle.record(std::make_unique<RpcPadContainer> (padMaxIndex) ) ); + ATH_MSG_DEBUG( "Created RpcPadContainer" ); + } + else{ + SG::UpdateHandle<RpcPad_Cache> update(m_rdoContainerCacheKey); + ATH_CHECK(update.isValid()); + ATH_CHECK(rdoContainerHandle.record (std::make_unique<RpcPadContainer>( update.ptr() ))); + ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key()); + } + + RpcPadContainer* pad = rdoContainerHandle.ptr(); + + SG::WriteHandle<RpcSectorLogicContainer> logicHandle(m_sec); + auto logic = std::make_unique<RpcSectorLogicContainer>(); - RpcPadContainer* pad = rdoContainerHandle.ptr(); - - SG::WriteHandle<RpcSectorLogicContainer> logicHandle(m_sec); - auto logic = std::make_unique<RpcSectorLogicContainer>(); - - for (ROBFragmentList::const_iterator itFrag = vecRobs.begin(); itFrag != vecRobs.end(); itFrag++) + // Reset to a nullptr (logic.get() will pass this through to decoder) + if(!m_WriteOutRpcSectorLogic) logic.reset(); + + for (ROBFragmentList::const_iterator itFrag = vecRobs.begin(); itFrag != vecRobs.end(); itFrag++) + { + //convert only if data payload is delivered + if ( (**itFrag).rod_ndata()!=0 ) { - //convert only if data payload is delivered - if ( (**itFrag).rod_ndata()!=0 ) - { - std::vector<IdentifierHash> coll = - to_be_converted(**itFrag,collections); - - if (m_decoder->fillCollections(**itFrag, *pad, coll, logic.get()).isFailure()) - { - // store the error conditions into the StatusCode and continue - } - } - else - { - if(msgLvl(MSG::DEBUG)) - { - uint32_t sourceId= (**itFrag).source_id(); - msg(MSG::DEBUG) << " ROB " << MSG::hex << sourceId + std::vector<IdentifierHash> coll = to_be_converted(**itFrag,collections); + + if (m_decoder->fillCollections(**itFrag, *pad, coll, logic.get()).isFailure()) + { + // store the error conditions into the StatusCode and continue + } + } + else + { + if(msgLvl(MSG::DEBUG)) + { + uint32_t sourceId= (**itFrag).source_id(); + msg(MSG::DEBUG) << " ROB " << MSG::hex << sourceId << " is delivered with an empty payload" << MSG::dec << endmsg; - } - // store the error condition into the StatusCode and continue - } + } + // store the error condition into the StatusCode and continue } - // Unsure about this at the moment - //ATH_CHECK( rdoContainerHandle.record (std::move (pad)) ); + } + // Unsure about this at the moment + //ATH_CHECK( rdoContainerHandle.record (std::move (pad)) ); + ATH_MSG_DEBUG("After processing, number of collections in container : " << pad-> numberOfCollections() ); + if(m_WriteOutRpcSectorLogic){ + ATH_MSG_DEBUG("Writing out RpcSectorLogicContainer"); ATH_CHECK( logicHandle.record (std::move (logic)) ); - //in presence of errors return FAILURE -//CALLGRIND_STOP_INSTRUMENTATION - return StatusCode::SUCCESS; + } + + //in presence of errors return FAILURE + //CALLGRIND_STOP_INSTRUMENTATION + return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.h index 820755fecbba..5c0bcf140550 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.h @@ -72,6 +72,8 @@ private: /// RPC container cache key SG::UpdateHandleKey<RpcPad_Cache> m_rdoContainerCacheKey ; + /// Turn on/off RpcSectorConfig writing + bool m_WriteOutRpcSectorLogic; }; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx index 892c4619d5d9..ba82e4d2bc14 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx @@ -38,7 +38,7 @@ Muon::RpcROD_Decoder::RpcROD_Decoder ( const std::string& type, const std::strin m_decodeSL(false), //m_byteStreamErrSvc("RPC_ByteStreamErrorSvc",name), m_cabling(0), - m_pRpcIdHelper(0) //,m_bench("RpcROD_Decoder") + m_pRpcIdHelper(0) //,m_bench("RpcROD_Decoder"), { declareInterface< IRpcROD_Decoder >( this ); declareProperty("SpecialROBNumber",m_specialROBNumber=-1); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h index b1bfc3c249b9..66dd7f1bdcb8 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h @@ -400,6 +400,9 @@ namespace Muon return StatusCode::FAILURE; // error in fragment } + if(RPC_SECTORLOGIC == nullptr){ + ATH_MSG_DEBUG("RPC_SECTORLOGIC is null, so we will skip decoding the sector logic information"); + } // get the pointer to the data BS data; @@ -517,7 +520,7 @@ namespace Muon ATH_MSG_DEBUG ( "RPC RDO collection already exist with collection hash = " << static_cast<unsigned int>(*it) << " converting is skipped!"); } else{ - ATH_MSG_VERBOSE(" Created new Pad Collection Hash ID = " << static_cast<unsigned int>(*it) ); + ATH_MSG_DEBUG(" Created new Pad Collection Hash ID = " << static_cast<unsigned int>(*it) ); // create new collection - I should be doing this with unique_ptr but it requires changing downstream functions RpcPad* coll = new RpcPad((m_cabling->padHashFunction())->identifier(*it), *it); @@ -547,22 +550,20 @@ namespace Muon //for (std::map<Identifier,RpcPad*>::const_iterator it=mapOfCollections.begin(); it!=mapOfCollections.end(); ++it) for (std::map<Identifier,RpcPad*>::const_iterator it=mapOfCollections.begin(); it!=mapOfCollections.end(); ++it) { - // add collection into IDC using RpcPadCache functions - + // Get the write handle again, but note that lock.alreadyPresent() will be true BUT we have already checked + // for this hash that it was not present before processing, and we still need to attach to the container RpcPadContainer::IDC_WriteHandle lock = rdoIdc.getWriteHandle( ((*it).second)->identifyHash() ); + + // Take the pointer and pass ownership to unique_ptr and pass to the IDC_WriteHandle + StatusCode status_lock = lock.addOrDelete( std::move( std::unique_ptr<RpcPad>((*it).second))); - if ( !lock.alreadyPresent() ) - { - // Take the pointer and pass ownership to unique_ptr and pass to the IDC_WriteHandle - StatusCode status_lock = lock.addOrDelete( std::unique_ptr<RpcPad>( (*it).second ) ); - - if(status_lock != StatusCode::SUCCESS) - { - ATH_MSG_ERROR("Failed to add RPC PAD collection to container" ); - //report the error condition - } - else - ATH_MSG_DEBUG("Adding RpcPad collection with hash "<<(int)((*it).second)->identifyHash()<<" to the RpcPad Container | size = "<<((*it).second)->size()); + if(status_lock != StatusCode::SUCCESS) + { + ATH_MSG_ERROR("Failed to add RPC PAD collection to container" ); + //report the error condition + } + else{ + ATH_MSG_DEBUG("Adding RpcPad collection with hash "<<(int)((*it).second)->identifyHash()<<" to the RpcPad Container | size = "<<((*it).second)->size()); } } return cnv_sc; @@ -571,12 +572,16 @@ namespace Muon std::vector<IdentifierHash>::const_iterator it = collections.begin(); for( ; it!=collections.end(); ++it) { - RpcPadContainer::const_iterator itColl = rdoIdc.indexFind(*it); - if (itColl == rdoIdc.end()) - { - msg(MSG::VERBOSE) << " Created new Pad Collection Hash ID = " << static_cast<unsigned int>(*it) << endmsg; - - // create new collection + // IDC_WriteHandle + RpcPadContainer::IDC_WriteHandle lock = rdoIdc.getWriteHandle( (*it) ); + + if(lock.alreadyPresent() ){ + ATH_MSG_DEBUG ( "RPC RDO collection already exist with collection hash = " << static_cast<unsigned int>(*it) << " converting is skipped!"); + } + else{ + ATH_MSG_VERBOSE(" Created new Pad Collection Hash ID = " << static_cast<unsigned int>(*it) ); + + // create new collection - I should be doing this with unique_ptr but it requires changing downstream functions RpcPad* coll = new RpcPad((m_cabling->padHashFunction())->identifier(*it), *it); //convert collection - note case3 will never be used due to statement above @@ -596,14 +601,18 @@ namespace Muon ATH_MSG_VERBOSE("Error into the RPC fillCollections decoding"); } + // Here need to implement writing for all the other fill methods + // Take the pointer and pass ownership to unique_ptr and pass to the IDC_WriteHandle + StatusCode status_lock = lock.addOrDelete( std::move( std::unique_ptr<RpcPad>( coll ) ) ); + // add collection into IDC - if (rdoIdc.addCollection(coll, *it).isFailure()) + if(status_lock != StatusCode::SUCCESS) { - msg(MSG::ERROR) << "Failed to add RPC PAD collection to container" << endmsg; + ATH_MSG_ERROR("Failed to add RPC PAD collection to container"); //report the error condition } else - ATH_MSG_DEBUG("Adding RpcPad collection with hash "<<(int)(*it)<<" to the RpcPad Container | size = "<<coll->size()); + ATH_MSG_DEBUG("Adding RpcPad collection with hash "<<(int)(*it)<<" to the RpcPad Container | size = " << coll->size()); } } return cnv_sc; @@ -619,6 +628,10 @@ namespace Muon RpcROD_Decoder::fillCollection_v302(BS data, const uint32_t data_size, RpcPad& v, const uint32_t& sourceId, RpcSectorLogicContainer* sectorLogicContainer ) const { + bool skipSectorLogicDecoding = (sectorLogicContainer == nullptr); + if(skipSectorLogicDecoding) + ATH_MSG_DEBUG("Skip SectorLogic decoding, so SLROC.decodeFragment is not being processed"); + /* for (unsigned int i = 0; i<1000; ++i) { */ /* //std::cout<<" aaa "<<std::endl; */ @@ -758,14 +771,16 @@ namespace Muon isPadPreFooter=false; isPadFooter =false; isSLHeader =false; - isSLSubHeader =false; + isSLSubHeader =false; isSLFooter =false; uint32_t currentWord = p[i]; RXROS.decodeFragment(currentWord,recField); PDROS.decodeFragment(currentWord,recField); - SLROS.decodeFragment(currentWord,recField); + if(!skipSectorLogicDecoding){ + SLROS.decodeFragment(currentWord,recField); + } if (RXROS.isHeader()) { isRXHeader=true; @@ -792,6 +807,14 @@ namespace Muon } else if (SLROS.isSubHeader() && isSLFragment) { isSLSubHeader=true; } + + // The SLROS functions still return values (based on default values) + if(skipSectorLogicDecoding){ + isSLHeader = false; + isSLSubHeader = false; + isSLFragment = false; + isSLFooter = false; + } if (msgLvl(MSG::VERBOSE) ) { @@ -1209,7 +1232,7 @@ namespace Muon uint16_t channel = matrixROS.channel(); firedChan = new RpcFiredChannel(bcid,time,ijk,channel); - ATH_MSG_VERBOSE ( + ATH_MSG_VERBOSE ( "Adding a fired channel, bcid=" << bcid << " time=" << " ijk=" << ijk << " channel=" << channel); @@ -1258,7 +1281,10 @@ namespace Muon RpcROD_Decoder::fillCollection_v301(BS data, const uint32_t data_size, RpcPad& v, const uint16_t& subDetector, RpcSectorLogicContainer* sectorLogicContainer ) const { - + bool skipSectorLogicDecoding = (sectorLogicContainer == nullptr); + if(skipSectorLogicDecoding) + ATH_MSG_DEBUG("Skip SectorLogic decoding, so SLROC.decodeFragment is not being processed"); + // unpack the 32 bits words into 16 bits // no ROD header and footer std::vector<uint16_t> p = get16bits_v301(data,data_size,0,0); @@ -1291,8 +1317,7 @@ namespace Muon bool foundPad=false; - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "The offline ID request for conversion is " - << m_pRpcIdHelper->show_to_string(thisPadOfflineId) << endmsg; + ATH_MSG_VERBOSE( "The offline ID request for conversion is " << m_pRpcIdHelper->show_to_string(thisPadOfflineId) ); bool isSLHeader =false; @@ -1344,7 +1369,9 @@ namespace Muon RXROS.decodeFragment(currentWord,recField); PDROS.decodeFragment(currentWord,recField); - SLROS.decodeFragment(currentWord,recField); + if(!skipSectorLogicDecoding){ + SLROS.decodeFragment(currentWord,recField); + } if (RXROS.isHeader() && !isSLFragment) isRXHeader=true; else if (RXROS.isFooter() && !isSLFragment) isRXFooter=true; @@ -1354,26 +1381,33 @@ namespace Muon else if (PDROS.isFooter() && !isSLFragment) isPadFooter=true; else if (SLROS.isHeader()) isSLHeader=true; else if (SLROS.isFooter()) isSLFooter=true; + + // The SLROS functions still return values (based on default values) + if(skipSectorLogicDecoding){ + isSLHeader = false; + isSLFragment = false; + isSLFooter = false; + } //#ifndef NVERBOSE if (msgLvl(MSG::VERBOSE)) - { - msg(MSG::VERBOSE) <<" RX Header: "<<isRXHeader - <<" RX Footer: "<<isRXFooter - <<endmsg; - msg(MSG::VERBOSE) <<" Pad Header: "<<isPadHeader - <<" Pad SubHeader: "<<isPadSubHeader - <<" Pad PreFooter: "<<isPadPreFooter - <<" Pad Footer: "<<isPadFooter - <<endmsg; - msg(MSG::VERBOSE) <<" isPADFragment: "<<isPADFragment - <<endmsg; - msg(MSG::VERBOSE) <<" SL Header: "<<isSLHeader - <<" SL Footer: "<<isSLFooter - <<endmsg; - msg(MSG::VERBOSE) <<" isSLFragment: "<<isSLFragment - <<endmsg; - } + { + msg(MSG::VERBOSE) <<" RX Header: "<<isRXHeader + <<" RX Footer: "<<isRXFooter + <<endmsg; + msg(MSG::VERBOSE) <<" Pad Header: "<<isPadHeader + <<" Pad SubHeader: "<<isPadSubHeader + <<" Pad PreFooter: "<<isPadPreFooter + <<" Pad Footer: "<<isPadFooter + <<endmsg; + msg(MSG::VERBOSE) <<" isPADFragment: "<<isPADFragment + <<endmsg; + msg(MSG::VERBOSE) <<" SL Header: "<<isSLHeader + <<" SL Footer: "<<isSLFooter + <<endmsg; + msg(MSG::VERBOSE) <<" isSLFragment: "<<isSLFragment + <<endmsg; + } //#endif if(isRXHeader) { @@ -1398,39 +1432,39 @@ namespace Muon // Check the Sector Logic Fragment if(foundSL && msgLvl(MSG::VERBOSE)) - { + { //#ifndef NVERBOSE msg(MSG::VERBOSE) <<"SectorLogicReadOut checkFragment: " << myRPC.SLFragment()->checkFragment()<<endmsg; msg(MSG::VERBOSE) << myRPC.SLFragment()<<endmsg; //#endif - } + } if(isSLHeader) SLBodyWords=0; // Decode the sector logic footer else if(isSLFooter ) { - + //#ifndef NVERBOSE if (SLindex>1) { msg(MSG::ERROR) << "More than 2 SL fragments in sector " << sector << endmsg; } //#endif - if (msgLvl(MSG::VERBOSE)) - { - //#ifndef NVERBOSE - msg(MSG::VERBOSE) <<" Number of data words in SectorLogicReadOut= " - <<SLBodyWords<<endmsg; - msg(MSG::VERBOSE) <<" TEST SL: "<<foundSL<<endmsg; - //#endif - - //#ifndef NVERBOSE - // Print out a raw dump of the SL fragment - for(unsigned short j=0; j<SLBodyWords; j++) { - msg(MSG::VERBOSE) <<" SL data word "<<j<<" : "<<std::hex<<SLBuff[j]<<MSG::dec<<endmsg; - } - } + if (msgLvl(MSG::VERBOSE)) + { + //#ifndef NVERBOSE + msg(MSG::VERBOSE) <<" Number of data words in SectorLogicReadOut= " + <<SLBodyWords<<endmsg; + msg(MSG::VERBOSE) <<" TEST SL: "<<foundSL<<endmsg; + //#endif + + //#ifndef NVERBOSE + // Print out a raw dump of the SL fragment + for(unsigned short j=0; j<SLBodyWords; j++) { + msg(MSG::VERBOSE) <<" SL data word "<<j<<" : "<<std::hex<<SLBuff[j]<<MSG::dec<<endmsg; + } + } //#endif // Found the sector logic footer, the sector logic fragment @@ -1465,12 +1499,12 @@ namespace Muon uint16_t ptid = sectorLogic->ptid(ilink,igate); //#ifndef NVERBOSE ATH_MSG_VERBOSE ("SL: pt for link=" << ilink - << " gate=" << igate << " is: " << ptid); + << " gate=" << igate << " is: " << ptid); //#endif if (ptid != 0) { //#ifndef NVERBOSE ATH_MSG_VERBOSE ("SL: found an hit for link=" << ilink - << " gate=" << igate); + << " gate=" << igate); //#endif uint16_t cmadd = sectorLogic->cmadd(ilink,igate); @@ -1495,9 +1529,9 @@ namespace Muon } - if (msgLvl(MSG::VERBOSE)){ - msg(MSG::VERBOSE) << "Size of sector 55: " << sl2->size() << endmsg; - msg(MSG::VERBOSE) << "Size of sector 56: " << sl1->size() << endmsg; + if (msgLvl(MSG::VERBOSE)){ + msg(MSG::VERBOSE) << "Size of sector 55: " << sl2->size() << endmsg; + msg(MSG::VERBOSE) << "Size of sector 56: " << sl1->size() << endmsg; } // flag the two sectors as decoded //bool setSector1 = sectorLogicContainer->setSector(56,0); @@ -1643,12 +1677,12 @@ namespace Muon isPadFooter ? isPADFragment=false : isPADFragment=true; //#ifndef NVERBOSE - if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) <<" current word "<<std::hex<<currentWord<<MSG::dec<<endmsg; - - msg(MSG::VERBOSE) <<" ==isPADFragment= "<<isPADFragment<<endmsg; - msg(MSG::VERBOSE) <<" calling pushword: "<<std::hex<<currentWord<<MSG::dec<<endmsg; - } + if (msgLvl(MSG::VERBOSE)) { + msg(MSG::VERBOSE) <<" current word "<<std::hex<<currentWord<<MSG::dec<<endmsg; + + msg(MSG::VERBOSE) <<" ==isPADFragment= "<<isPADFragment<<endmsg; + msg(MSG::VERBOSE) <<" calling pushword: "<<std::hex<<currentWord<<MSG::dec<<endmsg; + } //#endif int foundCM = 0; @@ -1697,7 +1731,7 @@ namespace Muon firedChan = new RpcFiredChannel(bcid,time,ijk,channel); //#ifndef NVERBOSE ATH_MSG_VERBOSE ("Adding a fired channel, bcid=" << bcid << " time=" - << " ijk=" << ijk << " channel=" << channel); + << " ijk=" << ijk << " channel=" << channel); //#endif // add the fired channel to the matrix @@ -1709,8 +1743,8 @@ namespace Muon firedChan = new RpcFiredChannel(bcid,time,ijk,threshold,overlap); //#ifndef NVERBOSE ATH_MSG_VERBOSE ("Adding a fired channel, bcid=" << bcid << " time=" - << " ijk=" << ijk << " overlap=" << overlap - << " threshold=" << threshold); + << " ijk=" << ijk << " overlap=" << overlap + << " threshold=" << threshold); //#endif // add the fired channel to the matrix @@ -1741,7 +1775,10 @@ namespace Muon RpcROD_Decoder::fillCollection_v300(BS data, const uint32_t data_size, RpcPad& v, const uint16_t& subDetector, RpcSectorLogicContainer* sectorLogicContainer ) const { - + bool skipSectorLogicDecoding = (sectorLogicContainer == nullptr); + if(skipSectorLogicDecoding) + ATH_MSG_DEBUG("Skip SectorLogic decoding, so SLROC.decodeFragment is not being processed"); + //#ifndef NVERBOSE if (msgLvl(MSG::VERBOSE)) { msg(MSG::VERBOSE) << "**********Decoder dumping the words******** " << endmsg; @@ -1829,6 +1866,13 @@ namespace Muon else if (SLROS.isHeader()) isSLHeader=true; else if (SLROS.isFooter()) isSLFooter=true; + // The SLROS functions still return values (based on default values) + if(skipSectorLogicDecoding){ + isSLHeader = false; + isSLFragment = false; + isSLFooter = false; + } + //#ifndef NVERBOSE if (msgLvl(MSG::VERBOSE)) { msg(MSG::VERBOSE) <<" RX Header: "<<isRXHeader diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder_v302.C b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder_v302.C index ab999037e721..255acd06daa0 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder_v302.C +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder_v302.C @@ -23,6 +23,10 @@ StatusCode Muon::RpcROD_Decoder::fillCollectionsFromRob_v302(BS data, const uint RpcSectorLogicContainer* sectorLogicContainer ) const { + bool skipSectorLogicDecoding = (sectorLogicContainer == nullptr); + if(skipSectorLogicDecoding) + ATH_MSG_DEBUG("Skip SectorLogic decoding, so SLROC.decodeFragment is not being processed"); + /* for (unsigned int i = 0; i<1000; ++i) { */ /* //std::cout<<" aaa "<<std::endl; */ /* msg(MSG::VERBOSE) << "try to increase cpu time "<<log(pow(((double)i+1.)/999.,3))<<endmsg; */ @@ -229,7 +233,9 @@ StatusCode Muon::RpcROD_Decoder::fillCollectionsFromRob_v302(BS data, const uint RXROS.decodeFragment(currentWord,recFieldROS); PDROS.decodeFragment(currentWord,recFieldPAD); - SLROS.decodeFragment(currentWord,recFieldSL); + if(!skipSectorLogicDecoding){ + SLROS.decodeFragment(currentWord,recFieldSL); + } if (RXROS.isHeader()) { isRXHeader=true; @@ -256,7 +262,26 @@ StatusCode Muon::RpcROD_Decoder::fillCollectionsFromRob_v302(BS data, const uint } else if (SLROS.isSubHeader() && isSLFragment) { isSLSubHeader=true; } + + // The SLROS functions still return values (based on default values) + if(skipSectorLogicDecoding){ + isSLHeader = false; + isSLSubHeader = false; + isSLFragment = false; + isSLFooter = false; + } + ATH_MSG_VERBOSE("\n isRXHeader " << isRXHeader << + "\n isRXFooter " << isRXFooter << + "\n isPadHeader " << isPadHeader << + "\n isPadSubHeader " << isPadSubHeader << + "\n isPADFragment " << isPADFragment << + "\n isPadPreFooter " << isPadPreFooter << + "\n isPadFooter " << isPadFooter << + "\n isSLHeader " << isSLHeader << + "\n isSLSubHeader " << isSLSubHeader << + "\n isSLFragment " << isSLFragment << + "\n isSLFooter " << isSLFooter ); @@ -297,27 +322,26 @@ StatusCode Muon::RpcROD_Decoder::fillCollectionsFromRob_v302(BS data, const uint //we must start with an RX Header: if (i==0 && (!isRXHeader)) - { - ATH_MSG_WARNING("Bad data from RPC ROD 0x" << MSG::hex << rodId << MSG::dec - << ". RX header not found at ROB fragment begin. Skipping this ROB fragment."); - return StatusCode::SUCCESS; //continue decoding data from other ROBs - //bsErrCheck_errorInRXHeader = true; - } + { + ATH_MSG_WARNING("Bad data from RPC ROD 0x" << MSG::hex << rodId << MSG::dec + << ". RX header not found at ROB fragment begin. Skipping this ROB fragment."); + return StatusCode::SUCCESS; //continue decoding data from other ROBs + //bsErrCheck_errorInRXHeader = true; + } if(isRXHeader) { - //bsErrCheck_errorInRXHeader = false; - //bsErrCheck_InRX = true; - // bsErrCheck_InSL = false; - // bsErrCheck_InPD = false; - // bsErrCheck_InCM = false; + //bsErrCheck_errorInRXHeader = false; + //bsErrCheck_InRX = true; + // bsErrCheck_InSL = false; + // bsErrCheck_InPD = false; + // bsErrCheck_InCM = false; - if (msgLvl(MSG::VERBOSE) ) - { - msg(MSG::VERBOSE) << " this is a RX Header " << endmsg; - msg(MSG::VERBOSE) <<" Sector ID=" <<RXROS.RXid()<<endmsg; - } + if (msgLvl(MSG::VERBOSE) ){ + msg(MSG::VERBOSE) << " this is a RX Header " << endmsg; + msg(MSG::VERBOSE) << " Sector ID=" <<RXROS.RXid()<<endmsg; + } // get the sector id according to the new format // not yet implemented in the readout classes @@ -327,7 +351,7 @@ StatusCode Muon::RpcROD_Decoder::fillCollectionsFromRob_v302(BS data, const uint uint16_t rxid = RXROS.RXid(); // range (presumably) 0-1 sectorForCabling = 2*rodId+rxid; // range 0-31 sector = side*32+sectorForCabling; // range 0-63 //side = 1 for side A or 0 for side C // side 1 corresponds to subDetID=65 (side 0 for subDetID=66) - if (msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "RXid, sectorForCabling, sector = "<<rxid<<" "<<sectorForCabling<<" "<<sector<<std::endl; + if (msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "RXid, sectorForCabling, sector = "<<rxid<<" "<<sectorForCabling<<" "<<sector<<std::endl; //fix for M3 if ((rodId==3 || rodId==1) && (m_specialROBNumber > 0) ) { -- GitLab