From ca4e4e11da34c6d765a94552356cbc24ef9241c2 Mon Sep 17 00:00:00 2001 From: juyan Date: Tue, 14 Jan 2020 14:07:07 +0100 Subject: [PATCH 01/26] Add new constructor of CMAdata that take RpcCablingCondData as an arguement. --- Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt | 5 +- .../TrigT1RPClogic/TrigT1RPClogic/CMAdata.h | 2 + Trigger/TrigT1/TrigT1RPClogic/src/CMAdata.cxx | 49 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt index ae6fbbc5423..3253c437ed0 100644 --- a/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt @@ -10,15 +10,16 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel MuonSpectrometer/MuonCablings/MuonCablingTools MuonSpectrometer/MuonCablings/RPCcablingInterface + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling Trigger/TrigT1/TrigT1RPChardware ) # Component(s) in the package: atlas_add_library( TrigT1RPClogicLib src/*.cxx PUBLIC_HEADERS TrigT1RPClogic - LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware ) + LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware RPC_CondCablingLib) atlas_add_component( TrigT1RPClogic src/components/*.cxx - LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib ) + LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib RPC_CondCablingLib) diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMAdata.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMAdata.h index 1cfe8615a46..42d38da576b 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMAdata.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMAdata.h @@ -16,6 +16,7 @@ #ifndef LVL1_STANDALONE #include "RPCcablingInterface/IRPCcablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" #endif @@ -42,6 +43,7 @@ class CMAdata : public BaseObject CMAdata(const RPCdata*); #else CMAdata(const RPCdata*,const IRPCcablingSvc*,unsigned long int); + CMAdata(const RPCdata*,const RpcCablingCondData*,unsigned long int); #endif CMAdata(const CMAdata&); ~CMAdata(); diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/CMAdata.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/CMAdata.cxx index 8e1cefb4f34..9e2455ff990 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/CMAdata.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/CMAdata.cxx @@ -92,6 +92,55 @@ CMAdata::CMAdata(const RPCdata* rpc_data,const IRPCcablingSvc* cabling, } } +#ifdef LVL1_STANDALONE +CMAdata::CMAdata(const RPCdata* rpc_data) : BaseObject(Data,"CMApatterns"), m_debug(0) +#else +CMAdata::CMAdata(const RPCdata* rpc_data,const RpcCablingCondData* readCdo, unsigned long int debug) : + BaseObject(Data,"CMApatterns"),m_debug(debug) +#endif +{ + m_eta_cma_patterns.clear(); + m_phi_cma_patterns.clear(); + + RPCdata::digitList eta = rpc_data->eta_digits_list(); + RPCdata::digitList::const_iterator digi = eta.begin(); + + while(digi != eta.end()) + { + const int sector = (*digi)->decoding().logic_sector(); + const ViewType type = (*digi)->decoding().view(); + const int station = (*digi)->decoding().lvl1_station(); + const int cabling_code = (*digi)->decoding().cabling_code(); + + const CMAparameters::CMAlist list = readCdo->give_CMAs(sector,type,station,cabling_code); + CMAparameters::CMAlist::const_iterator cma = list.begin(); + while(cma != list.end()) + { + create_patterns(*cma,*digi); + ++cma; + } + ++digi; + } + + RPCdata::digitList phi = rpc_data->phi_digits_list(); + digi = phi.begin(); + while(digi != phi.end()) + { + const int sector = (*digi)->decoding().logic_sector(); + const ViewType type = (*digi)->decoding().view(); + const int station = (*digi)->decoding().lvl1_station(); + const int cabling_code = (*digi)->decoding().cabling_code(); + + const CMAparameters::CMAlist list = readCdo->give_CMAs(sector,type,station,cabling_code); + CMAparameters::CMAlist::const_iterator cma = list.begin(); + while(cma != list.end()) + { + create_patterns(*cma,*digi); + ++cma; + } + ++digi; + } +} CMAdata::CMAdata(const CMAdata& cma_patterns) : -- GitLab From 14963a944f7286971726f76b50d24eae75f48f17 Mon Sep 17 00:00:00 2001 From: juyan Date: Wed, 15 Jan 2020 05:43:46 +0100 Subject: [PATCH 02/26] Use RpcCablingCondData in RpcDigitToRpcRDO to construct CMAdata. --- .../MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt | 5 +++-- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 4 ++++ .../MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt index 26613e5a6cc..16ee6f317dc 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt @@ -30,18 +30,19 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling MuonSpectrometer/MuonCablings/MuonCablingData ) # Component(s) in the package: atlas_add_library( MuonByteStreamCnvTestLib src/*.cxx PUBLIC_HEADERS MuonByteStreamCnvTest - LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonReadoutGeometry MuonRDO StoreGateLib SGtests RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib MuonMDT_CablingLib TGCcablingInterfaceLib MuonIdHelpersLib + LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonReadoutGeometry MuonRDO StoreGateLib SGtests RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib MuonMDT_CablingLib TGCcablingInterfaceLib MuonIdHelpersLib RPC_CondCablingLib PRIVATE_LINK_LIBRARIES EventInfo MuonDigitContainer MuonPrepRawData MuonCablingData ) atlas_add_component( MuonByteStreamCnvTest src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib MuonCablingData ) + LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib MuonCablingData RPC_CondCablingLib) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 21263271ed6..18373135ea2 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -11,6 +11,9 @@ #include "StoreGate/DataHandle.h" #include "RPCcablingInterface/IRPCcablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "TrigT1RPClogic/RPCsimuData.h" #include "TrigT1RPClogic/CMAdata.h" #include "TrigT1RPClogic/RPCbytestream.h" @@ -69,6 +72,7 @@ private: BooleanProperty m_data_detail{this, "DataDetail", false, "flag to printout detailed INFO on processed data"}; ServiceHandle m_cabling{this, "MuonRPC_CablingSvc", "MuonRPC_CablingSvc", ""}; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; SG::WriteHandleKey m_padContainerKey{this,"OutputObjectName","RPCPAD","WriteHandleKey for Output RpcPadContainer"}; SG::ReadHandleKey m_digitContainerKey{this,"InputObjectName","RPC_DIGITS","ReadHandleKey for Input RpcDigitContainer"}; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 5fbb63db70f..4bd0d79b21a 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -51,6 +51,8 @@ StatusCode RpcDigitToRpcRDO::initialize() else if (m_cabling->rpcCabSvcType() == "simulationLikeInitialization" ) m_cablingType="RPCcabling"; else ATH_MSG_WARNING( "Unknown cabling type: rpcCabSvcType()="<< m_cabling->rpcCabSvcType() ); + ATH_CHECK(m_readKey.initialize()); + // Fill Tag Info if (fillTagInfo() != StatusCode::SUCCESS) { ATH_MSG_WARNING( "Unable to fill Tag Info " ); @@ -83,6 +85,9 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { RPCsimuData data; // instantiate the container for the RPC digits + SG::ReadCondHandle readHandle{m_readKey, ctx}; + const RpcCablingCondData* readCdo{*readHandle}; + // fill the data with RPC simulated digits if (fill_RPCdata(data, ctx).isFailure()) { ATH_MSG_ERROR( "Fail to produce RPC data for byte stream simulation " ); @@ -104,7 +109,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { debug = (m_detailed_algo)? m_cma_debug : m_fast_debug; // // // CMAdata patterns(&data,m_cabling,type,debug); // - CMAdata patterns(&data,&*m_cabling,debug); // + CMAdata patterns(&data, readCdo, debug); // // ATH_MSG_DEBUG( "CMApatterns created from RPC digits:" << endl // << ShowData(patterns,"",m_data_detail) ); -- GitLab From 0e1a8fbb4816ea6e55f7a1e77079d4250d5b4bbf Mon Sep 17 00:00:00 2001 From: juyan Date: Wed, 15 Jan 2020 07:03:16 +0100 Subject: [PATCH 03/26] Migrate RpcByteStreamDecoder into RpcDigitToRpcRDO. --- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 11 +- .../src/RpcDigitToRpcRDO.cxx | 158 +++++++++++++++++- 2 files changed, 158 insertions(+), 11 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 18373135ea2..cf0abbe3361 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -8,6 +8,7 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/StatusCode.h" #include "StoreGate/DataHandle.h" #include "RPCcablingInterface/IRPCcablingSvc.h" @@ -17,8 +18,7 @@ #include "TrigT1RPClogic/RPCsimuData.h" #include "TrigT1RPClogic/CMAdata.h" #include "TrigT1RPClogic/RPCbytestream.h" - -#include "MuonByteStreamCnvTest/RpcByteStreamDecoder.h" +#include "TrigT1RPChardware/MatrixReadOutStructure.h" #include "MuonRDO/RpcPadContainer.h" #include "MuonRDO/RpcPad.h" @@ -40,6 +40,13 @@ public: virtual StatusCode execute(const EventContext& ctx) const override final; private: + + //--- Migrated from RpcByteStreamDecoder. + typedef std::map < int, PADreadout, std::less > PAD_Readout; + //Pad and Matrix decoding functions + RpcPad * decodePad(PADreadout& pad) const ; + RpcCoinMatrix * decodeMatrix(MatrixReadOut* matrix, Identifier& id) const ; + StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx) const; StatusCode fillTagInfo() const; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 4bd0d79b21a..5c55d25a535 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -132,23 +132,28 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { // ********************** create the RPC RDO's ***************************** - std::unique_ptr padDecoder = std::make_unique(&bytestream, - &*m_cabling, - m_muonIdHelperTool.get(), - &msg()); - if (padDecoder->decodeByteStream().isFailure()) { - ATH_MSG_ERROR( "Fail to decode RPC byte stream" ); - } - ATH_MSG_DEBUG( "Total number of pads in this event is " << padDecoder->getPads()->size() ); + std::vector* rpcpads = new std::vector; + ATH_MSG_DEBUG( "Start decoding" ); + PAD_Readout padReadout = bytestream.pad_readout(); + // Iterate on the readout PADS and decode them + for (PAD_Readout::iterator it = padReadout.begin() ; it != padReadout.end(); ++it) + { + PADreadout padro = (*it).second; + RpcPad* newpad = decodePad(padro); + // Push back the decoded pad in the vector + rpcpads->push_back(newpad); + } + ATH_MSG_DEBUG( "Total number of pads in this event is " << rpcpads ->size() ); - for (const RpcPad* pad : *(padDecoder->getPads())) { + for (const RpcPad* pad : *rpcpads) { const int elementHash1 = pad->identifyHash(); if (padContainer->addCollection(pad, elementHash1).isFailure()) { ATH_MSG_ERROR( "Unable to record RPC Pad in IDC" ); } } + delete rpcpads; rpcpads = NULL; return StatusCode::SUCCESS; } @@ -260,3 +265,138 @@ StatusCode RpcDigitToRpcRDO::fillTagInfo() const return StatusCode::SUCCESS; } + +// Decode a pad and return a pointer to a RpcPad RDO +RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const +{ + + ATH_MSG_DEBUG( "Decoding a new RpcPad" ); + + // Identifier elements + int name = 0; + int eta = 0; + int phi = 0; + int doublet_r = 0; + int doublet_z = 0; + int doublet_phi = 0; + int gas_gap = 0; + int measures_phi = 0; + int strip = 0; + + PadReadOut* readout = pad.give_pad_readout(); + + // Retrieve PAD sector and PAD ID + int sector = pad.sector(); + int pad_id = pad.PAD(); + // Compute side and logic sector + int side = (sector < 32) ? 0:1; + int logic_sector = sector%32; + // Compute the key to retrieve the offline id from the map (as from LVL1 sim.) + int key = side*10000+logic_sector*100+pad_id; + + ATH_MSG_DEBUG( "Pad: Side " << side << " Sector logic" << logic_sector << " Id " << pad_id ); + + // Retrieve the identifier elements from the map + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + + const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); + RDOindex index = (*pad_map.find(key)).second; + + index.offline_indexes(name, eta, phi, doublet_r, doublet_z, doublet_phi, gas_gap, + measures_phi, strip); + + // Build the pad offline identifier + bool check = true; + bool valid = false; + Identifier id = m_muonIdHelperTool->rpcIdHelper().padID(name, eta, phi, doublet_r, + doublet_z, doublet_phi, check, &valid); + + ATH_MSG_DEBUG( "Invalid pad offline indices " ); + ATH_MSG_DEBUG( "Name : " << name ); + ATH_MSG_DEBUG( "Eta " << eta << " Phi " << phi ); + ATH_MSG_DEBUG( "Doublet r " << doublet_r << " Doublet_z " << doublet_z << " Doublet_phi " << doublet_phi ); + ATH_MSG_DEBUG( "Gas gap " << gas_gap << " Measures_phi " << measures_phi << " Strip " << strip ); + + // Retrieve Pad status and error code from Pad header and footer + PadReadOutStructure pad_header = readout->getHeader(); + PadReadOutStructure pad_footer = readout->getFooter(); + // Check the data format + assert(pad_header.isHeader()); + assert(pad_footer.isFooter()); + + unsigned int hashId = index.hash(); + unsigned int onlineId = pad_id; + unsigned int status = 0; + unsigned int errorCode = pad_footer.errorCode(); + + // Construct the new Pad + RpcPad * rpc_pad = new RpcPad(id, hashId, onlineId, status, errorCode, sector); + + // Iterate on the matrices and decode them + for (int i=0 ; i < readout->numberOfCMROFragments() ; ++i) + { + MatrixReadOut* matrix = pad.matrices_readout(i); + RpcCoinMatrix* coinMatrix = decodeMatrix(matrix, id); + // Add the matrix to the pad + rpc_pad->push_back(coinMatrix); + } + + ATH_MSG_DEBUG( "Number of matrices in Pad : " << rpc_pad->size() ); + + return rpc_pad; +} + +// Function decoding a coincidence matrix +RpcCoinMatrix* RpcDigitToRpcRDO::decodeMatrix(MatrixReadOut* matrix, Identifier& id) const +{ + + ATH_MSG_DEBUG( "Decoding a new RpcCoinMatrix" ); + + // Matrix Header and SubHeader + MatrixReadOutStructure matrix_header = matrix->getHeader(); + MatrixReadOutStructure matrix_subheader = matrix->getSubHeader(); + MatrixReadOutStructure matrix_footer = matrix->getFooter(); + // Check the data structure + assert(matrix_header.isHeader()); + assert(matrix_subheader.isSubHeader()); + assert(matrix_footer.isFooter()); + + // Create the coincidence matrix + RpcCoinMatrix* coinMatrix = new RpcCoinMatrix(id, + matrix_header.cmid(), + matrix_footer.crc(), + matrix_header.fel1id(), + matrix_subheader.febcid()); + + // Iterate on fired channels and decode them + MatrixReadOutStructure cm_hit; + for (int j=0; j < matrix->numberOfBodyWords() ; ++j) + { + cm_hit = matrix->getCMAHit(j); + assert(cm_hit.isBody()); + RpcFiredChannel* firedChannel=0; + + if (cm_hit.ijk() < 7 ) + { + firedChannel = new RpcFiredChannel(cm_hit.bcid(), + cm_hit.time(), + cm_hit.ijk(), + cm_hit.channel()); + } + else if (cm_hit.ijk() == 7 ) + { + firedChannel = new RpcFiredChannel(cm_hit.bcid(), + cm_hit.time(), + cm_hit.ijk(), + cm_hit.threshold(), + cm_hit.overlap()); + } + + coinMatrix->push_back(firedChannel); + } + + ATH_MSG_DEBUG( "Number of Fired Channels in Matrix : " << coinMatrix->size()); + return coinMatrix; +} + -- GitLab From e3ef1753a796c19b75d950b09ba2a155cbc0877c Mon Sep 17 00:00:00 2001 From: juyan Date: Wed, 15 Jan 2020 13:46:39 +0100 Subject: [PATCH 04/26] Use RpcCablingCondData::strip_code_fromOffId() in RpcDigitToRpcRDO. --- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 2 +- .../src/RpcDigitToRpcRDO.cxx | 12 +++++------- .../src/RpcCablingCondData.cxx | 19 ++++++++++++++++++- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index cf0abbe3361..60d4b12852c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -47,7 +47,7 @@ private: RpcPad * decodePad(PADreadout& pad) const ; RpcCoinMatrix * decodeMatrix(MatrixReadOut* matrix, Identifier& id) const ; - StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx) const; + StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData*) const; StatusCode fillTagInfo() const; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 5c55d25a535..784125d16f0 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -45,11 +45,9 @@ StatusCode RpcDigitToRpcRDO::initialize() ATH_CHECK( detStore()->retrieve(m_MuonMgr) ); ATH_CHECK( m_cabling.retrieve()) ; + // determine the cabling type - if (m_cabling->rpcCabSvcType() == "simLike_MapsFromFiles" || m_cabling->rpcCabSvcType() == "dataLike") m_cablingType="MuonRPC_Cabling"; - else if (m_cabling->rpcCabSvcType() == "simulationLike") m_cablingType="RPCcablingSim"; - else if (m_cabling->rpcCabSvcType() == "simulationLikeInitialization" ) m_cablingType="RPCcabling"; - else ATH_MSG_WARNING( "Unknown cabling type: rpcCabSvcType()="<< m_cabling->rpcCabSvcType() ); + m_cablingType="MuonRPC_Cabling"; ATH_CHECK(m_readKey.initialize()); @@ -89,7 +87,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { const RpcCablingCondData* readCdo{*readHandle}; // fill the data with RPC simulated digits - if (fill_RPCdata(data, ctx).isFailure()) { + if (fill_RPCdata(data, ctx, readCdo).isFailure()) { ATH_MSG_ERROR( "Fail to produce RPC data for byte stream simulation " ); } ATH_MSG_DEBUG( "RPC data loaded from G3:" << endl @@ -157,7 +155,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { return StatusCode::SUCCESS; } -StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx) const { +StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData* readCdo) const { std::string space = " "; @@ -204,7 +202,7 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& Amg::Vector3D pos = descriptor->stripPos(channelId); // get now strip_code from cablingSvc - unsigned long int strip_code_cab = m_cabling->strip_code_fromOffId (StationName, StationEta, StationPhi, + unsigned long int strip_code_cab = readCdo->strip_code_fromOffId (StationName, StationEta, StationPhi, DoubletR, DoubletZ, DoubletP, GasGap, MeasuresPhi, Strip); diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index b23f36432ae..9208f5c7f5f 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -209,7 +209,24 @@ unsigned int RpcCablingCondData::computeZIndexInCablingStation(const std::string int stationEta, int doubletR, int doubletZ, int cabStat) const { - unsigned int zIndexInCablingStation = 999; + unsigned int zIndexInCablingStation = 999; + + int iStat=0; + + if (stationName=="BML") iStat=0; // BML + else if (stationName=="BMS") iStat=1; // BMS + else if (stationName=="BOL") iStat=2; // BOL + else if (stationName=="BOS") iStat=3; // BOS + else if (stationName=="BMF") iStat=4; // BMF + else if (stationName=="BOF") iStat=5; // BOF + else if (stationName=="BOG") iStat=6; // BOG + else if (stationName=="BME") iStat=7; // BME + else + { + return 9999; + } + int side = 0; + if (stationEta>0) side=1; int cablingStation = -1; int sectType = m_SectorMap[logicSector]; -- GitLab From b586c182762a7c18917924a1c1954489e1c8827e Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 04:36:48 +0100 Subject: [PATCH 05/26] Build m_RDOmap. --- .../RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h | 2 ++ .../RPC_CondCabling/src/RpcCablingCondAlg.cxx | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 1116790c4bf..72ae2c7e73a 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -29,6 +29,7 @@ class RpcCablingCondData{ typedef std::map > RDOmap; typedef std::vector OfflineOnlineHashMap; + typedef std::map > OfflineOnlineMap; typedef Identifier ID; typedef std::vector < RPC_CondCabling::SectorLogicSetup > STvec; typedef std::map > PRD_RDO_Map; @@ -99,6 +100,7 @@ class RpcCablingCondData{ RDOmap m_RDOs; + OfflineOnlineMap m_RDOmap; OfflineOnlineHashMap m_HashVec; std::string m_map; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index 75316d0b8f7..191a832c37d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -430,6 +430,13 @@ StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) Identifier id; pRDOindex->pad_identifier( id ); + // build the map + std::pair < RpcCablingCondData::OfflineOnlineMap::iterator, bool> ins = writeCdo->m_RDOmap.insert( RpcCablingCondData::OfflineOnlineMap::value_type(id,pRDOindex)); + ATH_MSG_DEBUG("OfflineOnlineMap new entry: value "<< m_idHelperSvc ->rpcIdHelper().show_to_string(id) << + "hash of the RDOindex (key) = " << pRDOindex->hash()); + if(!ins.second) return StatusCode::FAILURE; + + //build the PRD->RDO and PRD->ROB maps ATH_MSG_VERBOSE("Looking for PRDs corresponding to this RDO"); std::list strip_id_list; -- GitLab From ac60bf2b513d4904723258979e67b1de662902ee Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 05:21:01 +0100 Subject: [PATCH 06/26] Migrate MuonRPC_CablingSvc::giveOnlineID() to RpcCablingCondData. --- .../RPC_CondCabling/RpcCablingCondData.h | 9 ++++++++ .../src/RpcCablingCondData.cxx | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 72ae2c7e73a..8e1a6fa9891 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -39,6 +39,15 @@ class RpcCablingCondData{ virtual ~RpcCablingCondData(); const RDOmap& give_RDOs(void) const; + + bool giveOnlineID(const Identifier& compactID, + unsigned short int& ROBid, + unsigned short int& RODid, + unsigned short int& side, + unsigned short int& SLid, + unsigned short int& RXid, + unsigned short int& PADid) const; + bool giveOnlineID(const unsigned int hashID, unsigned short int& ROBid, unsigned short int& RODid, diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 9208f5c7f5f..6eb4f546781 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -11,6 +11,29 @@ RpcCablingCondData::~RpcCablingCondData() {} const RpcCablingCondData::RDOmap& RpcCablingCondData::give_RDOs(void) const {return m_RDOs;} +bool RpcCablingCondData::giveOnlineID(const Identifier& compactID, + unsigned short int& ROBid, + unsigned short int& RODid, + unsigned short int& side, + unsigned short int& SLid, + unsigned short int& RXid, + unsigned short int& PADid) const +{ + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + + ROBid = index->ROBid(); + RODid = index->RODid(); + side = index->side(); + SLid = index->SLid(); + RXid = index->RXid(); + PADid = index->PADid(); + + return true; +} + bool RpcCablingCondData::giveOnlineID(const unsigned int hashID, unsigned short int& ROBid, unsigned short int& RODid, -- GitLab From c4efc04f43fcb182f47f7f7a8e1f9a9978cbdc0e Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 08:03:00 +0100 Subject: [PATCH 07/26] Modification of RPC_Hid2RESrcID and RpcPadContByteStreamTool --- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx | 31 +++++++++---------- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h | 15 +++++---- .../src/RpcPadContByteStreamTool.cxx | 19 ++---------- .../src/RpcPadContByteStreamTool.h | 6 ++-- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx index 8f274c9c403..1fd121903b3 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx @@ -16,18 +16,17 @@ using eformat::helper::SourceIdentifier; // Jan-16-2003, BNL -RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_cabling(0), m_muonIdHelperTool(0), m_specialROBNumber(-1) { +RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_muonIdHelperTool(0), m_specialROBNumber(-1) { } -RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_cabling(0), m_muonIdHelperTool(nullptr), m_specialROBNumber(specialROBNumber) { +RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_muonIdHelperTool(nullptr), m_specialROBNumber(specialROBNumber) { } -void RPC_Hid2RESrcID::set(const IRPCcablingSvc* p_cabling, const Muon::MuonIdHelperTool* muonIdHelperTool) { - m_cabling=p_cabling; +void RPC_Hid2RESrcID::set(const Muon::MuonIdHelperTool* muonIdHelperTool) { m_muonIdHelperTool=muonIdHelperTool; } -std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offlineId) { +std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { // this method returns a vector of rod IDs , for a // given RPC collection offline ID @@ -48,10 +47,10 @@ std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offl // loop over side, sector logic and pad Id to find the correct pad! - const CablingRPCBase::RDOmap& pad_map = m_cabling->give_RDOs(); + const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); - CablingRPCBase::RDOmap::const_iterator pad_beg = (pad_map).begin(); - CablingRPCBase::RDOmap::const_iterator pad_end = (pad_map).end(); + RpcCablingCondData::RDOmap::const_iterator pad_beg = (pad_map).begin(); + RpcCablingCondData::RDOmap::const_iterator pad_end = (pad_map).end(); if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Looking for collection ID: " + std::string(m_muonIdHelperTool->rpcIdHelper().show_to_string(offlineId)) < RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offl } // This method is used by the RDO converter only -uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId) { +uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { // this method returns a RESrcID for the ROD, for a // given RPC pad ID offline ID @@ -154,7 +153,7 @@ uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId) { unsigned short int RXid; unsigned short int PADid; - if( m_cabling->giveOnlineID(offlineId,ROBid,RODid,Iside,SLid,RXid,PADid) ) { + if( readCdo->giveOnlineID(offlineId,ROBid,RODid,Iside,SLid,RXid,PADid) ) { uint8_t rodIndex = (uint8_t) RODid; uint16_t side = Iside; @@ -211,11 +210,11 @@ uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId) { uint32_t RPC_Hid2RESrcID::getRodID(const int& side, const int& slogic, - const int& padId) { + const int& padId, const RpcCablingCondData* readCdo) { // this method returns a RESrcID for the ROD, for a given RPC pad ID - const CablingRPCBase::RDOmap& pad_map = m_cabling->give_RDOs(); + const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); int key = side*10000+slogic*100+padId; RDOindex index = (*pad_map.find(key)).second; uint8_t rodIndex = (uint8_t) index.RODid(); @@ -287,8 +286,8 @@ uint32_t RPC_Hid2RESrcID::getDetID ( uint32_t ros_id) { } uint16_t RPC_Hid2RESrcID::findRODid(uint16_t side, uint16_t slogic, - uint16_t padId) { - const CablingRPCBase::RDOmap& pad_map = m_cabling->give_RDOs(); + uint16_t padId, const RpcCablingCondData* readCdo) { + const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); int key = side*10000 + slogic*100 + padId; RDOindex index = (*pad_map.find(key)).second; uint16_t rodId = (uint16_t) index.RODid(); @@ -297,7 +296,7 @@ uint16_t RPC_Hid2RESrcID::findRODid(uint16_t side, uint16_t slogic, Identifier RPC_Hid2RESrcID::findPadOfflineId(uint16_t side, uint16_t slogic, - uint16_t padId) { + uint16_t padId, const RpcCablingCondData* readCdo) { // Identifier elements int name = 0; @@ -310,7 +309,7 @@ Identifier RPC_Hid2RESrcID::findPadOfflineId(uint16_t side, uint16_t slogic, int measures_phi = 0; int strip = 0; - const CablingRPCBase::RDOmap& pad_map = m_cabling->give_RDOs(); + const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); int key = side*10000 + slogic*100 + padId; RDOindex index = (*pad_map.find(key)).second; index.offline_indexes(name, eta, phi, doublet_r, diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h index 6021ad96224..6a3500e4fa5 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h @@ -10,7 +10,7 @@ // #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" -#include "RPCcablingInterface/IRPCcablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" #include "MuonIdHelpers/MuonIdHelperTool.h" #include @@ -25,13 +25,13 @@ public: RPC_Hid2RESrcID (int specialROBNumber); - void set(const IRPCcablingSvc* p_cabling, const Muon::MuonIdHelperTool* muonIdHelperTool); + void set(const Muon::MuonIdHelperTool* muonIdHelperTool); - std::vector getRodIDFromCollID(const Identifier& offlineId); + std::vector getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo); - uint32_t getRodID(const Identifier& offlineId); + uint32_t getRodID(const Identifier& offlineId, const RpcCablingCondData* readCdo); - uint32_t getRodID (const int& side, const int& slogic, const int& padId); + uint32_t getRodID (const int& side, const int& slogic, const int& padId, const RpcCablingCondData* readCdo); uint32_t getRodID (const int& sector); uint32_t getRodID (const uint16_t& side, const uint16_t& rodIndex); @@ -41,9 +41,9 @@ public: uint32_t getDetID ( uint32_t ros_id); - uint16_t findRODid(uint16_t side, uint16_t slogic, uint16_t padId); + uint16_t findRODid(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); - Identifier findPadOfflineId(uint16_t side, uint16_t slogic, uint16_t padId); + Identifier findPadOfflineId(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); const RpcIdHelper& getIdHelper () { return m_muonIdHelperTool->rpcIdHelper(); } @@ -53,7 +53,6 @@ public: private: - const IRPCcablingSvc* m_cabling; const Muon::MuonIdHelperTool* m_muonIdHelperTool; int m_specialROBNumber; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx index d43c2983f76..1905cc64e38 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx @@ -5,8 +5,6 @@ #include "RpcPadContByteStreamTool.h" #include "RpcROD_Encoder.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" - #include "RPC_Hid2RESrcID.h" #include "MuonRDO/RpcPad.h" #include "MuonRDO/RpcPadContainer.h" @@ -50,21 +48,10 @@ StatusCode Muon::RpcPadContByteStreamTool::initialize() { msg(MSG::ERROR) << " Base class initialisation failed " << endmsg; return StatusCode::FAILURE; } - - const IRPCcablingServerSvc* RpcCabGet = 0; - - if (StatusCode::SUCCESS != service("RPCcablingServerSvc", RpcCabGet,true)) { - msg(MSG::ERROR) << " Can't get RPCcablingServerSvc " << endmsg; - return StatusCode::FAILURE; - } - - if (StatusCode::SUCCESS != RpcCabGet->giveCabling(m_cabling)) { - msg(MSG::ERROR) << " Can't get RPCcablingSvc from Server" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_readKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); - m_hid2re.set(m_cabling, m_muonIdHelperTool.get()); + m_hid2re.set(m_muonIdHelperTool.get()); return StatusCode::SUCCESS; } @@ -81,7 +68,7 @@ StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrit MsgStream& log ) { m_fea.clear(); - m_fea.idMap().set(m_cabling, m_muonIdHelperTool.get()); + m_fea.idMap().set(m_muonIdHelperTool.get()); FullEventAssembler::RODDATA* theROD ; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h index d5eba333eaa..75fcd48977f 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h @@ -16,11 +16,11 @@ #include "ByteStreamData/RawEvent.h" #include "ByteStreamCnvSvcBase/FullEventAssembler.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" class RpcPadContainer; class MsgStream ; -class IRPCcablingSvc; -//class RPC_Hid2RESrcID; #include @@ -64,7 +64,7 @@ public: private: - const IRPCcablingSvc* m_cabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; RPC_Hid2RESrcID m_hid2re; ToolHandle m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; -- GitLab From cc2e6d182aea95360ce5e7034661492c73a1701d Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 10:34:17 +0100 Subject: [PATCH 08/26] Modification of RpcRDO_Decoder --- .../MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx | 45 +++++++------------ .../MuonRPC_CnvTools/src/RpcRDO_Decoder.h | 10 +++-- .../RPC_CondCabling/RpcCablingCondData.h | 2 +- .../src/RpcCablingCondData.cxx | 2 +- 4 files changed, 24 insertions(+), 35 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx index f380b7edcff..b9c9690dd30 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx @@ -8,8 +8,6 @@ #include "StoreGate/StoreGate.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" -#include "RPCcablingInterface/IRPCcablingSvc.h" #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonDigitContainer/RpcDigit.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" @@ -21,8 +19,7 @@ Muon::RpcRDO_Decoder::RpcRDO_Decoder ( const std::string& type, const std::string& name,const IInterface* parent ) - : AthAlgTool(type,name,parent), - m_cablingSvc(0) + : AthAlgTool(type,name,parent) { declareInterface( this ); } @@ -32,28 +29,11 @@ StatusCode Muon::RpcRDO_Decoder::initialize() ATH_MSG_DEBUG ( "initialize"); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); - // get RPC cablingSvc - const IRPCcablingServerSvc* RpcCabGet = 0; - StatusCode sc = service("RPCcablingServerSvc", RpcCabGet); - if (sc.isFailure()) { - msg (MSG::FATAL) << "Could not get RPCcablingServerSvc !" << endmsg; - return StatusCode::FAILURE; - } - else msg (MSG::VERBOSE) << " RPCcablingServerSvc retrieved" << endmsg; - - sc = RpcCabGet->giveCabling(m_cablingSvc); - if (sc.isFailure()) { - msg (MSG::FATAL) << "Could not get RPCcablingSvc from the Server !" << endmsg; - m_cablingSvc = 0; - return StatusCode::FAILURE; - } - else { - msg (MSG::VERBOSE) << " RPCcablingSvc obtained " << endmsg; - } - - return sc; + ATH_CHECK(m_readKey.initialize()); + + return StatusCode::SUCCESS; } @@ -81,11 +61,14 @@ std::vector* Muon::RpcRDO_Decoder::getDigit(const RpcFiredChannel * f if (ijk==7) { return rpcDigitVec; } - + + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + // Get the list of offline channels corresponding to the // online identifier - std::list idList = m_cablingSvc->give_strip_id(side, slogic, padId, - cmaId, ijk, channel); + std::list idList = readCdo->give_strip_id(side, slogic, padId, + cmaId, ijk, channel, m_idHelperSvc); std::list::const_iterator it_list; rpcDigitVec->reserve(idList.size()); @@ -141,10 +124,12 @@ std::vector* Muon::RpcRDO_Decoder::getOfflineData(const RpcFiredChan return rpcIdVec; } + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the // online identifier - std::list idList = m_cablingSvc->give_strip_id(side, slogic, padId, - cmaId, ijk, channel); + std::list idList = readCdo->give_strip_id(side, slogic, padId, + cmaId, ijk, channel, m_idHelperSvc); rpcIdVec->assign(idList.begin(), idList.end()); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h index 07fac96f0e4..90c9fc14a9a 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h @@ -12,9 +12,14 @@ #include "AthenaKernel/MsgStreamMember.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include #include +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" + // Decoder class for conversion from RPC RDOs to RPC digits // Stefano Rosati @@ -47,10 +52,9 @@ class RpcRDO_Decoder : virtual public IRPC_RDO_Decoder, public AthAlgTool private: - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - const IRPCcablingSvc* m_cablingSvc; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 8e1a6fa9891..c22c673dd57 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -70,7 +70,7 @@ class RpcCablingCondData{ unsigned short int CMAId, unsigned short ijk, unsigned short int Channel, - ServiceHandle idHelperSvc ) const; + const ServiceHandle idHelperSvc ) const; const CMAparameters::CMAlist give_CMAs(const int logic_sector,const ViewType side, const int station,const int cabling_code) const; unsigned long int strip_code_fromOffline (int etaPhiView, int logicSector, int cablingStation, int gasGap, int zIndexInCablingStation, int strip) const; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 6eb4f546781..5c5e8b0557d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -305,7 +305,7 @@ std::list RpcCablingCondData::give_strip_id(unsigned short int Subsy unsigned short int CMAId, unsigned short ijk, unsigned short int Channel, - ServiceHandle idHelperSvc ) const + const ServiceHandle idHelperSvc ) const { std::list CodeList; -- GitLab From 527a78f7fa01a248c5bf7c8f80931b05ead0fb09 Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 11:25:19 +0100 Subject: [PATCH 09/26] Modification of RpcROD_Decoder --- .../MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx | 1 + .../MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx index 31393bd3799..734776daf85 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.cxx @@ -63,6 +63,7 @@ StatusCode Muon::RpcROD_Decoder::initialize() { ATH_MSG_FATAL("Can't get RPCcablingSvc from Server"); return StatusCode::FAILURE; } + ATH_CHECK(m_readKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h index cc33faaaf03..31ab0245ba0 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcROD_Decoder.h @@ -9,6 +9,8 @@ #include "TrigT1RPChardware/RPCRXRODDecode.h" #include "TrigT1RPChardware/RPCRODStructure.h" #include "RPCcablingInterface/IRPCcablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "MuonRPC_CnvTools/IRpcROD_Decoder.h" @@ -133,6 +135,7 @@ namespace Muon //RpcPadIdHash* m_hashfunc; const IRPCcablingSvc* m_cabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; ToolHandle m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; @@ -486,6 +489,8 @@ namespace Muon } */ + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; // here optimize decoding of ROB fragment (for data only type==3) if (type==3) { @@ -507,7 +512,7 @@ namespace Muon ATH_MSG_DEBUG ( "Created new Pad Collection Hash ID = " << static_cast(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); + RpcPad* coll = new RpcPad( readCdo->identifier(it), it); mapOfCollections[coll->identify()]=coll; }// endif collection not found in the container @@ -569,7 +574,7 @@ namespace Muon ATH_MSG_VERBOSE(" Created new Pad Collection Hash ID = " << static_cast(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); + RpcPad* coll = new RpcPad(readCdo->identifier(it), it); //convert collection - note case3 will never be used due to statement above switch(type) -- GitLab From ac8959cb822d3a871e27ea35050533052a59b460 Mon Sep 17 00:00:00 2001 From: juyan Date: Thu, 16 Jan 2020 13:38:17 +0100 Subject: [PATCH 10/26] Migrate part of RPCTriggerDbTool and MuonRPC_CablingSvc::initMappingModel() into Alg --- .../RPC_CondCabling/RpcCablingCondAlg.h | 27 ++- .../RPC_CondCabling/src/RpcCablingCondAlg.cxx | 188 +++++++++++++++++- 2 files changed, 206 insertions(+), 9 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h index 4a4277c88fd..bd1c16827e5 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h @@ -53,7 +53,10 @@ class RpcCablingCondAlg: public AthAlgorithm { private: - StatusCode loadParameters(const CondAttrListCollection* readCdoMap); + StatusCode loadParameters(const CondAttrListCollection* readCdoMap, + const CondAttrListCollection* readCdoCorr, + const CondAttrListCollection* readCdoEta, + const CondAttrListCollection* readCdoPhi); StatusCode ReadConf(); StatusCode buildRDOmap(EventIDRange range_map_schema); std::list give_strip_id (unsigned short int SubsystemId, @@ -63,8 +66,23 @@ class RpcCablingCondAlg: public AthAlgorithm { unsigned short ijk, unsigned short int Channel) const; + // virtual bool giveOffflineID(unsigned short int Side, + // unsigned short int Sector, + // unsigned short int PADID, + // Identifier& ID) const; const std::string* m_ConfMapPString; + const std::string* m_corr; + std::vector m_vecetaCM_File; + std::vector m_vecetaTh0; + std::vector m_vecetaSequence_Th; + std::vector m_vecetaInfo; + + std::map m_trigroads; + + std::vector m_vecphiCM_File; + std::vector m_vecphiTh0; + std::vector m_vecphiInfo; std::string m_DataName; bool m_TestbeamFlag; @@ -81,7 +99,12 @@ class RpcCablingCondAlg: public AthAlgorithm { //map; for each sectorlogic number returns the SectorLogicSetup SLmap m_SectorLogic; - + // BooleanProperty m_RPCTriggerRoadsfromCool; + + // Pad parameters + BooleanProperty m_ApplyFeetPadThresholds; + BooleanProperty m_ForceFeetPadThresholdsFromJO; + std::vector m_FeetPadThresholds; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index 191a832c37d..21b2b0ea6b8 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -14,6 +14,10 @@ RpcCablingCondAlg::RpcCablingCondAlg(const std::string& name, ISvcLocator* pSvcL m_condSvc("CondSvc",name) { declareProperty( "CosmicConfiguration", m_cosmic_configuration=false ); + declareProperty("ApplyFeetPadThresholds", m_ApplyFeetPadThresholds=true, + "map 3 low pt thresholds from special feet pads on standard 6 (3low+3high)"); + // declareProperty( "RPCTriggerRoadsfromCool",m_RPCTriggerRoadsfromCool=false) + declareProperty("ForceFeetPadThresholdsFromJO", m_ForceFeetPadThresholdsFromJO=false, "JO override db setting"); } StatusCode RpcCablingCondAlg::initialize() { @@ -112,15 +116,25 @@ StatusCode RpcCablingCondAlg::execute() return StatusCode::FAILURE; } - ATH_CHECK(loadParameters(readCdoMap)); + // Create an intersection of input IOVs + EventIDRange rangeIntersection = EventIDRange::intersect(range_map_schema, range_map_schema_corr, range_cm_thr_eta, range_cm_thr_phi); + if(rangeIntersection.start()>rangeIntersection.stop()) { + ATH_MSG_ERROR("Invalid intersection range: " << rangeIntersection); + return StatusCode::FAILURE; + } + + ATH_CHECK(loadParameters(readCdoMap,readCdoCorr,readCdoEta,readCdoPhi) ); ATH_CHECK(ReadConf()); - ATH_CHECK(buildRDOmap(range_map_schema)); + ATH_CHECK(buildRDOmap(rangeIntersection) ); return StatusCode::SUCCESS; } -StatusCode RpcCablingCondAlg::loadParameters(const CondAttrListCollection* readCdoMap) +StatusCode RpcCablingCondAlg::loadParameters(const CondAttrListCollection* readCdoMap, + const CondAttrListCollection* readCdoCorr, + const CondAttrListCollection* readCdoEta, + const CondAttrListCollection* readCdoPhi) { ATH_MSG_DEBUG( "RpcCablingCondAlg::loadParameters()" << name() ); @@ -140,6 +154,83 @@ StatusCode RpcCablingCondAlg::loadParameters(const CondAttrListCollection* readC m_ConfMapPString = static_cast((atr["Map"]).addressOfData()); } + // begin like RPCCablingDbTool::loadRPCCorr() ----------- + + ATH_MSG_DEBUG( "excute --- Read Corrections from DB" ); + + CondAttrListCollection::const_iterator itrCorr; + for (itrCorr = readCdoCorr->begin(); itrCorr != readCdoCorr->end(); ++itrCorr) + { + const coral::AttributeList& atr=itrCorr->second; + m_corr = static_cast((atr["Map"]).addressOfData()); + ATH_MSG_VERBOSE( "Sequence read is \n" << m_corr ); + ATH_MSG_VERBOSE( "End of Sequence read and write" ); + } + + // begin like RPCCablingDbTool::loadRPCEtaTable() ----------- + + ATH_MSG_DEBUG( "excute --- Read RPCEtaTable from DB" ); + + CondAttrListCollection::const_iterator itrEta; + ic=0; + for (itrEta = readCdoEta->begin(); itrEta != readCdoEta->end(); ++itrEta) { + ic++; + ATH_MSG_VERBOSE( "Loop over CondAttrListCollection ic = " << ic ); + const coral::AttributeList& atr=itrEta->second; + + std::string etaCM_File; + std::string etaTh0; + std::string etaSequence_Th; + std::string etaInfo; + + etaCM_File = *(static_cast((atr["CM_File"]).addressOfData())); + m_vecetaCM_File.push_back(etaCM_File); + etaTh0 = *(static_cast((atr["Th0"]).addressOfData())); + m_vecetaTh0.push_back(etaTh0); + m_trigroads[etaCM_File]=etaTh0; + etaSequence_Th = *(static_cast((atr["Sequence_Th"]).addressOfData())); + m_vecetaSequence_Th.push_back(etaSequence_Th); + etaInfo = *(static_cast((atr["Additional_Info"]).addressOfData())); + m_vecetaInfo.push_back(etaInfo); + + ATH_MSG_VERBOSE( "column eta CM_File is \n" << etaCM_File ); + ATH_MSG_VERBOSE( "column eta Th0 is \n" << etaTh0 ); + ATH_MSG_VERBOSE( "column eta Sequence_Th is \n" << etaSequence_Th ); + ATH_MSG_VERBOSE( "column eta Additional_Info is \n" << etaInfo ); + ATH_MSG_VERBOSE( "End of Sequence read and write" ); + + } + + // begin like RPCCablingDbTool::loadRPCEPhiTable() ----------- + + ATH_MSG_DEBUG( "excute --- Read RPCPhiTable from DB" ); + + CondAttrListCollection::const_iterator itrPhi; + ic=0; + for (itrPhi = readCdoPhi->begin(); itrPhi != readCdoPhi->end(); ++itrPhi) { + ic++; + ATH_MSG_VERBOSE( "Loop over CondAttrListCollection ic = " << ic ); + const coral::AttributeList& atr=itrPhi->second; + + std::string phiCM_File; + std::string phiTh0; + std::string phiInfo; + + phiCM_File = *(static_cast((atr["CM_File"]).addressOfData())); + m_vecphiCM_File.push_back(phiCM_File); + phiTh0 = *(static_cast((atr["Th0"]).addressOfData())); + m_vecphiTh0.push_back(phiTh0); + m_trigroads[phiCM_File]=phiTh0; + phiInfo = *(static_cast((atr["Additional_Info"]).addressOfData())); + m_vecphiInfo.push_back(phiInfo); + + ATH_MSG_VERBOSE( "column phi CM_File is \n" << phiCM_File ); + ATH_MSG_VERBOSE( "column phi Th0 is \n" << phiTh0 ); + ATH_MSG_VERBOSE( "column phi Additional_Info is \n" << phiInfo); + ATH_MSG_VERBOSE( "End of Sequence read and write" ); + + } + return StatusCode::SUCCESS; } @@ -255,7 +346,7 @@ StatusCode RpcCablingCondAlg::ReadConf() // build and init the map for the PAD RDO -StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) +StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange rangeIntersection) { ATH_MSG_DEBUG("RpcCablingCondAlg--- buildRDOmap"); @@ -480,7 +571,73 @@ StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) } } + // ---- begin like MuonRPC_CablingSvc::initTrigRoadsModel() + + // Trigger Roads Header + std::map::const_iterator it; + it=m_trigroads.find("infos.txt"); + if (it==m_trigroads.end()){ + ATH_MSG_WARNING("Missing HEADER FILE infos.txt"); + } else { + ATH_MSG_INFO("======== RPC Trigger Roads from COOL - Header infos ========"); + ATH_MSG_INFO("\n"+it->second+"\n"); + // Read FeetPadThresholds from infos.txt + if (!m_ForceFeetPadThresholdsFromJO){ + std::stringstream ss; + ss << it->second; + std::string word; + while (ss >> word){ + if (word=="FeetPadThresholds"){ + m_FeetPadThresholds.assign(3,0); + ss >> m_FeetPadThresholds.at(0); + ss >> m_FeetPadThresholds.at(1); + ss >> m_FeetPadThresholds.at(2); + ATH_MSG_VERBOSE("FeetPadThresholds set from COOL to: " + <m_RPCPadParameters_array[FeetSectors[is]][SpecialFeetPads[it]].set_feet_on(true); + for (unsigned int th=0; th<3; th++) + writeCdo->m_RPCPadParameters_array[FeetSectors[is]][SpecialFeetPads[it]].set_feet_threshold(th,m_FeetPadThresholds.at(th)); + } + } + // } + } // ------ begin like PCcablingInterface::RpcPadIdHash::RpcPadIdHash() RDOindex index = (*pad_beg).second; @@ -548,14 +705,15 @@ StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) ATH_MSG_DEBUG("Could not read any HashID"); return StatusCode::FAILURE; } - if (writeHandle.record( range_map_schema, std::move(writeCdo)).isFailure()) + // recording + if (writeHandle.record( rangeIntersection, std::move(writeCdo)).isFailure()) { - ATH_MSG_FATAL("Could not record RpcCondCablingData " << writeHandle.key() << " with EventRange " << range_map_schema << " into Conditions Store"); + ATH_MSG_FATAL("Could not record RpcCondCablingData " << writeHandle.key() << " with EventRange " << rangeIntersection << " into Conditions Store"); return StatusCode::SUCCESS; } - ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << range_map_schema ); + ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << rangeIntersection ); return StatusCode::SUCCESS; @@ -648,3 +806,19 @@ std::list RpcCablingCondAlg::give_strip_id(unsigned short int Subsys } +// bool RpcCablingCondAlg::giveOffflineID(unsigned short int Side, +// unsigned short int Sector, +// unsigned short int PADID, +// Identifier& ID) const +// { +// if (Side>=2) return false; +// if (Sector>=32) return false; +// if (PADID>=10) return false; + +// ID = m_offline_id[Side][Sector][PADID]; +// // if( ID == 0xFFFFFFFF ) return false; // original, not working with 64 bit identifiers +// if ( ID == m_uninitialized_identifier ) return false; + +// return true; +// } + -- GitLab From d5799dbd5779449b5c50f200a7d149d81902669c Mon Sep 17 00:00:00 2001 From: juyan Date: Fri, 17 Jan 2020 07:36:11 +0100 Subject: [PATCH 11/26] Modification of PADdata, PADpatterns, SLpatterns and TrigT1RPC --- .../TrigT1RPClogic/TrigT1RPClogic/PADdata.h | 4 +- .../TrigT1RPClogic/PADpatterns.h | 10 +- .../TrigT1RPClogic/SLpatterns.h | 4 +- Trigger/TrigT1/TrigT1RPClogic/src/PADdata.cxx | 7 +- .../TrigT1/TrigT1RPClogic/src/PADpatterns.cxx | 95 +++++++++---------- .../TrigT1/TrigT1RPClogic/src/SLpatterns.cxx | 48 +++++----- .../TrigT1RPCsteering/TrigT1RPC.h | 7 +- .../TrigT1RPCsteering/src/TrigT1RPC.cxx | 29 +++--- 8 files changed, 90 insertions(+), 114 deletions(-) diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADdata.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADdata.h index 8f617f9d544..8cf5e2afc70 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADdata.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADdata.h @@ -21,14 +21,13 @@ class PADdata : public BaseObject private: unsigned long int m_debug; PATTERNSlist m_pad_patterns; - const IRPCcablingSvc* m_cabling; void create_pad_patterns(CMApatterns*); PADpatterns* find(const int,const int); public: - PADdata(CMAdata*, const IRPCcablingSvc* cablingSvc,unsigned long int ); + PADdata(CMAdata*, unsigned long int ); PADdata(const PADdata&); ~PADdata(); @@ -36,7 +35,6 @@ class PADdata : public BaseObject unsigned long int debug(void) const {return m_debug;} - const IRPCcablingSvc* cabling(void) const {return m_cabling;}; const PATTERNSlist& pad_patterns(void) const {return m_pad_patterns;} PatternsList give_patterns(void); diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADpatterns.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADpatterns.h index 4825a086373..e27f93d3af6 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADpatterns.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/PADpatterns.h @@ -13,7 +13,7 @@ #include #include "TrigT1RPClogic/CMAdata.h" #include "TrigT1RPChardware/Pad.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" class PADpatterns : public RPCtrigDataObject { @@ -26,15 +26,12 @@ class PADpatterns : public RPCtrigDataObject unsigned long int m_debug; CMAdata::PatternsList m_cma_patterns; - const IRPCcablingSvc* m_cabling; Pad* m_pad; - void create_hardware(void); - public: - PADpatterns(int,int,const IRPCcablingSvc*, unsigned long int); + PADpatterns(int,int,unsigned long int); PADpatterns(const PADpatterns&); ~PADpatterns(); @@ -51,12 +48,11 @@ class PADpatterns : public RPCtrigDataObject int sector(void) const {return m_sector;} int pad_id(void) const {return m_pad_id;} unsigned long int debug(void) const {return m_debug;} - const IRPCcablingSvc* cabling(void) const {return m_cabling;}; const CMAdata::PatternsList cma_patterns(void) const {return m_cma_patterns;} - Pad* give_pad(void); + Pad* give_pad(const RpcCablingCondData* readCdo); void Print (std::ostream&,bool) const; }; diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/SLpatterns.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/SLpatterns.h index 245d5a8376f..bf8f98a7c1b 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/SLpatterns.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/SLpatterns.h @@ -12,6 +12,7 @@ #include #include #include "TrigT1RPClogic/PADdata.h" +#include "RPC_CondCabling/RpcCablingCondData.h" #include "TrigT1RPChardware/SectorLogic.h" @@ -25,7 +26,6 @@ class SLpatterns : public RPCtrigDataObject SectorLogic* m_SectorL; - void create_hardware(void); public: SLpatterns(int,unsigned long int); @@ -48,7 +48,7 @@ class SLpatterns : public RPCtrigDataObject const PADdata::PatternsList pad_patterns(void) const {return m_pad_patterns;} - SectorLogic* give_SectorL(void); + SectorLogic* give_SectorL(const RpcCablingCondData* readCdo); void Print (std::ostream&,bool) const; }; diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/PADdata.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/PADdata.cxx index bc00ef73279..18f245bb46a 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/PADdata.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/PADdata.cxx @@ -6,11 +6,10 @@ #include "TrigT1RPClogic/CMAdata.h" -PADdata::PADdata(CMAdata* cma_data,const IRPCcablingSvc* cablingSvc,unsigned long int debug) : +PADdata::PADdata(CMAdata* cma_data,unsigned long int debug) : BaseObject(Data,"PAD data"),m_debug(debug) { m_pad_patterns.clear(); - m_cabling=cablingSvc; CMAdata::PatternsList cma_patterns = cma_data->give_patterns(); CMAdata::PatternsList::const_iterator CMApatterns = cma_patterns.begin(); @@ -27,7 +26,6 @@ PADdata::PADdata(const PADdata& pad_data) : { m_pad_patterns = pad_data.pad_patterns(); m_debug = pad_data.debug(); - m_cabling = pad_data.cabling(); } PADdata::~PADdata() @@ -42,7 +40,6 @@ PADdata::operator=(const PADdata& pad_data) m_pad_patterns.clear(); m_pad_patterns = pad_data.pad_patterns(); m_debug = pad_data.debug(); - m_cabling = pad_data.cabling(); return *this; } @@ -58,7 +55,7 @@ PADdata::create_pad_patterns(CMApatterns* cma_patterns) patterns->load_cma_patterns(cma_patterns); else { - patterns = new PADpatterns(sector,pad_id,m_cabling,m_debug); + patterns = new PADpatterns(sector,pad_id,m_debug); patterns->load_cma_patterns(cma_patterns); m_pad_patterns.push_back(*patterns); delete patterns; diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/PADpatterns.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/PADpatterns.cxx index 05280975ef9..9070a80be9f 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/PADpatterns.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/PADpatterns.cxx @@ -8,12 +8,11 @@ #include "TrigT1RPClogic/PADpatterns.h" -PADpatterns::PADpatterns(int sector, int pad,const IRPCcablingSvc* cablingSvc,unsigned long int debug) : +PADpatterns::PADpatterns(int sector, int pad,unsigned long int debug) : RPCtrigDataObject(0,"PAD patterns"),m_sector(sector),m_pad_id(pad), m_debug(debug) { m_pad = 0; - m_cabling=cablingSvc; } PADpatterns::PADpatterns(const PADpatterns& PAD) : @@ -23,7 +22,6 @@ PADpatterns::PADpatterns(const PADpatterns& PAD) : m_pad_id = PAD.pad_id(); m_debug = PAD.debug(); m_cma_patterns = PAD.cma_patterns(); - m_cabling=PAD.cabling(); m_pad = 0; } @@ -42,7 +40,6 @@ PADpatterns::operator=(const PADpatterns& PAD) m_debug = PAD.debug(); m_cma_patterns.clear(); m_cma_patterns = PAD.cma_patterns(); - m_cabling=PAD.cabling(); m_pad = 0; return *this; } @@ -88,9 +85,11 @@ PADpatterns::operator<<(CMApatterns* patterns) return *this; } -void -PADpatterns::create_hardware(void) +Pad* +PADpatterns::give_pad(const RpcCablingCondData* readCdo) { + if (!m_pad) + { int subsystem = (m_sector<32)? 0 : 1; int logic_sector = m_sector%32; @@ -103,65 +102,57 @@ PADpatterns::create_hardware(void) oldSimulation = true; } } - + m_pad = new Pad(0,0,m_debug,subsystem,logic_sector,m_pad_id,1,oldSimulation); //M.Corradi 8/1/2015 get Pad configuration Parameters bool eta_and_phi, feet_on; unsigned short int cma_mask, feet_th0, feet_th1, feet_th2 ; - if (m_cabling->give_Pad_Parameters((unsigned short int)m_sector, - (unsigned short int)m_pad_id, - feet_on,eta_and_phi,cma_mask, - feet_th0,feet_th1,feet_th2)){ - m_pad->setFeetOn(feet_on); - m_pad->setFeetThresholds(0,feet_th0); - m_pad->setFeetThresholds(1,feet_th1); - m_pad->setFeetThresholds(2,feet_th2); - // m_pad->display(1); - // MASK AND eta_and_phi to be implemented - + if (readCdo->give_Pad_Parameters((unsigned short int)m_sector, + (unsigned short int)m_pad_id, + feet_on,eta_and_phi,cma_mask, + feet_th0,feet_th1,feet_th2)){ + m_pad->setFeetOn(feet_on); + m_pad->setFeetThresholds(0,feet_th0); + m_pad->setFeetThresholds(1,feet_th1); + m_pad->setFeetThresholds(2,feet_th2); + // m_pad->display(1); + // MASK AND eta_and_phi to be implemented + }else { - DISP << "Could not retrieve Pad Parameters" - << "m_ector , m_pad_id = " << m_sector << "," << m_pad_id - << std::endl; - DISP_ERROR; + DISP << "Could not retrieve Pad Parameters" + << "m_ector , m_pad_id = " << m_sector << "," << m_pad_id + << std::endl; + DISP_ERROR; } - - + + while(cma != m_cma_patterns.end()) { - Matrix* low_pt_matrix = (*cma)->give_low_pt_matrix(); - Matrix* high_pt_matrix = (*cma)->give_high_pt_matrix(); - - CMAidentity id = (*cma)->cma_parameters().id(); - int matrix_view = (id.type() == Phi)? 1 : 0; - int matrix_id = id.Ixx_index(); - - for (int bunch=0;bunch< NOBXS;++bunch) - { - m_pad->load(0,matrix_view,matrix_id,bunch, - low_pt_matrix->getOutputThres(bunch), - low_pt_matrix->getOutputOverl(bunch)); - - m_pad->load(1,matrix_view,matrix_id,bunch, - high_pt_matrix->getOutputThres(bunch), - high_pt_matrix->getOutputOverl(bunch)); - } - ++cma; + Matrix* low_pt_matrix = (*cma)->give_low_pt_matrix(); + Matrix* high_pt_matrix = (*cma)->give_high_pt_matrix(); + + CMAidentity id = (*cma)->cma_parameters().id(); + int matrix_view = (id.type() == Phi)? 1 : 0; + int matrix_id = id.Ixx_index(); + + for (int bunch=0;bunch< NOBXS;++bunch) + { + m_pad->load(0,matrix_view,matrix_id,bunch, + low_pt_matrix->getOutputThres(bunch), + low_pt_matrix->getOutputOverl(bunch)); + + m_pad->load(1,matrix_view,matrix_id,bunch, + high_pt_matrix->getOutputThres(bunch), + high_pt_matrix->getOutputOverl(bunch)); + } + ++cma; } m_pad->execute(); -} - -Pad* -PADpatterns::give_pad(void) -{ - if (!m_pad) - { - this->create_hardware(); - } - return m_pad; + } + return m_pad; } void diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/SLpatterns.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/SLpatterns.cxx index a4f6c0859ee..18572df63b4 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/SLpatterns.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/SLpatterns.cxx @@ -79,9 +79,11 @@ SLpatterns::operator<<(PADpatterns* patterns) return *this; } -void -SLpatterns::create_hardware(void) +SectorLogic* +SLpatterns::give_SectorL(const RpcCablingCondData* readCdo) { + if(!m_SectorL) + { int subsystem = (m_sector < 32)? 0 : 1; int logic_sector = m_sector%32; @@ -91,39 +93,35 @@ SLpatterns::create_hardware(void) bool oldSimulation=false; // M. Corradi 3/3/2010: check if using old cabling if (pad != m_pad_patterns.end()) { - oldSimulation=(*pad)->give_pad()->isOldSimulation(); + oldSimulation=(*pad)->give_pad(readCdo)->isOldSimulation(); } - + m_SectorL = new SectorLogic(0,0,m_debug,subsystem,logic_sector,oldSimulation); while(pad != m_pad_patterns.end()) { - Pad* Pad_board = (*pad)->give_pad(); - for (int bunch=0;bunchload( (*pad)->pad_id(), - bunch, - Pad_board->getRoI(bunch), - Pad_board->getPTCoding(bunch), - Pad_board->getOPL(bunch), - Pad_board->getOverlapPhi(bunch), - Pad_board->getOverlapEta(bunch), - Pad_board->getRoIAmbiguity(bunch), - Pad_board->getBCIDCounter(bunch) ); - } - - ++pad; + Pad* Pad_board = (*pad)->give_pad(readCdo); + for (int bunch=0;bunchload( (*pad)->pad_id(), + bunch, + Pad_board->getRoI(bunch), + Pad_board->getPTCoding(bunch), + Pad_board->getOPL(bunch), + Pad_board->getOverlapPhi(bunch), + Pad_board->getOverlapEta(bunch), + Pad_board->getRoIAmbiguity(bunch), + Pad_board->getBCIDCounter(bunch) ); + } + + ++pad; } m_SectorL->execute(); -} + } -SectorLogic* -SLpatterns::give_SectorL(void) -{ - if(!m_SectorL) this->create_hardware(); - return m_SectorL; + return m_SectorL; } void diff --git a/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h b/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h index 8b52e5212c8..e0295e79e5e 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h +++ b/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h @@ -19,7 +19,9 @@ #include "StoreGate/DataHandle.h" #include "Identifier/Identifier.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "TrigT1RPClogic/RPCsimuData.h" #include "TrigT1RPClogic/CMAdata.h" @@ -87,8 +89,7 @@ private: const MuonGM::MuonDetectorManager* m_MuonMgr; const RpcIdHelper* m_rpcId; - ServiceHandle m_cabling_getter; - const IRPCcablingSvc* m_cabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; SG::ReadHandleKey m_rpcDigitKey{this, "RPCDigitContainer", "RPC_DIGITS", "RPC Digit Input Container"}; SG::WriteHandleKey m_muctpiKey{this, "MuctpiLocationRPC", "L1MuctpiStoreRPC", "Location of muctpi for Rpc"}; diff --git a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx index 9025e2ead3e..8275a9d837e 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx +++ b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx @@ -50,9 +50,7 @@ static int digit_out = 0; ///////////////////////////////////////////////////////////////////////////// TrigT1RPC::TrigT1RPC(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_cabling_getter("RPCcablingServerSvc/RPCcablingServerSvc","TrigT1RPC"), - m_cabling(0) + AthAlgorithm(name, pSvcLocator) { m_MuonMgr=0; m_rpcId=0; @@ -68,12 +66,7 @@ StatusCode TrigT1RPC::initialize(){ CHECK (detStore()->retrieve( m_MuonMgr )); m_rpcId = m_MuonMgr->rpcIdHelper(); - - - - // initialize RPC cabling service - CHECK(m_cabling_getter.retrieve()); - CHECK(m_cabling_getter->giveCabling(m_cabling)); + ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_rpcDigitKey.initialize()); @@ -114,11 +107,12 @@ StatusCode TrigT1RPC::execute() { unsigned long int debug; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; ///// Creates the CMA patterns from RPC digits ///////////////////////// debug = (m_hardware_emulation)? m_cma_debug : m_fast_debug; // - //m_cabling.operator->() // - CMAdata patterns(&data,m_cabling,debug); // + CMAdata patterns(&data,readCdo, debug); // // ATH_MSG_DEBUG ( "CMApatterns created from RPC digits:" << endl // << ShowData(patterns,"",m_data_detail) ); // @@ -127,7 +121,7 @@ StatusCode TrigT1RPC::execute() { ///// Creates the PAD patterns from the CMA patterns /////////////////// debug = (m_hardware_emulation)? m_pad_debug : m_fast_debug; // - PADdata pads(&patterns,m_cabling,debug); // + PADdata pads(&patterns,debug); // // ATH_MSG_DEBUG ( "PADs created from CMA patterns:" << endl << ShowData(pads,"",m_data_detail) ); @@ -156,13 +150,14 @@ StatusCode TrigT1RPC::execute() { ctpiInRPC = wh_muctpiRpc.ptr(); } + // SLdata::PatternsList sectors_patterns = sectors.give_patterns(); // SLdata::PatternsList::iterator SLit = sectors_patterns.begin(); // // while(SLit != sectors_patterns.end()) // { // - SectorLogic* logic = (*SLit)->give_SectorL(); // + SectorLogic* logic = (*SLit)->give_SectorL(readCdo); // int sector = (*SLit)->sector(); // int subsystem = (sector > 31)? 1 : 0; // int logic_sector = sector%32;// @@ -230,9 +225,6 @@ StatusCode TrigT1RPC::execute() { (unsigned long int) m_rx_rostruct_debug, (unsigned long int) m_sl_rostruct_debug); - // Test of the decoder - //RpcByteStreamDecoder* decoder = new RpcByteStreamDecoder(&bytestream, m_cabling); - //StatusCode sc = decoder->decodeByteStream(); // Example on how to access the byte stream data. // Only the bare structure is dump. To access a specific data member, use @@ -313,6 +305,9 @@ StatusCode TrigT1RPC::finalize() { StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) { std::string space = " "; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + ATH_MSG_DEBUG("in execute(): fill RPC data"); @@ -376,7 +371,7 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) // Get the Level-1 numbering schema for the RPC strips unsigned long int strip_code_cab = - m_cabling->strip_code_fromOffId (StationName,StationEta,StationPhi, + readCdo->strip_code_fromOffId (StationName,StationEta,StationPhi, DoubletR,DoubletZ,DoubletP, GasGap,MeasuresPhi,Strip); -- GitLab From 65a6cb686d27ac91f4426611594b658502d86359 Mon Sep 17 00:00:00 2001 From: juyan Date: Fri, 17 Jan 2020 08:50:04 +0100 Subject: [PATCH 12/26] Modification of TrigRpcDataRetriever --- .../MuonCnv/MuonJiveXML/CMakeLists.txt | 3 ++- .../MuonJiveXML/TrigRpcDataRetriever.h | 10 +++++--- .../MuonJiveXML/src/TrigRpcDataRetriever.cxx | 25 +++++-------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonJiveXML/CMakeLists.txt index d5e4d984bff..ccd608d7755 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonRDO MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent ) # External dependencies: @@ -27,7 +28,7 @@ atlas_add_component( MuonJiveXML src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps MuonReadoutGeometry JiveXMLLib GaudiKernel RPCcablingInterfaceLib MuonIdHelpersLib MuonRDO MuonPrepRawData AnalysisTriggerEvent ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps MuonReadoutGeometry JiveXMLLib GaudiKernel RPCcablingInterfaceLib MuonIdHelpersLib MuonRDO MuonPrepRawData AnalysisTriggerEvent RPC_CondCablingLib) # Install files from the package: atlas_install_headers( MuonJiveXML ) diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h index efe2a51ff65..9b34b138bb9 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h @@ -17,8 +17,12 @@ #include "GaudiKernel/ToolHandle.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" -class IRPCcablingSvc; namespace JiveXML { @@ -49,9 +53,9 @@ namespace JiveXML { /// Tool for RPC identifier helper ToolHandle m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - /// RPC cabling Svc - const IRPCcablingSvc *m_rpcCabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; /// RPC decoder ToolHandle m_rpcDecoder; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx index 75c8a2e4ddc..8556ea633b4 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx @@ -13,7 +13,6 @@ #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" #include "MuonRDO/RpcPadContainer.h" #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" @@ -43,22 +42,8 @@ namespace JiveXML { return StatusCode::FAILURE; } - // get RPC cablingSvc - const IRPCcablingServerSvc* RpcCabGet; - sc = service("RPCcablingServerSvc", RpcCabGet); - if (sc.isFailure()) { - if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get RPCcablingServerSvc !" << endmsg; - return StatusCode::FAILURE; - } - - sc = RpcCabGet->giveCabling(m_rpcCabling); - if (sc.isFailure()) { - if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not get RPCcablingSvc from the Server !" << endmsg; - return StatusCode::FAILURE; - } - else { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << MSG::DEBUG << " Found the RPCcablingSvc. " << endmsg; - } + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_readKey.initialize()); /// retrieve the RPC RDO decoder if (m_rpcDecoder.retrieve().isFailure()) { @@ -131,6 +116,8 @@ namespace JiveXML { //loop on pad + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; const DataHandle itColl(firstRdoColl); for (; itColl!=lastRdoColl; ++itColl){ if ( itColl->size() == 0 ) continue; @@ -187,7 +174,7 @@ namespace JiveXML { // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; uint16_t sl = sectorId-side*32 ; - std::list stripList = m_rpcCabling->give_strip_id(side,sl,padId,cmaId,rpcChan->ijk(),rpcChan->channel()); + std::list stripList = readCdo->give_strip_id(side,sl,padId,cmaId,rpcChan->ijk(),rpcChan->channel(), m_idHelperSvc); std::list::const_iterator it_list; for (it_list=stripList.begin() ; it_list != stripList.end() ; ++it_list) { Identifier stripOfflineId = *it_list; @@ -238,7 +225,7 @@ namespace JiveXML { // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; uint16_t sl = sectorId-side*32 ; - std::list stripList1 = m_rpcCabling->give_strip_id(side,sl,padId,cmaId,rpcChan1->ijk(),rpcChan1->channel()); + std::list stripList1 = readCdo->give_strip_id(side,sl,padId,cmaId,rpcChan1->ijk(),rpcChan1->channel(), m_idHelperSvc); std::list::const_iterator it_list1; for (it_list1=stripList1.begin() ; it_list1 != stripList1.end() ; ++it_list1) { Identifier stripOfflineId1 = *it_list1; -- GitLab From 5863f876a4c925e53ad3f1f5bc099876989a64e4 Mon Sep 17 00:00:00 2001 From: juyan Date: Fri, 17 Jan 2020 13:12:04 +0100 Subject: [PATCH 13/26] Modification of RpcLv1RawDataValAlg --- .../RpcRawDataMonitoring/CMakeLists.txt | 3 ++- .../RpcLv1RawDataValAlg.h | 7 ++++- .../src/RpcLv1RawDataValAlg.cxx | 27 ++++++------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/CMakeLists.txt index bc8e5c378a2..10a47450063 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/CMakeLists.txt @@ -34,6 +34,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkMultiComponentStateOnSurface Tracking/TrkEvent/TrkTrack Trigger/TrigConfiguration/TrigConfL1Data + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling Trigger/TrigT1/TrigT1Result ) # External dependencies: @@ -45,7 +46,7 @@ atlas_add_component( RpcRawDataMonitoring src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaMonitoringLib StoreGateLib SGtests xAODEventInfo xAODMuon xAODTracking GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonGeoModelLib MuonRDO MuonTrigCoinData MuonDQAUtilsLib muonEvent TrigDecisionToolLib TrigT1Interfaces GeoPrimitives EventPrimitives MuonDigitContainer MuonIdHelpersLib MuonPrepRawData TrkEventPrimitives TrkMeasurementBase TrkMultiComponentStateOnSurface TrkTrack TrigConfL1Data TrigT1Result ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaMonitoringLib StoreGateLib SGtests xAODEventInfo xAODMuon xAODTracking GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonGeoModelLib MuonRDO MuonTrigCoinData MuonDQAUtilsLib muonEvent TrigDecisionToolLib TrigT1Interfaces GeoPrimitives EventPrimitives MuonDigitContainer MuonIdHelpersLib MuonPrepRawData TrkEventPrimitives TrkMeasurementBase TrkMultiComponentStateOnSurface TrkTrack TrigConfL1Data TrigT1Result RPC_CondCablingLib) # Install files from the package: atlas_install_headers( RpcRawDataMonitoring ) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h index a1539d6382a..1b3a194d8e6 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h @@ -25,6 +25,10 @@ #include "xAODEventInfo/EventInfo.h" #include "RPCcablingInterface/IRPCcablingServerSvc.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" @@ -113,8 +117,9 @@ class RpcLv1RawDataValAlg: public ManagedMonitorToolBase { ToolHandle m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - const IRPCcablingSvc* m_cabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; //Declare Properties diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx index 1da4af92f62..c387429f0ae 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx @@ -84,23 +84,8 @@ StatusCode RpcLv1RawDataValAlg::initialize() ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - // get RPC cablingSvc - const IRPCcablingServerSvc* RpcCabGet = 0; - sc = service("RPCcablingServerSvc", RpcCabGet); - if (sc.isFailure()) { - ATH_MSG_WARNING ( "Could not get RPCcablingServerSvc !" ); - return StatusCode::FAILURE; - } - - sc = RpcCabGet->giveCabling(m_cabling); - if (sc.isFailure()) { - ATH_MSG_WARNING ( "Could not get RPCcablingSvc from the Server !" ); - m_cabling = 0; - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG ( " Found the RPCcablingSvc. " ); } - + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_readKey.initialize()); std::vector hardware_name_list ; std::vector layer_name_list ; @@ -689,8 +674,10 @@ if ( m_doCoolDB ) { uint16_t ijk = i_ijk; uint16_t channel = i_channel; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the online identifier - std::list idList = m_cabling->give_strip_id(side, slogic, padId, cmaId, ijk, channel); + std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, m_idHelperSvc); std::list::const_iterator it_list; for (it_list=idList.begin() ; it_list != idList.end() ; ++it_list) { @@ -1509,8 +1496,10 @@ StatusCode RpcLv1RawDataValAlg::bookHistogramsRecurrent() for(uint16_t ijk = 0; ijk != 6 ; ijk ++) {if(cmaId>3&&ijk<2)continue; for(uint16_t channel = 0; channel!=32 ; channel++) { + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the online identifier - std::list idList = m_cabling->give_strip_id(side, slogic, padId, cmaId, ijk, channel); + std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, m_idHelperSvc); std::list::const_iterator it_list; for (it_list=idList.begin() ; it_list != idList.end() ; ++it_list) { -- GitLab From 3e1b8fee8cf1fc738090bf030a26f15809f6430e Mon Sep 17 00:00:00 2001 From: juyan Date: Fri, 17 Jan 2020 15:18:30 +0100 Subject: [PATCH 14/26] Modification of MuCalStreamerTool and migrate CAblingRPC::give_Pad_address() to Data. --- .../RPC_CondCabling/RpcCablingCondData.h | 8 ++++++ .../src/RpcCablingCondData.cxx | 25 +++++++++++++++++++ .../TrigL2MuonSA/CMakeLists.txt | 3 ++- .../TrigL2MuonSA/MuCalStreamerTool.h | 13 ++++++---- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 22 ++++++++-------- 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index c22c673dd57..89eec40f59e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -92,6 +92,14 @@ class RpcCablingCondData{ unsigned short int & feet_th1, unsigned short int & feet_th2 ) const; + bool give_PAD_address (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& logic_sector, + unsigned short int& PADId, + unsigned int& PadId) const; + + // migrate from RpcPadIDHash // reverse conversion diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 5c5e8b0557d..e0714c44b9e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -440,3 +440,28 @@ bool RpcCablingCondData::give_Pad_Parameters(unsigned short int logic_sector, } +bool +RpcCablingCondData::give_PAD_address (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& logic_sector, + unsigned short int& PADId, + unsigned int& PadId) const +{ + logic_sector = SectorId + SubsystemId*32; + PADId = (RoIId)/4; + + int key = SubsystemId*10000 + SectorId*100 + PADId; + + // checks if the key is in the map + RDOmap::const_iterator it = m_RDOs.find(key); + if (it == m_RDOs.end()) return false; + + // Retrieve the identifier elements from the map + const RDOindex index = (*it).second; + + PadId = index.hash(); + + return true; +} + diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt index c3d8b2b3390..220eed95897 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonCablings/MuonRPC_Cabling MuonSpectrometer/MuonCablings/MuonTGC_Cabling MuonSpectrometer/MuonCablings/RPCcablingInterface + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces MuonSpectrometer/MuonRDO @@ -57,7 +58,7 @@ atlas_add_library( TrigL2MuonSALib src/*.cxx PUBLIC_HEADERS TrigL2MuonSA INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib) atlas_add_component( TrigL2MuonSA src/*.cxx diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h index 9abda303d9b..f7b2589294b 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h @@ -15,9 +15,11 @@ #include "TrigL2MuonSA/TrackData.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" +// #include "RPCcablingInterface/IRPCcablingServerSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "MuonRPC_Cabling/MuonRPC_CablingSvc.h" +// #include "MuonRPC_Cabling/MuonRPC_CablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "RegionSelector/IRegSelSvc.h" #include "MuonRDO/TgcRdoContainer.h" #include "StoreGate/ReadHandleKey.h" @@ -119,9 +121,10 @@ namespace TrigL2MuonSA { // the region selector ServiceHandle m_regionSelector; - // RPC cabling service - const IRPCcablingSvc* m_rpcCabling; - const CablingRPCBase* m_rpcCablingSvc; + // // RPC cabling service + // const IRPCcablingSvc* m_rpcCabling; + // const CablingRPCBase* m_rpcCablingSvc; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; // tgc cabling maps // const ITGCcablingSvc* m_tgcCabling; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index ce8aa41914c..c84303f3cd4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -65,15 +65,15 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::initialize() return sc; } - // Retrieve the RPC cabling service - ServiceHandle RpcCabGet ("RPCcablingServerSvc", name()); - ATH_CHECK( RpcCabGet.retrieve() ); - ATH_CHECK( RpcCabGet->giveCabling(m_rpcCabling) ); - m_rpcCablingSvc = m_rpcCabling->getRPCCabling(); - if ( !m_rpcCablingSvc ) { - ATH_MSG_ERROR("Could not retrieve the RPC cabling svc"); - return StatusCode::FAILURE; - } + // // Retrieve the RPC cabling service + // ServiceHandle RpcCabGet ("RPCcablingServerSvc", name()); + // ATH_CHECK( RpcCabGet.retrieve() ); + // ATH_CHECK( RpcCabGet->giveCabling(m_rpcCabling) ); + // m_rpcCablingSvc = m_rpcCabling->getRPCCabling(); + // if ( !m_rpcCablingSvc ) { + // ATH_MSG_ERROR("Could not retrieve the RPC cabling svc"); + // return StatusCode::FAILURE; + // } // retrieve the TGC cabling svc // ServiceHandle TgcCabGet ("TGCCablingServerSvc", name()); @@ -548,8 +548,10 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::createRpcFragment(const LVL1::RecMuo // std::cout << "padNumber : " << padNumber << std::endl; unsigned int padIdHash; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; - if ( m_rpcCablingSvc->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if ( readCdo-> give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { RpcPadContainer::const_iterator itPad = rpcPadContainer->indexFind(padIdHash); if( itPad==rpcPadContainer->end() ) { -- GitLab From a4cce2f0b708e693fff6342df7de4ca6c8c8f903 Mon Sep 17 00:00:00 2001 From: juyan Date: Sat, 18 Jan 2020 06:14:55 +0100 Subject: [PATCH 15/26] Modification of RpcDataPreparator --- .../TrigL2MuonSA/CMakeLists.txt | 3 ++- .../TrigL2MuonSA/RpcDataPreparator.h | 8 +++---- .../TrigL2MuonSA/src/RpcDataPreparator.cxx | 23 ++++++------------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt index 220eed95897..eec61e63820 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt @@ -44,6 +44,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonCalib/MuonCalibEvent MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling Tools/PathResolver ) # External dependencies: @@ -58,7 +59,7 @@ atlas_add_library( TrigL2MuonSALib src/*.cxx PUBLIC_HEADERS TrigL2MuonSA INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib RPC_CondCablingLib) atlas_add_component( TrigL2MuonSA src/*.cxx diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h index 118f48d00ce..839222fe757 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h @@ -20,7 +20,6 @@ #include "RegionSelector/IRegSelSvc.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "MuonRPC_Cabling/MuonRPC_CablingSvc.h" #include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" @@ -34,6 +33,8 @@ #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" class ActiveStoreSvc; @@ -75,11 +76,8 @@ class RpcDataPreparator: public AthAlgTool private: // Region Selector ServiceHandle m_regionSelector; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - // RPC cabling service - const IRPCcablingSvc* m_rpcCabling; - const CablingRPCBase* m_rpcCablingSvc; - // Muon Id Helpers ToolHandle m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx index a70fc594762..692f2c4ca90 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx @@ -12,7 +12,6 @@ #include "Identifier/IdentifierHash.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" #include "CxxUtils/phihelper.h" // -------------------------------------------------------------------------------- @@ -55,17 +54,7 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::initialize() ATH_CHECK( m_rawDataProviderTool.retrieve(DisableTool{ !m_decodeBS || !m_doDecoding }) ); ATH_MSG_DEBUG("Retrieved Tool " << m_rawDataProviderTool); - // Retrieve the RPC cabling service - ServiceHandle RpcCabGet ("RPCcablingServerSvc", name()); - ATH_CHECK( RpcCabGet.retrieve() ); - ATH_CHECK( RpcCabGet->giveCabling(m_rpcCabling) ); - - m_rpcCablingSvc = m_rpcCabling->getRPCCabling(); - if ( !m_rpcCablingSvc ) { - ATH_MSG_ERROR("Could not retrieve the RPC cabling svc"); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_rpcPrepContainerKey.initialize()); return StatusCode::SUCCESS; @@ -105,20 +94,22 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* unsigned int sector = (sectorAddress & 0x0000003e) >> 1; unsigned int roiNumber = sectorRoIOvl & 0x0000001F; // unsigned int padNumber = roiNumber/4; - + + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; unsigned int logic_sector; unsigned short int PADId; unsigned int padIdHash; - if ( !m_rpcCablingSvc->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if ( !readCdo->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { ATH_MSG_WARNING("Roi Number: " << roiNumber << " not compatible with side, sector: " - << side << " " << sector); + << side << " " << sector); // set the bool flag to send the event to the debug stream m_isFakeRoi = true; // return StatusCode::FAILURE; } else { ATH_MSG_DEBUG("Roi Number: " << roiNumber << " side, sector: " << side << " " << sector - << " corresp. to log_sector, padId: " << logic_sector << " " << PADId); + << " corresp. to log_sector, padId: " << logic_sector << " " << PADId); } const IRoiDescriptor* iroi = (IRoiDescriptor*) p_roids; -- GitLab From 658b7d3772e10da8a10f7804756d37f0227c2192 Mon Sep 17 00:00:00 2001 From: juyan Date: Sat, 18 Jan 2020 07:10:31 +0100 Subject: [PATCH 16/26] Migrate MuonRPC_CablingSvc::give_RoI_borders_id() and related functions to CondData --- .../RPC_CondCabling/RpcCablingCondData.h | 21 ++- .../src/RpcCablingCondData.cxx | 149 +++++++++++++++++- 2 files changed, 168 insertions(+), 2 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 89eec40f59e..e28457b2643 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -99,7 +99,26 @@ class RpcCablingCondData{ unsigned short int& PADId, unsigned int& PadId) const; - +bool give_RoI_borders_id (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const; + +bool give_RoI_borders (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& EtaLowBorder, + unsigned int& EtaHighBorder, + unsigned int& PhiLowBorder, + unsigned int& PhiHighBorder) const; + +Identifier protected_strip_OffId_fromCode (unsigned long int strip_code, + const ServiceHandle idHelperSvc ) const; +RPCofflineId strip_id_fromCode(unsigned long int strip_code) const; // migrate from RpcPadIDHash // reverse conversion diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index e0714c44b9e..213c9a76957 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -464,4 +464,151 @@ RpcCablingCondData::give_PAD_address (unsigned short int SubsystemId, return true; } - + +bool +RpcCablingCondData::give_RoI_borders_id (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const +{ + unsigned int EtaLowBorder=0; + unsigned int EtaHighBorder=0; + unsigned int PhiLowBorder=0; + unsigned int PhiHighBorder=0; + bool ok = give_RoI_borders(SubsystemId,SectorId,RoIId, + EtaLowBorder,EtaHighBorder, + PhiLowBorder,PhiHighBorder); + if (ok){ + EtaLowBorder_id = protected_strip_OffId_fromCode( EtaLowBorder, idHelperSvc ); + EtaHighBorder_id = protected_strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); + PhiLowBorder_id = protected_strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); + PhiHighBorder_id = protected_strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + } + // else {std::cout<<" since give_RoI_borders is not ok"<48) rpc_strip.strip=48; + } + } + if (rpc_strip.stationName=="BME") + { + if (rpc_strip.doubletR==2 && rpc_strip.measuresPhi==1) + { + if (rpc_strip.strip>36) rpc_strip.strip=36; + } + } + Identifier rpcId = idHelperSvc->rpcIdHelper().channelID(rpc_strip.stationName, + rpc_strip.stationEta, + rpc_strip.stationPhi, + rpc_strip.doubletR, + rpc_strip.doubletZ, + rpc_strip.doubletPhi, + rpc_strip.gasGap, + rpc_strip.measuresPhi, + rpc_strip.strip); + return rpcId; +} + + +RPCofflineId RpcCablingCondData::strip_id_fromCode(unsigned long int strip_code) const +{ + RPCdecoder decode(strip_code); + RPCofflineId rpcId; + rpcId.init(); + if (!decode) { + return rpcId; + } + int RPC_logic_sector = decode.logic_sector(); + int RPC_strip = decode.strip_number(); + int RPC_chamber = decode.rpc_z_index(); + int RPC_layer = decode.rpc_layer(); + int RPC_station = decode.lvl1_station(); + int sector = (decode.logic_sector())%32; + + // retrieve the Sector Logic setup + const RPC_CondCabling::SectorLogicSetup& s = m_SectorType[m_SectorMap[RPC_logic_sector] - 1]; + // retrieve chamber + const RPC_CondCabling::RPCchamber* rpc = s.find_chamber(RPC_station, RPC_chamber); + + rpcId.stationName = rpc->stationName(); + rpcId.stationEta = (decode.half_barrel() == Positive)? rpc->stationEta() : + -rpc->stationEta(); + rpcId.stationPhi = (sector==31)? 1 : (sector+1)/4 +1; + rpcId.doubletR = rpc->doubletR(); + rpcId.doubletZ = rpc->doubletZ(); + rpcId.doubletPhi = (rpc->phiReadoutPannels()==2)? (sector+1)%2+1: 1; + rpcId.gasGap = RPC_layer + 1; + rpcId.measuresPhi = static_cast(decode.view()); + rpcId.strip = RPC_strip + 1; + + return rpcId; + +} + + + -- GitLab From 348ac92b40738aec9195f8fa138e804e39eb13d5 Mon Sep 17 00:00:00 2001 From: juyan Date: Sat, 18 Jan 2020 08:02:56 +0100 Subject: [PATCH 17/26] Migrate MuonRPC_CablingSvc::give_HighPt_borders_id() and related functions to CondData --- .../RPC_CondCabling/RpcCablingCondData.h | 36 ++++ .../src/RpcCablingCondData.cxx | 203 ++++++++++++++++-- 2 files changed, 226 insertions(+), 13 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index e28457b2643..0c5be87975a 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -120,6 +120,42 @@ Identifier protected_strip_OffId_fromCode (unsigned long int strip_code, const ServiceHandle idHelperSvc ) const; RPCofflineId strip_id_fromCode(unsigned long int strip_code) const; +bool give_LowPt_borders (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& EtaLowBorder, + unsigned int& EtaHighBorder, + unsigned int& PhiLowBorder, + unsigned int& PhiHighBorder) const; + +bool give_LowPt_borders_id (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const; + +bool give_HighPt_borders (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& EtaLowBorder, + unsigned int& EtaHighBorder, + unsigned int& PhiLowBorder, + unsigned int& PhiHighBorder) const; + +bool give_HighPt_borders_id(unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const; + +Identifier strip_OffId_fromCode (unsigned long int strip_code, const ServiceHandle idHelperSvc ) const; + // migrate from RpcPadIDHash // reverse conversion ID identifier(int i) const; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 213c9a76957..823d820551d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -530,10 +530,10 @@ RpcCablingCondData::give_RoI_borders (unsigned short int SubsystemId, DISP << " Unmatched RoIId= " << RoIId << " Side=" << SubsystemId << ", Sector=" << SectorId; DISP_DEBUG; - + return false; - } - **/ + } + **/ } EtaLowBorder += logic_sector*1000000; @@ -544,8 +544,9 @@ RpcCablingCondData::give_RoI_borders (unsigned short int SubsystemId, return true; } -Identifier RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int strip_code, - const ServiceHandle idHelperSvc ) const +Identifier +RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int strip_code, + const ServiceHandle idHelperSvc ) const { RPCofflineId rpc_strip = strip_id_fromCode (strip_code); if (rpc_strip.stationName=="BOG") @@ -563,14 +564,14 @@ Identifier RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int } } Identifier rpcId = idHelperSvc->rpcIdHelper().channelID(rpc_strip.stationName, - rpc_strip.stationEta, - rpc_strip.stationPhi, - rpc_strip.doubletR, - rpc_strip.doubletZ, - rpc_strip.doubletPhi, - rpc_strip.gasGap, - rpc_strip.measuresPhi, - rpc_strip.strip); + rpc_strip.stationEta, + rpc_strip.stationPhi, + rpc_strip.doubletR, + rpc_strip.doubletZ, + rpc_strip.doubletPhi, + rpc_strip.gasGap, + rpc_strip.measuresPhi, + rpc_strip.strip); return rpcId; } @@ -611,4 +612,180 @@ RPCofflineId RpcCablingCondData::strip_id_fromCode(unsigned long int strip_code) } +bool +RpcCablingCondData::give_LowPt_borders (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& EtaLowBorder, + unsigned int& EtaHighBorder, + unsigned int& PhiLowBorder, + unsigned int& PhiHighBorder) const +{ + int logic_sector = SectorId + SubsystemId*32; + int PadId = (RoIId)/4; + int PadRoI = (RoIId)%4; + int PhiIxx = PadRoI/2; + int EtaIxx = PadRoI%2; + + CMAcoverage PhiCov = (logic_sector%2)? OddSectors : EvenSectors; + + const RPC_CondCabling::SectorLogicSetup& s = m_SectorType[m_SectorMap[logic_sector] - 1]; + + CMAidentity ETA(Eta,AllSectors,PadId,EtaIxx); + CMAidentity PHI(Phi,PhiCov,PadId,PhiIxx); + + if(!s.give_LowPt_borders(ETA,PHI,EtaLowBorder,EtaHighBorder,PhiLowBorder, PhiHighBorder)) + { + return false; // Added for HLT + /* Commented for HLT + // LOCAL RoI within the pad may be wrong if triggering only phi vew only, try the other local eta + EtaIxx = (EtaIxx + 1)%2; + CMAidentity ETA1(Eta,AllSectors,PadId,EtaIxx); + if(!s.give_LowPt_borders(ETA1,PHI,EtaLowBorder,EtaHighBorder,PhiLowBorder, + PhiHighBorder)){ + DISP << " Unmatched RoIId= " << RoIId + << " Side=" << SubsystemId << ", Sector=" << SectorId; + DISP_DEBUG; + return false; + } + */ + } + if (EtaLowBorder==0||EtaHighBorder==0|| + PhiLowBorder==0||PhiHighBorder==0) return false; + + EtaLowBorder += logic_sector*1000000; + EtaHighBorder += logic_sector*1000000; + PhiLowBorder += logic_sector*1000000; + PhiHighBorder += logic_sector*1000000; + + return true; +} + + + + +bool +RpcCablingCondData::give_LowPt_borders_id (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const +{ + unsigned int EtaLowBorder=0; + unsigned int EtaHighBorder=0; + unsigned int PhiLowBorder=0; + unsigned int PhiHighBorder=0; + bool ok = give_LowPt_borders(SubsystemId,SectorId,RoIId, + EtaLowBorder,EtaHighBorder, + PhiLowBorder,PhiHighBorder); + if (ok){ + EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder,idHelperSvc ); + EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); + PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); + PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + } + return ok; +} + +bool +RpcCablingCondData::give_HighPt_borders (unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + unsigned int& EtaLowBorder, + unsigned int& EtaHighBorder, + unsigned int& PhiLowBorder, + unsigned int& PhiHighBorder) const +{ + int logic_sector = SectorId + SubsystemId*32; + int PadId = (RoIId)/4; + int PadRoI = (RoIId)%4; + int PhiIxx = PadRoI/2; + int EtaIxx = PadRoI%2; + + CMAcoverage PhiCov = (logic_sector%2)? OddSectors : EvenSectors; + + const RPC_CondCabling::SectorLogicSetup& s = m_SectorType[m_SectorMap[logic_sector] - 1]; + + CMAidentity ETA(Eta,AllSectors,PadId,EtaIxx); + CMAidentity PHI(Phi,PhiCov,PadId,PhiIxx); + + if(!s.give_HighPt_borders(ETA,PHI,EtaLowBorder,EtaHighBorder,PhiLowBorder, PhiHighBorder)) + { + return false; // Added for HLT + /* commented for HLT + // LOCAL RoI within the pad may be wrong if triggering only phi vew only, try the other local eta + EtaIxx = (EtaIxx + 1)%2; + CMAidentity ETA1(Eta,AllSectors,PadId,EtaIxx); + if(!s.give_HighPt_borders(ETA1,PHI,EtaLowBorder,EtaHighBorder,PhiLowBorder, + PhiHighBorder)){ + DISP << " Unmatched RoIId= " << RoIId + << " Side=" << SubsystemId << ", Sector=" << SectorId; + DISP_DEBUG; + return false; + } + */ + } + if (EtaLowBorder==0||EtaHighBorder==0|| + PhiLowBorder==0||PhiHighBorder==0) return false; + + EtaLowBorder += logic_sector*1000000; + EtaHighBorder += logic_sector*1000000; + PhiLowBorder += logic_sector*1000000; + PhiHighBorder += logic_sector*1000000; + + return true; +} + + + + +bool +RpcCablingCondData::give_HighPt_borders_id(unsigned short int SubsystemId, + unsigned short int SectorId, + unsigned short int RoIId, + Identifier& EtaLowBorder_id, + Identifier& EtaHighBorder_id, + Identifier& PhiLowBorder_id, + Identifier& PhiHighBorder_id, + const ServiceHandle idHelperSvc ) const +{ + unsigned int EtaLowBorder=0; + unsigned int EtaHighBorder=0; + unsigned int PhiLowBorder=0; + unsigned int PhiHighBorder=0; + bool ok = give_HighPt_borders(SubsystemId,SectorId,RoIId, + EtaLowBorder,EtaHighBorder, + PhiLowBorder,PhiHighBorder); + + if (ok){ + EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder, idHelperSvc ); + EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); + PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); + PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + } + return ok; +} + + +Identifier +RpcCablingCondData::strip_OffId_fromCode (unsigned long int strip_code, + const ServiceHandle idHelperSvc ) const +{ + RPCofflineId rpc_strip = strip_id_fromCode (strip_code); + Identifier rpcId = idHelperSvc->rpcIdHelper().channelID(rpc_strip.stationName, + rpc_strip.stationEta, + rpc_strip.stationPhi, + rpc_strip.doubletR, + rpc_strip.doubletZ, + rpc_strip.doubletPhi, + rpc_strip.gasGap, + rpc_strip.measuresPhi, + rpc_strip.strip); + return rpcId; +} + + -- GitLab From f084b833ed97e6bddc8691b3eb6a050a21815af5 Mon Sep 17 00:00:00 2001 From: juyan Date: Sat, 18 Jan 2020 11:10:44 +0100 Subject: [PATCH 18/26] Modification of RPCRecRoiSvc --- .../TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt | 5 +- .../TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h | 13 +++-- .../TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx | 48 ++++++++----------- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt index 29ddb406349..1cf12c27789 100644 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt @@ -13,18 +13,19 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate DetectorDescription/Identifier GaudiKernel + MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling MuonSpectrometer/MuonCablings/RPCcablingInterface ) # Component(s) in the package: atlas_add_library( TrigT1RPCRecRoiSvcLib src/*.cxx PUBLIC_HEADERS TrigT1RPCRecRoiSvc - LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests RPCcablingInterfaceLib + LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests RPCcablingInterfaceLib RPC_CondCablingLib PRIVATE_LINK_LIBRARIES Identifier GaudiKernel ) atlas_add_component( TrigT1RPCRecRoiSvc src/components/*.cxx - LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib TrigT1RPCRecRoiSvcLib ) + LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib TrigT1RPCRecRoiSvcLib RPC_CondCablingLib) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h index 19dde7fcb82..14f7a039ee9 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h @@ -8,10 +8,13 @@ #include "TrigT1Interfaces/RecMuonRoiSvc.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" //class IRPCgeometrySvc; class Identifier; -class IRPCcablingSvc; class IMDTcablingSvc; @@ -31,8 +34,7 @@ public: m_side(0), m_sector(0), m_roi(0), - m_MuonMgr(0), - m_rPCcablingSvc(0) + m_MuonMgr(0) {}; ~RPCRecRoiSvc (void) {}; @@ -69,8 +71,9 @@ private: mutable double m_phiMin, m_phiMax, m_etaMin, m_etaMax; mutable unsigned short int m_side, m_sector, m_roi; - const MuonGM::MuonDetectorManager * m_MuonMgr; - const IRPCcablingSvc* m_rPCcablingSvc; + const MuonGM::MuonDetectorManager * m_MuonMgr; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // const IMDTcablingSvc* m_mDTcablingSvc; }; diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx index b02dbe07787..8c16df59573 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx @@ -11,7 +11,6 @@ #include "StoreGate/StoreGateSvc.h" #include "Identifier/Identifier.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" using namespace LVL1RPC; @@ -24,10 +23,7 @@ StatusCode RPCRecRoiSvc::initialize (void) ATH_CHECK( detStore->retrieve(m_MuonMgr) ); ATH_MSG_DEBUG( "Found the MuonDetDescrMgr " ); - m_rPCcablingSvc = 0; - const IRPCcablingServerSvc* RpcCabGet = 0; - ATH_CHECK( service("RPCcablingServerSvc",RpcCabGet,1) ); - ATH_CHECK( RpcCabGet->giveCabling(m_rPCcablingSvc) ); + ATH_CHECK(m_readKey.initialize()); return StatusCode::SUCCESS; } @@ -66,16 +62,14 @@ void RPCRecRoiSvc::reconstruct (const unsigned int & roIWord) const Amg::Vector3D PhiLowBorder_pos(0.,0.,0.); Amg::Vector3D PhiHighBorder_pos(0.,0.,0.); + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; - if(m_rPCcablingSvc-> - give_RoI_borders_id(m_side, - m_sector, - m_roi, - EtaLowBorder_id, - EtaHighBorder_id, - PhiLowBorder_id, - PhiHighBorder_id)) { - + if(readCdo-> give_RoI_borders_id(m_side, m_sector, m_roi, + EtaLowBorder_id, EtaHighBorder_id, + PhiLowBorder_id, PhiHighBorder_id, + m_idHelperSvc)) + { const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); EtaLowBorder_pos = EtaLowBorder_descriptor->stripPos(EtaLowBorder_id); @@ -213,13 +207,12 @@ bool RPCRecRoiSvc::etaDimLow (double& etaMin, double& etaMax) const Amg::Vector3D EtaLowBorder_pos(0.,0.,0.); Amg::Vector3D EtaHighBorder_pos(0.,0.,0.); - if( !m_rPCcablingSvc-> give_LowPt_borders_id(m_side, - m_sector, - m_roi, - EtaLowBorder_id, - EtaHighBorder_id, - PhiLowBorder_id, - PhiHighBorder_id)) return false; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + if( ! readCdo->give_LowPt_borders_id(m_side, m_sector, m_roi, + EtaLowBorder_id, EtaHighBorder_id, + PhiLowBorder_id, PhiHighBorder_id, + m_idHelperSvc)) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); @@ -249,13 +242,12 @@ bool RPCRecRoiSvc::etaDimHigh (double& etaMin, double& etaMax) const Amg::Vector3D EtaLowBorder_pos(0.,0.,0.); Amg::Vector3D EtaHighBorder_pos(0.,0.,0.); - if(!m_rPCcablingSvc->give_HighPt_borders_id(m_side, - m_sector, - m_roi, - EtaLowBorder_id, - EtaHighBorder_id, - PhiLowBorder_id, - PhiHighBorder_id)) return false; + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + if(!readCdo->give_HighPt_borders_id(m_side, m_sector, m_roi, + EtaLowBorder_id, EtaHighBorder_id, + PhiLowBorder_id, PhiHighBorder_id, + m_idHelperSvc)) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); -- GitLab From b437fa7cadb0a057e17140b2b54c588454293567 Mon Sep 17 00:00:00 2001 From: juyan Date: Sun, 19 Jan 2020 14:58:49 +0100 Subject: [PATCH 19/26] Reverse modofication of RpcRDO_Decoder --- .../MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx | 45 ++++++++++++------- .../MuonRPC_CnvTools/src/RpcRDO_Decoder.h | 10 ++--- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx index b9c9690dd30..f380b7edcff 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx @@ -8,6 +8,8 @@ #include "StoreGate/StoreGate.h" +#include "RPCcablingInterface/IRPCcablingServerSvc.h" +#include "RPCcablingInterface/IRPCcablingSvc.h" #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonDigitContainer/RpcDigit.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" @@ -19,7 +21,8 @@ Muon::RpcRDO_Decoder::RpcRDO_Decoder ( const std::string& type, const std::string& name,const IInterface* parent ) - : AthAlgTool(type,name,parent) + : AthAlgTool(type,name,parent), + m_cablingSvc(0) { declareInterface( this ); } @@ -29,11 +32,28 @@ StatusCode Muon::RpcRDO_Decoder::initialize() ATH_MSG_DEBUG ( "initialize"); - ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK(m_readKey.initialize()); - - return StatusCode::SUCCESS; + // get RPC cablingSvc + const IRPCcablingServerSvc* RpcCabGet = 0; + StatusCode sc = service("RPCcablingServerSvc", RpcCabGet); + if (sc.isFailure()) { + msg (MSG::FATAL) << "Could not get RPCcablingServerSvc !" << endmsg; + return StatusCode::FAILURE; + } + else msg (MSG::VERBOSE) << " RPCcablingServerSvc retrieved" << endmsg; + + sc = RpcCabGet->giveCabling(m_cablingSvc); + if (sc.isFailure()) { + msg (MSG::FATAL) << "Could not get RPCcablingSvc from the Server !" << endmsg; + m_cablingSvc = 0; + return StatusCode::FAILURE; + } + else { + msg (MSG::VERBOSE) << " RPCcablingSvc obtained " << endmsg; + } + + return sc; } @@ -61,14 +81,11 @@ std::vector* Muon::RpcRDO_Decoder::getDigit(const RpcFiredChannel * f if (ijk==7) { return rpcDigitVec; } - - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - + // Get the list of offline channels corresponding to the // online identifier - std::list idList = readCdo->give_strip_id(side, slogic, padId, - cmaId, ijk, channel, m_idHelperSvc); + std::list idList = m_cablingSvc->give_strip_id(side, slogic, padId, + cmaId, ijk, channel); std::list::const_iterator it_list; rpcDigitVec->reserve(idList.size()); @@ -124,12 +141,10 @@ std::vector* Muon::RpcRDO_Decoder::getOfflineData(const RpcFiredChan return rpcIdVec; } - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the // online identifier - std::list idList = readCdo->give_strip_id(side, slogic, padId, - cmaId, ijk, channel, m_idHelperSvc); + std::list idList = m_cablingSvc->give_strip_id(side, slogic, padId, + cmaId, ijk, channel); rpcIdVec->assign(idList.begin(), idList.end()); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h index 90c9fc14a9a..07fac96f0e4 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h @@ -12,14 +12,9 @@ #include "AthenaKernel/MsgStreamMember.h" #include "MuonIdHelpers/MuonIdHelperTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include #include -#include "RPC_CondCabling/RpcCablingCondData.h" -#include "StoreGate/ReadCondHandleKey.h" - // Decoder class for conversion from RPC RDOs to RPC digits // Stefano Rosati @@ -52,9 +47,10 @@ class RpcRDO_Decoder : virtual public IRPC_RDO_Decoder, public AthAlgTool private: - ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + ToolHandle m_muonIdHelperTool{this, "idHelper", + "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; + const IRPCcablingSvc* m_cablingSvc; }; -- GitLab From 2404feb13e6364d32f1ee4a983b6fc5507068407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Tue, 31 Mar 2020 15:33:14 +0200 Subject: [PATCH 20/26] pass RpcCablingCondData to RPC_Hid2RESrcID and address some shifters comments --- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 11 +- .../src/RpcDigitToRpcRDO.cxx | 51 ++--- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx | 46 ++-- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h | 13 +- .../src/RpcPadContByteStreamTool.cxx | 56 +---- .../src/RpcPadContByteStreamTool.h | 24 +- .../RPC_CondCabling/RpcCablingCondAlg.h | 17 +- .../RPC_CondCabling/RpcCablingCondData.h | 49 +++-- .../RPC_CondCabling/src/RpcCablingCondAlg.cxx | 37 +--- .../src/RpcCablingCondData.cxx | 207 ++++++++++-------- .../TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h | 17 +- .../TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx | 13 +- 12 files changed, 223 insertions(+), 318 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 60d4b12852c..ec7170d122d 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPCDIGITTORPCRDO_H @@ -7,8 +7,6 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/StatusCode.h" #include "StoreGate/DataHandle.h" #include "RPCcablingInterface/IRPCcablingSvc.h" @@ -26,7 +24,7 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -84,9 +82,8 @@ private: SG::WriteHandleKey m_padContainerKey{this,"OutputObjectName","RPCPAD","WriteHandleKey for Output RpcPadContainer"}; SG::ReadHandleKey m_digitContainerKey{this,"InputObjectName","RPC_DIGITS","ReadHandleKey for Input RpcDigitContainer"}; const MuonGM::MuonDetectorManager* m_MuonMgr{}; - std::string m_cablingType{"UNKNOWN"}; - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + std::string m_cablingType{"MuonRPC_Cabling"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 784125d16f0..f603fef7db2 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -21,8 +21,6 @@ #include #include -using namespace std; - static double time_correction(double, double, double); ///////////////////////////////////////////////////////////////////////////// @@ -41,14 +39,11 @@ StatusCode RpcDigitToRpcRDO::initialize() { ATH_MSG_DEBUG( " in initialize()" ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( detStore()->retrieve(m_MuonMgr) ); ATH_CHECK( m_cabling.retrieve()) ; - // determine the cabling type - m_cablingType="MuonRPC_Cabling"; - ATH_CHECK(m_readKey.initialize()); // Fill Tag Info @@ -90,7 +85,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { if (fill_RPCdata(data, ctx, readCdo).isFailure()) { ATH_MSG_ERROR( "Fail to produce RPC data for byte stream simulation " ); } - ATH_MSG_DEBUG( "RPC data loaded from G3:" << endl + ATH_MSG_DEBUG( "RPC data loaded from G3:" << std::endl << ShowData(data,"",m_data_detail) ); @@ -109,7 +104,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { // CMAdata patterns(&data,m_cabling,type,debug); // CMAdata patterns(&data, readCdo, debug); // // - ATH_MSG_DEBUG( "CMApatterns created from RPC digits:" << endl // + ATH_MSG_DEBUG( "CMApatterns created from RPC digits:" << std::endl // << ShowData(patterns,"",m_data_detail) ); //////////////////////////////////////////////////////////////////////// @@ -135,10 +130,11 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { ATH_MSG_DEBUG( "Start decoding" ); PAD_Readout padReadout = bytestream.pad_readout(); // Iterate on the readout PADS and decode them - for (PAD_Readout::iterator it = padReadout.begin() ; it != padReadout.end(); ++it) - { - PADreadout padro = (*it).second; - RpcPad* newpad = decodePad(padro); + // for (PAD_Readout::iterator it = padReadout.begin() ; it != padReadout.end(); ++it) + // { + for (auto& padro : padReadout) { + // PADreadout padro = (*it).second; + RpcPad* newpad = decodePad(padro.second); // Push back the decoded pad in the vector rpcpads->push_back(newpad); } @@ -161,7 +157,7 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ATH_MSG_DEBUG( "in execute(): fill RPC data" ); - IdContext rpcContext = m_muonIdHelperTool->rpcIdHelper().module_context(); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); SG::ReadHandle container (m_digitContainerKey, ctx); if (!container.isValid()) { @@ -178,20 +174,20 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& Identifier moduleId; //if (m_digit_position->initialize(moduleId)) - if (!m_muonIdHelperTool->rpcIdHelper().get_id(moduleHash, moduleId, &rpcContext)) { + if (!m_idHelperSvc->rpcIdHelper().get_id(moduleHash, moduleId, &rpcContext)) { for (const RpcDigit* rpcDigit : *rpcCollection) { - if (rpcDigit->is_valid(m_muonIdHelperTool->rpcIdHelper())) { + if (rpcDigit->is_valid(m_idHelperSvc->rpcIdHelper())) { Identifier channelId = rpcDigit->identify(); - int stationType = m_muonIdHelperTool->rpcIdHelper().stationName(channelId); - std::string StationName = m_muonIdHelperTool->rpcIdHelper().stationNameString(stationType); - int StationEta = m_muonIdHelperTool->rpcIdHelper().stationEta(channelId); - int StationPhi = m_muonIdHelperTool->rpcIdHelper().stationPhi(channelId); - int DoubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(channelId); - int DoubletZ = m_muonIdHelperTool->rpcIdHelper().doubletZ(channelId); - int DoubletP = m_muonIdHelperTool->rpcIdHelper().doubletPhi(channelId); - int GasGap = m_muonIdHelperTool->rpcIdHelper().gasGap(channelId); - int MeasuresPhi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(channelId); - int Strip = m_muonIdHelperTool->rpcIdHelper().strip(channelId); + int stationType = m_idHelperSvc->rpcIdHelper().stationName(channelId); + std::string StationName = m_idHelperSvc->rpcIdHelper().stationNameString(stationType); + int StationEta = m_idHelperSvc->rpcIdHelper().stationEta(channelId); + int StationPhi = m_idHelperSvc->rpcIdHelper().stationPhi(channelId); + int DoubletR = m_idHelperSvc->rpcIdHelper().doubletR(channelId); + int DoubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(channelId); + int DoubletP = m_idHelperSvc->rpcIdHelper().doubletPhi(channelId); + int GasGap = m_idHelperSvc->rpcIdHelper().gasGap(channelId); + int MeasuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(channelId); + int Strip = m_idHelperSvc->rpcIdHelper().strip(channelId); ATH_MSG_DEBUG( "RPC Digit Type, Eta, Phi, dbR, dbZ, dbP, gg, mPhi, Strip "<rpcIdHelper().padID(name, eta, phi, doublet_r, + Identifier id = m_idHelperSvc->rpcIdHelper().padID(name, eta, phi, doublet_r, doublet_z, doublet_phi, check, &valid); ATH_MSG_DEBUG( "Invalid pad offline indices " ); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx index 1fd121903b3..17062322f97 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RPC_Hid2RESrcID.h" @@ -16,14 +16,15 @@ using eformat::helper::SourceIdentifier; // Jan-16-2003, BNL -RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_muonIdHelperTool(0), m_specialROBNumber(-1) { +RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_rpcCondData(nullptr), m_rpcIdHelper(nullptr), m_specialROBNumber(-1) { } -RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_muonIdHelperTool(nullptr), m_specialROBNumber(specialROBNumber) { +RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_rpcIdHelper(nullptr), m_specialROBNumber(specialROBNumber) { } -void RPC_Hid2RESrcID::set(const Muon::MuonIdHelperTool* muonIdHelperTool) { - m_muonIdHelperTool=muonIdHelperTool; +void RPC_Hid2RESrcID::set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId) { + m_rpcCondData=readCdo; + m_rpcIdHelper=rpdId; } std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { @@ -52,12 +53,11 @@ std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offl RpcCablingCondData::RDOmap::const_iterator pad_beg = (pad_map).begin(); RpcCablingCondData::RDOmap::const_iterator pad_end = (pad_map).end(); - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Looking for collection ID: " + std::string(m_muonIdHelperTool->rpcIdHelper().show_to_string(offlineId)) <show_to_string(offlineId)) <rpcIdHelper().stationName(offlineId); - int stationEta = m_muonIdHelperTool->rpcIdHelper().stationEta(offlineId); - int stationPhi = m_muonIdHelperTool->rpcIdHelper().stationPhi(offlineId); - //int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(offlineId); + int stationName = m_rpcIdHelper->stationName(offlineId); + int stationEta = m_rpcIdHelper->stationEta(offlineId); + int stationPhi = m_rpcIdHelper->stationPhi(offlineId); bool addRod; @@ -108,14 +108,13 @@ std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offl if (rodIDs.size() == 0) { msg(MSG::ERROR) << "RPC_Hid2RESrcID: RPC_Could not find Rod ID for the collection " - << m_muonIdHelperTool->rpcIdHelper().show_to_string(offlineId) << endmsg; + << m_rpcIdHelper->show_to_string(offlineId) << endmsg; } // FIXME Temp Fix for sector13 test data if ( (m_specialROBNumber>0) ) { if (stationPhi==7 && stationEta>0 && stationEta<4 && (stationName==2 || stationName==4) ) { - //std::cout << m_muonIdHelperTool->rpcIdHelper().show_to_string(offlineId) << std::endl; rodIDs.clear(); rodIDs.push_back(m_specialROBNumber); @@ -146,27 +145,22 @@ uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId, const RpcCabling // this method returns a RESrcID for the ROD, for a // given RPC pad ID offline ID - unsigned short int ROBid; unsigned short int RODid; unsigned short int Iside; unsigned short int SLid; - unsigned short int RXid; - unsigned short int PADid; - if( readCdo->giveOnlineID(offlineId,ROBid,RODid,Iside,SLid,RXid,PADid) ) { + if(readCdo->give_RODid(offlineId,RODid) && readCdo->give_side(offlineId,Iside) && readCdo->give_SLid(offlineId,SLid)) { uint8_t rodIndex = (uint8_t) RODid; uint16_t side = Iside; - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "in getRodID, the side, sectorL, RX, pad are " - << MSG::hex - << side - << " " - << SLid + if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "in getRodID: RODid, side, sectorL are " + << MSG::hex + << RODid << " " - << RXid + << side << " " - << PADid + << SLid << MSG::dec < #include @@ -25,7 +24,7 @@ public: RPC_Hid2RESrcID (int specialROBNumber); - void set(const Muon::MuonIdHelperTool* muonIdHelperTool); + void set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId); std::vector getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo); @@ -44,16 +43,14 @@ public: uint16_t findRODid(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); Identifier findPadOfflineId(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); - - const RpcIdHelper& getIdHelper () { return m_muonIdHelperTool->rpcIdHelper(); } MsgStream & msg(MSG::Level lvl) const { return m_msg << lvl;}; bool msgLevel (MSG::Level lvl) { return m_msg.get().level() <= lvl;}; private: - - const Muon::MuonIdHelperTool* m_muonIdHelperTool; + const RpcCablingCondData* m_rpcCondData; + const RpcIdHelper* m_rpcIdHelper; int m_specialROBNumber; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx index 1905cc64e38..570d4eba421 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RpcPadContByteStreamTool.h" @@ -8,13 +8,6 @@ #include "RPC_Hid2RESrcID.h" #include "MuonRDO/RpcPad.h" #include "MuonRDO/RpcPadContainer.h" -#include "MuonIdHelpers/RpcIdHelper.h" - -#include "GaudiKernel/MsgStream.h" - -//#include "StoreGate/StoreGate.h" -//#include "StoreGate/tools/ClassID_traits.h" -#include "AthenaKernel/CLASS_DEF.h" #include @@ -25,50 +18,25 @@ const InterfaceID& Muon::RpcPadContByteStreamTool::interfaceID( ) { return IID_IRpcPadContByteStreamTool; } -// default contructor - Muon::RpcPadContByteStreamTool::RpcPadContByteStreamTool ( const std::string& type, const std::string& name,const IInterface* parent ) : AthAlgTool(type,name,parent) { declareInterface< IRPC_RDOtoByteStreamTool >( this ); } - -// destructor - -Muon::RpcPadContByteStreamTool::~RpcPadContByteStreamTool() -{} StatusCode Muon::RpcPadContByteStreamTool::initialize() { - - // MsgStream log(msgSvc(), "RpcROD_Decoder::fillCollection"); - - StatusCode sc = AlgTool::initialize(); - - if (StatusCode::SUCCESS !=sc) { - msg(MSG::ERROR) << " Base class initialisation failed " << endmsg; - return StatusCode::FAILURE; - } - + ATH_CHECK(AlgTool::initialize()); ATH_CHECK(m_readKey.initialize()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - m_hid2re.set(m_muonIdHelperTool.get()); - + ATH_CHECK(m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } - -StatusCode Muon::RpcPadContByteStreamTool::finalize() { - StatusCode sc = AlgTool::finalize(); - - return sc; -} - - -StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re, - MsgStream& log ) { - +StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log) { + SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle}; + m_hid2re.set(readCdo, &m_idHelperSvc->rpcIdHelper()); m_fea.clear(); - m_fea.idMap().set(m_muonIdHelperTool.get()); + m_fea.idMap().set(readCdo, &m_idHelperSvc->rpcIdHelper()); FullEventAssembler::RODDATA* theROD ; @@ -77,7 +45,6 @@ StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrit std::map mapEncoder; - //log <size() << endmsg; for( ; it_coll!=it_coll_end;++it_coll) { const RpcPad* coll = (*it_coll); @@ -91,7 +58,6 @@ StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrit // RpcROD_Encoder has collected all the pads, now can fill the // ROD block data. - for (; it!=it_end;++it) { theROD = m_fea.getRodData( (*it).first ); ((*it).second).set( &m_hid2re ) ; @@ -101,11 +67,5 @@ StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrit m_fea.fill(re,log); return StatusCode::SUCCESS; - } - - - - - diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h index 75fcd48977f..a7f4288d741 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h @@ -1,29 +1,26 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONRPC_CNVTOOLS_RPCPADCONTRAWEVENTTOOL_H #define MUONRPC_CNVTOOLS_RPCPADCONTRAWEVENTTOOL_H -#include -#include #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h" -#include "RPC_Hid2RESrcID.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "RPC_Hid2RESrcID.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "ByteStreamData/RawEvent.h" - #include "ByteStreamCnvSvcBase/FullEventAssembler.h" #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" class RpcPadContainer; -class MsgStream ; - #include + namespace Muon { /** An AlgTool class to provide conversion from LArRawChannelContainer @@ -49,16 +46,13 @@ public: RpcPadContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent ) ; - /** destructor - */ - virtual ~RpcPadContByteStreamTool() ; + virtual ~RpcPadContByteStreamTool()=default; /** AlgTool InterfaceID */ static const InterfaceID& interfaceID( ) ; virtual StatusCode initialize(); - virtual StatusCode finalize(); StatusCode convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log ); @@ -66,9 +60,7 @@ private: SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; RPC_Hid2RESrcID m_hid2re; - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; FullEventAssembler m_fea ; }; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h index 1228057a91a..ba390c7ca7e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h @@ -1,19 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDALG_RPCCABLINGCONDALG_H #define MUONCONDALG_RPCCABLINGCONDALG_H +#include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" + #include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/IChronoStatSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaBaseComps/AthAlgorithm.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/WriteCondHandleKey.h" #include "GaudiKernel/ICondSvc.h" @@ -28,13 +25,10 @@ #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" -#include "Identifier/IdentifierHash.h" #include "PathResolver/PathResolver.h" #include #include #include -#include "Identifier/Identifier.h" -#include "MuonIdHelpers/RpcIdHelper.h" #include "RPC_CondCabling/RPCofflineId.h" @@ -66,11 +60,6 @@ class RpcCablingCondAlg: public AthAlgorithm { unsigned short ijk, unsigned short int Channel) const; - // virtual bool giveOffflineID(unsigned short int Side, - // unsigned short int Sector, - // unsigned short int PADID, - // Identifier& ID) const; - const std::string* m_ConfMapPString; const std::string* m_corr; std::vector m_vecetaCM_File; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 0c5be87975a..bd0362d95fe 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPCCABLINGCONDDATA_H @@ -35,26 +35,28 @@ class RpcCablingCondData{ typedef std::map > PRD_RDO_Map; typedef std::map > PRD_ROB_Map; - RpcCablingCondData(); - virtual ~RpcCablingCondData(); + RpcCablingCondData()=default; + virtual ~RpcCablingCondData()=default; const RDOmap& give_RDOs(void) const; - bool giveOnlineID(const Identifier& compactID, - unsigned short int& ROBid, - unsigned short int& RODid, - unsigned short int& side, - unsigned short int& SLid, - unsigned short int& RXid, - unsigned short int& PADid) const; - - bool giveOnlineID(const unsigned int hashID, - unsigned short int& ROBid, - unsigned short int& RODid, - unsigned short int& side, - unsigned short int& SLid, - unsigned short int& RXid, - unsigned short int& PADid) const; + bool give_ROBid(const Identifier& compactID, unsigned short int& id) const; + bool give_ROBid(const unsigned int hashID, unsigned short int& id) const; + + bool give_RODid(const Identifier& compactID, unsigned short int& id) const; + bool give_RODid(const unsigned int hashID, unsigned short int& id) const; + + bool give_side(const Identifier& compactID, unsigned short int& id) const; + bool give_side(const unsigned int hashID, unsigned short int& id) const; + + bool give_SLid(const Identifier& compactID, unsigned short int& id) const; + bool give_SLid(const unsigned int hashID, unsigned short int& id) const; + + bool give_RXid(const Identifier& compactID, unsigned short int& id) const; + bool give_RXid(const unsigned int hashID, unsigned short int& id) const; + + bool give_PADid(const Identifier& compactID, unsigned short int& id) const; + bool give_PADid(const unsigned int hashID, unsigned short int& id) const; const std::vector& giveFullListOfRobIds() const; @@ -106,7 +108,7 @@ bool give_RoI_borders_id (unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const; + const RpcIdHelper* rpcId) const; bool give_RoI_borders (unsigned short int SubsystemId, unsigned short int SectorId, @@ -116,8 +118,7 @@ bool give_RoI_borders (unsigned short int SubsystemId, unsigned int& PhiLowBorder, unsigned int& PhiHighBorder) const; -Identifier protected_strip_OffId_fromCode (unsigned long int strip_code, - const ServiceHandle idHelperSvc ) const; +Identifier protected_strip_OffId_fromCode (unsigned long int strip_code, const RpcIdHelper* rpcId) const; RPCofflineId strip_id_fromCode(unsigned long int strip_code) const; bool give_LowPt_borders (unsigned short int SubsystemId, @@ -135,7 +136,7 @@ bool give_LowPt_borders_id (unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const; + const RpcIdHelper* rpcId) const; bool give_HighPt_borders (unsigned short int SubsystemId, unsigned short int SectorId, @@ -152,9 +153,9 @@ bool give_HighPt_borders_id(unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const; + const RpcIdHelper* rpcId) const; -Identifier strip_OffId_fromCode (unsigned long int strip_code, const ServiceHandle idHelperSvc ) const; +Identifier strip_OffId_fromCode (unsigned long int strip_code, const RpcIdHelper* rpcId) const; // migrate from RpcPadIDHash // reverse conversion diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index ed270217a2a..8cb4e5c4736 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RPC_CondCabling/RpcCablingCondAlg.h" @@ -196,19 +196,14 @@ StatusCode RpcCablingCondAlg::loadParameters(const CondAttrListCollection* readC ATH_MSG_VERBOSE( "Loop over CondAttrListCollection ic = " << ic ); const coral::AttributeList& atr=itrEta->second; - std::string etaCM_File; - std::string etaTh0; - std::string etaSequence_Th; - std::string etaInfo; - - etaCM_File = *(static_cast((atr["CM_File"]).addressOfData())); + std::string etaCM_File = *(static_cast((atr["CM_File"]).addressOfData())); m_vecetaCM_File.push_back(etaCM_File); - etaTh0 = *(static_cast((atr["Th0"]).addressOfData())); + std::string etaTh0 = *(static_cast((atr["Th0"]).addressOfData())); m_vecetaTh0.push_back(etaTh0); m_trigroads[etaCM_File]=etaTh0; - etaSequence_Th = *(static_cast((atr["Sequence_Th"]).addressOfData())); + std::string etaSequence_Th = *(static_cast((atr["Sequence_Th"]).addressOfData())); m_vecetaSequence_Th.push_back(etaSequence_Th); - etaInfo = *(static_cast((atr["Additional_Info"]).addressOfData())); + std::string etaInfo = *(static_cast((atr["Additional_Info"]).addressOfData())); m_vecetaInfo.push_back(etaInfo); ATH_MSG_VERBOSE( "column eta CM_File is \n" << etaCM_File ); @@ -622,10 +617,10 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) m_FeetPadThresholds.at(1)=2; m_FeetPadThresholds.at(2)=5; } - msg(MSG::INFO) << "Applying FeetPadThresholds : " + ATH_MSG_INFO("Applying FeetPadThresholds : " << m_FeetPadThresholds.at(0) << "," << m_FeetPadThresholds.at(1) << "," - << m_FeetPadThresholds.at(2) << endmsg; + << m_FeetPadThresholds.at(2)); const unsigned int NumFeetSectors = 8; unsigned int FeetSectors[NumFeetSectors]={21,22,25,26,53,54,57,58}; @@ -800,21 +795,3 @@ std::list RpcCablingCondAlg::give_strip_id(unsigned short int Subsys return id; } - - -// bool RpcCablingCondAlg::giveOffflineID(unsigned short int Side, -// unsigned short int Sector, -// unsigned short int PADID, -// Identifier& ID) const -// { -// if (Side>=2) return false; -// if (Sector>=32) return false; -// if (PADID>=10) return false; - -// ID = m_offline_id[Side][Sector][PADID]; -// // if( ID == 0xFFFFFFFF ) return false; // original, not working with 64 bit identifiers -// if ( ID == m_uninitialized_identifier ) return false; - -// return true; -// } - diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 823d820551d..8e4ca2657c3 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -1,66 +1,109 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RPC_CondCabling/RpcCablingCondData.h" - -RpcCablingCondData::RpcCablingCondData() {} - -RpcCablingCondData::~RpcCablingCondData() {} - const RpcCablingCondData::RDOmap& RpcCablingCondData::give_RDOs(void) const {return m_RDOs;} -bool RpcCablingCondData::giveOnlineID(const Identifier& compactID, - unsigned short int& ROBid, - unsigned short int& RODid, - unsigned short int& side, - unsigned short int& SLid, - unsigned short int& RXid, - unsigned short int& PADid) const -{ +bool RpcCablingCondData::give_ROBid(const Identifier& compactID, unsigned short int& id) const { OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); if (it == m_RDOmap.end()) return false; - const RDOindex* index = (*m_RDOmap.find(compactID)).second; - - ROBid = index->ROBid(); - RODid = index->RODid(); - side = index->side(); - SLid = index->SLid(); - RXid = index->RXid(); - PADid = index->PADid(); - + if (!index) return false; + id = index->ROBid(); + return true; +} +bool RpcCablingCondData::give_ROBid(const unsigned int hashID, unsigned short int& id) const { + if ( hashID >= m_HashVec.size() ) return false; + const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->ROBid(); return true; } -bool RpcCablingCondData::giveOnlineID(const unsigned int hashID, - unsigned short int& ROBid, - unsigned short int& RODid, - unsigned short int& side, - unsigned short int& SLid, - unsigned short int& RXid, - unsigned short int& PADid) const -{ +bool RpcCablingCondData::give_RODid(const Identifier& compactID, unsigned short int& id) const { + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + if (!index) return false; + id = index->RODid(); + return true; +} +bool RpcCablingCondData::give_RODid(const unsigned int hashID, unsigned short int& id) const { if ( hashID >= m_HashVec.size() ) return false; + const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->RODid(); + return true; +} +bool RpcCablingCondData::give_side(const Identifier& compactID, unsigned short int& id) const { + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + if (!index) return false; + id = index->side(); + return true; +} +bool RpcCablingCondData::give_side(const unsigned int hashID, unsigned short int& id) const { + if ( hashID >= m_HashVec.size() ) return false; const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->side(); + return true; +} - ROBid = index->ROBid(); - RODid = index->RODid(); - side = index->side(); - SLid = index->SLid(); - RXid = index->RXid(); - PADid = index->PADid(); +bool RpcCablingCondData::give_SLid(const Identifier& compactID, unsigned short int& id) const { + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + if (!index) return false; + id = index->SLid(); + return true; +} +bool RpcCablingCondData::give_SLid(const unsigned int hashID, unsigned short int& id) const { + if ( hashID >= m_HashVec.size() ) return false; + const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->SLid(); + return true; +} +bool RpcCablingCondData::give_RXid(const Identifier& compactID, unsigned short int& id) const { + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + if (!index) return false; + id = index->RXid(); + return true; +} +bool RpcCablingCondData::give_RXid(const unsigned int hashID, unsigned short int& id) const { + if ( hashID >= m_HashVec.size() ) return false; + const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->RXid(); return true; } +bool RpcCablingCondData::give_PADid(const Identifier& compactID, unsigned short int& id) const { + OfflineOnlineMap::const_iterator it = m_RDOmap.find(compactID); + if (it == m_RDOmap.end()) return false; + const RDOindex* index = (*m_RDOmap.find(compactID)).second; + if (!index) return false; + id = index->PADid(); + return true; +} +bool RpcCablingCondData::give_PADid(const unsigned int hashID, unsigned short int& id) const { + if ( hashID >= m_HashVec.size() ) return false; + const RDOindex* index = m_HashVec[hashID]; + if (!index) return false; + id = index->PADid(); + return true; +} const std::vector& RpcCablingCondData::giveFullListOfRobIds() const {return m_fullListOfRobIds;} - - RpcCablingCondData::ID RpcCablingCondData::identifier(int index) const { int size = m_int2id.size(); @@ -94,15 +137,9 @@ std::vector RpcCablingCondData::rod2hash(uint16_t subsystem_id, uint32_t RpcCablingCondData::hash2source(unsigned int h) const { - unsigned short int ROBid; - unsigned short int RODid; unsigned short int side; - unsigned short int SLid; - unsigned short int RXid; - unsigned short int PADid; - - if( RpcCablingCondData::giveOnlineID(h,ROBid,RODid,side,SLid,RXid,PADid) ) - { + unsigned short int RODid; + if(give_side(h,side) && give_RODid(h,RODid) ) { uint32_t sub = side; uint32_t rod = RODid; return (sub << 16) | rod; @@ -233,24 +270,6 @@ unsigned int RpcCablingCondData::computeZIndexInCablingStation(const std::string { unsigned int zIndexInCablingStation = 999; - - int iStat=0; - - if (stationName=="BML") iStat=0; // BML - else if (stationName=="BMS") iStat=1; // BMS - else if (stationName=="BOL") iStat=2; // BOL - else if (stationName=="BOS") iStat=3; // BOS - else if (stationName=="BMF") iStat=4; // BMF - else if (stationName=="BOF") iStat=5; // BOF - else if (stationName=="BOG") iStat=6; // BOG - else if (stationName=="BME") iStat=7; // BME - else - { - return 9999; - } - int side = 0; - if (stationEta>0) side=1; - int cablingStation = -1; int sectType = m_SectorMap[logicSector]; if (sectType < 1 || sectType > m_MaxType+1) @@ -473,7 +492,7 @@ RpcCablingCondData::give_RoI_borders_id (unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const + const RpcIdHelper* rpcId) const { unsigned int EtaLowBorder=0; unsigned int EtaHighBorder=0; @@ -483,10 +502,10 @@ RpcCablingCondData::give_RoI_borders_id (unsigned short int SubsystemId, EtaLowBorder,EtaHighBorder, PhiLowBorder,PhiHighBorder); if (ok){ - EtaLowBorder_id = protected_strip_OffId_fromCode( EtaLowBorder, idHelperSvc ); - EtaHighBorder_id = protected_strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); - PhiLowBorder_id = protected_strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); - PhiHighBorder_id = protected_strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + EtaLowBorder_id = protected_strip_OffId_fromCode( EtaLowBorder, rpcId ); + EtaHighBorder_id = protected_strip_OffId_fromCode( EtaHighBorder, rpcId ); + PhiLowBorder_id = protected_strip_OffId_fromCode( PhiLowBorder, rpcId ); + PhiHighBorder_id = protected_strip_OffId_fromCode( PhiHighBorder, rpcId ); } // else {std::cout<<" since give_RoI_borders is not ok"< idHelperSvc ) const +RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int strip_code, const RpcIdHelper* rpcId) const { RPCofflineId rpc_strip = strip_id_fromCode (strip_code); if (rpc_strip.stationName=="BOG") @@ -563,7 +581,7 @@ RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int strip_code if (rpc_strip.strip>36) rpc_strip.strip=36; } } - Identifier rpcId = idHelperSvc->rpcIdHelper().channelID(rpc_strip.stationName, + return rpcId->channelID(rpc_strip.stationName, rpc_strip.stationEta, rpc_strip.stationPhi, rpc_strip.doubletR, @@ -572,7 +590,6 @@ RpcCablingCondData::protected_strip_OffId_fromCode (unsigned long int strip_code rpc_strip.gasGap, rpc_strip.measuresPhi, rpc_strip.strip); - return rpcId; } @@ -672,7 +689,7 @@ RpcCablingCondData::give_LowPt_borders_id (unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const + const RpcIdHelper* rpcId) const { unsigned int EtaLowBorder=0; unsigned int EtaHighBorder=0; @@ -682,10 +699,10 @@ RpcCablingCondData::give_LowPt_borders_id (unsigned short int SubsystemId, EtaLowBorder,EtaHighBorder, PhiLowBorder,PhiHighBorder); if (ok){ - EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder,idHelperSvc ); - EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); - PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); - PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder,rpcId ); + EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, rpcId ); + PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, rpcId ); + PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, rpcId ); } return ok; } @@ -750,7 +767,7 @@ RpcCablingCondData::give_HighPt_borders_id(unsigned short int SubsystemId, Identifier& EtaHighBorder_id, Identifier& PhiLowBorder_id, Identifier& PhiHighBorder_id, - const ServiceHandle idHelperSvc ) const + const RpcIdHelper* rpcId) const { unsigned int EtaLowBorder=0; unsigned int EtaHighBorder=0; @@ -761,30 +778,28 @@ RpcCablingCondData::give_HighPt_borders_id(unsigned short int SubsystemId, PhiLowBorder,PhiHighBorder); if (ok){ - EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder, idHelperSvc ); - EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, idHelperSvc ); - PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, idHelperSvc ); - PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, idHelperSvc ); + EtaLowBorder_id = strip_OffId_fromCode( EtaLowBorder, rpcId ); + EtaHighBorder_id = strip_OffId_fromCode( EtaHighBorder, rpcId ); + PhiLowBorder_id = strip_OffId_fromCode( PhiLowBorder, rpcId ); + PhiHighBorder_id = strip_OffId_fromCode( PhiHighBorder, rpcId ); } return ok; } Identifier -RpcCablingCondData::strip_OffId_fromCode (unsigned long int strip_code, - const ServiceHandle idHelperSvc ) const +RpcCablingCondData::strip_OffId_fromCode (unsigned long int strip_code, const RpcIdHelper* rpcId) const { RPCofflineId rpc_strip = strip_id_fromCode (strip_code); - Identifier rpcId = idHelperSvc->rpcIdHelper().channelID(rpc_strip.stationName, - rpc_strip.stationEta, - rpc_strip.stationPhi, - rpc_strip.doubletR, - rpc_strip.doubletZ, - rpc_strip.doubletPhi, - rpc_strip.gasGap, - rpc_strip.measuresPhi, - rpc_strip.strip); - return rpcId; + return rpcId->channelID(rpc_strip.stationName, + rpc_strip.stationEta, + rpc_strip.stationPhi, + rpc_strip.doubletR, + rpc_strip.doubletZ, + rpc_strip.doubletPhi, + rpc_strip.gasGap, + rpc_strip.measuresPhi, + rpc_strip.strip); } diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h index 14f7a039ee9..30f3ffea823 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGT1_RPCRECROISVC_H @@ -13,11 +13,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" -//class IRPCgeometrySvc; -class Identifier; -class IMDTcablingSvc; - - namespace LVL1RPC { class RPCRecRoiSvc : public LVL1::RecMuonRoiSvc @@ -37,9 +32,9 @@ public: m_MuonMgr(0) {}; - ~RPCRecRoiSvc (void) {}; + ~RPCRecRoiSvc()=default; - StatusCode initialize (void); + StatusCode initialize(); void reconstruct (const unsigned int & roIWord) const; double phi (void) const {return m_phi;}; @@ -64,17 +59,13 @@ public: private: - - - mutable double m_phi, m_eta; mutable double m_phiMin, m_phiMax, m_etaMin, m_etaMax; mutable unsigned short int m_side, m_sector, m_roi; const MuonGM::MuonDetectorManager * m_MuonMgr; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - // const IMDTcablingSvc* m_mDTcablingSvc; + ServiceHandle m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; } // end of namespace diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx index 8c16df59573..492f12cc380 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include @@ -9,8 +9,6 @@ #include "TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h" #include "StoreGate/StoreGateSvc.h" -#include "Identifier/Identifier.h" - using namespace LVL1RPC; @@ -24,6 +22,7 @@ StatusCode RPCRecRoiSvc::initialize (void) ATH_MSG_DEBUG( "Found the MuonDetDescrMgr " ); ATH_CHECK(m_readKey.initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -65,10 +64,10 @@ void RPCRecRoiSvc::reconstruct (const unsigned int & roIWord) const SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; - if(readCdo-> give_RoI_borders_id(m_side, m_sector, m_roi, + if(readCdo->give_RoI_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, PhiLowBorder_id, PhiHighBorder_id, - m_idHelperSvc)) + &m_idHelperSvc->rpcIdHelper())) { const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); @@ -212,7 +211,7 @@ bool RPCRecRoiSvc::etaDimLow (double& etaMin, double& etaMax) const if( ! readCdo->give_LowPt_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, PhiLowBorder_id, PhiHighBorder_id, - m_idHelperSvc)) return false; + &m_idHelperSvc->rpcIdHelper())) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); @@ -247,7 +246,7 @@ bool RPCRecRoiSvc::etaDimHigh (double& etaMin, double& etaMax) const if(!readCdo->give_HighPt_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, PhiLowBorder_id, PhiHighBorder_id, - m_idHelperSvc)) return false; + &m_idHelperSvc->rpcIdHelper())) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); -- GitLab From 80079463eed78f180d6f8cb38f1e968808a93534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Tue, 31 Mar 2020 17:03:10 +0200 Subject: [PATCH 21/26] add warning to RpcByteStreamDecoder, more cleanup --- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 2 +- .../src/MdtDigitToMdtRDO.cxx | 4 +- .../src/ReadMdtDigit.cxx | 10 +-- .../MuonByteStreamCnvTest/src/ReadMdtPRD.cxx | 5 +- .../MuonByteStreamCnvTest/src/ReadMdtRDO.cxx | 6 +- .../MuonByteStreamCnvTest/src/ReadRpcRDO.cxx | 8 +- .../src/RpcByteStreamDecoder.cxx | 10 ++- .../src/RpcDigitToRpcRDO.cxx | 15 ++-- .../RPC_CondCabling/RpcCablingCondData.h | 4 +- .../RPC_CondCabling/src/CMAidentity.cxx | 16 ++-- .../RPC_CondCabling/src/CMAparameters.cxx | 85 +++++++++---------- .../RPC_CondCabling/src/CMAprogram.cxx | 16 ++-- .../RPC_CondCabling/src/CablingObject.cxx | 20 ++--- .../src/RpcCablingCondData.cxx | 41 +++------ .../RPC_CondCabling/src/TRIGGERidentity.cxx | 8 +- .../RpcLv1RawDataEfficiency.h | 4 +- .../RpcLv1RawDataSectorLogic.h | 6 +- .../src/RPCMonitorAlgorithm.cxx | 2 - .../src/RpcLv1RawDataEfficiency.cxx | 40 +-------- .../src/RpcLv1RawDataSectorLogic.cxx | 38 +-------- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 23 +---- .../TrigL2MuonSA/src/RpcDataPreparator.cxx | 11 +-- 22 files changed, 116 insertions(+), 258 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index ec7170d122d..087c0d425d0 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -42,7 +42,7 @@ private: //--- Migrated from RpcByteStreamDecoder. typedef std::map < int, PADreadout, std::less > PAD_Readout; //Pad and Matrix decoding functions - RpcPad * decodePad(PADreadout& pad) const ; + std::shared_ptr decodePad(PADreadout& pad) const ; RpcCoinMatrix * decodeMatrix(MatrixReadOut* matrix, Identifier& id) const ; StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData*) const; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx index 03061be26e2..86e65c8dacd 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonDigitContainer/MdtDigitContainer.h" @@ -17,8 +17,6 @@ #include #include -using namespace std; - ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx index 781053b4437..4c1a8536408 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* @@ -10,16 +10,10 @@ Re-adapted by Michela Biglietti for Mdt Rods */ -//#include -//#include - #include "MuonByteStreamCnvTest/ReadMdtDigit.h" #include "MuonDigitContainer/MdtDigitCollection.h" #include "MuonDigitContainer/MdtDigitContainer.h" -using namespace std; - - static const int maxColl = 1200; static const int maxDig = 5000; @@ -29,8 +23,6 @@ ReadMdtDigit::ReadMdtDigit(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore("ActiveStoreSvc", name) { - // Declare the properties - declareProperty("NtupleLocID",m_NtupleLocID); declareProperty("WriteMdtNtuple", m_mdtNtuple = false); } diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx index 10f8af9d17e..8fa56ab5ad0 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -12,9 +12,6 @@ S. Rosati Dec 2005 #include "MuonByteStreamCnvTest/ReadMdtPRD.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "MuonIdHelpers/MdtIdHelper.h" - -using namespace std; static const int maxColl = 1200; static const int maxPrd = 5000; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtRDO.cxx index 424151ac993..21fa7159a5c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtRDO.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* @@ -19,9 +19,6 @@ #include "MuonByteStreamCnvTest/ReadMdtRDO.h" -using namespace std; - - static const int maxCsm = 1200;//????? static const int maxAmt = 5000;//????? @@ -31,7 +28,6 @@ ReadMdtRDO::ReadMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore("ActiveStoreSvc", name) { - // Declare the properties declareProperty("NtupleLocID",m_NtupleLocID); declareProperty("WriteMdtNtuple",m_mdtNtuple = false); } diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcRDO.cxx index c8f9acc3962..0720d872e27 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcRDO.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* @@ -21,8 +21,6 @@ #include "MuonByteStreamCnvTest/ReadRpcRDO.h" -using namespace std; - static const int maxPad = 512; static const int maxCMA = 2048; static const int maxFiredChannels = 4096; @@ -33,12 +31,8 @@ ReadRpcRDO::ReadRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_ntuplePtr(0), m_activeStore("ActiveStoreSvc", name) { - - // Declare the properties - declareProperty("NtupleLocID",m_NtupleLocID); declareProperty("WriteRpcNtuple", m_rpcNtuple = false); - } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx index e9fb54334bc..adc536aec74 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx @@ -1,10 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" #include "MuonByteStreamCnvTest/RpcByteStreamDecoder.h" +namespace { + static constexpr unsigned int const& rpcRawHitWordLength = 7; +} + RpcByteStreamDecoder::RpcByteStreamDecoder(const RPCbytestream * p_bytestream, const IRPCcablingSvc * p_cabling, const Muon::MuonIdHelperTool * muonIdHelperTool, MsgStream* log) : m_bytestream(p_bytestream), m_cabling(p_cabling), @@ -168,14 +172,14 @@ RpcCoinMatrix* RpcByteStreamDecoder::decodeMatrix(MatrixReadOut* matrix, Identif assert(cm_hit.isBody()); RpcFiredChannel* firedChannel=0; - if (cm_hit.ijk() < 7 ) + if (cm_hit.ijk() < rpcRawHitWordLength ) { firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), cm_hit.ijk(), cm_hit.channel()); } - else if (cm_hit.ijk() == 7 ) + else if (cm_hit.ijk() == rpcRawHitWordLength ) { firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index f603fef7db2..92b3f400641 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -126,23 +126,20 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { // ********************** create the RPC RDO's ***************************** - std::vector* rpcpads = new std::vector; + std::vector>* rpcpads = new std::vector>; ATH_MSG_DEBUG( "Start decoding" ); PAD_Readout padReadout = bytestream.pad_readout(); // Iterate on the readout PADS and decode them - // for (PAD_Readout::iterator it = padReadout.begin() ; it != padReadout.end(); ++it) - // { for (auto& padro : padReadout) { - // PADreadout padro = (*it).second; - RpcPad* newpad = decodePad(padro.second); + std::shared_ptr newpad = decodePad(padro.second); // Push back the decoded pad in the vector rpcpads->push_back(newpad); } ATH_MSG_DEBUG( "Total number of pads in this event is " << rpcpads ->size() ); - for (const RpcPad* pad : *rpcpads) { + for (const auto& pad : *rpcpads) { const int elementHash1 = pad->identifyHash(); - if (padContainer->addCollection(pad, elementHash1).isFailure()) { + if (padContainer->addCollection(pad.get(), elementHash1).isFailure()) { ATH_MSG_ERROR( "Unable to record RPC Pad in IDC" ); } } @@ -260,7 +257,7 @@ StatusCode RpcDigitToRpcRDO::fillTagInfo() const } // Decode a pad and return a pointer to a RpcPad RDO -RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const +std::shared_ptr RpcDigitToRpcRDO::decodePad(PADreadout& pad) const { ATH_MSG_DEBUG( "Decoding a new RpcPad" ); @@ -324,7 +321,7 @@ RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const unsigned int errorCode = pad_footer.errorCode(); // Construct the new Pad - RpcPad * rpc_pad = new RpcPad(id, hashId, onlineId, status, errorCode, sector); + std::shared_ptr rpc_pad = std::make_shared(id, hashId, onlineId, status, errorCode, sector); // Iterate on the matrices and decode them for (int i=0 ; i < readout->numberOfCMROFragments() ; ++i) diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index bd0362d95fe..51ffecaaa04 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -97,9 +97,7 @@ class RpcCablingCondData{ bool give_PAD_address (unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, - unsigned int& logic_sector, - unsigned short int& PADId, - unsigned int& PadId) const; + unsigned int& padIdHash) const; bool give_RoI_borders_id (unsigned short int SubsystemId, unsigned short int SectorId, diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAidentity.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAidentity.cxx index c40fa2ce472..0d9257499e6 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAidentity.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAidentity.cxx @@ -1,13 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include #include #include "RPC_CondCabling/CMAidentity.h" -using namespace std; - const char CMAidentity::CoverageTAG[3][5] = {{"even"},{"odd"},{""}}; bool @@ -159,7 +157,7 @@ CMAidentity::inversion() m_Ixx_index = (m_Ixx_index==0)? 1 : 0; } -ostream& operator<<(ostream& stream, const CMAidentity& id) +std::ostream& operator<<(std::ostream& stream, const CMAidentity& id) { char exttag[5] = {' ',' ',' ',' ','\0'}; const char* tag = CMAidentity::covtag(id.m_coverage); @@ -173,10 +171,10 @@ ostream& operator<<(ostream& stream, const CMAidentity& id) std::string type = (id.type() == Phi )?" phi cma " + covtag : " eta cma " + covtag; if(covtag != "" ) type = type + " "; - stream << type << setw(2) << id.number() << ": Eta "; - stream << setw(2) << id.eta_index(); - stream << " Phi " << setw(2) << id.phi_index(); - stream << " PAD " << setw(2) << id.PAD_index(); - stream << " Ixx " << setw(2) << id.Ixx_index(); + stream << type << std::setw(2) << id.number() << ": Eta "; + stream << std::setw(2) << id.eta_index(); + stream << " Phi " << std::setw(2) << id.phi_index(); + stream << " PAD " << std::setw(2) << id.PAD_index(); + stream << " Ixx " << std::setw(2) << id.Ixx_index(); return stream; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAparameters.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAparameters.cxx index ed26454626a..853dff4e776 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAparameters.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAparameters.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include @@ -9,9 +9,6 @@ #include "RPC_CondCabling/CMAprogram.h" #include "MuonCablingTools/RPCdecoder.h" - -using namespace std; - int CMAparameters::s_Layer = 0; void @@ -445,16 +442,16 @@ CMAparameters::operator+=(const CMAparameters& cma) } void -CMAparameters::showDt(ostream& stream) const +CMAparameters::showDt(std::ostream& stream) const { // Set the chracters used for matrix display unsigned int finish = 164; if(!m_pivot) { - stream << endl << "Low Pt and Hi Pt not yet connected!" << endl; + stream << std::endl << "Low Pt and Hi Pt not yet connected!" << std::endl; for(int i=0;i<80;++i) stream << (char)finish; - stream << endl; + stream << std::endl; return; } @@ -464,16 +461,16 @@ CMAparameters::showDt(ostream& stream) const char (*displow)[90] = new char [ln][90]; // Show Low Pt connections - stream << endl << "Low Pt matrix connections:" << endl << endl; + stream << std::endl << "Low Pt matrix connections:" << std::endl << std::endl; showMt(displow,ln,Low); // Dumping memory on output stream - for (int i=0;i 0)? (m_highPt_rpc_read - 1)*6 + 39 : 39; @@ -482,13 +479,13 @@ CMAparameters::showDt(ostream& stream) const showMt(disphi,ln,High); // Dumping memory on output stream - for (int i=0;i= 0) { - *disp[i] << setw(5) << m_pivot[j][s_Layer][pivot_channels-i]; + *disp[i] << std::setw(5) << m_pivot[j][s_Layer][pivot_channels-i]; } else *disp[i] << "*****"; } // Display the trigger window for all tresholds - (ostream&) *disp[i] << (char)left; + (std::ostream&) *disp[i] << (char)left; for(int j=0;j= 0) { - (ostream&) *disp[start+j] << + (std::ostream&) *disp[start+j] << ( conf[i][s_Layer][ch]/static_cast(pow(10.,j)) )%10; - } else (ostream&) *disp[start+j] << "*"; + } else (std::ostream&) *disp[start+j] << "*"; } } @@ -616,44 +613,44 @@ CMAparameters::showMt(char display[][90],int ln, TrigType type) const void -CMAparameters::Print(ostream& stream,bool detail) const +CMAparameters::Print(std::ostream& stream,bool detail) const { stream << id(); stream << " I/O " << m_pivot_station << ","; stream << m_lowPt_station << "," << m_highPt_station << " pivot "; stream.fill(48); - stream << "<" <" << endl; + stream << "<" <" << std::endl; stream << " "; - stream << "lowPt <" << setw(2); + stream << "lowPt <" << std::setw(2); - stream << lowPt_start_ch() << ":" << setw(2) << lowPt_start_st(); - stream << " " << setw(2) << lowPt_stop_ch() << ":"; - stream << setw(2) << lowPt_stop_st() << ">" << endl; + stream << lowPt_start_ch() << ":" << std::setw(2) << lowPt_start_st(); + stream << " " << std::setw(2) << lowPt_stop_ch() << ":"; + stream << std::setw(2) << lowPt_stop_st() << ">" << std::endl; stream << " "; - stream << "highPt<" << setw(2); + stream << "highPt<" << std::setw(2); - stream << highPt_start_ch() << ":" << setw(2) << highPt_start_st(); - stream << " " << setw(2) << highPt_stop_ch() << ":"; - stream << setw(2) << highPt_stop_st() << ">" << endl; + stream << highPt_start_ch() << ":" << std::setw(2) << highPt_start_st(); + stream << " " << std::setw(2) << highPt_stop_ch() << ":"; + stream << std::setw(2) << highPt_stop_st() << ">" << std::endl; stream.fill(32); if(detail) showDt(stream); } void -CMAparameters::noMoreChannels(const string stat) +CMAparameters::noMoreChannels(const std::string stat) { int max_channels = 0; if(stat == "Pivot") max_channels = pivot_channels; else max_channels = confirm_channels; - DISP << "Error in Sector Type " << this->sector_type() << ":" << endl + DISP << "Error in Sector Type " << this->sector_type() << ":" << std::endl << this->id() << " attempted to receive more than " << max_channels - << " channels for " << stat << " side" << endl; + << " channels for " << stat << " side" << std::endl; DISP_ERROR; } @@ -691,7 +688,7 @@ CMAparameters::two_obj_error_message(std::string msg,CMAparameters* cma) this->error_header(); DISP << " " << msg << " between " << name() << " n. " << number() - << " and " << cma->name() << " n. " << cma->number() << endl + << " and " << cma->name() << " n. " << cma->number() << std::endl << *this << *cma; DISP_ERROR; @@ -706,14 +703,14 @@ CMAparameters::no_confirm_error(int stat) { DISP << "Low Pt cabling inconsistence (cabling from connector " << m_lowPt_start_co << " to connector " << m_lowPt_stop_co - << ") for" << endl << *this; + << ") for" << std::endl << *this; DISP_ERROR; } else if (stat == highPt_station()) { DISP << "High Pt cabling inconsistence (cabling from connector " << m_highPt_start_co << " to connector " << m_highPt_stop_co - << ") for" << endl << *this; + << ") for" << std::endl << *this; DISP_ERROR; } else return; @@ -724,9 +721,9 @@ CMAparameters::no_wor_readout(int num,int stat) { this->error_header(); - DISP << this->id() << " receives input from" << endl + DISP << this->id() << " receives input from" << std::endl << " RPC chamber n. " << num << " of station " << stat - << " which has no Wired OR readout!" << endl; + << " which has no Wired OR readout!" << std::endl; DISP_ERROR; } @@ -735,7 +732,7 @@ CMAparameters::error(std::string str) { this->error_header(); - DISP << this->id() << str << endl; + DISP << this->id() << str << std::endl; DISP_ERROR; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAprogram.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAprogram.cxx index 99ee701714b..19dc2c3ed9e 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAprogram.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CMAprogram.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RPC_CondCabling/CMAprogram.h" #include -using namespace std; - CMAprogram::CMAprogram() : m_isnewcab(false), m_overlap1(0xff), m_overlap2(0xff000000), m_trig_local_direc_i(0x1), m_trig_local_direc_j(0x1), m_trig_k_readout(0x0), @@ -88,7 +86,7 @@ CMAprogram::CMAprogram() : m_status = false; } -CMAprogram::CMAprogram(ifstream& file) : +CMAprogram::CMAprogram(std::ifstream& file) : m_overlap1(0xff),m_overlap2(0xff000000),m_trig_local_direc_i(0x1), m_trig_local_direc_j(0x1),m_trig_k_readout(0x0), @@ -173,7 +171,7 @@ CMAprogram::CMAprogram(ifstream& file) : m_status = read_v02(data); } -CMAprogram::CMAprogram(ifstream& file, bool NewCab) : +CMAprogram::CMAprogram(std::ifstream& file, bool NewCab) : m_overlap1(0xff),m_overlap2(0xff000000),m_trig_local_direc_i(0x1), m_trig_local_direc_j(0x1),m_trig_k_readout(0x0), @@ -258,7 +256,7 @@ CMAprogram::CMAprogram(ifstream& file, bool NewCab) : m_status = read_v02(data); } -CMAprogram::CMAprogram(istringstream& filestr) : +CMAprogram::CMAprogram(std::istringstream& filestr) : m_overlap1(0xff),m_overlap2(0xff000000),m_trig_local_direc_i(0x1), m_trig_local_direc_j(0x1),m_trig_k_readout(0x0), @@ -343,7 +341,7 @@ CMAprogram::CMAprogram(istringstream& filestr) : m_status = read_v02(data); } -CMAprogram::CMAprogram(istringstream& filestr, bool NewCab) : +CMAprogram::CMAprogram(std::istringstream& filestr, bool NewCab) : m_overlap1(0xff),m_overlap2(0xff000000),m_trig_local_direc_i(0x1), m_trig_local_direc_j(0x1),m_trig_k_readout(0x0), @@ -996,7 +994,7 @@ CMAprogram::hasProgrammed(unsigned int th) const { return false; } -ostream& operator<<(ostream& stream,const CMAprogram& program) +std::ostream& operator<<(std::ostream& stream,const CMAprogram& program) { unsigned int no_coincidence = 183; @@ -1014,7 +1012,7 @@ ostream& operator<<(ostream& stream,const CMAprogram& program) if(th==0) stream << (char)no_coincidence; } } - stream << endl; + stream << std::endl; } return stream; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CablingObject.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CablingObject.cxx index ee79c1eac95..db12a43b8c8 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CablingObject.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/CablingObject.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include #include "RPC_CondCabling/CablingObject.h" -using namespace std; - CablingObject::CablingObject(int num,int stat,int type,std::string name) : BaseObject(Logic,name),m_number(num),m_station(stat),m_sector_type(type) {} @@ -32,12 +30,12 @@ CablingObject::operator=(const CablingObject& obj) return*this; } -ostream& operator<< (ostream& stream,const CablingObject& obj) +std::ostream& operator<< (std::ostream& stream,const CablingObject& obj) { - stream << obj.name() << " number " << setw(3) << obj.number() - << " associated to sector type " << setw(3) + stream << obj.name() << " number " << std::setw(3) << obj.number() + << " associated to sector type " << std::setw(3) << obj.sector_type() << " in station n. " << obj.station() - << endl; + << std::endl; return stream; } @@ -47,20 +45,20 @@ CablingObject::error_header(void) const __osstream disp; disp << "Error in Sector Type " << m_sector_type; - if( m_station >0 ) disp << ", station " << m_station << ":" << endl; - else disp << ":" << endl; + if( m_station >0 ) disp << ", station " << m_station << ":" << std::endl; + else disp << ":" << std::endl; display_error(disp); } void -CablingObject::no_connection_error(string name,int num) +CablingObject::no_connection_error(std::string name,int num) { this->error_header(); DISP << this->name() << " n. " << m_number << " is supposed to receive input from " << name << " n. " << num - << " which doesn't exist!" << endl; + << " which doesn't exist!" << std::endl; DISP_ERROR; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 8e4ca2657c3..5ac474324aa 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -4,6 +4,9 @@ #include "RPC_CondCabling/RpcCablingCondData.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" + const RpcCablingCondData::RDOmap& RpcCablingCondData::give_RDOs(void) const {return m_RDOs;} bool RpcCablingCondData::give_ROBid(const Identifier& compactID, unsigned short int& id) const { @@ -463,12 +466,9 @@ bool RpcCablingCondData::give_PAD_address (unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, - unsigned int& logic_sector, - unsigned short int& PADId, - unsigned int& PadId) const + unsigned int& padIdHash) const { - logic_sector = SectorId + SubsystemId*32; - PADId = (RoIId)/4; + unsigned short int PADId = (RoIId)/4; int key = SubsystemId*10000 + SectorId*100 + PADId; @@ -479,7 +479,7 @@ RpcCablingCondData::give_PAD_address (unsigned short int SubsystemId, // Retrieve the identifier elements from the map const RDOindex index = (*it).second; - PadId = index.hash(); + padIdHash = index.hash(); return true; } @@ -500,14 +500,14 @@ RpcCablingCondData::give_RoI_borders_id (unsigned short int SubsystemId, unsigned int PhiHighBorder=0; bool ok = give_RoI_borders(SubsystemId,SectorId,RoIId, EtaLowBorder,EtaHighBorder, - PhiLowBorder,PhiHighBorder); - if (ok){ + PhiLowBorder,PhiHighBorder); + // give_RoI_borders() already complains if the return code is false + if (ok) { EtaLowBorder_id = protected_strip_OffId_fromCode( EtaLowBorder, rpcId ); EtaHighBorder_id = protected_strip_OffId_fromCode( EtaHighBorder, rpcId ); PhiLowBorder_id = protected_strip_OffId_fromCode( PhiLowBorder, rpcId ); PhiHighBorder_id = protected_strip_OffId_fromCode( PhiHighBorder, rpcId ); } - // else {std::cout<<" since give_RoI_borders is not ok"< #include "RPC_CondCabling/TRIGGERidentity.h" -using namespace std; - /////////////////////////////////////////////////////////////////////////////// const char TRIGGERidentity::s_type_tag [NTYPE][8] = { {"no"}, @@ -113,14 +111,14 @@ TRIGGERidentity::searchForHigh() const } -void TRIGGERidentity::Print(ostream& stream,bool detail) const +void TRIGGERidentity::Print(std::ostream& stream,bool detail) const { detail = true; if(detail) { stream << s_type_tag[type()] << " trigger, " << s_threshold_tag[threshold()] - << " threshold fired (" << setw(4) + << " threshold fired (" << std::setw(4) << s_pt_value[type()][threshold()] << " GeV), overlap flag "; if(overlap()) stream << "ON"; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h index 85cc80b7e26..e32daa3183a 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h @@ -163,17 +163,15 @@ class RpcLv1RawDataEfficiency: public ManagedMonitorToolBase { public: RpcLv1RawDataEfficiency ( const std::string & type, const std::string & name, const IInterface* parent ); - virtual ~RpcLv1RawDataEfficiency(); + virtual ~RpcLv1RawDataEfficiency()=default; StatusCode initialize(); - StatusCode finalize(); StatusCode readRpcCoinDataContainer(); // virtual StatusCode GetHistograms(); virtual StatusCode bookHistogramsRecurrent(); virtual StatusCode fillHistograms( ); - virtual StatusCode procHistograms(); private: // Retrieving information and data diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataSectorLogic.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataSectorLogic.h index 431925a7782..937092424c4 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataSectorLogic.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataSectorLogic.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -55,13 +55,11 @@ class RpcLv1RawDataSectorLogic: public ManagedMonitorToolBase { public: RpcLv1RawDataSectorLogic ( const std::string & type, const std::string & name, const IInterface* parent ); - virtual ~RpcLv1RawDataSectorLogic(); + virtual ~RpcLv1RawDataSectorLogic()=default; StatusCode initialize(); - StatusCode finalize(); virtual StatusCode bookHistogramsRecurrent(); virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); private: diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCMonitorAlgorithm.cxx index de5df2dc024..be2a1f53068 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCMonitorAlgorithm.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCMonitorAlgorithm.cxx @@ -4,8 +4,6 @@ #include "RpcRawDataMonitoring/RPCMonitorAlgorithm.h" -using namespace std; - //======================================================================================================== RPCMonitorAlgorithm::RPCMonitorAlgorithm (const std::string& name, ISvcLocator* pSvcLocator) :AthMonitorAlgorithm(name,pSvcLocator), diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx index feb8da559e1..fc52585c8c2 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////// @@ -10,8 +10,6 @@ // Subject: RPCLV1--> Efficiency Offline Muon Data Quality // RPCLv1 Sector Hits vs LB ///////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/MsgStream.h" #include "StoreGate/DataHandle.h" @@ -29,23 +27,12 @@ #include -using namespace std; - - - //================================================================================================================================ RpcLv1RawDataEfficiency::RpcLv1RawDataEfficiency( const std::string & type, const std::string & name, - const IInterface* parent ) - :ManagedMonitorToolBase( type, name, parent ) + const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ) { - declareProperty("isMC" , m_isMC = false ); -} - -//================================================================================================================================ -RpcLv1RawDataEfficiency::~RpcLv1RawDataEfficiency() -{ - ATH_MSG_INFO( " Deleting RpcLv1RawDataEfficiency " ); + declareProperty("isMC", m_isMC=false); } //================================================================================================================================ @@ -253,24 +240,3 @@ StatusCode RpcLv1RawDataEfficiency::fillHistograms( ) } return StatusCode::SUCCESS; } - -//================================================================================================================================ -// Proc histograms -//================================================================================================================================ -StatusCode RpcLv1RawDataEfficiency::procHistograms() -{ - ATH_MSG_INFO( "RpcLv1RawDataEfficiency finalize()" ); - - return StatusCode::SUCCESS; -} - - - -//================================================================================================================================ -// Finalizing -//================================================================================================================================ -StatusCode RpcLv1RawDataEfficiency::finalize() -{ - ATH_MSG_INFO( "RpcLv1RawDataEfficiency finalize()" ); - return StatusCode::SUCCESS; -} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataSectorLogic.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataSectorLogic.cxx index d68e4dac493..9569aeef4a4 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataSectorLogic.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataSectorLogic.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////// @@ -10,8 +10,6 @@ // DESCRIPTION: // Subject: RPCLV1-->Sector Logic Offline Muon Data Quality ///////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/MsgStream.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" #include "MuonDQAUtils/MuonChambersRange.h" @@ -24,28 +22,17 @@ #include -using namespace std; - - //*********************************************************************************************************************** //*********************************************************************************************************************** RpcLv1RawDataSectorLogic::RpcLv1RawDataSectorLogic( const std::string & type, const std::string & name, - const IInterface* parent ) - :ManagedMonitorToolBase( type, name, parent ) + const IInterface* parent ) : + ManagedMonitorToolBase( type, name, parent ) { - // Declare the properties declareProperty("LumiblockHist" , m_lumiblockhist = false ); declareProperty("isMC" , m_isMC = false ); } -//*********************************************************************************************************************** -RpcLv1RawDataSectorLogic::~RpcLv1RawDataSectorLogic() -{ - ATH_MSG_INFO( " Deleting RpcLv1RawDataSectorLogic " ); -} - - //*********************************************************************************************************************** StatusCode RpcLv1RawDataSectorLogic::initialize() { @@ -646,22 +633,3 @@ StatusCode RpcLv1RawDataSectorLogic::bookHistogramsRecurrent() return sc; } - - - -//*********************************************************************************************************************** -StatusCode RpcLv1RawDataSectorLogic::procHistograms() -{ - - ATH_MSG_DEBUG( "RpcLv1RawDataSectorLogic finalize()" ); - return StatusCode::SUCCESS; -} - - -//*********************************************************************************************************************** -StatusCode RpcLv1RawDataSectorLogic::finalize() -{ - ATH_MSG_DEBUG( "RpcLv1RawDataSectorLogic finalize()" ); - - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index c84303f3cd4..905ff47bbcd 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -523,12 +523,8 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::createRpcFragment(const LVL1::RecMuo unsigned int sectorRoIOvl = (roIWord & 0x000007FC) >> 2; unsigned int side = sectorAddress & 0x00000001; unsigned int sector = (sectorAddress & 0x0000003e) >> 1; - unsigned int roiNumber = sectorRoIOvl & 0x0000001F; - // unsigned int padNumber = roiNumber/4; - + unsigned int roiNumber = sectorRoIOvl & 0x0000001F; - unsigned int logic_sector; - unsigned short int PADId; Identifier padId; // retrieve the pad container @@ -539,30 +535,19 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::createRpcFragment(const LVL1::RecMuo return sc; } -// std::cout << ">>>>>>>>>>>>>>>>>>> ROI PARAMETERS" << std::endl; -// std::cout << "sectorAddress: " << sectorAddress << std::endl; -// std::cout << "sectorRoIOvl : " << sectorRoIOvl << std::endl; -// std::cout << "side : " << side << std::endl; -// std::cout << "sector : " << sector << std::endl; -// std::cout << "roiNumber : " << roiNumber << std::endl; -// std::cout << "padNumber : " << padNumber << std::endl; - unsigned int padIdHash; SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; - if ( readCdo-> give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if (readCdo->give_PAD_address( side, sector, roiNumber, padIdHash)) { RpcPadContainer::const_iterator itPad = rpcPadContainer->indexFind(padIdHash); if( itPad==rpcPadContainer->end() ) { ATH_MSG_WARNING("Failed to retrieve PAD hash Id " << padIdHash); return StatusCode::FAILURE; - } - + } const RpcPad* rpcPad = *itPad; - //unsigned int subsys_id = (subsystemID==1)? 0x65 : 0x66; - // unsigned int robId = (subsys_id << 16) | (sectorID/2); - + if(rpcPad) { uint16_t sector = rpcPad->sector(); uint16_t sysId = (sector<32)? 0x66 : 0x65; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx index 692f2c4ca90..27b06a6268b 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx @@ -93,23 +93,18 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* unsigned int side = sectorAddress & 0x00000001; unsigned int sector = (sectorAddress & 0x0000003e) >> 1; unsigned int roiNumber = sectorRoIOvl & 0x0000001F; - // unsigned int padNumber = roiNumber/4; SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; - unsigned int logic_sector; - unsigned short int PADId; unsigned int padIdHash; - if ( !readCdo->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if ( !readCdo->give_PAD_address( side, sector, roiNumber, padIdHash) ) { ATH_MSG_WARNING("Roi Number: " << roiNumber << " not compatible with side, sector: " - << side << " " << sector); + << side << " " << sector << " (padIdHash=" << padIdHash << ")"); // set the bool flag to send the event to the debug stream m_isFakeRoi = true; - // return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG("Roi Number: " << roiNumber << " side, sector: " << side << " " << sector - << " corresp. to log_sector, padId: " << logic_sector << " " << PADId); + ATH_MSG_DEBUG("Roi Number: " << roiNumber << " side, sector: " << side << " " << sector); } const IRoiDescriptor* iroi = (IRoiDescriptor*) p_roids; -- GitLab From 82ebd2dd9430ccbc5103ecd3a9621bcb79f049b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Tue, 31 Mar 2020 17:23:27 +0200 Subject: [PATCH 22/26] added constexpr to RpcDigitToRpcRDO --- .../src/RpcDigitToRpcRDO.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 92b3f400641..9f76cfc88af 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -2,13 +2,10 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "TrigT1RPClogic/ShowData.h" #include "StoreGate/StoreGateSvc.h" -#include "MuonIdHelpers/RpcIdHelper.h" - #include "MuonDigitContainer/RpcDigitCollection.h" #include "MuonDigitContainer/RpcDigit.h" @@ -20,9 +17,15 @@ #include #include +#include "GaudiKernel/PhysicalConstants.h" static double time_correction(double, double, double); +namespace { + static constexpr unsigned int const& rpcRawHitWordLength = 7; + static constexpr double const& inverseSpeedOfLight = 1e6 / Gaudi::Units::c_light; // Gaudi::Units::c_light=2.99792458e+8, but need 299.792458 +} + ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -232,8 +235,7 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& double time_correction(double x, double y, double z) { - double speed_of_light = 299.792458; // mm/ns - return sqrt(x*x+y*y+z*z)/speed_of_light; + return std::sqrt(x*x+y*y+z*z)*inverseSpeedOfLight; } @@ -367,14 +369,14 @@ RpcCoinMatrix* RpcDigitToRpcRDO::decodeMatrix(MatrixReadOut* matrix, Identifier& assert(cm_hit.isBody()); RpcFiredChannel* firedChannel=0; - if (cm_hit.ijk() < 7 ) + if (cm_hit.ijk() < rpcRawHitWordLength) { firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), cm_hit.ijk(), cm_hit.channel()); } - else if (cm_hit.ijk() == 7 ) + else if (cm_hit.ijk() == rpcRawHitWordLength) { firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), -- GitLab From 9e3e75ab8e4e4b14bd070ea4e1e2b2a4a4a6a6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Thu, 2 Apr 2020 20:47:23 +0200 Subject: [PATCH 23/26] more cleanup --- .../src/RpcPadContByteStreamCnv.cxx | 10 ++------ .../IRPC_RDOtoByteStreamTool.h | 25 ++----------------- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx | 3 +++ .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h | 3 ++- .../src/RpcPadContByteStreamTool.cxx | 21 ++++++++++------ .../src/RpcPadContByteStreamTool.h | 8 +++--- .../RPC_CondCabling/src/RpcCablingCondAlg.cxx | 6 ++--- 7 files changed, 28 insertions(+), 48 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx index fb52d2c9490..243293706d3 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/RpcPadContByteStreamCnv.cxx @@ -1,16 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonByteStream/RpcPadContByteStreamCnv.h" -#include "MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h" #include "ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" #include "ByteStreamData/RawEvent.h" -//using namespace EventFormat::RawMemory ; - #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/DataObject.h" @@ -21,9 +18,6 @@ #include "StoreGate/StoreGateSvc.h" -// Tool -#include "GaudiKernel/IToolSvc.h" - #include #include @@ -95,6 +89,6 @@ RpcPadContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) { pAddr = addr; - return m_tool->convert(cont, re, log); + return m_tool->convert(cont, re); } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h index b9e2628eb79..e1d398aacae 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDOtoByteStreamTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,13 @@ ----------------------------------------- ***************************************************************************/ -// $Id: IRPC_RDOtoByteStreamTool.h,v 1.1 2009-02-18 16:26:53 stefspa Exp $ -// $Name: not supported by cvs2svn $ - #ifndef MUONRPC_CNVTOOLS_IRPC_RDOTOBYTESTREAMTOOL_H # define MUONRPC_CNVTOOLS_IRPC_RDOTOBYTESTREAMTOOL_H -//<<<<<< INCLUDES >>>>>> -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> - - - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - - #include "GaudiKernel/IAlgTool.h" #include "ByteStreamData/RawEvent.h" class RpcPadContainer; -class MsgStream ; static const InterfaceID IID_IRPC_RDOtoByteStreamTool( "Muon::IRPC_RDOtoByteStreamTool", 1, 0 ); @@ -46,10 +28,7 @@ class IRPC_RDOtoByteStreamTool : virtual public IAlgTool public: static const InterfaceID& interfaceID( ) { return IID_IRPC_RDOtoByteStreamTool; }; - // virtual StatusCode initialize(); - // virtual StatusCode finalize(); - - virtual StatusCode convert(RpcPadContainer* cont, RawEventWrite* re, MsgStream& log)=0; + virtual StatusCode convert(RpcPadContainer* cont, RawEventWrite* re)=0; }; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx index 17062322f97..9df162e3a2c 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx @@ -26,6 +26,9 @@ void RPC_Hid2RESrcID::set(const RpcCablingCondData* readCdo, const RpcIdHelper* m_rpcCondData=readCdo; m_rpcIdHelper=rpdId; } +void RPC_Hid2RESrcID::set(const RpcIdHelper* rpdId) { + m_rpcIdHelper=rpdId; +} std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h index 257c48022cb..4c8fbe23b9d 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h @@ -24,7 +24,8 @@ public: RPC_Hid2RESrcID (int specialROBNumber); - void set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId); + void set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId); + void set(const RpcIdHelper* rpdId); std::vector getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo); diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx index 570d4eba421..de17406cc86 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx @@ -8,6 +8,8 @@ #include "RPC_Hid2RESrcID.h" #include "MuonRDO/RpcPad.h" #include "MuonRDO/RpcPadContainer.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" #include @@ -31,14 +33,16 @@ StatusCode Muon::RpcPadContByteStreamTool::initialize() { return StatusCode::SUCCESS; } -StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log) { - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - m_hid2re.set(readCdo, &m_idHelperSvc->rpcIdHelper()); +StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re) { + // SG::ReadCondHandle readHandle{m_readKey}; + // const RpcCablingCondData* readCdo{*readHandle}; + // m_hid2re.set(readCdo, &m_idHelperSvc->rpcIdHelper()); + m_hid2re.set(&m_idHelperSvc->rpcIdHelper()); m_fea.clear(); - m_fea.idMap().set(readCdo, &m_idHelperSvc->rpcIdHelper()); + // m_fea.idMap().set(readCdo, &m_idHelperSvc->rpcIdHelper()); + m_fea.idMap().set(&m_idHelperSvc->rpcIdHelper()); - FullEventAssembler::RODDATA* theROD ; + FullEventAssembler::RODDATA* theROD; RpcPadContainer::const_iterator it_coll = cont->begin(); RpcPadContainer::const_iterator it_coll_end = cont->end(); @@ -63,8 +67,9 @@ StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrit ((*it).second).set( &m_hid2re ) ; ((*it).second).fillROD( *theROD ) ; } - - m_fea.fill(re,log); + + MsgStream log(Athena::getMessageSvc(), "RpcPadContByteStreamTool"); + m_fea.fill(re, log); return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h index a7f4288d741..c9e75dd155b 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h @@ -43,21 +43,19 @@ public: /** constructor */ - RpcPadContByteStreamTool( const std::string& type, const std::string& name, - const IInterface* parent ) ; + RpcPadContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent); virtual ~RpcPadContByteStreamTool()=default; /** AlgTool InterfaceID */ - static const InterfaceID& interfaceID( ) ; + static const InterfaceID& interfaceID(); virtual StatusCode initialize(); - StatusCode convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log ); + StatusCode convert(CONTAINER* cont, RawEventWrite* re); private: - SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; RPC_Hid2RESrcID m_hid2re; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index 8cb4e5c4736..0edffc60e25 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -580,8 +580,8 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) if (it==m_trigroads.end()){ ATH_MSG_WARNING("Missing HEADER FILE infos.txt"); } else { - ATH_MSG_INFO("======== RPC Trigger Roads from COOL - Header infos ========"); - ATH_MSG_INFO("\n"+it->second+"\n"); + ATH_MSG_VERBOSE("======== RPC Trigger Roads from COOL - Header infos ========"); + ATH_MSG_VERBOSE("\n"+it->second+"\n"); // Read FeetPadThresholds from infos.txt if (!m_ForceFeetPadThresholdsFromJO){ std::stringstream ss; @@ -617,7 +617,7 @@ StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) m_FeetPadThresholds.at(1)=2; m_FeetPadThresholds.at(2)=5; } - ATH_MSG_INFO("Applying FeetPadThresholds : " + ATH_MSG_VERBOSE("Applying FeetPadThresholds : " << m_FeetPadThresholds.at(0) << "," << m_FeetPadThresholds.at(1) << "," << m_FeetPadThresholds.at(2)); -- GitLab From 1c0630acc23f35d74b9dc2e9afea97b181c6e633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Fri, 3 Apr 2020 12:37:49 +0200 Subject: [PATCH 24/26] fix streamObjects failed crash --- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 2 +- .../src/RpcDigitToRpcRDO.cxx | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 087c0d425d0..02788cc61fd 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -42,7 +42,7 @@ private: //--- Migrated from RpcByteStreamDecoder. typedef std::map < int, PADreadout, std::less > PAD_Readout; //Pad and Matrix decoding functions - std::shared_ptr decodePad(PADreadout& pad) const ; + RpcPad* decodePad(PADreadout& pad) const; RpcCoinMatrix * decodeMatrix(MatrixReadOut* matrix, Identifier& id) const ; StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData*) const; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index 9f76cfc88af..cc7ca85eb6b 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -129,25 +129,24 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { // ********************** create the RPC RDO's ***************************** - std::vector>* rpcpads = new std::vector>; - ATH_MSG_DEBUG( "Start decoding" ); + std::vector rpcpads; + ATH_MSG_DEBUG( "Start decoding"); PAD_Readout padReadout = bytestream.pad_readout(); // Iterate on the readout PADS and decode them for (auto& padro : padReadout) { - std::shared_ptr newpad = decodePad(padro.second); + RpcPad* newpad = decodePad(padro.second); // Push back the decoded pad in the vector - rpcpads->push_back(newpad); + rpcpads.push_back(newpad); } - ATH_MSG_DEBUG( "Total number of pads in this event is " << rpcpads ->size() ); + ATH_MSG_DEBUG("Total number of pads in this event is " << rpcpads.size()); - for (const auto& pad : *rpcpads) { + for (const auto& pad : rpcpads) { const int elementHash1 = pad->identifyHash(); - if (padContainer->addCollection(pad.get(), elementHash1).isFailure()) { + if (padContainer->addCollection(pad, elementHash1).isFailure()) { ATH_MSG_ERROR( "Unable to record RPC Pad in IDC" ); } } - - delete rpcpads; rpcpads = NULL; + rpcpads.clear(); return StatusCode::SUCCESS; } @@ -259,7 +258,7 @@ StatusCode RpcDigitToRpcRDO::fillTagInfo() const } // Decode a pad and return a pointer to a RpcPad RDO -std::shared_ptr RpcDigitToRpcRDO::decodePad(PADreadout& pad) const +RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const { ATH_MSG_DEBUG( "Decoding a new RpcPad" ); @@ -323,7 +322,7 @@ std::shared_ptr RpcDigitToRpcRDO::decodePad(PADreadout& pad) const unsigned int errorCode = pad_footer.errorCode(); // Construct the new Pad - std::shared_ptr rpc_pad = std::make_shared(id, hashId, onlineId, status, errorCode, sector); + RpcPad* rpc_pad = new RpcPad(id, hashId, onlineId, status, errorCode, sector); // Iterate on the matrices and decode them for (int i=0 ; i < readout->numberOfCMROFragments() ; ++i) -- GitLab From b62bdada7d806e6cfec1c8506e09cca9c2fcfe48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Tue, 7 Apr 2020 17:59:37 +0200 Subject: [PATCH 25/26] overlay test working --- .../RpcByteStreamDecoder.h | 9 +- .../MuonByteStreamCnvTest/RpcDigitToRpcRDO.h | 3 +- .../src/RpcByteStreamDecoder.cxx | 9 +- .../src/RpcDigitToRpcRDO.cxx | 31 ++- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx | 184 +----------------- .../MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h | 31 +-- .../src/RpcPadContByteStreamTool.cxx | 8 +- .../src/RpcPadContByteStreamTool.h | 4 +- 8 files changed, 43 insertions(+), 236 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcByteStreamDecoder.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcByteStreamDecoder.h index c3f02623618..ee72b265d49 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcByteStreamDecoder.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcByteStreamDecoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPCBYTESTREAMDECODER_H @@ -12,7 +12,7 @@ #include "TrigT1RPChardware/MatrixReadOutStructure.h" #include "RPCcablingInterface/IRPCcablingSvc.h" #include "MuonRDO/RpcPad.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/RpcIdHelper.h" // Decode a RPCbytestream object and build the bare RPC RDO's // Stefano Rosati @@ -26,8 +26,7 @@ class RpcByteStreamDecoder { public: // Constructor and destructor - RpcByteStreamDecoder(const RPCbytestream * p_bytestream, const IRPCcablingSvc * p_cabling, - const Muon::MuonIdHelperTool * muonIdHelperTool, MsgStream* log=0); + RpcByteStreamDecoder(const RPCbytestream * p_bytestream, const IRPCcablingSvc * p_cabling, const RpcIdHelper* rpcId, MsgStream* log=nullptr); ~RpcByteStreamDecoder(); // Decode the bytestream coming from the LVL1 simulation @@ -48,7 +47,7 @@ class RpcByteStreamDecoder { // Data members const RPCbytestream* m_bytestream; const IRPCcablingSvc* m_cabling; - const Muon::MuonIdHelperTool* m_muonIdHelperTool; + const RpcIdHelper* m_rpcIdHelper; std::vector* m_rpcpads; MsgStream* m_log; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 02788cc61fd..9b681d39a7d 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -12,6 +12,7 @@ #include "RPCcablingInterface/IRPCcablingSvc.h" #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" +#include "MuonByteStreamCnvTest/RpcByteStreamDecoder.h" #include "TrigT1RPClogic/RPCsimuData.h" #include "TrigT1RPClogic/CMAdata.h" @@ -42,7 +43,7 @@ private: //--- Migrated from RpcByteStreamDecoder. typedef std::map < int, PADreadout, std::less > PAD_Readout; //Pad and Matrix decoding functions - RpcPad* decodePad(PADreadout& pad) const; + RpcPad* decodePad(PADreadout& pad, const RpcCablingCondData* readCdo) const; RpcCoinMatrix * decodeMatrix(MatrixReadOut* matrix, Identifier& id) const ; StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData*) const; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx index adc536aec74..dc78d4a2715 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcByteStreamDecoder.cxx @@ -2,17 +2,16 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" #include "MuonByteStreamCnvTest/RpcByteStreamDecoder.h" namespace { static constexpr unsigned int const& rpcRawHitWordLength = 7; } -RpcByteStreamDecoder::RpcByteStreamDecoder(const RPCbytestream * p_bytestream, const IRPCcablingSvc * p_cabling, const Muon::MuonIdHelperTool * muonIdHelperTool, MsgStream* log) : +RpcByteStreamDecoder::RpcByteStreamDecoder(const RPCbytestream * p_bytestream, const IRPCcablingSvc * p_cabling, const RpcIdHelper* rpcId, MsgStream* log) : m_bytestream(p_bytestream), m_cabling(p_cabling), - m_muonIdHelperTool(muonIdHelperTool) + m_rpcIdHelper(rpcId) { m_rpcpads = new std::vector; m_log = log; @@ -95,9 +94,7 @@ RpcPad* RpcByteStreamDecoder::decodePad(PADreadout& pad) // Build the pad offline identifier bool check = true; bool valid = false; - Identifier id = m_muonIdHelperTool->rpcIdHelper().padID(name, eta, phi, doublet_r, - doublet_z, doublet_phi, - check, &valid); + Identifier id = m_rpcIdHelper->padID(name, eta, phi, doublet_r, doublet_z, doublet_phi, check, &valid); if ( m_log && !valid ) { *m_log << MSG::ERROR << "Invalid pad offline indices " << endmsg; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index cc7ca85eb6b..9512ae7364c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -42,10 +42,14 @@ StatusCode RpcDigitToRpcRDO::initialize() { ATH_MSG_DEBUG( " in initialize()" ); - ATH_CHECK( m_idHelperSvc.retrieve() ); - ATH_CHECK( detStore()->retrieve(m_MuonMgr) ); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(detStore()->retrieve(m_MuonMgr)); - ATH_CHECK( m_cabling.retrieve()) ; + ATH_CHECK(m_cabling.retrieve()) ; + if (m_cabling->rpcCabSvcType() == "simLike_MapsFromFiles" || m_cabling->rpcCabSvcType() == "dataLike") m_cablingType="MuonRPC_Cabling"; + else if (m_cabling->rpcCabSvcType() == "simulationLike") m_cablingType="RPCcablingSim"; + else if (m_cabling->rpcCabSvcType() == "simulationLikeInitialization" ) m_cablingType="RPCcabling"; + else ATH_MSG_WARNING( "Unknown cabling type: rpcCabSvcType()="<< m_cabling->rpcCabSvcType() ); ATH_CHECK(m_readKey.initialize()); @@ -104,8 +108,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { ///// Creates the CMA patterns from RPC digits ///////////////////////// debug = (m_detailed_algo)? m_cma_debug : m_fast_debug; // // - // CMAdata patterns(&data,m_cabling,type,debug); // - CMAdata patterns(&data, readCdo, debug); // + CMAdata patterns(&data,&*m_cabling,debug); // // ATH_MSG_DEBUG( "CMApatterns created from RPC digits:" << std::endl // << ShowData(patterns,"",m_data_detail) ); @@ -128,13 +131,12 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { // ********************** create the RPC RDO's ***************************** - std::vector rpcpads; ATH_MSG_DEBUG( "Start decoding"); PAD_Readout padReadout = bytestream.pad_readout(); // Iterate on the readout PADS and decode them for (auto& padro : padReadout) { - RpcPad* newpad = decodePad(padro.second); + RpcPad* newpad = decodePad(padro.second, readCdo); // Push back the decoded pad in the vector rpcpads.push_back(newpad); } @@ -150,7 +152,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { return StatusCode::SUCCESS; } -StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData* readCdo) const { +StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData* /*readCdo*/) const { std::string space = " "; @@ -171,8 +173,6 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& IdentifierHash moduleHash = rpcCollection->identifierHash(); Identifier moduleId; - - //if (m_digit_position->initialize(moduleId)) if (!m_idHelperSvc->rpcIdHelper().get_id(moduleHash, moduleId, &rpcContext)) { for (const RpcDigit* rpcDigit : *rpcCollection) { if (rpcDigit->is_valid(m_idHelperSvc->rpcIdHelper())) { @@ -197,7 +197,7 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& Amg::Vector3D pos = descriptor->stripPos(channelId); // get now strip_code from cablingSvc - unsigned long int strip_code_cab = readCdo->strip_code_fromOffId (StationName, StationEta, StationPhi, + unsigned long int strip_code_cab = m_cabling->strip_code_fromOffId (StationName, StationEta, StationPhi, DoubletR, DoubletZ, DoubletP, GasGap, MeasuresPhi, Strip); @@ -225,7 +225,6 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& } } } - // string id = moduleId; } } @@ -258,7 +257,7 @@ StatusCode RpcDigitToRpcRDO::fillTagInfo() const } // Decode a pad and return a pointer to a RpcPad RDO -RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const +RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad, const RpcCablingCondData* readCdo) const { ATH_MSG_DEBUG( "Decoding a new RpcPad" ); @@ -288,14 +287,10 @@ RpcPad* RpcDigitToRpcRDO::decodePad(PADreadout& pad) const ATH_MSG_DEBUG( "Pad: Side " << side << " Sector logic" << logic_sector << " Id " << pad_id ); // Retrieve the identifier elements from the map - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); RDOindex index = (*pad_map.find(key)).second; - index.offline_indexes(name, eta, phi, doublet_r, doublet_z, doublet_phi, gas_gap, - measures_phi, strip); + index.offline_indexes(name, eta, phi, doublet_r, doublet_z, doublet_phi, gas_gap, measures_phi, strip); // Build the pad offline identifier bool check = true; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx index 9df162e3a2c..b32e6c126ee 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.cxx @@ -16,132 +16,16 @@ using eformat::helper::SourceIdentifier; // Jan-16-2003, BNL -RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_rpcCondData(nullptr), m_rpcIdHelper(nullptr), m_specialROBNumber(-1) { +RPC_Hid2RESrcID::RPC_Hid2RESrcID(): m_rpcIdHelper(nullptr), m_specialROBNumber(-1) { } RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_rpcIdHelper(nullptr), m_specialROBNumber(specialROBNumber) { } -void RPC_Hid2RESrcID::set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId) { - m_rpcCondData=readCdo; - m_rpcIdHelper=rpdId; -} void RPC_Hid2RESrcID::set(const RpcIdHelper* rpdId) { m_rpcIdHelper=rpdId; } -std::vector RPC_Hid2RESrcID::getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { - - // this method returns a vector of rod IDs , for a - // given RPC collection offline ID - // An RpcDigitCollection can correspond to more than a single Rod Id - - std::vector rodIDs; - - // Identifier elements - int name = 0; - int eta = 0; - int phi = 0; - int doublet_r = 0; - int doublet_z = 0; - int doublet_phi = 0; - int gas_gap = 0; - int measures_phi = 0; - int strip = 0; - - // loop over side, sector logic and pad Id to find the correct pad! - - const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); - - RpcCablingCondData::RDOmap::const_iterator pad_beg = (pad_map).begin(); - RpcCablingCondData::RDOmap::const_iterator pad_end = (pad_map).end(); - - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Looking for collection ID: " + std::string(m_rpcIdHelper->show_to_string(offlineId)) <stationName(offlineId); - int stationEta = m_rpcIdHelper->stationEta(offlineId); - int stationPhi = m_rpcIdHelper->stationPhi(offlineId); - bool addRod; - - - for (; pad_beg!=pad_end; ++pad_beg) { - - RDOindex index = (*pad_beg).second; - index.offline_indexes(name, eta, phi, doublet_r, - doublet_z, doublet_phi, gas_gap, - measures_phi, strip); - - if ( (stationEta == eta && stationPhi == phi) || - (stationName==10 && stationEta==0 && abs(eta)==1 && stationPhi == phi) ) { - uint8_t rodIndex = (uint8_t) index.RODid(); - uint16_t side = index.side(); - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) <<"In getRODIdFromCollID .. The side is 0x" - << MSG::hex << side - << MSG::dec <::const_iterator rod_it = rodIDs.begin(); - for ( ; rod_it != rodIDs.end() ; ++rod_it) - { - if ( rodId == (*rod_it) ) - addRod = false; - } - - if (addRod) { - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a RodId for this collection : 0x" - << MSG::hex - << rodId - << MSG::dec <show_to_string(offlineId) << endmsg; - } - - // FIXME Temp Fix for sector13 test data - if ( (m_specialROBNumber>0) ) { - if (stationPhi==7 && stationEta>0 && stationEta<4 && (stationName==2 || stationName==4) ) { - - rodIDs.clear(); - rodIDs.push_back(m_specialROBNumber); - - if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Setting the special ROB Number: " - << MSG::hex - << m_specialROBNumber - << MSG::dec - << " for this collection" <0 && (stationName==2 || stationName==4) ) { - rodIDs.clear(); - rodIDs.push_back(0x650001); - rodIDs.push_back(0x650002); - } - else { - rodIDs.clear(); - rodIDs.push_back(0xffffffff); - } - } - - - return rodIDs; -} - // This method is used by the RDO converter only uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId, const RpcCablingCondData* readCdo) { @@ -206,11 +90,8 @@ uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId, const RpcCabling } -uint32_t RPC_Hid2RESrcID::getRodID(const int& side, const int& slogic, - const int& padId, const RpcCablingCondData* readCdo) { - +uint32_t RPC_Hid2RESrcID::getRodID(const int& side, const int& slogic, const int& padId, const RpcCablingCondData* readCdo) { // this method returns a RESrcID for the ROD, for a given RPC pad ID - const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); int key = side*10000+slogic*100+padId; RDOindex index = (*pad_map.find(key)).second; @@ -226,9 +107,7 @@ uint32_t RPC_Hid2RESrcID::getRodID(const int& side, const int& slogic, } uint32_t RPC_Hid2RESrcID::getRodID(const int& sector) { - // this method returns a RESrcID for the ROD, for a given RPC pad ID - uint8_t rodIndex = (uint8_t) ((sector%32)/2); int side = (sector < 32) ? 0:1; @@ -242,82 +121,33 @@ uint32_t RPC_Hid2RESrcID::getRodID(const int& sector) { } uint32_t RPC_Hid2RESrcID::getRodID(const uint16_t& side, const uint16_t& rodIndex) { - // this method returns a RESrcID for the ROD, for a given RPC pad ID - - eformat::SubDetector detid = (side == 1) ? eformat::MUON_RPC_BARREL_A_SIDE - : eformat::MUON_RPC_BARREL_C_SIDE ; - + eformat::SubDetector detid = (side == 1) ? eformat::MUON_RPC_BARREL_A_SIDE : eformat::MUON_RPC_BARREL_C_SIDE ; SourceIdentifier sid(detid,rodIndex); uint32_t rod_id = sid.code(); - return rod_id; } -/** mapping SrcID from ROD to ROB +/** mapping SrcID from ROD to ROB (called in ByteStreamCnvSvcBase/FullEventAssembler.icc) */ -uint32_t RPC_Hid2RESrcID::getRobID( uint32_t rod_id) { - +uint32_t RPC_Hid2RESrcID::getRobID(const uint32_t rod_id) { return rod_id; - //return 1; } /** mapping SrcID from ROB to ROS */ -uint32_t RPC_Hid2RESrcID::getRosID( uint32_t rob_id) { +uint32_t RPC_Hid2RESrcID::getRosID(const uint32_t rob_id) { // Change Module Type to ROS, moduleid = 0 SourceIdentifier id (rob_id); SourceIdentifier id2(id.subdetector_id(),0); return id2.code(); - } /** mapping SrcID from ROS to Det */ -uint32_t RPC_Hid2RESrcID::getDetID ( uint32_t ros_id) { +uint32_t RPC_Hid2RESrcID::getDetID(const uint32_t ros_id) { // ROS to DET - SourceIdentifier id (ros_id); SourceIdentifier id2(id.subdetector_id(),0); return id2.code(); } - -uint16_t RPC_Hid2RESrcID::findRODid(uint16_t side, uint16_t slogic, - uint16_t padId, const RpcCablingCondData* readCdo) { - const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); - int key = side*10000 + slogic*100 + padId; - RDOindex index = (*pad_map.find(key)).second; - uint16_t rodId = (uint16_t) index.RODid(); - return rodId; -} - - -Identifier RPC_Hid2RESrcID::findPadOfflineId(uint16_t side, uint16_t slogic, - uint16_t padId, const RpcCablingCondData* readCdo) { - - // Identifier elements - int name = 0; - int eta = 0; - int phi = 0; - int doublet_r = 0; - int doublet_z = 0; - int doublet_phi = 0; - int gas_gap = 0; - int measures_phi = 0; - int strip = 0; - - const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs(); - int key = side*10000 + slogic*100 + padId; - RDOindex index = (*pad_map.find(key)).second; - index.offline_indexes(name, eta, phi, doublet_r, - doublet_z, doublet_phi, gas_gap, - measures_phi, strip); - - // Build the identifier - Identifier id = m_rpcIdHelper->padID(name, eta, phi, doublet_r, doublet_z, doublet_phi); - - return id; - -} - - diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h index 4c8fbe23b9d..608e5dd4150 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_Hid2RESrcID.h @@ -5,7 +5,6 @@ #ifndef __RPC_HID2RESRCID__ #define __RPC_HID2RESRCID__ - #include "AthenaKernel/MsgStreamMember.h" #include "GaudiKernel/StatusCode.h" @@ -15,42 +14,32 @@ #include #include - class RPC_Hid2RESrcID { public: - RPC_Hid2RESrcID (); + RPC_Hid2RESrcID(); - RPC_Hid2RESrcID (int specialROBNumber); + RPC_Hid2RESrcID (int specialROBNumber); - void set(const RpcCablingCondData* readCdo, const RpcIdHelper* rpdId); void set(const RpcIdHelper* rpdId); - std::vector getRodIDFromCollID(const Identifier& offlineId, const RpcCablingCondData* readCdo); - uint32_t getRodID(const Identifier& offlineId, const RpcCablingCondData* readCdo); + uint32_t getRodID(const int& side, const int& slogic, const int& padId, const RpcCablingCondData* readCdo); + uint32_t getRodID(const int& sector); + uint32_t getRodID(const uint16_t& side, const uint16_t& rodIndex); - uint32_t getRodID (const int& side, const int& slogic, const int& padId, const RpcCablingCondData* readCdo); - uint32_t getRodID (const int& sector); - uint32_t getRodID (const uint16_t& side, const uint16_t& rodIndex); + uint32_t getRobID(const uint32_t rod_id); - uint32_t getRobID ( uint32_t rod_id); - - uint32_t getRosID ( uint32_t rob_id); - - uint32_t getDetID ( uint32_t ros_id); - - uint16_t findRODid(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); + uint32_t getRosID(const uint32_t rob_id); - Identifier findPadOfflineId(uint16_t side, uint16_t slogic, uint16_t padId, const RpcCablingCondData* readCdo); + uint32_t getDetID(const uint32_t ros_id); - MsgStream & msg(MSG::Level lvl) const { return m_msg << lvl;}; + MsgStream& msg(MSG::Level lvl) const { return m_msg << lvl;}; bool msgLevel (MSG::Level lvl) { return m_msg.get().level() <= lvl;}; -private: - const RpcCablingCondData* m_rpcCondData; +private: const RpcIdHelper* m_rpcIdHelper; int m_specialROBNumber; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx index de17406cc86..5f92bc36912 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.cxx @@ -29,17 +29,13 @@ Muon::RpcPadContByteStreamTool::RpcPadContByteStreamTool StatusCode Muon::RpcPadContByteStreamTool::initialize() { ATH_CHECK(AlgTool::initialize()); ATH_CHECK(m_readKey.initialize()); - ATH_CHECK(m_idHelperSvc.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); + m_hid2re.set(&m_idHelperSvc->rpcIdHelper()); return StatusCode::SUCCESS; } StatusCode Muon::RpcPadContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re) { - // SG::ReadCondHandle readHandle{m_readKey}; - // const RpcCablingCondData* readCdo{*readHandle}; - // m_hid2re.set(readCdo, &m_idHelperSvc->rpcIdHelper()); - m_hid2re.set(&m_idHelperSvc->rpcIdHelper()); m_fea.clear(); - // m_fea.idMap().set(readCdo, &m_idHelperSvc->rpcIdHelper()); m_fea.idMap().set(&m_idHelperSvc->rpcIdHelper()); FullEventAssembler::RODDATA* theROD; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h index c9e75dd155b..c7aa1c2ea45 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcPadContByteStreamTool.h @@ -17,7 +17,7 @@ #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" -class RpcPadContainer; +class RpcPadContainer; #include @@ -55,7 +55,7 @@ public: StatusCode convert(CONTAINER* cont, RawEventWrite* re); -private: +private: SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; RPC_Hid2RESrcID m_hid2re; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; -- GitLab From ce782d5b316eabc9359477c410d2a162d01a020d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Thu, 9 Apr 2020 12:10:59 +0200 Subject: [PATCH 26/26] check if trigger tests are working --- .../MuonJiveXML/TrigRpcDataRetriever.h | 10 +- .../MuonJiveXML/src/TrigRpcDataRetriever.cxx | 58 +++---- .../RPC_CondCabling/RpcCablingCondData.h | 5 +- .../src/RpcCablingCondData.cxx | 27 ++-- .../RpcLv1RawDataValAlg.h | 29 +--- .../src/RpcLv1RawDataValAlg.cxx | 82 +++------- .../TrigL2MuonSA/CMakeLists.txt | 2 +- .../TrigL2MuonSA/MuCalStreamerTool.h | 19 +-- .../TrigL2MuonSA/RpcDataPreparator.h | 28 +--- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 51 ++---- .../TrigL2MuonSA/src/RpcDataPreparator.cxx | 35 ++-- .../TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h | 8 +- .../TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx | 35 ++-- .../TrigT1RPCsteering/TrigT1RPC.h | 28 ++-- .../TrigT1RPCsteering/src/TrigT1RPC.cxx | 149 +++++++----------- 15 files changed, 198 insertions(+), 368 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h index 9b34b138bb9..bba7333ba8e 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef JIVEXML_TRIGRPCDATARETRIEVER_H @@ -14,8 +14,8 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" @@ -23,6 +23,7 @@ #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" +class IRPCcablingSvc; namespace JiveXML { @@ -50,11 +51,10 @@ namespace JiveXML { ///The storegate key for the CSC collection std::string m_sgKey; - /// Tool for RPC identifier helper - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + const IRPCcablingSvc *m_rpcCabling; + SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; /// RPC decoder diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx index 8556ea633b4..b03ae910adb 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx @@ -1,21 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonJiveXML/TrigRpcDataRetriever.h" -#include -#include +#include +#include #include "MuonJiveXML/MuonFullIDHelper.h" - #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonRDO/RpcPadContainer.h" #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" +#include "RPCcablingInterface/IRPCcablingServerSvc.h" + namespace JiveXML { //-------------------------------------------------------------------------- @@ -25,9 +26,7 @@ namespace JiveXML { m_typeName("RPC"), // same datatype name as RPC ! Must not be run together m_rpcDecoder("Muon::RpcRDO_Decoder") { - declareInterface(this); - declareProperty("StoreGateKey", m_sgKey = "RPCPAD", "StoreGate key for the RPC RDO container" ); } @@ -35,25 +34,14 @@ namespace JiveXML { StatusCode TrigRpcDataRetriever::initialize(){ - StatusCode sc=m_muonIdHelperTool.retrieve(); - if (sc.isFailure()) - { - if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not retrieve MuonIdHelperTool!" << endmsg; - return StatusCode::FAILURE; - } + const IRPCcablingServerSvc* RpcCabGet; + ATH_CHECK(service("RPCcablingServerSvc", RpcCabGet)); + ATH_CHECK(RpcCabGet->giveCabling(m_rpcCabling)); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_readKey.initialize()); - - /// retrieve the RPC RDO decoder - if (m_rpcDecoder.retrieve().isFailure()) { - msg(MSG::ERROR) << "Failed to retrieve " << m_rpcDecoder << endmsg; - return StatusCode::FAILURE; - } else - msg(MSG::INFO) << "Retrieved Tool " << m_rpcDecoder << endmsg; - + ATH_CHECK(m_rpcDecoder.retrieve()); ATH_CHECK(m_DetectorManagerKey.initialize()); - return StatusCode::SUCCESS; } @@ -116,8 +104,8 @@ namespace JiveXML { //loop on pad - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; + /*SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle};*/ const DataHandle itColl(firstRdoColl); for (; itColl!=lastRdoColl; ++itColl){ if ( itColl->size() == 0 ) continue; @@ -166,28 +154,24 @@ namespace JiveXML { std::vector* digitVec = m_rpcDecoder->getOfflineData(rpcChan, sectorId, padId, cmaId, time); // Loop on the digits corresponding to the fired channel ///// following still unused - //std::vector::iterator itVec = digitVec->begin(); - //std::vector::iterator itVec_e = digitVec->end(); - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of digits: " << digitVec->size()<< endmsg; // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; uint16_t sl = sectorId-side*32 ; - std::list stripList = readCdo->give_strip_id(side,sl,padId,cmaId,rpcChan->ijk(),rpcChan->channel(), m_idHelperSvc); + std::list stripList = m_rpcCabling->give_strip_id(side,sl,padId,cmaId,rpcChan->ijk(),rpcChan->channel()); std::list::const_iterator it_list; for (it_list=stripList.begin() ; it_list != stripList.end() ; ++it_list) { Identifier stripOfflineId = *it_list; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId " << m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId)<< endmsg; + if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId)<< endmsg; const MuonGM::RpcReadoutElement* element = MuonDetMgr->getRpcReadoutElement(stripOfflineId); char ChID[100]; snprintf(ChID, 100, "SL%d-Pad%d-CM%d-ijk%d-ch%d-time%d",sectorId,padId,cmaId, rpcChan->ijk(),rpcChan->channel(),8*rpcChan->bcid()+rpcChan->time()); - // HepGeom::Point3D globalPos = element->stripPos(stripOfflineId); Amg::Vector3D globalPos = element->stripPos(stripOfflineId); - int measuresPhi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(stripOfflineId); + int measuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(stripOfflineId); double stripLength = element->StripLength(measuresPhi); double stripWidth = element->StripWidth(measuresPhi); @@ -197,7 +181,7 @@ namespace JiveXML { lengthVec.push_back(DataType(stripLength/CLHEP::cm)); widthVec.push_back(DataType(stripWidth/CLHEP::cm)); identifierVec.push_back(DataType(ChID)); - idVec.push_back(DataType( m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId) )); + idVec.push_back(DataType( m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId) )); barcode.push_back(DataType(0)); } delete digitVec; @@ -216,20 +200,17 @@ namespace JiveXML { //write confirm hits std::vector* digitVec1 = m_rpcDecoder->getOfflineData(rpcChan1, sectorId, padId, cmaId, time1); // Loop on the digits corresponding to the fired channel - //////// following still unused - // std::vector::iterator itVec1 = digitVec1->begin(); - // std::vector::iterator itVec_e1 = digitVec1->end(); if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of digits: " << digitVec1->size()<< endmsg; // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; uint16_t sl = sectorId-side*32 ; - std::list stripList1 = readCdo->give_strip_id(side,sl,padId,cmaId,rpcChan1->ijk(),rpcChan1->channel(), m_idHelperSvc); + std::list stripList1 = m_rpcCabling->give_strip_id(side,sl,padId,cmaId,rpcChan1->ijk(),rpcChan1->channel()); std::list::const_iterator it_list1; for (it_list1=stripList1.begin() ; it_list1 != stripList1.end() ; ++it_list1) { Identifier stripOfflineId1 = *it_list1; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId1 " << m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId1)<< endmsg; + if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId1 " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId1)<< endmsg; const MuonGM::RpcReadoutElement* element1 = MuonDetMgr->getRpcReadoutElement(stripOfflineId1); @@ -237,9 +218,8 @@ namespace JiveXML { snprintf(ChID1,100, "SL%d-Pad%d-CM%d-ijk%d-ch%d-time%d",sectorId,padId,cmaId, rpcChan1->ijk(),rpcChan1->channel(),8*rpcChan1->bcid()+rpcChan1->time()); - // HepGeom::Point3D globalPos1 = element1->stripPos(stripOfflineId1); Amg::Vector3D globalPos1 = element1->stripPos(stripOfflineId1); - int measuresPhi1 = m_muonIdHelperTool->rpcIdHelper().measuresPhi(stripOfflineId1); + int measuresPhi1 = m_idHelperSvc->rpcIdHelper().measuresPhi(stripOfflineId1); double stripLength1 = element1->StripLength(measuresPhi1); double stripWidth1 = element1->StripWidth(measuresPhi1); @@ -249,7 +229,7 @@ namespace JiveXML { lengthVec.push_back(DataType(stripLength1/CLHEP::cm)); widthVec.push_back(DataType(stripWidth1/CLHEP::cm)); identifierVec.push_back(DataType(ChID1)); - idVec.push_back(DataType( m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId1) )); + idVec.push_back(DataType( m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId1) )); barcode.push_back(DataType(0)); } delete digitVec1; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h index 51ffecaaa04..b3304319459 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondData.h @@ -18,8 +18,7 @@ #include "RPC_CondCabling/RPCPadParameters.h" #include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" - +#include "MuonIdHelpers/RpcIdHelper.h" class RpcCablingCondData{ @@ -72,7 +71,7 @@ class RpcCablingCondData{ unsigned short int CMAId, unsigned short ijk, unsigned short int Channel, - const ServiceHandle idHelperSvc ) const; + const RpcIdHelper* rpcId ) const; const CMAparameters::CMAlist give_CMAs(const int logic_sector,const ViewType side, const int station,const int cabling_code) const; unsigned long int strip_code_fromOffline (int etaPhiView, int logicSector, int cablingStation, int gasGap, int zIndexInCablingStation, int strip) const; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx index 5ac474324aa..a02ae192f4b 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondData.cxx @@ -327,7 +327,7 @@ std::list RpcCablingCondData::give_strip_id(unsigned short int Subsy unsigned short int CMAId, unsigned short ijk, unsigned short int Channel, - const ServiceHandle idHelperSvc ) const + const RpcIdHelper* rpcId ) const { std::list CodeList; @@ -386,25 +386,24 @@ std::list RpcCablingCondData::give_strip_id(unsigned short int Subsy ++it; } - - std::list id; + std::list ids; std::list::const_iterator iterator = offlineIdList.begin(); while(iterator != offlineIdList.end()) { - Identifier rpcId = idHelperSvc->rpcIdHelper().channelID((*iterator).stationName, - (*iterator).stationEta, - (*iterator).stationPhi, - (*iterator).doubletR, - (*iterator).doubletZ, - (*iterator).doubletPhi, - (*iterator).gasGap, - (*iterator).measuresPhi, - (*iterator).strip); - id.push_back(rpcId); + Identifier id = rpcId->channelID((*iterator).stationName, + (*iterator).stationEta, + (*iterator).stationPhi, + (*iterator).doubletR, + (*iterator).doubletZ, + (*iterator).doubletPhi, + (*iterator).gasGap, + (*iterator).measuresPhi, + (*iterator).strip); + ids.push_back(id); ++iterator; } - return id; + return ids; } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h index 1b3a194d8e6..51e881c2f52 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////////////////////// // Package : RpcRawDataMonitoring @@ -48,15 +48,12 @@ #include "StoreGate/ReadHandleKey.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include #include #include #include class TFile; -class RpcIdHelper; template class AlgFactory; ///////////////////////////////////////////////////////////////////////////// @@ -65,30 +62,22 @@ class RpcLv1RawDataValAlg: public ManagedMonitorToolBase { public: RpcLv1RawDataValAlg ( const std::string & type, const std::string & name, const IInterface* parent ); - virtual ~RpcLv1RawDataValAlg(); + virtual ~RpcLv1RawDataValAlg()=default; StatusCode initialize(); virtual StatusCode bookHistogramsRecurrent(); virtual StatusCode fillHistograms(); virtual StatusCode procHistograms(); - StatusCode finalize(); private: - - // Private function to add the clusters to the ntuple - // StatusCode addClusters(std::string clusterContainerName); - - // Functions declaration - + //Function for histogram booking and parameterd for fitting - StatusCode bookRPCLV1cmatimevschHistograms(std::string m_sectorlogic_name, std::string m_tower_name, std::string m_cma_name); + StatusCode bookRPCLV1cmatimevschHistograms(std::string m_sectorlogic_name, std::string m_tower_name, std::string m_cma_name); StatusCode bookRPCLV1TriggerRoadHistograms(std::string m_sectorlogic_name, std::string m_tower_name, std::string m_cma_name, std::string m_thr_name); StatusCode bookRPCLV1ProfilesHistograms(int m_i_sector, std::string m_sectorlogic_name, std::string m_cma_name, int m_i_ijk, std::string m_ijk_name) ; - MuonDQAHistMap m_stationHists; - StatusCode StoreTriggerType(); int GetTriggerType() { return m_trigtype; } int m_trigtype; @@ -115,21 +104,15 @@ class RpcLv1RawDataValAlg: public ManagedMonitorToolBase { "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - - //Declare Properties - - // cool + void bookRPCCoolHistograms(std::vector::const_iterator &m_iter, int, int, std::string m_layer); - bool m_doCoolDB ; + bool m_doCoolDB; std::string m_chamberName; std::string m_StationSize; - //std::string m_key_rpc; int m_StationEta; int m_StationPhi; int m_lastEvent; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx index 15fb22368f7..4d89bdfbc10 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx @@ -51,12 +51,6 @@ RpcLv1RawDataValAlg::RpcLv1RawDataValAlg( const std::string & type, const std::s declareProperty("doCoolDB", m_doCoolDB = false ); } -RpcLv1RawDataValAlg::~RpcLv1RawDataValAlg() -{ - - ATH_MSG_INFO ( " deleting RpcLv1RawDataValAlg " ); -} - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode RpcLv1RawDataValAlg::initialize() @@ -83,7 +77,6 @@ StatusCode RpcLv1RawDataValAlg::initialize() // MuonDetectorManager from the conditions store ATH_CHECK(m_DetectorManagerKey.initialize()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_readKey.initialize()); @@ -677,7 +670,7 @@ if ( m_doCoolDB ) { SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the online identifier - std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, m_idHelperSvc); + std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, &m_idHelperSvc->rpcIdHelper()); std::list::const_iterator it_list; for (it_list=idList.begin() ; it_list != idList.end() ; ++it_list) { @@ -699,11 +692,11 @@ if ( m_doCoolDB ) { // // - std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; + std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0) ; std::string sector_dphi_layer = rpclayersectorsidename[12] ; - std::vector RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); - int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile + std::vector RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0); + int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile if ( m_doCoolDB ) { TH1* rpcCool_StripProfile = nullptr; if(cmaId==0||cmaId==2||cmaId==4||cmaId==6)sc = rpcCoolDb.getHist( rpcCool_StripProfile, sector_dphi_layer+"_ProfileDataCMeven" ) ; @@ -1499,33 +1492,18 @@ StatusCode RpcLv1RawDataValAlg::bookHistogramsRecurrent() SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; // Get the list of offline channels corresponding to the online identifier - std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, m_idHelperSvc); + std::list idList = readCdo->give_strip_id(side, slogic, padId, cmaId, ijk, channel, &m_idHelperSvc->rpcIdHelper()); std::list::const_iterator it_list; for (it_list=idList.begin() ; it_list != idList.end() ; ++it_list) { // and add the digit to the collection Identifier prdcoll_id = *it_list; - - // // RPC digits do not hold anymore time of flight : digit time (and RDO time) is TOF subtracted - // // recalculate the time of flight in case it was not in the RDOs - // if (time==0) { - // // get the digit position - // const MuonGM::RpcReadoutElement* descriptor = - // MuonDetMgr->getRpcReadoutElement(stripOfflineId); - // - // const HepGeom::Point3D stripPos = descriptor->stripPos(stripOfflineId); - // // TEMP : set the time of flight from the digit position - // // temporary solution - // time = static_cast ( stripPos.distance()/(299.7925*CLHEP::mm/CLHEP::ns) ); - // - // - - std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; + std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0) ; std::string sector_dphi_layer = rpclayersectorsidename[12] ; - std::vector RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); - int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile + std::vector RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0); + int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile if ( m_doCoolDB ) { TH1* rpcCool_PanelIdHist = nullptr; sc = rpcCoolDb.getHist( rpcCool_PanelIdHist, sector_dphi_layer+"_ProfileCabling" ) ; @@ -1808,14 +1786,14 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector::const if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; } rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),idr, 0) ; NTotStripsSideC = rpcstripshift[7]+rpcstripshift[18]; } @@ -1859,21 +1837,21 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector::const if ( iz+1 != rpc->getDoubletZ() ) { continue ; } - Identifier idr = m_muonIdHelperTool->rpcIdHelper().parentID( rpc->identify() ); + Identifier idr = m_idHelperSvc->rpcIdHelper().parentID( rpc->identify() ); rpcElemPhiStrip = int (rpc->NphiStrips() ) ; rpcElemEtaStrip = int (rpc->NetaStrips() ) ; for ( int istripEta=0; istripEta!=rpcElemEtaStrip; istripEta++ ) { - Identifier strip_id = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 0, istripEta+1) ; + Identifier strip_id = m_idHelperSvc->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 0, istripEta+1) ; if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),strip_id, 0)).at(16); rpcCool_PanelIdHist->Fill(coolStripIndex, -1) ; } for ( int istripPhi=0; istripPhi!=rpcElemPhiStrip; istripPhi++ ) { - Identifier strip_id = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 1, istripPhi+1) ; + Identifier strip_id = m_idHelperSvc->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 1, istripPhi+1) ; if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),strip_id, 0)).at(16); rpcCool_PanelIdHist->Fill(coolStripIndex, -1 ); } @@ -1884,34 +1862,10 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector::const } // end loop on stationeta } // end fill cool histograms with panelId - - -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - +} -StatusCode RpcLv1RawDataValAlg::procHistograms() -{ - - ATH_MSG_DEBUG ( "RpcLv1RawDataValAlg finalize()" ); +StatusCode RpcLv1RawDataValAlg::procHistograms() { + ATH_MSG_DEBUG ("RpcLv1RawDataValAlg procHistograms()"); return StatusCode::SUCCESS; } - -//======================================================================================// -/** finalize */ -//======================================================================================// -StatusCode RpcLv1RawDataValAlg::finalize() -{ - - StatusCode sc = ManagedMonitorToolBase::finalize(); - if(!sc.isSuccess()) return sc; - - - ATH_MSG_DEBUG ( "RpcLv1RawDataValAlg::finalize() " ); - - - return sc; -} diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt index eec61e63820..32fce2b7abf 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt @@ -59,7 +59,7 @@ atlas_add_library( TrigL2MuonSALib src/*.cxx PUBLIC_HEADERS TrigL2MuonSA INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib RPC_CondCablingLib) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib ) atlas_add_component( TrigL2MuonSA src/*.cxx diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h index f7b2589294b..3b1946f1aee 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_MUCALSTREAMERTOOL_H @@ -15,7 +15,7 @@ #include "TrigL2MuonSA/TrackData.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" -// #include "RPCcablingInterface/IRPCcablingServerSvc.h" +#include "RPCcablingInterface/IRPCcablingServerSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" // #include "MuonRPC_Cabling/MuonRPC_CablingSvc.h" #include "RPC_CondCabling/RpcCablingCondData.h" @@ -24,12 +24,6 @@ #include "MuonRDO/TgcRdoContainer.h" #include "StoreGate/ReadHandleKey.h" -//#include "TGCcablingInterface/ITGCcablingServerSvc.h" -//#include "TGCcablingInterface/ITGCcablingSvc.h" -//#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" - -///////////////////////////////////////////////////////////// - #include #include #include @@ -71,7 +65,7 @@ namespace TrigL2MuonSA { const std::string& name, const IInterface* parent); - ~MuCalStreamerTool(); + ~MuCalStreamerTool()=default; virtual StatusCode initialize(); virtual StatusCode finalize (); @@ -120,16 +114,11 @@ namespace TrigL2MuonSA { // the region selector ServiceHandle m_regionSelector; - - // // RPC cabling service + // const IRPCcablingSvc* m_rpcCabling; // const CablingRPCBase* m_rpcCablingSvc; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - // tgc cabling maps - // const ITGCcablingSvc* m_tgcCabling; - // const TGCCablingBase* m_tgcCablingSvc; - // ROB DataProvider ServiceHandle m_robDataProvider; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h index 839222fe757..dc225aca802 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_RPCDATAPREPARATOR_H @@ -20,8 +20,7 @@ #include "RegionSelector/IRegSelSvc.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/RpcIdHelper.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" @@ -32,22 +31,10 @@ #include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" - - -class ActiveStoreSvc; - -namespace HLT { - class TriggerElement; - class Algo; -} - -namespace MuonGM { - class MuonDetectorManager; - class RpcReadoutElement; -} +// #include "MuonRPC_Cabling/MuonRPC_CablingSvc.h" +// #include "RPCcablingInterface/IRPCcablingServerSvc.h" // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -78,9 +65,10 @@ class RpcDataPreparator: public AthAlgTool ServiceHandle m_regionSelector; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - // Muon Id Helpers - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + // const IRPCcablingSvc* m_rpcCabling; + // const CablingRPCBase* m_rpcCablingSvc; + + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // handles to the RoI driven data access ToolHandle m_rawDataProviderTool{ diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 905ff47bbcd..7a02fa025c4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/MuCalStreamerTool.h" @@ -21,8 +21,6 @@ #include "circ/Circ.h" #include "circ/Circservice.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "CxxUtils/checker_macros.h" // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -49,23 +47,10 @@ TrigL2MuonSA::MuCalStreamerTool::MuCalStreamerTool(const std::string& type, // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -TrigL2MuonSA::MuCalStreamerTool::~MuCalStreamerTool() -{ -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - StatusCode TrigL2MuonSA::MuCalStreamerTool::initialize() { - StatusCode sc; - sc = AthAlgTool::initialize(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR("Could not initialize the AthAlgTool base class."); - return sc; - } - - // // Retrieve the RPC cabling service + ATH_CHECK(AthAlgTool::initialize()); + // ServiceHandle RpcCabGet ("RPCcablingServerSvc", name()); // ATH_CHECK( RpcCabGet.retrieve() ); // ATH_CHECK( RpcCabGet->giveCabling(m_rpcCabling) ); @@ -73,25 +58,7 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::initialize() // if ( !m_rpcCablingSvc ) { // ATH_MSG_ERROR("Could not retrieve the RPC cabling svc"); // return StatusCode::FAILURE; - // } - - // retrieve the TGC cabling svc - // ServiceHandle TgcCabGet ("TGCCablingServerSvc", name()); - // sc = TgcCabGet.retrieve(); - // if ( sc != StatusCode::SUCCESS ) { - // ATH_MSG_ERROR("Could not retrieve the TGC cabling service"); - // return StatusCode::FAILURE; - // } - // sc = TgcCabGet->giveCabling(m_tgcCabling); - // if ( sc != StatusCode::SUCCESS ) { - // ATH_MSG_ERROR("Could not retrieve the TGC Cabling Server"); - // return sc; // } - // m_tgcCablingSvc = m_tgcCabling->getTGCCabling(); - //if ( !m_tgcCablingSvc ) { - // ATH_MSG_ERROR("Could not retrieve the TGC cabling svc"); - // return StatusCode::FAILURE; - //} // locate the region selector ATH_CHECK( m_regionSelector.retrieve() ); @@ -528,17 +495,17 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::createRpcFragment(const LVL1::RecMuo Identifier padId; // retrieve the pad container - const RpcPadContainer* rpcPadContainer; - StatusCode sc = evtStore()->retrieve(rpcPadContainer,"RPCPAD"); - if ( sc != StatusCode::SUCCESS ) { - ATH_MSG_ERROR("Could not retrieve the "); - return sc; - } + const RpcPadContainer* rpcPadContainer=nullptr; + ATH_CHECK(evtStore()->retrieve(rpcPadContainer,"RPCPAD")); unsigned int padIdHash; SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; + // unsigned int logic_sector; + // unsigned short int PADId; + // if ( m_rpcCablingSvc->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if (readCdo->give_PAD_address( side, sector, roiNumber, padIdHash)) { RpcPadContainer::const_iterator itPad = rpcPadContainer->indexFind(padIdHash); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx index 27b06a6268b..0daad73fa12 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include @@ -9,7 +9,6 @@ #include "TrigL2MuonSA/RpcData.h" #include "TrigL2MuonSA/RecMuonRoIUtils.h" -#include "Identifier/IdentifierHash.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "CxxUtils/phihelper.h" @@ -45,8 +44,8 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::initialize() ATH_CHECK( m_rpcPrepDataProvider.retrieve(DisableTool{!m_doDecoding}) ); ATH_MSG_DEBUG("Retrieved " << m_rpcPrepDataProvider); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_MSG_DEBUG("Retrieved " << m_muonIdHelperTool); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_MSG_DEBUG("Retrieved " << m_idHelperSvc); // Retreive PRC raw data provider tool ATH_MSG_DEBUG("Decode BS set to " << m_decodeBS); @@ -54,6 +53,15 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::initialize() ATH_CHECK( m_rawDataProviderTool.retrieve(DisableTool{ !m_decodeBS || !m_doDecoding }) ); ATH_MSG_DEBUG("Retrieved Tool " << m_rawDataProviderTool); + // ServiceHandle RpcCabGet ("RPCcablingServerSvc", name()); + // ATH_CHECK( RpcCabGet.retrieve() ); + // ATH_CHECK( RpcCabGet->giveCabling(m_rpcCabling) ); + // m_rpcCablingSvc = m_rpcCabling->getRPCCabling(); + // if ( !m_rpcCablingSvc ) { + // ATH_MSG_ERROR("Could not retrieve the RPC cabling svc"); + // return StatusCode::FAILURE; + // } + ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_rpcPrepContainerKey.initialize()); @@ -97,6 +105,11 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; unsigned int padIdHash; + + // unsigned int logic_sector; + // unsigned short int PADId; + // if ( !m_rpcCablingSvc->give_PAD_address( side, sector, roiNumber, logic_sector, PADId, padIdHash) ) { + if ( !readCdo->give_PAD_address( side, sector, roiNumber, padIdHash) ) { ATH_MSG_WARNING("Roi Number: " << roiNumber << " not compatible with side, sector: " << side << " " << sector << " (padIdHash=" << padIdHash << ")"); @@ -195,13 +208,13 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* const Identifier id = prd->identify(); - const int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(id); - const int doubletPhi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(id); - const int doubletZ = m_muonIdHelperTool->rpcIdHelper().doubletZ(id); - const int gasGap = m_muonIdHelperTool->rpcIdHelper().gasGap(id); - const bool measuresPhi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(id); - const int stationEta = m_muonIdHelperTool->rpcIdHelper().stationEta(id); - std::string stationName = m_muonIdHelperTool->rpcIdHelper().stationNameString(m_muonIdHelperTool->rpcIdHelper().stationName(id)); + const int doubletR = m_idHelperSvc->rpcIdHelper().doubletR(id); + const int doubletPhi = m_idHelperSvc->rpcIdHelper().doubletPhi(id); + const int doubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(id); + const int gasGap = m_idHelperSvc->rpcIdHelper().gasGap(id); + const bool measuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(id); + const int stationEta = m_idHelperSvc->rpcIdHelper().stationEta(id); + std::string stationName = m_idHelperSvc->rpcIdHelper().stationNameString(m_idHelperSvc->rpcIdHelper().stationName(id)); int layer = 0; // BO diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h index 30f3ffea823..b2de0a86bf1 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h @@ -13,6 +13,8 @@ #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +class IRPCcablingSvc; + namespace LVL1RPC { class RPCRecRoiSvc : public LVL1::RecMuonRoiSvc @@ -29,7 +31,7 @@ public: m_side(0), m_sector(0), m_roi(0), - m_MuonMgr(0) + m_MuonMgr(nullptr) {}; ~RPCRecRoiSvc()=default; @@ -63,9 +65,11 @@ private: mutable double m_phiMin, m_phiMax, m_etaMin, m_etaMax; mutable unsigned short int m_side, m_sector, m_roi; - const MuonGM::MuonDetectorManager * m_MuonMgr; + const MuonGM::MuonDetectorManager* m_MuonMgr; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; ServiceHandle m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + const IRPCcablingSvc* m_cabling; }; } // end of namespace diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx index 492f12cc380..3685d8f3054 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/src/RPCRecRoiSvc.cxx @@ -10,6 +10,8 @@ #include "StoreGate/StoreGateSvc.h" +#include "RPCcablingInterface/IRPCcablingServerSvc.h" + using namespace LVL1RPC; StatusCode RPCRecRoiSvc::initialize (void) @@ -17,13 +19,17 @@ StatusCode RPCRecRoiSvc::initialize (void) StoreGateSvc* detStore = nullptr; ATH_CHECK( service("DetectorStore",detStore) ); - m_MuonMgr = 0; ATH_CHECK( detStore->retrieve(m_MuonMgr) ); ATH_MSG_DEBUG( "Found the MuonDetDescrMgr " ); ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_idHelperSvc.retrieve()); + m_cabling = nullptr; + const IRPCcablingServerSvc* RpcCabGet = nullptr; + ATH_CHECK( service("RPCcablingServerSvc",RpcCabGet,1) ); + ATH_CHECK( RpcCabGet->giveCabling(m_cabling) ); + return StatusCode::SUCCESS; } @@ -61,13 +67,12 @@ void RPCRecRoiSvc::reconstruct (const unsigned int & roIWord) const Amg::Vector3D PhiLowBorder_pos(0.,0.,0.); Amg::Vector3D PhiHighBorder_pos(0.,0.,0.); - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; + /*SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle};*/ - if(readCdo->give_RoI_borders_id(m_side, m_sector, m_roi, + if(m_cabling->give_RoI_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, - PhiLowBorder_id, PhiHighBorder_id, - &m_idHelperSvc->rpcIdHelper())) + PhiLowBorder_id, PhiHighBorder_id)) { const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); @@ -206,12 +211,11 @@ bool RPCRecRoiSvc::etaDimLow (double& etaMin, double& etaMax) const Amg::Vector3D EtaLowBorder_pos(0.,0.,0.); Amg::Vector3D EtaHighBorder_pos(0.,0.,0.); - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - if( ! readCdo->give_LowPt_borders_id(m_side, m_sector, m_roi, + /*SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle};*/ + if(!m_cabling->give_LowPt_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, - PhiLowBorder_id, PhiHighBorder_id, - &m_idHelperSvc->rpcIdHelper())) return false; + PhiLowBorder_id, PhiHighBorder_id)) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); @@ -241,12 +245,11 @@ bool RPCRecRoiSvc::etaDimHigh (double& etaMin, double& etaMax) const Amg::Vector3D EtaLowBorder_pos(0.,0.,0.); Amg::Vector3D EtaHighBorder_pos(0.,0.,0.); - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - if(!readCdo->give_HighPt_borders_id(m_side, m_sector, m_roi, + /*SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle};*/ + if(!m_cabling->give_HighPt_borders_id(m_side, m_sector, m_roi, EtaLowBorder_id, EtaHighBorder_id, - PhiLowBorder_id, PhiHighBorder_id, - &m_idHelperSvc->rpcIdHelper())) return false; + PhiLowBorder_id, PhiHighBorder_id)) return false; const MuonGM::RpcReadoutElement* EtaLowBorder_descriptor = m_MuonMgr->getRpcReadoutElement(EtaLowBorder_id); diff --git a/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h b/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h index e0295e79e5e..4062288d177 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h +++ b/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h @@ -1,27 +1,20 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPCMuonTrigger_H #define RPCMuonTrigger_H -#include - #include "AthenaBaseComps/AthAlgorithm.h" - -#include "GaudiKernel/Property.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/INTupleSvc.h" #include "GaudiKernel/NTuple.h" -#include "GaudiKernel/ServiceHandle.h" - #include "StoreGate/DataHandle.h" -#include "Identifier/Identifier.h" #include "RPC_CondCabling/RpcCablingCondData.h" #include "StoreGate/ReadCondHandleKey.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrigT1RPClogic/RPCsimuData.h" #include "TrigT1RPClogic/CMAdata.h" @@ -29,14 +22,12 @@ #include "TrigT1RPClogic/SLdata.h" #include "TrigT1RPClogic/RPCbytestream.h" -//#include "TrigT1RPCmonitoring/TrigEfficiency.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonDigitContainer/RpcDigitContainer.h" #include "TrigT1Interfaces/Lvl1MuCTPIInput.h" #include "TrigT1Interfaces/Lvl1MuCTPIInputPhase1.h" -class RpcIdHelper; +#include "RPCcablingInterface/IRPCcablingServerSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -47,7 +38,6 @@ public: TrigT1RPC (const std::string& name, ISvcLocator* pSvcLocator); StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: IntegerProperty m_fast_debug{this,"FastDebug",0}; // bits for debugging "fast" algos @@ -81,13 +71,10 @@ private: BooleanProperty m_useRun3Config{this,"useRun3Config",false}; // flag for using switch between Run3 and Run2 configurations StatusCode fill_RPCdata(RPCsimuData&); - - private: - // ActiveStoreSvc* m_activeStore; - - const MuonGM::MuonDetectorManager* m_MuonMgr; - const RpcIdHelper* m_rpcId; + private: + const MuonGM::MuonDetectorManager* m_MuonMgr; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadCondHandleKey m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; @@ -95,6 +82,9 @@ private: SG::WriteHandleKey m_muctpiKey{this, "MuctpiLocationRPC", "L1MuctpiStoreRPC", "Location of muctpi for Rpc"}; SG::WriteHandleKey m_muctpiPhase1Key{this, "MuctpiPhase1LocationRPC", "L1MuctpiStoreRPC", "Location of muctpiPhase1 for Rpc"}; + ServiceHandle m_cabling_getter; + const IRPCcablingSvc* m_cabling; + }; diff --git a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx index 8275a9d837e..399321a8223 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx +++ b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigT1RPCsteering/TrigT1RPC.h" @@ -23,9 +23,6 @@ #include "MuonReadoutGeometry/RpcReadoutElement.h" -// next candidate for removal -//#include "TrigT1RPCmonitoring/DetailedTW.h" - #include "TrigT1RPChardware/SectorLogic.h" #include "TrigT1RPChardware/MatrixReadOut.h" @@ -38,11 +35,6 @@ #include #include - -using namespace std; - -//static double time_correction(double, double, double); - static int digit_num = 0; static int digit_out = 0; @@ -50,22 +42,23 @@ static int digit_out = 0; ///////////////////////////////////////////////////////////////////////////// TrigT1RPC::TrigT1RPC(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) -{ - m_MuonMgr=0; - m_rpcId=0; + AthAlgorithm(name, pSvcLocator), + m_MuonMgr(nullptr), + m_cabling_getter("RPCcablingServerSvc/RPCcablingServerSvc","TrigT1RPC"), + m_cabling(nullptr) { } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode TrigT1RPC::initialize(){ - - // MsgStream mylog(msgSvc(), name()); ATH_MSG_INFO("Initializing"); - CHECK (detStore()->retrieve( m_MuonMgr )); - m_rpcId = m_MuonMgr->rpcIdHelper(); + ATH_CHECK(detStore()->retrieve( m_MuonMgr )); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_cabling_getter.retrieve()); + ATH_CHECK(m_cabling_getter->giveCabling(m_cabling)); + ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_rpcDigitKey.initialize()); @@ -73,7 +66,7 @@ StatusCode TrigT1RPC::initialize(){ ATH_CHECK(m_muctpiPhase1Key.initialize(m_useRun3Config)); ATH_CHECK(m_muctpiKey.initialize(!m_useRun3Config)); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } @@ -91,30 +84,28 @@ StatusCode TrigT1RPC::execute() { CHECK(fill_RPCdata(data)); // fill the data with RPC simulated digts ATH_MSG_DEBUG( - "RPC data loaded from G3:" << endl - << ShowData(data,"",m_data_detail) << endl + "RPC data loaded from G3:" << std::endl + << ShowData(data,"",m_data_detail) << std::endl << "RPC digits into station 1 ==> " - << data.how_many(-1,-1,1,-1,-1,-1) << endl + << data.how_many(-1,-1,1,-1,-1,-1) << std::endl << "RPC digits into station 2 ==> " - << data.how_many(-1,-1,2,-1,-1,-1) << endl + << data.how_many(-1,-1,2,-1,-1,-1) << std::endl << "RPC digits into station 3 ==> " << data.how_many(-1,-1,3,-1,-1,-1) ); - - // exit(1); - // ******************** Start of Level-1 simulation section ***************** - unsigned long int debug; + unsigned long int debug; SG::ReadCondHandle readHandle{m_readKey}; const RpcCablingCondData* readCdo{*readHandle}; ///// Creates the CMA patterns from RPC digits ///////////////////////// debug = (m_hardware_emulation)? m_cma_debug : m_fast_debug; // - CMAdata patterns(&data,readCdo, debug); // + CMAdata patterns(&data,m_cabling,debug); + // CMAdata patterns(&data,readCdo, debug); // // - ATH_MSG_DEBUG ( "CMApatterns created from RPC digits:" << endl // + ATH_MSG_DEBUG ( "CMApatterns created from RPC digits:" << std::endl // << ShowData(patterns,"",m_data_detail) ); // //////////////////////////////////////////////////////////////////////// @@ -123,7 +114,7 @@ StatusCode TrigT1RPC::execute() { debug = (m_hardware_emulation)? m_pad_debug : m_fast_debug; // PADdata pads(&patterns,debug); // // - ATH_MSG_DEBUG ( "PADs created from CMA patterns:" << endl + ATH_MSG_DEBUG ( "PADs created from CMA patterns:" << std::endl << ShowData(pads,"",m_data_detail) ); //////////////////////////////////////////////////////////////////////// @@ -133,7 +124,7 @@ StatusCode TrigT1RPC::execute() { SLdata sectors(&pads,debug); // // ATH_MSG_DEBUG("Sector Logics created from PAD patterns:" // - << endl // + << std::endl // << ShowData(sectors,"",m_data_detail) ); // //////////////////////////////////////////////////////////////////////// @@ -249,7 +240,7 @@ StatusCode TrigT1RPC::execute() { //access to PadReadOut class and print the informations inside ATH_MSG_DEBUG ("Start dumping the PAD " << (*it).second.PAD() - << " bytestream structure" << endl + << " bytestream structure" << std::endl << PADdata.str()); //access to MatrixReadOut classes given in input to that PAD @@ -291,23 +282,11 @@ StatusCode TrigT1RPC::execute() { return StatusCode::SUCCESS; } -StatusCode TrigT1RPC::finalize() { - - - ATH_MSG_DEBUG ( "in finalize()" << endmsg - << "processed digits = " << digit_num << endmsg - << "digits out of the time window = " - << digit_out ); - - return StatusCode::SUCCESS; -} - StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) { std::string space = " "; - SG::ReadCondHandle readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle}; - + /*SG::ReadCondHandle readHandle{m_readKey}; + const RpcCablingCondData* readCdo{*readHandle};*/ ATH_MSG_DEBUG("in execute(): fill RPC data"); @@ -330,38 +309,29 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) const RpcDigitCollection* rpcCollection = *it1_coll; Identifier moduleId = rpcCollection->identify(); - - // if (m_rpcId->validElement(moduleId) && - // m_digit_position->initialize(moduleId)) - if (m_rpcId->is_rpc(moduleId)) + if (m_idHelperSvc->rpcIdHelper().is_rpc(moduleId)) { digit_iterator it1_digit = rpcCollection->begin(); digit_iterator it2_digit = rpcCollection->end(); - //const int stationCode = m_rpcId->stationName(moduleId); - //std::string StationName = m_rpcId->stationNameString(stationCode); - //int StationEta = m_rpcId->stationEta(moduleId); - //int StationPhi = m_rpcId->stationPhi(moduleId); - for ( ; it1_digit!=it2_digit; ++it1_digit) { const RpcDigit* rpcDigit = *it1_digit; - //Identifier channelId = rpcDigit->identify(); - if (rpcDigit->is_valid(*m_rpcId)) + if (rpcDigit->is_valid(&m_idHelperSvc->rpcIdHelper())) { Identifier channelId = rpcDigit->identify(); - const int stationType = m_rpcId->stationName(channelId); - std::string StationName = m_rpcId->stationNameString(stationType); - int StationEta = m_rpcId->stationEta(channelId); - int StationPhi = m_rpcId->stationPhi(channelId); - int DoubletR = m_rpcId->doubletR(channelId); - int DoubletZ = m_rpcId->doubletZ(channelId); - int DoubletP = m_rpcId->doubletPhi(channelId); - int GasGap = m_rpcId->gasGap(channelId); - int MeasuresPhi = m_rpcId->measuresPhi(channelId); - int Strip = m_rpcId->strip(channelId); + const int stationType = m_idHelperSvc->rpcIdHelper().stationName(channelId); + std::string StationName = m_idHelperSvc->rpcIdHelper().stationNameString(stationType); + int StationEta = m_idHelperSvc->rpcIdHelper().stationEta(channelId); + int StationPhi = m_idHelperSvc->rpcIdHelper().stationPhi(channelId); + int DoubletR = m_idHelperSvc->rpcIdHelper().doubletR(channelId); + int DoubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(channelId); + int DoubletP = m_idHelperSvc->rpcIdHelper().doubletPhi(channelId); + int GasGap = m_idHelperSvc->rpcIdHelper().gasGap(channelId); + int MeasuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(channelId); + int Strip = m_idHelperSvc->rpcIdHelper().strip(channelId); const MuonGM::RpcReadoutElement* descriptor = m_MuonMgr->getRpcReadoutElement(channelId); @@ -371,7 +341,7 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) // Get the Level-1 numbering schema for the RPC strips unsigned long int strip_code_cab = - readCdo->strip_code_fromOffId (StationName,StationEta,StationPhi, + m_cabling->strip_code_fromOffId (StationName,StationEta,StationPhi, DoubletR,DoubletZ,DoubletP, GasGap,MeasuresPhi,Strip); @@ -393,41 +363,32 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data) RPCsimuDigit digit(0,strip_code_cab,param,xyz); data << digit; - - - // Start of debugging printout - - - //char buffer[100]; - //for(int i=0;i<100;++i) buffer[i] = '\0'; - //ostrstream disp_digit (buffer,100); - //disp_digit << *rpcDigit; - ATH_MSG_DEBUG ( "Muon Identifiers from GM:" <