diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h index 779be99f33b75956b11dc05c1acd1b36c02930ad..f2d841d8690d0fb13d8af6bbc088cf52d22f3d19 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.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 MDTDIGITTOMDTRDO_H @@ -7,15 +7,11 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" - #include "MuonDigitContainer/MdtDigitContainer.h" #include "MuonRDO/MdtCsmContainer.h" - #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -36,8 +32,7 @@ class MdtDigitToMdtRDO : public AthReentrantAlgorithm { protected: bool m_BMEpresent{false}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::WriteHandleKey<MdtCsmContainer> m_csmContainerKey{this,"OutputObjectName","MDTCSM","WriteHandleKey for Output MdtCsmContainer"}; SG::ReadHandleKey<MdtDigitContainer> m_digitContainerKey{this,"InputObjectName","MDT_DIGITS","ReadHandleKey for Input MdtDigitContainer"}; SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h index 533a47637af96881cb6e2275da162a13573ee012..69794fbf48bf05fbe414c06809cff959cb877abc 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h @@ -1,25 +1,30 @@ /* - 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 MUONRDOTOMUONDIGITTOOL_H #define MUONRDOTOMUONDIGITTOOL_H +#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -//#include "CscCalibTools/CscCalibTool.h" -#include "CscCalibTools/ICscCalibTool.h" -#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" +#include "CscCalibTools/ICscCalibTool.h" #include "MuonRDO/CscRawDataContainer.h" #include "MuonDigitContainer/CscDigitContainer.h" #include "MuonRDO/STGC_RawDataContainer.h" #include "MuonDigitContainer/sTgcDigitContainer.h" #include "MuonRDO/MM_RawDataContainer.h" #include "MuonDigitContainer/MmDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class ITGCcablingSvc; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" +#include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" +#include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" +#include "MuonTGC_CnvTools/ITGC_RDO_Decoder.h" +#include "MuonSTGC_CnvTools/ISTGC_RDO_Decoder.h" +#include "MuonMM_CnvTools/IMM_RDO_Decoder.h" +#include "TGCcablingInterface/ITGCcablingSvc.h" class MdtDigitContainer; class CscDigitContainer; @@ -46,15 +51,6 @@ class MM_RawDataCollection; class MM_RawDataContainer; class MM_RawData; -namespace Muon { - class IMDT_RDO_Decoder; - class ICSC_RDO_Decoder; - class IRPC_RDO_Decoder; - class ITGC_RDO_Decoder; - class ISTGC_RDO_Decoder; - class IMM_RDO_Decoder; - class MuonIdHelperTool; -} // Author: Ketevi A. Assamagan // BNL, January 24, 2004 @@ -70,7 +66,7 @@ class MuonRdoToMuonDigitTool : virtual public IMuonDigitizationTool, public AthA public: MuonRdoToMuonDigitTool(const std::string& type, const std::string& name, const IInterface* pIID); - ~MuonRdoToMuonDigitTool(); + ~MuonRdoToMuonDigitTool()=default; virtual StatusCode initialize() override; virtual StatusCode digitize(const EventContext& ctx) override; @@ -110,12 +106,10 @@ class MuonRdoToMuonDigitTool : virtual public IMuonDigitizationTool, public AthA ToolHandle<Muon::ITGC_RDO_Decoder> m_tgcRdoDecoderTool; ToolHandle<Muon::ISTGC_RDO_Decoder> m_stgcRdoDecoderTool; ToolHandle<Muon::IMM_RDO_Decoder> m_mmRdoDecoderTool; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // cabling service - // const MDTcablingSvc * m_mdtCabling; - const ITGCcablingSvc * m_tgcCabling; + const ITGCcablingSvc* m_tgcCabling; // algorithm properties bool m_decodeMdtRDO; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadCscDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadCscDigit.h index d76fe9d3d31cc898291f7884fc0b012f924fe17c..4b974db2038e75e86483ed6b5a8600e1796ae345 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadCscDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadCscDigit.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 READCSCDIGIT_H @@ -14,10 +14,10 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" + #include "GaudiKernel/NTuple.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -40,8 +40,7 @@ private: //Ntuple ID std::string m_NtupleLocID; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Define variables in the Ntuple: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtDigit.h index 020df7cd35293d3f8bb43ba5609de914ad385c89..b8ebeb85b847c418e8ce3620071a88ad46edbc38 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtDigit.h @@ -1,15 +1,15 @@ /* - 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 READMDTDIGIT_H #define READMDTDIGIT_H #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/NTuple.h" #include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/NTuple.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,6 @@ class ReadMdtDigit: public AthAlgorithm { ReadMdtDigit (const std::string& name, ISvcLocator* pSvcLocator); virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); protected: @@ -34,8 +33,7 @@ class ReadMdtDigit: public AthAlgorithm { //Ntuple ID std::string m_NtupleLocID; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Define variables in the Ntuple: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtPRD.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtPRD.h index 0650d5cc690e76e7b66548ef2da23cdb87ab18cf..ccd86fab54ea06b71a6d7339b47bf8420f08596f 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtPRD.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadMdtPRD.h @@ -1,13 +1,15 @@ /* - 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 MUONBYTESTREAMCNVTEST_READMDTPRD_H #define MUONBYTESTREAMCNVTEST_READMDTPRD_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + #include "GaudiKernel/NTuple.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +19,6 @@ class ReadMdtPRD: public AthAlgorithm { ReadMdtPRD (const std::string& name, ISvcLocator* pSvcLocator); virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); protected: NTuple::Tuple* m_ntuplePtr; @@ -29,8 +30,7 @@ class ReadMdtPRD: public AthAlgorithm { //Ntuple ID std::string m_NtupleLocID; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Define variables in the Ntuple: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadRpcDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadRpcDigit.h index 212f6c7385da4c9dccd9ec2144a4ff4210e3d7ca..b35df1840e061db0643e53236dd863475c348d4f 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadRpcDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadRpcDigit.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 MUONBYTESTREAMCNVTEST_READRPCDIGIT @@ -8,9 +8,10 @@ #include <string.h> #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + #include "GaudiKernel/NTuple.h" -#include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class RpcIdHelper; @@ -19,17 +20,15 @@ class ReadRpcDigit : public AthAlgorithm public: // Agorithm constructor ReadRpcDigit (const std::string &name, ISvcLocator *pSvcLocator); - ~ReadRpcDigit(); + ~ReadRpcDigit()=default; // Gaudi hooks StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: ServiceHandle<ActiveStoreSvc> m_activeStore; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; StatusCode accessNtuple(); bool m_rpcNtuple; std::string m_NtupleLocID; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadTgcDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadTgcDigit.h index a8da51fa966b459d76c344408b710fdbdd31d447..a53af07052aba102ecc3a7085e58712ccc316d05 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadTgcDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/ReadTgcDigit.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 READTGCDIGIT_H @@ -14,9 +14,9 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/NTuple.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/NTuple.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,6 @@ public: ReadTgcDigit (const std::string& name, ISvcLocator* pSvcLocator); virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); protected: NTuple::Tuple* m_ntuplePtr; @@ -39,8 +38,7 @@ private: //Ntuple ID std::string m_NtupleLocID; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Define variables in the Ntuple: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h index 639de1ea1d3986e7936dd997d10a9bb6294f5b82..dfec6d1b64949e428d66442de7d7a22b1093b236 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.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 TGCDIGITTOTGCRDO_H @@ -7,16 +7,14 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" +#include "StoreGate/DataHandle.h" #include "MuonRDO/TgcRdoContainer.h" #include "MuonRDO/TgcRdo.h" #include "MuonDigitContainer/TgcDigitContainer.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class ITGCcablingSvc; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "TGCcablingInterface/ITGCcablingSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -48,8 +46,7 @@ protected: SG::WriteHandleKey<TgcRdoContainer> m_rdoContainerKey{this,"OutputObjectName","TGCRDO","WriteHandleKey for Output TgcRdoContainer"}; SG::ReadHandleKey<TgcDigitContainer> m_digitContainerKey{this,"InputObjectName","TGC_DIGITS","ReadHandleKey for Input TgcDigitContainer"}; const ITGCcablingSvc * m_cabling{}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::string m_cablingType; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.cxx index 633e33a2aa44da2f3182f06d1569a51467200d61..fb97e09f32fa95208f5c54e2f671acefefda35e7 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.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 "CscRdoToCscDigit.h" @@ -13,7 +13,7 @@ CscRdoToCscDigit::CscRdoToCscDigit(const std::string& name, StatusCode CscRdoToCscDigit::initialize() { - ATH_CHECK(m_muonIdHelperTool.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); /** CSC calibration tool for the Condtiions Data base access */ ATH_CHECK(m_cscCalibTool.retrieve()); ATH_CHECK(m_cscRdoKey.initialize()); @@ -35,7 +35,7 @@ StatusCode CscRdoToCscDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " CSC RDOs." ); SG::WriteHandle<CscDigitContainer> wh_cscDigit(m_cscDigitKey, ctx); - ATH_CHECK(wh_cscDigit.record(std::make_unique<CscDigitContainer> (m_muonIdHelperTool->cscIdHelper().module_hash_max()))); + ATH_CHECK(wh_cscDigit.record(std::make_unique<CscDigitContainer> (m_idHelperSvc->cscIdHelper().module_hash_max()))); ATH_MSG_DEBUG( "Decoding CSC RDO into CSC Digit" ); Identifier oldId; @@ -62,7 +62,7 @@ StatusCode CscRdoToCscDigit::decodeCsc(const CscRawDataCollection *rdoColl, CscD // decoder.setParams(samplingTime); - const IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + const IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); /** for each Rdo, loop over RawData, converter RawData to digit retrieve/create digit collection, and insert digit into collection */ @@ -98,17 +98,17 @@ StatusCode CscRdoToCscDigit::decodeCsc(const CscRawDataCollection *rdoColl, CscD << " or charge finding failed " << " ... skipping " ); continue; } - ATH_MSG_DEBUG( "CSC RDO->CscDigit: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) ); + ATH_MSG_DEBUG( "CSC RDO->CscDigit: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) ); const int theCharge = static_cast<int>(charge); CscDigit * newDigit = new CscDigit(channelId, theCharge, time); - ATH_MSG_DEBUG( "CSC RDO->Digit: " << m_muonIdHelperTool->cscIdHelper().show_to_string(newDigit->identify()) + ATH_MSG_DEBUG( "CSC RDO->Digit: " << m_idHelperSvc->cscIdHelper().show_to_string(newDigit->identify()) << " " << newDigit->charge() << " " << charge << " time= " << time ); for (uint16_t i=0; i< samples.size(); ++i) { ATH_MSG_DEBUG( "CSC RDO->Digit: " << samples[i] ); } IdentifierHash coll_hash; - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, coll_hash, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, coll_hash, &cscContext)) { ATH_MSG_WARNING( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.h index d2a83d780eb0808f211a3edbc8fa9474dda6a156..67d6f591ef1189d20daad79ff8ab3101351fd57f 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscRdoToCscDigit.h @@ -1,24 +1,19 @@ /* - 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 MUONBYTESTREAMCNVTEST_CSCRDOTOCSCDIGIT_H #define MUONBYTESTREAMCNVTEST_CSCRDOTOCSCDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "CscCalibTools/ICscCalibTool.h" #include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" #include "MuonRDO/CscRawDataContainer.h" #include "MuonDigitContainer/CscDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -// class CscDigitContainer; -// class CscDigitCollection; -// class CscRawDataCollection; -// namespace Muon { -// class ICSC_RDO_Decoder; -// } +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class CscRdoToCscDigit : public AthReentrantAlgorithm { @@ -36,8 +31,7 @@ class CscRdoToCscDigit : public AthReentrantAlgorithm { ToolHandle<ICscCalibTool> m_cscCalibTool{this, "cscCalibTool", "CscCalibTool", ""}; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool{this, "cscRdoDecoderTool", "Muon::CscRDO_Decoder", ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKey<CscRawDataContainer> m_cscRdoKey{this, "CscRdoContainer", "CSCRDO", "Csc RDO Input"}; SG::WriteHandleKey<CscDigitContainer> m_cscDigitKey{this, "CscDigitContainer", "CSC_DIGITS", "Csc Digit Output"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.cxx index 9f7324e2a9c9c82fd66a8a384625b3f4c2e09305..b8c8b5406ef986bf266d7ae02376f9e2fbd9a6d5 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.cxx @@ -1,9 +1,8 @@ /* - 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 "MM_DigitToRDO.h" -#include "MuonIdHelpers/MmIdHelper.h" ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -16,9 +15,9 @@ MM_DigitToRDO::MM_DigitToRDO(const std::string& name, ISvcLocator* pSvcLocator) StatusCode MM_DigitToRDO::initialize() { ATH_MSG_DEBUG( " in initialize()" ); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK( m_rdoContainer.initialize() ); ATH_CHECK( m_digitContainer.initialize() ); - ATH_CHECK( detStore()->retrieve(m_idHelper, "MMIDHELPER") ); return StatusCode::SUCCESS; } @@ -30,7 +29,7 @@ StatusCode MM_DigitToRDO::execute(const EventContext& ctx) const SG::WriteHandle<MM_RawDataContainer> rdos (m_rdoContainer, ctx); SG::ReadHandle<MmDigitContainer> digits (m_digitContainer, ctx); - ATH_CHECK( rdos.record(std::make_unique<MM_RawDataContainer>(m_idHelper->module_hash_max())) ); + ATH_CHECK( rdos.record(std::make_unique<MM_RawDataContainer>(m_idHelperSvc->mmIdHelper().module_hash_max())) ); if (digits.isValid()){ for (const MmDigitCollection* digitColl : *digits ){ @@ -40,7 +39,7 @@ StatusCode MM_DigitToRDO::execute(const EventContext& ctx) const // get the hash of the RDO collection IdentifierHash hash; - int getRdoCollHash = m_idHelper->get_module_hash(digitId,hash); + int getRdoCollHash = m_idHelperSvc->mmIdHelper().get_module_hash(digitId,hash); if ( getRdoCollHash!=0 ) { ATH_MSG_ERROR("Could not get the module hash Id"); return StatusCode::FAILURE; @@ -67,15 +66,15 @@ StatusCode MM_DigitToRDO::execute(const EventContext& ctx) const /// set the rdo id to a value consistent with the channel number /// bool isValid; - int stationName = m_idHelper->stationName(id); - int stationEta = m_idHelper->stationEta(id); - int stationPhi = m_idHelper->stationPhi(id); - int multilayer = m_idHelper->multilayer(id); - int gasGap = m_idHelper->gasGap(id); + int stationName = m_idHelperSvc->mmIdHelper().stationName(id); + int stationEta = m_idHelperSvc->mmIdHelper().stationEta(id); + int stationPhi = m_idHelperSvc->mmIdHelper().stationPhi(id); + int multilayer = m_idHelperSvc->mmIdHelper().multilayer(id); + int gasGap = m_idHelperSvc->mmIdHelper().gasGap(id); /// int channel = digit->stripResponsePosition().at(i); - Identifier newId = m_idHelper->channelID(stationName,stationEta, + Identifier newId = m_idHelperSvc->mmIdHelper().channelID(stationName,stationEta, stationPhi,multilayer,gasGap,channel,true,&isValid); if (!isValid) { @@ -103,7 +102,3 @@ StatusCode MM_DigitToRDO::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "done execute()" ); return StatusCode::SUCCESS; } - -StatusCode MM_DigitToRDO::finalize() { - return StatusCode::SUCCESS; -} diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.h index 480353fb88df02e11507e5040a90382be4e1a3b1..6ae1454199d147db05b5ea9b55dc876dd983e0f0 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_DigitToRDO.h @@ -1,14 +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 MMDIGITTORDO_H #define MMDIGITTORDO_H #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonRDO/MM_RawDataContainer.h" #include "MuonDigitContainer/MmDigitContainer.h" -class MmIdHelper; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -21,10 +23,9 @@ public: virtual ~MM_DigitToRDO() = default; virtual StatusCode initialize() override final; virtual StatusCode execute(const EventContext& ctx) const override final; - virtual StatusCode finalize() override; private: - const MmIdHelper* m_idHelper{}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::WriteHandleKey<Muon::MM_RawDataContainer> m_rdoContainer{this, "OutputObjectName", "MMRDO","WriteHandleKey for Output MM_RawDataContainer"}; SG::ReadHandleKey<MmDigitContainer> m_digitContainer{this, "InputObjectName", "MM_DIGITS", "ReadHAndleKey for Input MmDigitContainer"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.cxx index 1e9b33b211c61284f1155885603642fe45e11861..a26db8769e20a4340b035fc9cb4fef1c759bb370 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.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 "MM_RdoToDigit.h" @@ -12,7 +12,7 @@ MM_RdoToDigit::MM_RdoToDigit(const std::string& name, StatusCode MM_RdoToDigit::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_mmRdoDecoderTool.retrieve() ); ATH_CHECK(m_mmRdoKey.initialize()); ATH_CHECK(m_mmDigitKey.initialize()); @@ -31,7 +31,7 @@ StatusCode MM_RdoToDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " MM RDOs." ); SG::WriteHandle<MmDigitContainer> wh_mmDigit(m_mmDigitKey, ctx); - ATH_CHECK(wh_mmDigit.record(std::make_unique<MmDigitContainer>(m_muonIdHelperTool->mmIdHelper().module_hash_max()))); + ATH_CHECK(wh_mmDigit.record(std::make_unique<MmDigitContainer>(m_idHelperSvc->mmIdHelper().module_hash_max()))); ATH_MSG_DEBUG( "Decoding MM RDO into MM Digit" ); // retrieve the collection of RDO @@ -47,7 +47,7 @@ StatusCode MM_RdoToDigit::execute(const EventContext& ctx) const StatusCode MM_RdoToDigit::decodeMM( const Muon::MM_RawDataCollection * rdoColl, MmDigitContainer * mmContainer, MmDigitCollection*& collection, Identifier& oldId ) const { - const IdContext mmContext = m_muonIdHelperTool->mmIdHelper().module_context(); + const IdContext mmContext = m_idHelperSvc->mmIdHelper().module_context(); if ( rdoColl->size() > 0 ) { ATH_MSG_DEBUG( " Number of RawData in this rdo " @@ -64,9 +64,9 @@ StatusCode MM_RdoToDigit::decodeMM( const Muon::MM_RawDataCollection * rdoColl, // find here the Proper Digit Collection identifier, using the rdo-hit id // (since RDO collections are not in a 1-to-1 relation with digit collections) - const Identifier elementId = m_muonIdHelperTool->mmIdHelper().elementID(newDigit->identify()); + const Identifier elementId = m_idHelperSvc->mmIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->mmIdHelper().get_hash(elementId, coll_hash, &mmContext)) { + if (m_idHelperSvc->mmIdHelper().get_hash(elementId, coll_hash, &mmContext)) { ATH_MSG_WARNING( "Unable to get MM digit collection hash id " << "context begin_index = " << mmContext.begin_index() << " context end_index = " << mmContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.h index e739a81b7c09d48f7e55dd23ffa5187eac3072c8..893d30610489c7309c79a65f37f3e321342f45c6 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MM_RdoToDigit.h @@ -1,16 +1,18 @@ /* - 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 MUONBYTESTREAMCNVTEST_MMRDOTOMMDIGIT_H #define MUONBYTESTREAMCNVTEST_MMRDOTOMMDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonMM_CnvTools/IMM_RDO_Decoder.h" #include "MuonRDO/MM_RawDataContainer.h" #include "MuonDigitContainer/MmDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class MM_RdoToDigit : public AthReentrantAlgorithm { @@ -26,8 +28,7 @@ class MM_RdoToDigit : public AthReentrantAlgorithm { StatusCode decodeMM( const Muon::MM_RawDataCollection *, MmDigitContainer *, MmDigitCollection*&, Identifier& ) const; ToolHandle<Muon::IMM_RDO_Decoder> m_mmRdoDecoderTool{this, "mmRdoDecoderTool", "Muon::MM_RDO_Decoder", ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKey<Muon::MM_RawDataContainer> m_mmRdoKey{this, "MmRdoContainer", "MMRDO", "MM RDO Input"}; SG::WriteHandleKey<MmDigitContainer> m_mmDigitKey{this, "MmDigitContainer", "MM_DIGITS", "MM Digit Output"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx index 86e65c8dacd64bec28d165a8ffe36caad5c2717f..041e9d83422e5968b6f72d14be5ae3e46f60f72d 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx @@ -34,7 +34,7 @@ StatusCode MdtDigitToMdtRDO::initialize() ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_csmContainerKey ); ATH_CHECK( m_digitContainerKey.initialize() ); ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_digitContainerKey ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_readKey.initialize() ); if ( fillTagInfo().isFailure() ) { @@ -42,7 +42,7 @@ StatusCode MdtDigitToMdtRDO::initialize() } // check if the layout includes elevator chambers - m_BMEpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1; + m_BMEpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1; if ( m_BMEpresent ) ATH_MSG_INFO( "Processing configuration for layouts with BME chambers." ); @@ -73,7 +73,7 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const { ATH_CHECK(csmContainer.record(std::make_unique<MdtCsmContainer>())); ATH_MSG_DEBUG("Recorded MdtCsmContainer called " << csmContainer.name() << " in store " << csmContainer.store()); - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); SG::ReadHandle<MdtDigitContainer> container (m_digitContainerKey, ctx); if (!container.isValid()) { @@ -101,10 +101,10 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const { const MdtDigitCollection* mdtCollection = *it_coll; IdentifierHash moduleHash = mdtCollection->identifierHash(); Identifier moduleId; - m_muonIdHelperTool->mdtIdHelper().get_id(moduleHash, moduleId, &mdtContext); - int name = m_muonIdHelperTool->mdtIdHelper().stationName(moduleId); - int eta = m_muonIdHelperTool->mdtIdHelper().stationEta(moduleId); - int phi = m_muonIdHelperTool->mdtIdHelper().stationPhi(moduleId); + m_idHelperSvc->mdtIdHelper().get_id(moduleHash, moduleId, &mdtContext); + int name = m_idHelperSvc->mdtIdHelper().stationName(moduleId); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(moduleId); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(moduleId); // Get the online ID of the MDT module uint8_t subsystem; @@ -129,15 +129,15 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const { Identifier chid1, chid2; if ( m_BMEpresent ){ // 1st ML channel get_id - chid1 = m_muonIdHelperTool->mdtIdHelper().channelID(m_muonIdHelperTool->mdtIdHelper().stationName(moduleId), - m_muonIdHelperTool->mdtIdHelper().stationEta(moduleId), - m_muonIdHelperTool->mdtIdHelper().stationPhi(moduleId), + chid1 = m_idHelperSvc->mdtIdHelper().channelID(m_idHelperSvc->mdtIdHelper().stationName(moduleId), + m_idHelperSvc->mdtIdHelper().stationEta(moduleId), + m_idHelperSvc->mdtIdHelper().stationPhi(moduleId), 1, 1, 1 ); // 2nd ML channel id if ( name == 53 ) { - chid2 = m_muonIdHelperTool->mdtIdHelper().channelID(m_muonIdHelperTool->mdtIdHelper().stationName(moduleId), - m_muonIdHelperTool->mdtIdHelper().stationEta(moduleId), - m_muonIdHelperTool->mdtIdHelper().stationPhi(moduleId), + chid2 = m_idHelperSvc->mdtIdHelper().channelID(m_idHelperSvc->mdtIdHelper().stationName(moduleId), + m_idHelperSvc->mdtIdHelper().stationEta(moduleId), + m_idHelperSvc->mdtIdHelper().stationPhi(moduleId), 2, 1, 1 ); } @@ -188,11 +188,11 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const { const MdtDigit* mdtDigit = *it_dig; Identifier channelId = mdtDigit->identify(); - if (m_muonIdHelperTool->mdtIdHelper().valid(channelId)) + if (m_idHelperSvc->mdtIdHelper().valid(channelId)) { - int multilayer = m_muonIdHelperTool->mdtIdHelper().multilayer(channelId); - int layer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId); - int tube = m_muonIdHelperTool->mdtIdHelper().tube(channelId); + int multilayer = m_idHelperSvc->mdtIdHelper().multilayer(channelId); + int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(channelId); + int tube = m_idHelperSvc->mdtIdHelper().tube(channelId); // Get the online Id of the channel cabling = readCdo->getOnlineId(name, eta, phi, diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.cxx index d0c8c80609555e026639969f1c01edba5d570812..210a55f91ad96b5ce74f8ac538c5cfe8a2cd4d19 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.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 "MdtRdoToMdtDigit.h" @@ -12,7 +12,7 @@ MdtRdoToMdtDigit::MdtRdoToMdtDigit(const std::string& name, StatusCode MdtRdoToMdtDigit::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_mdtRdoDecoderTool.retrieve() ); ATH_CHECK(m_mdtRdoKey.initialize()); ATH_CHECK(m_mdtDigitKey.initialize()); @@ -31,7 +31,7 @@ StatusCode MdtRdoToMdtDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " MDT RDOs." ); SG::WriteHandle<MdtDigitContainer> wh_mdtDigit(m_mdtDigitKey, ctx); - ATH_CHECK(wh_mdtDigit.record(std::make_unique<MdtDigitContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max()))); + ATH_CHECK(wh_mdtDigit.record(std::make_unique<MdtDigitContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max()))); ATH_MSG_DEBUG( "Decoding MDT RDO into MDT Digit" ); // retrieve the collection of RDO @@ -48,7 +48,7 @@ StatusCode MdtRdoToMdtDigit::execute(const EventContext& ctx) const StatusCode MdtRdoToMdtDigit::decodeMdt( const MdtCsm * rdoColl, MdtDigitContainer * mdtContainer, MdtDigitCollection*& collection, Identifier& oldId ) const { - const IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + const IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); if ( rdoColl->size() > 0 ) { ATH_MSG_DEBUG( " Number of AmtHit in this Csm " @@ -71,9 +71,9 @@ StatusCode MdtRdoToMdtDigit::decodeMdt( const MdtCsm * rdoColl, MdtDigitContaine // find here the Proper Digit Collection identifier, using the rdo-hit id // (since RDO collections are not in a 1-to-1 relation with digit collections) - const Identifier elementId = m_muonIdHelperTool->mdtIdHelper().elementID(newDigit->identify()); + const Identifier elementId = m_idHelperSvc->mdtIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) { + if (m_idHelperSvc->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) { ATH_MSG_WARNING( "Unable to get MDT digit collection hash id " << "context begin_index = " << mdtContext.begin_index() << " context end_index = " << mdtContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.h index 51a406fd62e52c7a23bba58c1117e870388afa60..f1ea332fd583fe5c386ad1f855a9b70668d00a2a 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtRdoToMdtDigit.h @@ -1,16 +1,18 @@ /* - 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 MUONBYTESTREAMCNVTEST_MDTRDOTOMDTDIGIT_H #define MUONBYTESTREAMCNVTEST_MDTRDOTOMDTDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" #include "MuonRDO/MdtCsmContainer.h" #include "MuonDigitContainer/MdtDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class MdtRdoToMdtDigit : public AthReentrantAlgorithm { @@ -26,8 +28,7 @@ class MdtRdoToMdtDigit : public AthReentrantAlgorithm { StatusCode decodeMdt( const MdtCsm *, MdtDigitContainer *, MdtDigitCollection*&, Identifier& ) const; ToolHandle<Muon::IMDT_RDO_Decoder> m_mdtRdoDecoderTool{this, "mdtRdoDecoderTool", "Muon::MdtRDO_Decoder", ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKey<MdtCsmContainer> m_mdtRdoKey{this, "MdtRdoContainer", "MDTCSM", "Mdt RDO Input"}; SG::WriteHandleKey<MdtDigitContainer> m_mdtDigitKey{this, "MdtDigitContainer", "MDT_DIGITS", "Mdt Digit Output"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx index 772686b372acc1128a5edebbba9e2f37ecd548a9..83b6afbea53e28af4b12b4b7e21aed4a3d409939 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.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 */ // Author: Ketevi A. Assamagan @@ -7,22 +7,6 @@ // algorithm to decode RDO into digits -#include "GaudiKernel/MsgStream.h" - -#include "StoreGate/StoreGate.h" -#include "StoreGate/DataHandle.h" - -#include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" -#include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" -#include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" -#include "MuonTGC_CnvTools/ITGC_RDO_Decoder.h" -#include "MuonSTGC_CnvTools/ISTGC_RDO_Decoder.h" -#include "MuonMM_CnvTools/IMM_RDO_Decoder.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - -#include "TGCcablingInterface/ITGCcablingServerSvc.h" - #include "MuonRDO/MdtAmtHit.h" #include "MuonRDO/MdtCsm.h" #include "MuonRDO/MdtCsmContainer.h" @@ -74,6 +58,8 @@ #include "MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h" +#include "TGCcablingInterface/ITGCcablingServerSvc.h" + namespace std { template<typename _Tp> class auto_ptr; } MuonRdoToMuonDigitTool::MuonRdoToMuonDigitTool(const std::string& type,const std::string& name,const IInterface* pIID) @@ -106,19 +92,15 @@ MuonRdoToMuonDigitTool::MuonRdoToMuonDigitTool(const std::string& type,const std declareProperty("tgcRdoDecoderTool", m_tgcRdoDecoderTool); declareProperty("stgcRdoDecoderTool", m_stgcRdoDecoderTool); declareProperty("mmRdoDecoderTool", m_mmRdoDecoderTool); - declareProperty("MuonIdHelperTool", m_muonIdHelperTool); declareProperty("show_warning_level_invalid_TGC_A09_SSW6_hit", m_show_warning_level_invalid_TGC_A09_SSW6_hit = false); } -MuonRdoToMuonDigitTool::~MuonRdoToMuonDigitTool() -{} - StatusCode MuonRdoToMuonDigitTool::initialize() { ATH_MSG_DEBUG( " in initialize()" ); ATH_CHECK( m_acSvc.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); /** CSC calibratin tool for the Condtiions Data base access */ ATH_CHECK( m_cscCalibTool.retrieve() ); @@ -155,38 +137,38 @@ StatusCode MuonRdoToMuonDigitTool::digitize(const EventContext& ctx) { if (m_decodeMdtRDO){ SG::WriteHandle<MdtDigitContainer> wh_mdtDigit(m_mdtDigitKey, ctx); - ATH_CHECK(wh_mdtDigit.record(std::make_unique<MdtDigitContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max()))); + ATH_CHECK(wh_mdtDigit.record(std::make_unique<MdtDigitContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max()))); ATH_CHECK( decodeMdtRDO(ctx, wh_mdtDigit.ptr()) ); } if (m_decodeCscRDO){ SG::WriteHandle<CscDigitContainer> wh_cscDigit(m_cscDigitKey, ctx); - ATH_CHECK(wh_cscDigit.record(std::make_unique<CscDigitContainer> (m_muonIdHelperTool->cscIdHelper().module_hash_max()))); + ATH_CHECK(wh_cscDigit.record(std::make_unique<CscDigitContainer> (m_idHelperSvc->cscIdHelper().module_hash_max()))); ATH_CHECK( decodeCscRDO(ctx, wh_cscDigit.ptr()) ); } if (m_decodeRpcRDO ){ SG::WriteHandle<RpcDigitContainer> wh_rpcDigit(m_rpcDigitKey, ctx); - ATH_CHECK(wh_rpcDigit.record(std::make_unique<RpcDigitContainer> (m_muonIdHelperTool->rpcIdHelper().module_hash_max()))); + ATH_CHECK(wh_rpcDigit.record(std::make_unique<RpcDigitContainer> (m_idHelperSvc->rpcIdHelper().module_hash_max()))); ATH_CHECK( decodeRpcRDO(ctx, wh_rpcDigit.ptr()) ); } if(!m_tgcCabling && getTgcCabling().isFailure()) return StatusCode::FAILURE; if (m_decodeTgcRDO && m_tgcCabling){ SG::WriteHandle<TgcDigitContainer> wh_tgcDigit(m_tgcDigitKey, ctx); - ATH_CHECK(wh_tgcDigit.record(std::make_unique<TgcDigitContainer> (m_muonIdHelperTool->tgcIdHelper().module_hash_max()))); + ATH_CHECK(wh_tgcDigit.record(std::make_unique<TgcDigitContainer> (m_idHelperSvc->tgcIdHelper().module_hash_max()))); ATH_CHECK( decodeTgcRDO(ctx, wh_tgcDigit.ptr()) ); } if (m_decodesTgcRDO){ SG::WriteHandle<sTgcDigitContainer> wh_stgcDigit(m_stgcDigitKey, ctx); - ATH_CHECK(wh_stgcDigit.record(std::make_unique<sTgcDigitContainer> (m_muonIdHelperTool->stgcIdHelper().module_hash_max()))); + ATH_CHECK(wh_stgcDigit.record(std::make_unique<sTgcDigitContainer> (m_idHelperSvc->stgcIdHelper().module_hash_max()))); ATH_CHECK( decodeSTGC_RDO(ctx, wh_stgcDigit.ptr()) ); } if (m_decodeMmRDO){ SG::WriteHandle<MmDigitContainer> wh_mmDigit(m_mmDigitKey, ctx); - ATH_CHECK(wh_mmDigit.record(std::make_unique<MmDigitContainer> (m_muonIdHelperTool->mmIdHelper().module_hash_max()))); + ATH_CHECK(wh_mmDigit.record(std::make_unique<MmDigitContainer> (m_idHelperSvc->mmIdHelper().module_hash_max()))); ATH_CHECK( decodeMM_RDO(ctx, wh_mmDigit.ptr()) ); } @@ -371,7 +353,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeMM_RDO(const EventContext& ctx, MmDigit StatusCode MuonRdoToMuonDigitTool::decodeMdt( MdtDigitContainer *mdtContainer, const MdtCsm * rdoColl, MdtDigitCollection*& collection, Identifier& oldId ) { - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); if ( !rdoColl->empty() ) { ATH_MSG_DEBUG( " Number of AmtHit in this Csm " @@ -399,9 +381,9 @@ StatusCode MuonRdoToMuonDigitTool::decodeMdt( MdtDigitContainer *mdtContainer, c // find here the Proper Digit Collection identifier, using the rdo-hit id // (since RDO collections are not in a 1-to-1 relation with digit collections) - Identifier elementId = m_muonIdHelperTool->mdtIdHelper().elementID(newDigit->identify()); + Identifier elementId = m_idHelperSvc->mdtIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) { + if (m_idHelperSvc->mdtIdHelper().get_hash(elementId, coll_hash, &mdtContext)) { ATH_MSG_WARNING( "Unable to get MDT digit collection hash id " << "context begin_index = " << mdtContext.begin_index() << " context end_index = " << mdtContext.end_index() @@ -447,7 +429,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeCsc(CscDigitContainer* cscContainer, co // decoder.setParams(samplingTime); - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); /** for each Rdo, loop over RawData, converter RawData to digit retrieve/create digit collection, and insert digit into collection */ @@ -484,17 +466,17 @@ StatusCode MuonRdoToMuonDigitTool::decodeCsc(CscDigitContainer* cscContainer, co << " or charge finding failed " << " ... skipping " ); continue; } - ATH_MSG_DEBUG( "CSC RDO->CscDigit: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) ); + ATH_MSG_DEBUG( "CSC RDO->CscDigit: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) ); int theCharge = static_cast<int>(charge); CscDigit * newDigit = new CscDigit(channelId, theCharge, time); - ATH_MSG_DEBUG( "CSC RDO->Digit: " << m_muonIdHelperTool->cscIdHelper().show_to_string(newDigit->identify()) + ATH_MSG_DEBUG( "CSC RDO->Digit: " << m_idHelperSvc->cscIdHelper().show_to_string(newDigit->identify()) << " " << newDigit->charge() << " " << charge << " time= " << time ); for (uint16_t i=0; i< samples.size(); ++i) { ATH_MSG_DEBUG( "CSC RDO->Digit: " << samples[i] ); } IdentifierHash coll_hash; - if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, coll_hash, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(stationId, coll_hash, &cscContext)) { ATH_MSG_WARNING( "Unable to get CSC digiti collection hash id " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -530,7 +512,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeCsc(CscDigitContainer* cscContainer, co StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, const RpcPad * rdoColl, RpcDigitCollection*& collection ) { - IdContext rpcContext = m_muonIdHelperTool->rpcIdHelper().module_context(); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); ATH_MSG_DEBUG( " Number of CMs in this Pad " << rdoColl->size() ); @@ -540,12 +522,12 @@ StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, co uint16_t padId = rdoColl->onlineId(); uint16_t sectorId = rdoColl->sector(); - int stationName = m_muonIdHelperTool->rpcIdHelper().stationName(padOfflineId); - int stationEta = m_muonIdHelperTool->rpcIdHelper().stationEta(padOfflineId); - int stationPhi = m_muonIdHelperTool->rpcIdHelper().stationPhi(padOfflineId); - int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(padOfflineId); + int stationName = m_idHelperSvc->rpcIdHelper().stationName(padOfflineId); + int stationEta = m_idHelperSvc->rpcIdHelper().stationEta(padOfflineId); + int stationPhi = m_idHelperSvc->rpcIdHelper().stationPhi(padOfflineId); + int doubletR = m_idHelperSvc->rpcIdHelper().doubletR(padOfflineId); - Identifier elementId = m_muonIdHelperTool->rpcIdHelper().elementID(stationName, stationEta, + Identifier elementId = m_idHelperSvc->rpcIdHelper().elementID(stationName, stationEta, stationPhi, doubletR); // For each pad, loop on the coincidence matrices @@ -580,10 +562,10 @@ StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, co { collection = 0; RpcDigit* newDigit = (*itVec); - elementId = m_muonIdHelperTool->rpcIdHelper().elementID(newDigit->identify()); + elementId = m_idHelperSvc->rpcIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->rpcIdHelper().get_hash(elementId, coll_hash, &rpcContext)) { + if (m_idHelperSvc->rpcIdHelper().get_hash(elementId, coll_hash, &rpcContext)) { ATH_MSG_WARNING( "Unable to get RPC digit collection hash id " << "context begin_index = " << rpcContext.begin_index() << " context end_index = " << rpcContext.end_index() @@ -623,7 +605,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeTgc(TgcDigitContainer* tgcContainer, co if(!m_tgcCabling && getTgcCabling().isFailure()) return StatusCode::FAILURE; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); ATH_MSG_DEBUG( "Number of RawData in this rdo " << rdoColl->size() ); @@ -785,7 +767,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeTgc(TgcDigitContainer* tgcContainer, co // check new element or not IdentifierHash coll_hash; - if (m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, coll_hash, &tgcContext)) { + if (m_idHelperSvc->tgcIdHelper().get_hash(elementId, coll_hash, &tgcContext)) { ATH_MSG_WARNING( "Unable to get TGC digit collection hash " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -842,7 +824,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeTgc(TgcDigitContainer* tgcContainer, co StatusCode MuonRdoToMuonDigitTool::decodeSTGC(sTgcDigitContainer * stgcContainer, const Muon::STGC_RawDataCollection * rdoColl, sTgcDigitCollection*& collection, Identifier& oldId){ if ( !rdoColl->empty() ) { ATH_MSG_DEBUG( " Number of RawData in this rdo " << rdoColl->size() ); - IdContext stgcContext = m_muonIdHelperTool->stgcIdHelper().module_context(); + IdContext stgcContext = m_idHelperSvc->stgcIdHelper().module_context(); /** for each Rdo, loop over RawData, converter RawData to digit retrieve/create digit collection, and insert digit into collection */ @@ -853,13 +835,13 @@ StatusCode MuonRdoToMuonDigitTool::decodeSTGC(sTgcDigitContainer * stgcContainer ATH_MSG_WARNING( "Error in sTGC RDO decoder" ); continue; } - ATH_MSG_DEBUG( "sTGC RDO->sTGCDigit: " << m_muonIdHelperTool->stgcIdHelper().show_to_string(newDigit->identify()) ); - ATH_MSG_DEBUG( "sTGC RDO->Digit: " << m_muonIdHelperTool->stgcIdHelper().show_to_string(newDigit->identify()) + ATH_MSG_DEBUG( "sTGC RDO->sTGCDigit: " << m_idHelperSvc->stgcIdHelper().show_to_string(newDigit->identify()) ); + ATH_MSG_DEBUG( "sTGC RDO->Digit: " << m_idHelperSvc->stgcIdHelper().show_to_string(newDigit->identify()) << " charge: " << newDigit->charge() << " time: " << newDigit->time() ); - Identifier elementId = m_muonIdHelperTool->stgcIdHelper().elementID(newDigit->identify()); + Identifier elementId = m_idHelperSvc->stgcIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->stgcIdHelper().get_hash(elementId, coll_hash, &stgcContext)) { + if (m_idHelperSvc->stgcIdHelper().get_hash(elementId, coll_hash, &stgcContext)) { ATH_MSG_WARNING( "Unable to get sTGC digit collection hash id " << "context begin_index = " << stgcContext.begin_index() << " context end_index = " << stgcContext.end_index() @@ -896,7 +878,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeSTGC(sTgcDigitContainer * stgcContainer StatusCode MuonRdoToMuonDigitTool::decodeMM(MmDigitContainer *mmContainer, const Muon::MM_RawDataCollection * rdoColl, MmDigitCollection*& collection, Identifier& oldId){ if ( !rdoColl->empty() ) { ATH_MSG_DEBUG( " Number of RawData in this rdo " << rdoColl->size() ); - IdContext mmContext = m_muonIdHelperTool->mmIdHelper().module_context(); + IdContext mmContext = m_idHelperSvc->mmIdHelper().module_context(); /** for each Rdo, loop over RawData, converter RawData to digit retrieve/create digit collection, and insert digit into collection */ @@ -907,11 +889,11 @@ StatusCode MuonRdoToMuonDigitTool::decodeMM(MmDigitContainer *mmContainer, const ATH_MSG_WARNING( "Error in MM RDO decoder" ); continue; } - ATH_MSG_DEBUG( "MM RDO->MMDigit: " << m_muonIdHelperTool->mmIdHelper().show_to_string(newDigit->identify()) ); + ATH_MSG_DEBUG( "MM RDO->MMDigit: " << m_idHelperSvc->mmIdHelper().show_to_string(newDigit->identify()) ); - Identifier elementId = m_muonIdHelperTool->mmIdHelper().elementID(newDigit->identify()); + Identifier elementId = m_idHelperSvc->mmIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->mmIdHelper().get_hash(elementId, coll_hash, &mmContext)) { + if (m_idHelperSvc->mmIdHelper().get_hash(elementId, coll_hash, &mmContext)) { ATH_MSG_WARNING( "Unable to get MM digit collection hash id " << "context begin_index = " << mmContext.begin_index() << " context end_index = " << mmContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadCscDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadCscDigit.cxx index d1e5dcd805d1dd5237111cc7b24437889c1b3c88..ee0e667be726014c0fca02ea170dc21ac531ca4c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadCscDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadCscDigit.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 "MuonByteStreamCnvTest/ReadCscDigit.h" @@ -26,7 +26,7 @@ StatusCode ReadCscDigit::initialize() { ATH_MSG_DEBUG( " in initialize()" ); ATH_CHECK( m_activeStore.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_cscNtuple) return StatusCode::SUCCESS; @@ -80,15 +80,15 @@ StatusCode ReadCscDigit::execute() Identifier id = (*dig)->identify(); // ID information - m_stationName[m_nDig] = m_muonIdHelperTool->cscIdHelper().stationName(id); - m_stationEta [m_nDig] = m_muonIdHelperTool->cscIdHelper().stationEta(id); - m_stationPhi [m_nDig] = m_muonIdHelperTool->cscIdHelper().stationPhi(id); - m_chamberLayer[m_nDig] = m_muonIdHelperTool->cscIdHelper().chamberLayer(id); - m_wireLayer[m_nDig] = m_muonIdHelperTool->cscIdHelper().wireLayer(id); - m_measuresPhi[m_nDig] = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); - m_strip[m_nDig] = m_muonIdHelperTool->cscIdHelper().strip(id); + m_stationName[m_nDig] = m_idHelperSvc->cscIdHelper().stationName(id); + m_stationEta [m_nDig] = m_idHelperSvc->cscIdHelper().stationEta(id); + m_stationPhi [m_nDig] = m_idHelperSvc->cscIdHelper().stationPhi(id); + m_chamberLayer[m_nDig] = m_idHelperSvc->cscIdHelper().chamberLayer(id); + m_wireLayer[m_nDig] = m_idHelperSvc->cscIdHelper().wireLayer(id); + m_measuresPhi[m_nDig] = m_idHelperSvc->cscIdHelper().measuresPhi(id); + m_strip[m_nDig] = m_idHelperSvc->cscIdHelper().strip(id); m_charge[m_nDig] = (*dig)->charge(); - ATH_MSG_DEBUG( "Digit = " << m_muonIdHelperTool->cscIdHelper().show_to_string(id) << " charge = " + ATH_MSG_DEBUG( "Digit = " << m_idHelperSvc->cscIdHelper().show_to_string(id) << " charge = " << m_charge[m_nDig] ); ++m_nDig; } diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx index 4c1a853640866c35c859265f7296f6e432119c44..a70a9343c7ecc12b004ff3468f577916a0953709 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtDigit.cxx @@ -33,7 +33,7 @@ StatusCode ReadMdtDigit::initialize() { ATH_MSG_DEBUG( " in initialize()" ); ATH_CHECK( m_activeStore.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_mdtNtuple) return StatusCode::SUCCESS; @@ -86,9 +86,9 @@ StatusCode ReadMdtDigit::execute() m_tdc[m_nDig] = (*dig)->tdc(); m_adc[m_nDig] = (*dig)->adc(); - m_multi[m_nDig] = m_muonIdHelperTool->mdtIdHelper().multilayer(dig_id); - m_layer[m_nDig] = m_muonIdHelperTool->mdtIdHelper().tubeLayer(dig_id); - m_wire[m_nDig] = m_muonIdHelperTool->mdtIdHelper().tube(dig_id); + m_multi[m_nDig] = m_idHelperSvc->mdtIdHelper().multilayer(dig_id); + m_layer[m_nDig] = m_idHelperSvc->mdtIdHelper().tubeLayer(dig_id); + m_wire[m_nDig] = m_idHelperSvc->mdtIdHelper().tube(dig_id); ++m_nDig; ATH_MSG_DEBUG( " Digit number " << m_nDig ); @@ -119,13 +119,6 @@ StatusCode ReadMdtDigit::execute() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode ReadMdtDigit::finalize() -{ - ATH_MSG_INFO( "in finalize()" ); - return StatusCode::SUCCESS; -} - - StatusCode ReadMdtDigit::accessNtuple() { m_NtupleLocID = "/NTUPLES" + m_NtupleLocID ; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx index 8fa56ab5ad0ec3bb1b58bad54e5c240d9bf0ba77..6387f832313aacdc81ab6162457383eb0651c2f2 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadMdtPRD.cxx @@ -32,7 +32,7 @@ ReadMdtPRD::ReadMdtPRD(const std::string& name, ISvcLocator* pSvcLocator) : StatusCode ReadMdtPRD::initialize() { ATH_MSG_DEBUG( " in initialize()" ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_mdtNtuple) return StatusCode::SUCCESS; @@ -89,9 +89,9 @@ StatusCode ReadMdtPRD::execute ATLAS_NOT_THREAD_SAFE () m_tdc[m_nPrd] = (*mdtPrd)->tdc(); m_adc[m_nPrd] = (*mdtPrd)->adc(); - m_multi[m_nPrd] = m_muonIdHelperTool->mdtIdHelper().multilayer(dig_id); - m_layer[m_nPrd] = m_muonIdHelperTool->mdtIdHelper().tubeLayer(dig_id); - m_wire[m_nPrd] = m_muonIdHelperTool->mdtIdHelper().tube(dig_id); + m_multi[m_nPrd] = m_idHelperSvc->mdtIdHelper().multilayer(dig_id); + m_layer[m_nPrd] = m_idHelperSvc->mdtIdHelper().tubeLayer(dig_id); + m_wire[m_nPrd] = m_idHelperSvc->mdtIdHelper().tube(dig_id); ++m_nPrd; ATH_MSG_DEBUG( " MdtPrepData number: " << m_nPrd ); @@ -123,13 +123,6 @@ StatusCode ReadMdtPRD::execute ATLAS_NOT_THREAD_SAFE () // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode ReadMdtPRD::finalize() -{ - ATH_MSG_INFO( "in finalize()" ); - return StatusCode::SUCCESS; -} - - StatusCode ReadMdtPRD::accessNtuple() { m_NtupleLocID = "/NTUPLES" + m_NtupleLocID ; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcDigit.cxx index bb184b6f77d771f1389192855cef24a9981f32a3..6e40421e15109b1e8705c1db74565550db810a15 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadRpcDigit.cxx @@ -20,16 +20,11 @@ ReadRpcDigit::ReadRpcDigit(const std::string &name, ISvcLocator *pSvcLocator) declareProperty("WriteRpcNtuple", m_rpcNtuple = false); } -ReadRpcDigit::~ReadRpcDigit() -{ } - -// Initialize method - StatusCode ReadRpcDigit::initialize() { ATH_MSG_DEBUG( " in initialize()" ); ATH_CHECK( m_activeStore.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_rpcNtuple) return StatusCode::SUCCESS; @@ -84,19 +79,19 @@ StatusCode ReadRpcDigit::execute() dig != (*c)->end(); ++dig) { Identifier dig_id = (*dig)->identify(); - if ( m_muonIdHelperTool->rpcIdHelper().valid(dig_id) ) + if ( m_idHelperSvc->rpcIdHelper().valid(dig_id) ) { m_time[m_nDig] = (*dig)->time(); - m_station[m_nDig] = m_muonIdHelperTool->rpcIdHelper().stationName(dig_id); - m_eta[m_nDig] = m_muonIdHelperTool->rpcIdHelper().stationEta(dig_id); - m_phi[m_nDig] = m_muonIdHelperTool->rpcIdHelper().stationPhi(dig_id); - m_doubletR[m_nDig] = m_muonIdHelperTool->rpcIdHelper().doubletR(dig_id); - m_doubletZ[m_nDig] = m_muonIdHelperTool->rpcIdHelper().doubletZ(dig_id); - m_doubletPhi[m_nDig] = m_muonIdHelperTool->rpcIdHelper().doubletPhi(dig_id); - m_gasGap[m_nDig] = m_muonIdHelperTool->rpcIdHelper().gasGap(dig_id); - m_measuresPhi[m_nDig] = m_muonIdHelperTool->rpcIdHelper().measuresPhi(dig_id); - m_strip[m_nDig] = m_muonIdHelperTool->rpcIdHelper().strip(dig_id); + m_station[m_nDig] = m_idHelperSvc->rpcIdHelper().stationName(dig_id); + m_eta[m_nDig] = m_idHelperSvc->rpcIdHelper().stationEta(dig_id); + m_phi[m_nDig] = m_idHelperSvc->rpcIdHelper().stationPhi(dig_id); + m_doubletR[m_nDig] = m_idHelperSvc->rpcIdHelper().doubletR(dig_id); + m_doubletZ[m_nDig] = m_idHelperSvc->rpcIdHelper().doubletZ(dig_id); + m_doubletPhi[m_nDig] = m_idHelperSvc->rpcIdHelper().doubletPhi(dig_id); + m_gasGap[m_nDig] = m_idHelperSvc->rpcIdHelper().gasGap(dig_id); + m_measuresPhi[m_nDig] = m_idHelperSvc->rpcIdHelper().measuresPhi(dig_id); + m_strip[m_nDig] = m_idHelperSvc->rpcIdHelper().strip(dig_id); } ++m_nDig; @@ -123,15 +118,6 @@ StatusCode ReadRpcDigit::execute() return StatusCode::SUCCESS; } - -// Finalize method - -StatusCode ReadRpcDigit::finalize() -{ - return StatusCode::SUCCESS; -} - - StatusCode ReadRpcDigit::accessNtuple() { //try to access it diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadTgcDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadTgcDigit.cxx index 9f2aa13c171587ebdb4dd4f87ee6488e9904e592..385b8da30582d2e8bb0a58b23a1fadedb636caf3 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadTgcDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/ReadTgcDigit.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 "MuonByteStreamCnvTest/ReadTgcDigit.h" @@ -28,7 +28,7 @@ StatusCode ReadTgcDigit::initialize() { ATH_MSG_DEBUG( " in initialize()" ); ATH_CHECK( m_activeStore.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_tgcNtuple) return StatusCode::SUCCESS; @@ -100,20 +100,20 @@ StatusCode ReadTgcDigit::execute() ATH_MSG_DEBUG( "Digit number " << m_nDig ); // ID information - m_stationName[m_nDig] = m_muonIdHelperTool->tgcIdHelper().stationName(id); - m_stationEta [m_nDig] = m_muonIdHelperTool->tgcIdHelper().stationEta(id); - m_stationPhi [m_nDig] = m_muonIdHelperTool->tgcIdHelper().stationPhi(id); - m_gasGap [m_nDig] = m_muonIdHelperTool->tgcIdHelper().gasGap(id); - m_isStrip [m_nDig] = m_muonIdHelperTool->tgcIdHelper().isStrip(id); - m_channel [m_nDig] = m_muonIdHelperTool->tgcIdHelper().channel(id); + m_stationName[m_nDig] = m_idHelperSvc->tgcIdHelper().stationName(id); + m_stationEta [m_nDig] = m_idHelperSvc->tgcIdHelper().stationEta(id); + m_stationPhi [m_nDig] = m_idHelperSvc->tgcIdHelper().stationPhi(id); + m_gasGap [m_nDig] = m_idHelperSvc->tgcIdHelper().gasGap(id); + m_isStrip [m_nDig] = m_idHelperSvc->tgcIdHelper().isStrip(id); + m_channel [m_nDig] = m_idHelperSvc->tgcIdHelper().channel(id); m_bcTag [m_nDig] = bctag; ATH_MSG_DEBUG( MSG::hex - << " N_" << m_muonIdHelperTool->tgcIdHelper().stationName(id) - << " E_" << m_muonIdHelperTool->tgcIdHelper().stationEta(id) - << " P_" << m_muonIdHelperTool->tgcIdHelper().stationPhi(id) - << " G_" << m_muonIdHelperTool->tgcIdHelper().gasGap(id) - << " C_" << m_muonIdHelperTool->tgcIdHelper().channel(id) ); + << " N_" << m_idHelperSvc->tgcIdHelper().stationName(id) + << " E_" << m_idHelperSvc->tgcIdHelper().stationEta(id) + << " P_" << m_idHelperSvc->tgcIdHelper().stationPhi(id) + << " G_" << m_idHelperSvc->tgcIdHelper().gasGap(id) + << " C_" << m_idHelperSvc->tgcIdHelper().channel(id) ); ++m_nDig; } @@ -124,15 +124,6 @@ StatusCode ReadTgcDigit::execute() return StatusCode::SUCCESS; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode ReadTgcDigit::finalize() -{ - ATH_MSG_DEBUG( "in finalize()" ); - return StatusCode::SUCCESS; -} - - StatusCode ReadTgcDigit::accessNtuple() { diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx index 838989f9c965b61f9f3c8b475223613a3908a28f..f6cf5f9e71138e2957e1b050bb37a3db4b4e14a5 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx @@ -1,9 +1,8 @@ /* - 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 "RpcRdoToRpcDigit.h" -#include "MuonIdHelpers/RpcIdHelper.h" RpcRdoToRpcDigit::RpcRdoToRpcDigit(const std::string& name, ISvcLocator* pSvcLocator) @@ -13,7 +12,7 @@ RpcRdoToRpcDigit::RpcRdoToRpcDigit(const std::string& name, StatusCode RpcRdoToRpcDigit::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // get RPC cabling ATH_CHECK(m_rpcCablingServerSvc.retrieve()); @@ -40,7 +39,7 @@ StatusCode RpcRdoToRpcDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " RPC RDOs." ); SG::WriteHandle<RpcDigitContainer> wh_rpcDigit(m_rpcDigitKey, ctx); - ATH_CHECK(wh_rpcDigit.record(std::make_unique<RpcDigitContainer> (m_muonIdHelperTool->rpcIdHelper().module_hash_max()))); + ATH_CHECK(wh_rpcDigit.record(std::make_unique<RpcDigitContainer> (m_idHelperSvc->rpcIdHelper().module_hash_max()))); ATH_MSG_DEBUG( "Decoding RPC RDO into RPC Digit" ); RpcDigitCollection * collection = nullptr; @@ -60,7 +59,7 @@ StatusCode RpcRdoToRpcDigit::execute(const EventContext& ctx) const StatusCode RpcRdoToRpcDigit::decodeRpc( const RpcPad * rdoColl, RpcDigitContainer *rpcContainer, RpcDigitCollection*& collection ) const { - const IdContext rpcContext = m_muonIdHelperTool->rpcIdHelper().module_context(); + const IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); ATH_MSG_DEBUG( " Number of CMs in this Pad " << rdoColl->size() ); @@ -70,12 +69,12 @@ StatusCode RpcRdoToRpcDigit::decodeRpc( const RpcPad * rdoColl, RpcDigitContaine uint16_t padId = rdoColl->onlineId(); uint16_t sectorId = rdoColl->sector(); - const int stationName = m_muonIdHelperTool->rpcIdHelper().stationName(padOfflineId); - const int stationEta = m_muonIdHelperTool->rpcIdHelper().stationEta(padOfflineId); - const int stationPhi = m_muonIdHelperTool->rpcIdHelper().stationPhi(padOfflineId); - const int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(padOfflineId); + const int stationName = m_idHelperSvc->rpcIdHelper().stationName(padOfflineId); + const int stationEta = m_idHelperSvc->rpcIdHelper().stationEta(padOfflineId); + const int stationPhi = m_idHelperSvc->rpcIdHelper().stationPhi(padOfflineId); + const int doubletR = m_idHelperSvc->rpcIdHelper().doubletR(padOfflineId); - Identifier elementId = m_muonIdHelperTool->rpcIdHelper().elementID(stationName, stationEta, + Identifier elementId = m_idHelperSvc->rpcIdHelper().elementID(stationName, stationEta, stationPhi, doubletR); // For each pad, loop on the coincidence matrices @@ -97,10 +96,10 @@ StatusCode RpcRdoToRpcDigit::decodeRpc( const RpcPad * rdoColl, RpcDigitContaine // Loop on the digits corresponding to the fired channel for (RpcDigit *newDigit : *digitVec) { collection = nullptr; - elementId = m_muonIdHelperTool->rpcIdHelper().elementID(newDigit->identify()); + elementId = m_idHelperSvc->rpcIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->rpcIdHelper().get_hash(elementId, coll_hash, &rpcContext)) { + if (m_idHelperSvc->rpcIdHelper().get_hash(elementId, coll_hash, &rpcContext)) { ATH_MSG_WARNING( "Unable to get RPC digit collection hash id " << "context begin_index = " << rpcContext.begin_index() << " context end_index = " << rpcContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h index 91ce94f3d5b002de69e515d2ba646edd8dd48a09..d53c9ff812417ddd785c876be47675823aa3ee3c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h @@ -5,13 +5,15 @@ #ifndef MUONBYTESTREAMCNVTEST_RPCRDOTORPCDIGIT_H #define MUONBYTESTREAMCNVTEST_RPCRDOTORPCDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" #include "MuonRDO/RpcPadContainer.h" #include "MuonDigitContainer/RpcDigitContainer.h" #include "RPCcablingInterface/IRPCcablingServerSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class RpcRdoToRpcDigit : public AthReentrantAlgorithm { @@ -26,8 +28,7 @@ class RpcRdoToRpcDigit : public AthReentrantAlgorithm { private: StatusCode decodeRpc( const RpcPad *, RpcDigitContainer *, RpcDigitCollection*& ) const; ToolHandle<Muon::IRPC_RDO_Decoder> m_rpcRdoDecoderTool{this,"rpcRdoDecoderTool","Muon::RpcRDO_Decoder",""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<IRPCcablingServerSvc> m_rpcCablingServerSvc{this, "RPCcablingServerSvc", "RPCcablingServerSvc", ""}; const IRPCcablingSvc * m_rpcCabling{}; SG::ReadHandleKey<RpcPadContainer> m_rpcRdoKey{this, "RpcRdoContainer", "RPCPAD", "Rpc RDO Input"}; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx index 4401cdfbe90c59924140ee1c2fbdc45795f876ed..aa86b43904ca8898afa25753cf909561600764af 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.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 "STGC_DigitToRDO.h" @@ -15,10 +15,9 @@ STGC_DigitToRDO::STGC_DigitToRDO(const std::string& name, ISvcLocator* pSvcLocat StatusCode STGC_DigitToRDO::initialize() { ATH_MSG_DEBUG( " in initialize()" ); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK( m_rdoContainer.initialize() ); ATH_CHECK( m_digitContainer.initialize() ); - ATH_CHECK ( detStore()->retrieve(m_idHelper, "STGCIDHELPER") ); - return StatusCode::SUCCESS; } @@ -28,7 +27,7 @@ StatusCode STGC_DigitToRDO::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "in execute()" ); SG::WriteHandle<STGC_RawDataContainer> rdos (m_rdoContainer, ctx); SG::ReadHandle<sTgcDigitContainer> digits (m_digitContainer, ctx); - ATH_CHECK( rdos.record(std::make_unique<STGC_RawDataContainer>(m_idHelper->module_hash_max())) ); + ATH_CHECK( rdos.record(std::make_unique<STGC_RawDataContainer>(m_idHelperSvc->mmIdHelper().module_hash_max())) ); if (digits.isValid() ) { for (const sTgcDigitCollection* digitColl : *digits ) { @@ -37,7 +36,7 @@ StatusCode STGC_DigitToRDO::execute(const EventContext& ctx) const // module Id hash Identifier digitId = digitColl->identify(); IdentifierHash hash; - int getRdoCollHash = m_idHelper->get_module_hash(digitId,hash); + int getRdoCollHash = m_idHelperSvc->mmIdHelper().get_module_hash(digitId,hash); if ( getRdoCollHash !=0 ) { ATH_MSG_ERROR("Could not get the module hash Id"); return StatusCode::FAILURE; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.h index b21eb2ddaa1a46a35da49d7579c2732604fc3ea4..55a77ca614e0c34086352cfe140eab0baf9b674c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.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 STGCDIGITTORDO_H @@ -11,8 +11,7 @@ #include "MuonRDO/STGC_RawDataContainer.h" #include "MuonDigitContainer/sTgcDigitContainer.h" - -class sTgcIdHelper; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" ///////////////////////////////////////////////////////////////////////////// @@ -27,8 +26,7 @@ public: virtual StatusCode execute(const EventContext& ctx) const override final; private: - - const sTgcIdHelper* m_idHelper{}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::WriteHandleKey<Muon::STGC_RawDataContainer> m_rdoContainer{this, "OutputObjectName", "sTGCRDO", "WriteHandleKey for Output STGC_RawDataContainer"}; SG::ReadHandleKey<sTgcDigitContainer> m_digitContainer{this, "InputObjectName", "sTGC_DIGITS", "ReadHandleKey for Input sTgcDigitContainer"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.cxx index 62248d5eaf3b7e0ed81f454dcdde438e26966c14..9ac6a5a613b55db606ae27df52941345a5d8e68c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.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 "STGC_RdoToDigit.h" @@ -12,7 +12,7 @@ STGC_RdoToDigit::STGC_RdoToDigit(const std::string& name, StatusCode STGC_RdoToDigit::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_stgcRdoDecoderTool.retrieve() ); ATH_CHECK(m_stgcRdoKey.initialize()); ATH_CHECK(m_stgcDigitKey.initialize()); @@ -31,7 +31,7 @@ StatusCode STGC_RdoToDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " sTGC RDOs." ); SG::WriteHandle<sTgcDigitContainer> wh_stgcDigit(m_stgcDigitKey, ctx); - ATH_CHECK(wh_stgcDigit.record(std::make_unique<sTgcDigitContainer>(m_muonIdHelperTool->stgcIdHelper().detectorElement_hash_max()))); + ATH_CHECK(wh_stgcDigit.record(std::make_unique<sTgcDigitContainer>(m_idHelperSvc->stgcIdHelper().detectorElement_hash_max()))); ATH_MSG_DEBUG( "Decoding sTGC RDO into sTGC Digit" ); // retrieve the collection of RDO @@ -47,7 +47,7 @@ StatusCode STGC_RdoToDigit::execute(const EventContext& ctx) const StatusCode STGC_RdoToDigit::decodeSTGC( const Muon::STGC_RawDataCollection * rdoColl, sTgcDigitContainer * stgcContainer, sTgcDigitCollection*& collection, Identifier& oldId ) const { - const IdContext stgcContext = m_muonIdHelperTool->stgcIdHelper().module_context(); + const IdContext stgcContext = m_idHelperSvc->stgcIdHelper().module_context(); if ( rdoColl->size() > 0 ) { ATH_MSG_DEBUG( " Number of RawData in this rdo " @@ -64,9 +64,9 @@ StatusCode STGC_RdoToDigit::decodeSTGC( const Muon::STGC_RawDataCollection * rdo // find here the Proper Digit Collection identifier, using the rdo-hit id // (since RDO collections are not in a 1-to-1 relation with digit collections) - const Identifier elementId = m_muonIdHelperTool->stgcIdHelper().elementID(newDigit->identify()); + const Identifier elementId = m_idHelperSvc->stgcIdHelper().elementID(newDigit->identify()); IdentifierHash coll_hash; - if (m_muonIdHelperTool->stgcIdHelper().get_hash(elementId, coll_hash, &stgcContext)) { + if (m_idHelperSvc->stgcIdHelper().get_hash(elementId, coll_hash, &stgcContext)) { ATH_MSG_WARNING( "Unable to get STGC digit collection hash id " << "context begin_index = " << stgcContext.begin_index() << " context end_index = " << stgcContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.h index c17593b4d64c1ac1e5167e41cadd48fe548775ea..00a3013664ec778ada05bfa439b5feb14f562694 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_RdoToDigit.h @@ -1,16 +1,18 @@ /* - 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 MUONBYTESTREAMCNVTEST_STGCRDOTOSTGCDIGIT_H #define MUONBYTESTREAMCNVTEST_STGCRDOTOSTGCDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonSTGC_CnvTools/ISTGC_RDO_Decoder.h" #include "MuonRDO/STGC_RawDataContainer.h" #include "MuonDigitContainer/sTgcDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class STGC_RdoToDigit : public AthReentrantAlgorithm { @@ -26,8 +28,7 @@ class STGC_RdoToDigit : public AthReentrantAlgorithm { StatusCode decodeSTGC( const Muon::STGC_RawDataCollection *, sTgcDigitContainer *, sTgcDigitCollection*&, Identifier& ) const; ToolHandle<Muon::ISTGC_RDO_Decoder> m_stgcRdoDecoderTool{this, "sTgcRdoDecoderTool", "Muon::STGC_RDO_Decoder", ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKey<Muon::STGC_RawDataContainer> m_stgcRdoKey{this, "sTgcRdoContainer", "sTGCRDO", "sTGC RDO Input"}; SG::WriteHandleKey<sTgcDigitContainer> m_stgcDigitKey{this, "sTgcDigitContainer", "sTGC_DIGITS", "sTGC Digit Output"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx index 4cc312b8fe4cfb7ad870ea613e0200376fa971dd..97302353c4d27cb648a66f09d444bf2d9ce92af0 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.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 "StoreGate/StoreGateSvc.h" @@ -7,7 +7,6 @@ #include "EventInfoMgt/ITagInfoMgr.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" -#include "TGCcablingInterface/ITGCcablingSvc.h" #include "MuonDigitContainer/TgcDigitCollection.h" #include "MuonDigitContainer/TgcDigit.h" @@ -31,7 +30,7 @@ TgcDigitToTgcRDO::TgcDigitToTgcRDO(const std::string& name, ISvcLocator* pSvcLoc StatusCode TgcDigitToTgcRDO::initialize() { ATH_MSG_DEBUG( " in initialize()" ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_tgc_cabling_server.retrieve() ); ATH_MSG_DEBUG( "standard digitization job: " @@ -106,7 +105,7 @@ StatusCode TgcDigitToTgcRDO::fill_TGCdata(const EventContext& ctx) const bctag = 0; } - if (m_muonIdHelperTool->tgcIdHelper().valid(channelId)) + if (m_idHelperSvc->tgcIdHelper().valid(channelId)) { // Get the online Id of the channel int subDetectorID; @@ -140,19 +139,17 @@ StatusCode TgcDigitToTgcRDO::fill_TGCdata(const EventContext& ctx) const { ATH_MSG_DEBUG( "ITGCcablingSvc can't return an online ID for the channel : " << MSG::dec - << " N_" << m_muonIdHelperTool->tgcIdHelper().stationName(channelId) - << " E_" << m_muonIdHelperTool->tgcIdHelper().stationEta(channelId) - << " P_" << m_muonIdHelperTool->tgcIdHelper().stationPhi(channelId) - << " G_" << m_muonIdHelperTool->tgcIdHelper().gasGap(channelId) - << " C_" << m_muonIdHelperTool->tgcIdHelper().channel(channelId) ); + << " N_" << m_idHelperSvc->tgcIdHelper().stationName(channelId) + << " E_" << m_idHelperSvc->tgcIdHelper().stationEta(channelId) + << " P_" << m_idHelperSvc->tgcIdHelper().stationPhi(channelId) + << " G_" << m_idHelperSvc->tgcIdHelper().gasGap(channelId) + << " C_" << m_idHelperSvc->tgcIdHelper().channel(channelId) ); continue; } // Create the new Tgc RawData -// TgcRawData* rawData -// = new TgcRawData(bctag,subDetectorID,rodID,sswID,slbID,0,0,channelID); - bool isStrip = m_muonIdHelperTool->tgcIdHelper().isStrip(channelId); - std::string name = m_muonIdHelperTool->tgcIdHelper().stationNameString(m_muonIdHelperTool->tgcIdHelper().stationName(channelId)); + bool isStrip = m_idHelperSvc->tgcIdHelper().isStrip(channelId); + std::string name = m_idHelperSvc->tgcIdHelper().stationNameString(m_idHelperSvc->tgcIdHelper().stationName(channelId)); TgcRawData::SlbType type = TgcRawData::SLB_TYPE_UNKNOWN; if (name[1] == '4') type = isStrip ? TgcRawData::SLB_TYPE_INNER_STRIP : TgcRawData::SLB_TYPE_INNER_WIRE; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.cxx index ba8a2d24851279eda3597b7ec2d02f83e0e36ab9..6a5de6e69a635f82e787943580e4917fa11e319d 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.cxx @@ -1,9 +1,8 @@ /* - 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 "TgcRdoToTgcDigit.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" TgcRdoToTgcDigit::TgcRdoToTgcDigit(const std::string& name, ISvcLocator* pSvcLocator) @@ -13,7 +12,7 @@ TgcRdoToTgcDigit::TgcRdoToTgcDigit(const std::string& name, StatusCode TgcRdoToTgcDigit::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_tgcRdoDecoderTool.retrieve() ); ATH_CHECK(m_tgcRdoKey.initialize()); ATH_CHECK(m_tgcDigitKey.initialize()); @@ -37,7 +36,7 @@ StatusCode TgcRdoToTgcDigit::execute(const EventContext& ctx) const ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " TGC RDOs." ); SG::WriteHandle<TgcDigitContainer> wh_tgcDigit(m_tgcDigitKey, ctx); - ATH_CHECK(wh_tgcDigit.record(std::make_unique<TgcDigitContainer> (m_muonIdHelperTool->tgcIdHelper().module_hash_max()))); + ATH_CHECK(wh_tgcDigit.record(std::make_unique<TgcDigitContainer> (m_idHelperSvc->tgcIdHelper().module_hash_max()))); ATH_MSG_DEBUG( "Decoding TGC RDO into TGC Digit" ); Identifier oldElementId; @@ -59,7 +58,7 @@ StatusCode TgcRdoToTgcDigit::decodeTgc( const TgcRdo *rdoColl, { TgcDigitCollection* collection = nullptr; - const IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + const IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); ATH_MSG_DEBUG( "Number of RawData in this rdo " << rdoColl->size() ); @@ -217,7 +216,7 @@ StatusCode TgcRdoToTgcDigit::decodeTgc( const TgcRdo *rdoColl, // check new element or not IdentifierHash coll_hash; - if (m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, coll_hash, &tgcContext)) { + if (m_idHelperSvc->tgcIdHelper().get_hash(elementId, coll_hash, &tgcContext)) { ATH_MSG_WARNING( "Unable to get TGC digit collection hash " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.h index 616e26b8edf542fdad466a1423da50092189678b..c294a06c3ffb81d9a8f012d1369f1813cadbd099 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcRdoToTgcDigit.h @@ -1,17 +1,19 @@ /* - 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 MUONBYTESTREAMCNVTEST_TGCRDOTOTGCDIGIT_H #define MUONBYTESTREAMCNVTEST_TGCRDOTOTGCDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonTGC_CnvTools/ITGC_RDO_Decoder.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" #include "MuonRDO/TgcRdoContainer.h" #include "MuonDigitContainer/TgcDigitContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class TgcRdoToTgcDigit : public AthReentrantAlgorithm { @@ -27,13 +29,7 @@ class TgcRdoToTgcDigit : public AthReentrantAlgorithm { StatusCode decodeTgc( const TgcRdo *, TgcDigitContainer *, Identifier&) const; ToolHandle<Muon::ITGC_RDO_Decoder> m_tgcRdoDecoderTool{this, "tgcRdoDecoderTool", "Muon::TgcRDO_Decoder", ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - /** Switch for warning message disabling on one invalid channel in - TGC sector A09 seen in 2008 data, at least run 79772 - 91800. - bug #48828: TgcRdoToTgcDigit WARNING ElementID not found for - sub=103 rod=9 ssw=6 slb=20 bitpos=151 +offset=0 orFlag=0 - */ + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; Gaudi::Property<bool> m_show_warning_level_invalid_TGC_A09_SSW6_hit{this, "show_warning_level_invalid_TGC_A09_SSW6_hit", false, ""}; ServiceHandle<ITGCcablingServerSvc> m_tgcCablingServerSvc{this, "TGCcablingServerSvc", "TGCcablingServerSvc", ""}; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/CscPrepDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/CscPrepDataRetriever.h index f5aeac15536270fc75ef9f0bc113fe6de6fd6316..ba81d48817b32bf5b7ff27884ab5b508dd08f85f 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/CscPrepDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/CscPrepDataRetriever.h @@ -1,19 +1,18 @@ /* - 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 JIVEXML_CSCPREPDATARETRIEVER_H #define JIVEXML_CSCPREPDATARETRIEVER_H -#include <string> - #include "JiveXML/IDataRetriever.h" - #include "AthenaBaseComps/AthAlgTool.h" - +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <string> namespace JiveXML { @@ -39,9 +38,7 @@ namespace JiveXML { ///The storegate key for the CSC collection std::string m_sgKey; - /// Tool for CSC identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/MdtPrepDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/MdtPrepDataRetriever.h index bdd4012993903a597fc518dfe567e66fa5515837..84300c54b6d63594f372a1602c0242f83c03f0c3 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/MdtPrepDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/MdtPrepDataRetriever.h @@ -1,19 +1,18 @@ /* - 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 JIVEXML_MDTPREPDATARETRIEVER_H #define JIVEXML_MDTPREPDATARETRIEVER_H -#include <string> - #include "JiveXML/IDataRetriever.h" - #include "AthenaBaseComps/AthAlgTool.h" - +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <string> namespace JiveXML { @@ -38,12 +37,10 @@ namespace JiveXML { ///The data type that is generated by this retriever const std::string m_typeName; - ///The storegate key for the CSC collection + ///The storegate key for the MDT collection std::string m_sgKey; - /// Tool for MDT identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; int m_adcCut; bool m_obeyMasked; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/RpcPrepDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/RpcPrepDataRetriever.h index 667ff91dd426cd51e112a3d23eec0c971cf316bd..4ad080b012daf3ce4379905609fbd4448a9d5e89 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/RpcPrepDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/RpcPrepDataRetriever.h @@ -1,19 +1,19 @@ /* - 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 JIVEXML_RPCPREPDATARETRIEVER_H #define JIVEXML_RPCPREPDATARETRIEVER_H -#include <string> - #include "JiveXML/IDataRetriever.h" #include "AthenaBaseComps/AthAlgTool.h" - +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <string> namespace JiveXML { @@ -38,12 +38,10 @@ namespace JiveXML { ///The data type that is generated by this retriever const std::string m_typeName; - ///The storegate key for the CSC collection + ///The storegate key for the RPC collection std::string m_sgKey; - /// Tool for RPC identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TgcPrepDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TgcPrepDataRetriever.h index e5cfb778c1df494cad6e2b24e4badc11dde04d32..e8b4a3dba2e0a11d6e12d9cd6c1423f9892c881c 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TgcPrepDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TgcPrepDataRetriever.h @@ -1,19 +1,19 @@ /* - 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 JIVEXML_TGCPREPDATARETRIEVER_H #define JIVEXML_TGCPREPDATARETRIEVER_H -#include <string> - #include "JiveXML/IDataRetriever.h" #include "AthenaBaseComps/AthAlgTool.h" - +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <string> namespace JiveXML { @@ -38,12 +38,10 @@ namespace JiveXML { ///The data type that is generated by this retriever const std::string m_typeName; - ///The storegate key for the CSC collection + ///The storegate key for the TGC collection std::string m_sgKey; - /// Tool for TGC identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx index 689c260f966a3d7512f98f35c6ddf94ef8e41fe8..6cb8beab92ad33c6f42c628825910837c172b460 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.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 "MuonJiveXML/CSCClusterRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" - namespace JiveXML { /** @@ -31,7 +29,7 @@ namespace JiveXML { StatusCode CSCClusterRetriever::initialize(){ //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName()); return StatusCode::SUCCESS; } @@ -43,85 +41,6 @@ namespace JiveXML { * @param FormatTool the tool that will create formated output from the DataMap */ StatusCode CSCClusterRetriever::retrieve(ToolHandle<IFormatTool> &/*FormatTool*/) { - - // //be verbose - // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; - - // //retrieve the cluster collection - // const CscClusterCollection* container; - // if( evtStore()->retrieve(container,m_sgKey).isFailure() ) { - // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Could not find CscClusterCollection " << m_sgKey << endmsg; - // return StatusCode::SUCCESS; - // } - - // //Abort if the container is empty - // if (container->empty()){ - // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "CscClusterCollection with name " << m_sgKey << " is empty!" << endmsg; - // return StatusCode::SUCCESS; - // } - - // //Make the vectors to contain the information - // //and reserve enough space - // int nClusters = container->size(); - // DataVect x; x.reserve(nClusters); - // DataVect y; y.reserve(nClusters); - // DataVect z; z.reserve(nClusters); - // DataVect sigma; sigma.reserve(nClusters); - // DataVect id; id.reserve(nClusters); - // DataVect identifier; identifier.reserve(nClusters); - // DataVect numHits; numHits.reserve(nClusters); - // DataVect barcode; barcode.reserve(nClusters); - // DataVect hitsFull; - - // //Get the number of full hits, and reserve enough space - // int hitsCount = 0; - // //Get an iterator over the clusters - // //and calculate number of hits - // CscClusterCollection::const_iterator itr = container->begin(); - // for(; itr != container->end() ; ++itr) - // hitsCount += ((*itr)->digit_iterator_end() - (*itr)->digit_iterator_begin()); - - // //Reserve enough space for hits - // std::string noHitsFull = DataType( hitsCount/((double)(container->size())) ).toString(); - // hitsFull.reserve(hitsCount); - - // //Now loop again to retrieve the information - // for(itr = container->begin(); itr != container->end() ; ++itr){ - // x.push_back( DataType( (*itr)->position().x()/CLHEP::cm ) ); - // y.push_back( DataType( (*itr)->position().y()/CLHEP::cm ) ); - // z.push_back( DataType( (*itr)->position().z()/CLHEP::cm ) ); - // sigma.push_back( DataType( (*itr)->sigma() ) ); - // id.push_back( DataType( (*itr)->identify().get_compact() ) ); - // identifier.push_back( DataType( MuonFullIDHelper::getFullID((*itr)->identify(),m_cscHelper) ) ); - // //Barcode is always zero - // barcode.push_back(DataType((int)0)); - - // //Now loop over CSC digits - // std::vector<CscDigit*>::const_iterator dig = (*itr)->digit_iterator_begin(); - // //store all their ids - // for(; dig != (*itr)->digit_iterator_end(); ++dig) - // hitsFull.push_back( DataType( MuonFullIDHelper::getFullID( (*dig)->identify(),m_cscHelper ) ) ); - // //and the number of them - // numHits.push_back( DataType(((*itr)->digit_iterator_end() - (*itr)->digit_iterator_begin()))); - // } - - // //Finally assemble the DataMap - // DataMap myDataMap; - // myDataMap["x"] = x; - // myDataMap["y"] = y; - // myDataMap["z"] = z; - // myDataMap["sigma"] = sigma; - // myDataMap["id"] = id; - // myDataMap["identifier"] = identifier; - // myDataMap["numHits"] = numHits; - // myDataMap["barcode"] = barcode; - // myDataMap["hitsFull multiple=\"" + noHitsFull + "\""] = hitsFull; - - // //Be verbose - // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; - - // //forward data to formating tool - // return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); return StatusCode::SUCCESS; } } diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx index 807b72a1619038658a61feedda3cfc5200a06438..745cade49b8d46bb146b71ce7434f493e55808a7 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx @@ -1,13 +1,11 @@ /* - 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 "MuonJiveXML/CscPrepDataRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" - #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" namespace JiveXML { @@ -28,9 +26,9 @@ namespace JiveXML { StatusCode CscPrepDataRetriever::initialize(){ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -40,11 +38,11 @@ namespace JiveXML { StatusCode CscPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieving " << dataTypeName()); - const Muon::CscPrepDataContainer *cscContainer; + const Muon::CscPrepDataContainer *cscContainer=nullptr; if ( evtStore()->retrieve(cscContainer, m_sgKey).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Muon::CscPrepDataContainer '" << m_sgKey << "' was not retrieved." << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Muon::CscPrepDataContainer '" << m_sgKey << "' was not retrieved."); return StatusCode::SUCCESS; } @@ -75,7 +73,7 @@ namespace JiveXML { Identifier id = data->identify(); if (!element) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No MuonGM::CscReadoutElement for hit " << id << endmsg; + if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::CscReadoutElement for hit " << id); continue; } @@ -88,7 +86,7 @@ namespace JiveXML { z.push_back(DataType(globalPos.z()/CLHEP::cm)); lengthVec.push_back(DataType(length/CLHEP::cm)); chargeVec.push_back(DataType(charge)); - identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_muonIdHelperTool->cscIdHelper()))); + identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->cscIdHelper()))); idVec.push_back(DataType( id.get_compact() )); barcode.push_back(DataType(0)); } @@ -105,7 +103,7 @@ namespace JiveXML { myDataMap["barcode"] = barcode; //Be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size()); //forward data to formating tool //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx index 15cbcef50bbee50e7303b579afa30782b40b781e..04bdc4571f901ce7b5378fbc779e0527614c1d62 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx @@ -1,13 +1,11 @@ /* - 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 "MuonJiveXML/MdtPrepDataRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonIdHelpers/MdtIdHelper.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" namespace JiveXML { @@ -30,9 +28,9 @@ namespace JiveXML { StatusCode MdtPrepDataRetriever::initialize(){ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -42,11 +40,11 @@ namespace JiveXML { StatusCode MdtPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieving " << dataTypeName()); - const Muon::MdtPrepDataContainer *mdtContainer; + const Muon::MdtPrepDataContainer *mdtContainer=nullptr; if ( evtStore()->retrieve(mdtContainer, m_sgKey).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Muon::MdtPrepDataContainer '" << m_sgKey << "' was not retrieved." << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Muon::MdtPrepDataContainer '" << m_sgKey << "' was not retrieved."); return StatusCode::SUCCESS; } @@ -79,7 +77,7 @@ namespace JiveXML { Identifier id = data->identify(); if (!element) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No MuonGM::MdtReadoutElement for hit " << id << endmsg; + if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::MdtReadoutElement for hit " << id); continue; } @@ -103,16 +101,15 @@ namespace JiveXML { z.push_back(DataType(globalPos.z()/CLHEP::cm)); driftRVec.push_back(DataType(localPos[Trk::driftRadius]/CLHEP::cm)); lengthVec.push_back(DataType(tubeLength/CLHEP::cm)); - identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_muonIdHelperTool->mdtIdHelper()))); + identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->mdtIdHelper()))); idVec.push_back(DataType( id.get_compact() )); barcode.push_back(DataType(0)); } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " MdtPrepData x, y, z, driftR, lenght " << globalPos.x() << " " + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" MdtPrepData x, y, z, driftR, lenght " << globalPos.x() << " " << globalPos.y() << " " << globalPos.z() << " " << localPos[Trk::driftRadius] - << " " << tubeLength << " adc: " << adcCount; - if ( notMasked ){ if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " *notMasked* "; } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << endmsg; + << " " << tubeLength << " adc: " << adcCount); + if ( notMasked ){ if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" *notMasked* "); } } } @@ -127,7 +124,7 @@ namespace JiveXML { myDataMap["barcode"] = barcode; //Be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size()); //forward data to formating tool //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx index 2af4e90267bec837e510096e615b5d707d2a4796..0b9d55321211d5e6cfe0a258d0c8dce75154da25 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx @@ -1,11 +1,10 @@ /* - 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 "MuonJiveXML/RpcPrepDataRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" - #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" @@ -27,9 +26,9 @@ namespace JiveXML { StatusCode RpcPrepDataRetriever::initialize(){ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -39,11 +38,11 @@ namespace JiveXML { StatusCode RpcPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieving " << dataTypeName()); - const Muon::RpcPrepDataContainer *rpcContainer; + const Muon::RpcPrepDataContainer *rpcContainer=nullptr; if ( evtStore()->retrieve(rpcContainer, m_sgKey).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Muon::RpcPrepDataContainer '" << m_sgKey << "' was not retrieved." << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Muon::RpcPrepDataContainer '" << m_sgKey << "' was not retrieved."); return StatusCode::SUCCESS; } @@ -74,12 +73,12 @@ namespace JiveXML { Identifier id = data->identify(); if (!element) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No MuonGM::RpcReadoutElement for hit " << id << endmsg; + if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::RpcReadoutElement for hit " << id); continue; } Amg::Vector3D globalPos = element->stripPos(id); - int measuresPhi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(id); + int measuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(id); double stripLength = element->StripLength(measuresPhi); double stripWidth = element->StripWidth(measuresPhi); @@ -88,7 +87,7 @@ namespace JiveXML { z.push_back(DataType(globalPos.z()/CLHEP::cm)); lengthVec.push_back(DataType(stripLength/CLHEP::cm)); widthVec.push_back(DataType(stripWidth/CLHEP::cm)); - identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_muonIdHelperTool->rpcIdHelper()))); + identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->rpcIdHelper()))); idVec.push_back(DataType( id.get_compact() )); barcode.push_back(DataType(0)); } @@ -105,7 +104,7 @@ namespace JiveXML { myDataMap["barcode"] = barcode; //Be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size()); //forward data to formating tool return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx index 7bebed02dc62ac8ac8a313d42b6dd5a75b97f87a..489dd3caf6bb58ead99718a3958323d814436858 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx @@ -1,13 +1,11 @@ /* - 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 "MuonJiveXML/TgcPrepDataRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" - #include "MuonReadoutGeometry/TgcReadoutElement.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" namespace JiveXML { @@ -28,9 +26,9 @@ namespace JiveXML { StatusCode TgcPrepDataRetriever::initialize(){ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -40,11 +38,11 @@ namespace JiveXML { StatusCode TgcPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieving " << dataTypeName()); - const Muon::TgcPrepDataContainer *tgcContainer; + const Muon::TgcPrepDataContainer *tgcContainer=nullptr; if ( evtStore()->retrieve(tgcContainer, m_sgKey).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Muon::TgcPrepDataContainer '" << m_sgKey << "' was not retrieved." << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Muon::TgcPrepDataContainer '" << m_sgKey << "' was not retrieved."); return StatusCode::SUCCESS; } @@ -75,22 +73,22 @@ namespace JiveXML { Identifier id = data->identify(); if (!element) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No MuonGM::TgcReadoutElement for hit " << id << endmsg; + if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::TgcReadoutElement for hit " << id); continue; } Amg::Vector3D globalPos; double shortWidth, longWidth, length; - if (m_muonIdHelperTool->tgcIdHelper().isStrip(id)) { - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(id); - int strip = m_muonIdHelperTool->tgcIdHelper().channel(id); + if (m_idHelperSvc->tgcIdHelper().isStrip(id)) { + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id); + int strip = m_idHelperSvc->tgcIdHelper().channel(id); shortWidth = element->stripShortWidth(gasGap, strip); longWidth = element->stripLongWidth(gasGap, strip); length = element->stripLength(gasGap, strip); globalPos = element->stripPos(gasGap, strip); } else { - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(id); - int gang = m_muonIdHelperTool->tgcIdHelper().channel(id); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id); + int gang = m_idHelperSvc->tgcIdHelper().channel(id); shortWidth = element->gangShortWidth(gasGap, gang); longWidth = element->gangLongWidth(gasGap, gang); length = element->gangLength(gasGap, gang); @@ -103,7 +101,7 @@ namespace JiveXML { swidthVec.push_back(DataType(shortWidth/CLHEP::cm)); lwidthVec.push_back(DataType(longWidth/CLHEP::cm)); lengthVec.push_back(DataType(length/CLHEP::cm)); - identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_muonIdHelperTool->tgcIdHelper()))); + identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->tgcIdHelper()))); idVec.push_back(DataType( id.get_compact() )); barcode.push_back(DataType(0)); @@ -122,7 +120,7 @@ namespace JiveXML { myDataMap["barcode"] = barcode; //Be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size()); ////forward data to formating tool //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx index 5326b967911a6b320f5fef023b04645d4909d047..3ca1dfb5c2c7c565d9d2d57926d7a4dbe722ad22 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx @@ -23,14 +23,14 @@ using eformat::helper::SourceIdentifier; MDT_Hid2RESrcID::MDT_Hid2RESrcID() : - m_muonIdHelperTool(nullptr), m_specialROBNumber(0), m_readKey("MuonMDT_CablingMap") + m_mdtIdHelper(nullptr), m_specialROBNumber(0), m_readKey("MuonMDT_CablingMap") { } -StatusCode MDT_Hid2RESrcID::set(const Muon::MuonIdHelperTool* muonIdHelperTool) { +StatusCode MDT_Hid2RESrcID::set(const MdtIdHelper* mdtId) { // Initialize the cabling Service - m_muonIdHelperTool = muonIdHelperTool; + m_mdtIdHelper = mdtId; ATH_CHECK( m_readKey.initialize() ); return StatusCode::SUCCESS; } @@ -58,12 +58,12 @@ uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { << endmsg; bool online; - int station_name = m_muonIdHelperTool->mdtIdHelper().stationName(offlineId); - int station_eta = m_muonIdHelperTool->mdtIdHelper().stationEta(offlineId); - int station_phi = m_muonIdHelperTool->mdtIdHelper().stationPhi(offlineId); - int multilayer = m_muonIdHelperTool->mdtIdHelper().multilayer(offlineId); - int tubelayer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(offlineId); - int tube = m_muonIdHelperTool->mdtIdHelper().tube(offlineId); + int station_name = m_mdtIdHelper->stationName(offlineId); + int station_eta = m_mdtIdHelper->stationEta(offlineId); + int station_phi = m_mdtIdHelper->stationPhi(offlineId); + int multilayer = m_mdtIdHelper->multilayer(offlineId); + int tubelayer = m_mdtIdHelper->tubeLayer(offlineId); + int tube = m_mdtIdHelper->tube(offlineId); SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; const MuonMDT_CablingMap* readCdo{*readHandle}; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h index e24965d459fe45664f7462474eeebe17c8810bd4..404413e9bb1bea89cc4536b837b9549b4c7e5d1e 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.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 __MDT_HID2RESRCID__ @@ -12,7 +12,7 @@ #include "StoreGate/ReadCondHandle.h" #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/MdtIdHelper.h" #include "Identifier/Identifier.h" @@ -38,7 +38,7 @@ public: /** intialize the cabling service */ - StatusCode set(const Muon::MuonIdHelperTool* muonIdHelperTool); + StatusCode set(const MdtIdHelper* mdtId); /** TMP method for sector 13 data */ void setSpecialROBNumber(int specialROBNumber) {m_specialROBNumber=specialROBNumber;} @@ -60,7 +60,7 @@ public: private: - const Muon::MuonIdHelperTool* m_muonIdHelperTool; + const MdtIdHelper* m_mdtIdHelper; int m_specialROBNumber; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx index 26a0d0c0dc7b48ae3f62764f790482156dbd3274..b60e60d219447ff62fa896ff8f535d0f40ad17f8 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx @@ -1,21 +1,14 @@ /* - 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 "MdtCsmContByteStreamTool.h" -#include "MdtROD_Encoder.h" +#include "MdtROD_Encoder.h" #include "MuonRDO/MdtCsm.h" #include "MuonRDO/MdtCsmContainer.h" - -#include "GaudiKernel/MsgStream.h" - -//#include "StoreGate/tools/ClassID_traits.h" -#include "AthenaKernel/CLASS_DEF.h" #include "ByteStreamData/RawEvent.h" -#include <map> - // default constructor Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool ( const std::string& type, const std::string& name,const IInterface* parent ) @@ -26,22 +19,14 @@ Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool declareInterface< Muon::IMDT_RDOtoByteStreamTool >( this ); } -// destructor - -//Muon::MdtCsmContByteStreamTool::~MdtCsmContByteStreamTool() { -//delete m_hid2re; -//} - StatusCode Muon::MdtCsmContByteStreamTool::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK( m_idHelperSvc.retrieve() ); m_hid2re = new MDT_Hid2RESrcID (); - StatusCode status = m_hid2re->set(m_muonIdHelperTool.get()); + StatusCode status = m_hid2re->set(&m_idHelperSvc->mdtIdHelper()); if ( status.isFailure() ){ ATH_MSG_FATAL("Could not initialize MDT mapping !"); return StatusCode::FAILURE; } - return StatusCode::SUCCESS; } @@ -56,7 +41,7 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit MsgStream& log ) { m_fea.clear(); - StatusCode status = m_fea.idMap().set(m_muonIdHelperTool.get()); + StatusCode status = m_fea.idMap().set(&m_idHelperSvc->mdtIdHelper()); if ( status.isFailure() ){ ATH_MSG_FATAL("Could not initialize MDT mapping !"); return StatusCode::FAILURE; @@ -86,7 +71,6 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit for (; it!=it_end;++it) { theROD = m_fea.getRodData( (*it).first ); - //((*it).second).set( m_hid2re, m_muonIdHelperTool.get() ) ; ((*it).second).fillROD( *theROD ) ; } diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h index 722d3d9d0502e55babce65c7432746ad5f823af5..20d3d3ec4570ccb1e1db09a4a34bf0d81d113f71 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h @@ -1,27 +1,23 @@ /* - 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 MUONMDT_CNVTOOLS_MDTCSMCONTRAWEVENTTOOL_H #define MUONMDT_CNVTOOLS_MDTCSMCONTRAWEVENTTOOL_H -#include <stdint.h> -#include <map> #include "AthenaBaseComps/AthAlgTool.h" -#include "MDT_Hid2RESrcID.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MDT_Hid2RESrcID.h" #include "ByteStreamData/RawEvent.h" - #include "ByteStreamCnvSvcBase/FullEventAssembler.h" - #include "MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class MdtCsmContainer; -class MsgStream; #include <string> +#include <map> namespace Muon { /** An AlgTool class to provide conversion from LArRawChannelContainer @@ -48,16 +44,7 @@ public: /** constructor */ - MdtCsmContByteStreamTool( const std::string& type, const std::string& name, - const IInterface* parent ) ; - - /** destructor - */ - //virtual ~MdtCsmContByteStreamTool() ; - - /** AlgTool InterfaceID - */ - // static const InterfaceID& interfaceID( ) ; + MdtCsmContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent ) ; virtual StatusCode initialize(); virtual StatusCode finalize(); @@ -68,8 +55,7 @@ private: MDT_Hid2RESrcID* m_hid2re; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; FullEventAssembler<MDT_Hid2RESrcID> m_fea ; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.cxx index 976ef91576b7c32e0ece01885d1ad8d6cc86589a..2839b8d9fdbf4c8096eef7220a95cbdea1fa8452 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.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 "MdtRDO_Decoder.h" @@ -13,23 +13,7 @@ MdtRDO_Decoder::MdtRDO_Decoder(const std::string& type, const std::string& name, } StatusCode MdtRDO_Decoder::initialize() { - - StatusCode status = m_muonIdHelperTool.retrieve(); - if (status.isFailure()) { - ATH_MSG_FATAL("Could not get MuonIdHelperTool !"); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG(" Found the MdtIdHelper. "); - } + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK( m_readKey.initialize() ); - - return StatusCode::SUCCESS; -} - -StatusCode MdtRDO_Decoder::finalize() -{ return StatusCode::SUCCESS; } - - diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h index 40feec2ae6b794bfba56dc12df16ade42711ef37..9241061bd259787ee730c2b7a849cbd986595c05 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h @@ -1,24 +1,23 @@ /* - 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 MUONBYTESTREAMMDTRDODECODER_H #define MUONBYTESTREAMMDTRDODECODER_H +#include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonRDO/MdtAmtHit.h" #include "MuonDigitContainer/MdtDigit.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" -#include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" - -#include <inttypes.h> +#include <string> #include <vector> - namespace Muon { // Decoder class for conversion from MDT RDOs to MDT digits // Stefano Rosati @@ -28,11 +27,9 @@ namespace Muon { public: - MdtRDO_Decoder( const std::string& type, const std::string& name, - const IInterface* parent ) ; + MdtRDO_Decoder( const std::string& type, const std::string& name, const IInterface* parent ) ; virtual StatusCode initialize(); - virtual StatusCode finalize(); MdtDigit * getDigit(const MdtAmtHit * amtHit, uint16_t& subdetId, uint16_t& mrodId, uint16_t& csmId) const; @@ -41,9 +38,7 @@ namespace Muon { uint16_t& mrodId, uint16_t& csmId, int& tdc, int& width) const; private: - - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; }; @@ -80,7 +75,7 @@ inline MdtDigit* Muon::MdtRDO_Decoder::getDigit(const MdtAmtHit* amtHit, uint16_ if (!cab) return NULL; - Identifier chanId = m_muonIdHelperTool->mdtIdHelper().channelID(stationName, stationEta, stationPhi, + Identifier chanId = m_idHelperSvc->mdtIdHelper().channelID(stationName, stationEta, stationPhi, multiLayer, tubeLayer, tube); int tdcCounts = coarse*32+fine; @@ -123,7 +118,7 @@ inline Identifier Muon::MdtRDO_Decoder::getOfflineData(const MdtAmtHit* amtHit, } - Identifier chanId = m_muonIdHelperTool->mdtIdHelper().channelID(stationName, stationEta, stationPhi, + Identifier chanId = m_idHelperSvc->mdtIdHelper().channelID(stationName, stationEta, stationPhi, multiLayer, tubeLayer, tube); tdcCounts = coarse*32+fine; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx index 87a31ab7c3a366796122b1ac6d0844d91ce95efb..f1e1012cdb221f00c95f1f357b9bcbe48faa19e9 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx @@ -1,15 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Implementation of MDTROD_Decoder class - #include "MdtROD_Decoder.h" -#include "GaudiKernel/ListItem.h" -#include "GaudiKernel/GaudiException.h" -//#include "GaudiKernel/MsgStream.h" - #include "eformat/Issue.h" #include <algorithm> @@ -20,45 +14,28 @@ static const InterfaceID IID_IMdtROD_Decoder ("MdtROD_Decoder", 1, 0); /** constructor -*/ - +*/ MdtROD_Decoder::MdtROD_Decoder ( const std::string& type, const std::string& name,const IInterface* parent ) : AthAlgTool(type,name,parent), m_hid2re(0), m_rodReadOut(0), m_csmReadOut(0), m_amtReadOut(0), m_hptdcReadOut(0), m_BMEpresent(false), m_BMGpresent(false), m_BMEid(-1), m_BMGid(-1) - // m_debug(false), - // m_log (msgSvc(), name) { declareInterface< MdtROD_Decoder >( this ); declareProperty("SpecialROBNumber",m_specialROBNumber=-1); } -/** destructor -*/ -MdtROD_Decoder::~MdtROD_Decoder() { - -} - const InterfaceID& MdtROD_Decoder::interfaceID( ) { return IID_IMdtROD_Decoder; } StatusCode MdtROD_Decoder::initialize() { - - // m_log.setLevel(outputLevel()); - - // Retrieve the MuonIdHelperTool - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // Here the mapping service has to be initialized m_hid2re=new MDT_Hid2RESrcID(); - StatusCode sc = m_hid2re->set(m_muonIdHelperTool.get()); - if ( !sc.isSuccess() ) { - ATH_MSG_ERROR(" Can't initialize MDT mapping"); - return sc; - } + ATH_CHECK(m_hid2re->set(&m_idHelperSvc->mdtIdHelper())); // Initialize decoding classes m_rodReadOut = new MdtRODReadOut(); @@ -67,15 +44,15 @@ StatusCode MdtROD_Decoder::initialize() { m_hptdcReadOut = new MdtHptdcReadOut(); // check if the layout includes elevator chambers - m_BMEpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1; + m_BMEpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1; if(m_BMEpresent){ ATH_MSG_INFO("Processing configuration for layouts with BME chambers."); - m_BMEid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME"); + m_BMEid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME"); } - m_BMGpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG") != -1; + m_BMGpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG") != -1; if(m_BMGpresent){ ATH_MSG_INFO("Processing configuration for layouts with BMG chambers."); - m_BMGid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG"); + m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG"); } ATH_CHECK( m_readKey.initialize() ); @@ -287,22 +264,18 @@ StatusCode MdtROD_Decoder::fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::RO ATH_MSG_DEBUG("Name : " << StationName); ATH_MSG_DEBUG("Eta : " << StationEta); ATH_MSG_DEBUG("Phi : " << StationPhi); - - // bool isValid = true; - // moduleId = m_muonIdHelperTool->mdtIdHelper().elementID(StationName, StationEta, StationPhi, - // true,&isValid); if (m_BMEpresent) { // for layouts with BMEs (read out by 2 CSMs) the RDOs have to be registered with the detectorElement hash // registration of common chambers is always done with detectorElement hash of 1st multilayer // boundary in BME when 2nd CSM starts is (offline!) tube 43, 1st CMS is registered with ML1 hash, 2nd CSM is ML2 hash if (StationName == m_BMEid && Tube > 42) - moduleId = m_muonIdHelperTool->mdtIdHelper().channelID(StationName, StationEta, StationPhi, 2, 1, 1); + moduleId = m_idHelperSvc->mdtIdHelper().channelID(StationName, StationEta, StationPhi, 2, 1, 1); else - moduleId = m_muonIdHelperTool->mdtIdHelper().channelID(StationName, StationEta, StationPhi, 1, 1, 1); + moduleId = m_idHelperSvc->mdtIdHelper().channelID(StationName, StationEta, StationPhi, 1, 1, 1); } else // for layouts with no BME the module hash keeps being used for registration - moduleId = m_muonIdHelperTool->mdtIdHelper().elementID(StationName, StationEta, StationPhi); + moduleId = m_idHelperSvc->mdtIdHelper().elementID(StationName, StationEta, StationPhi); if (!cab) { ATH_MSG_DEBUG("Cabling not understood"); @@ -548,14 +521,14 @@ std::pair<IdentifierHash, Identifier> MdtROD_Decoder::getHash ( Identifier iden IdentifierHash idHash; Identifier regid; if (m_BMEpresent) { - regid = m_muonIdHelperTool->mdtIdHelper().channelID(m_muonIdHelperTool->mdtIdHelper().stationName(ident), - m_muonIdHelperTool->mdtIdHelper().stationEta(ident), - m_muonIdHelperTool->mdtIdHelper().stationPhi(ident), - m_muonIdHelperTool->mdtIdHelper().multilayer(ident), 1, 1 ); - m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(regid, idHash); + regid = m_idHelperSvc->mdtIdHelper().channelID(m_idHelperSvc->mdtIdHelper().stationName(ident), + m_idHelperSvc->mdtIdHelper().stationEta(ident), + m_idHelperSvc->mdtIdHelper().stationPhi(ident), + m_idHelperSvc->mdtIdHelper().multilayer(ident), 1, 1 ); + m_idHelperSvc->mdtIdHelper().get_detectorElement_hash(regid, idHash); } else { regid = ident; - m_muonIdHelperTool->mdtIdHelper().get_module_hash(regid, idHash); + m_idHelperSvc->mdtIdHelper().get_module_hash(regid, idHash); } return std::make_pair(idHash, regid); } diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h index 4ba3e1cc6a243bbd9a7d29034a19cd901bd96f6a..6e2bfed0ed5616853f14fd4b6ca0293f3e6a8381 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h @@ -5,6 +5,9 @@ #ifndef MUONBYTESTREAM_MDTROD_DECODER_H #define MUONBYTESTREAM_MDTROD_DECODER_H +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MdtRODReadOut.h" #include "MdtCsmReadOut.h" #include "MdtAmtReadOut.h" @@ -13,45 +16,33 @@ #include "MuonRDO/MdtCsmContainer.h" #include "MuonRDO/MdtCsm.h" #include "MuonRDO/MdtAmtHit.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MDT_Hid2RESrcID.h" #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" -#include <stdint.h> -#include <map> -#include <vector> -#include <cassert> - -#include "AthenaBaseComps/AthAlgTool.h" - #include "eformat/SourceIdentifier.h" #include "eformat/Version.h" #include "ByteStreamData/RawEvent.h" -#include "Identifier/Identifier.h" - - - -//using eformat::helper::SourceIdentifier; +#include <string> +#include <map> +#include <vector> +#include <cassert> typedef std::map <uint16_t, MdtAmtHit*, std::less<uint16_t> > leading_amt_map; -class MdtROD_Decoder :public AthAlgTool -{ - +class MdtROD_Decoder :public AthAlgTool { public: /** constructor */ - MdtROD_Decoder(const std::string& type, const std::string& name, const IInterface* parent ) ; /** destructor */ - virtual ~MdtROD_Decoder(); + virtual ~MdtROD_Decoder()=default; /** AlgTool InterfaceID */ @@ -63,12 +54,6 @@ public: /** TODO Add documentation. What is a MDT_Hid2RESrcID?*/ MDT_Hid2RESrcID* getHid2RE() {return m_hid2re;} - /** Convert ROD Data words into MDr RDOs. - @param robFrag Input. Take this and decode it, and fill rdoIDC - @param rdoIDC Output. Will be filled with data (and MUST exist before calling this function)*/ - //void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, - // MdtCsmContainer& rdoIDC); - StatusCode fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, MdtCsmContainer& rdoIDC); @@ -77,12 +62,10 @@ public: std::pair<IdentifierHash, Identifier> getHash (Identifier ident); private: - MDT_Hid2RESrcID* m_hid2re; SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** TMP special ROB number for sector13 runs*/ int m_specialROBNumber; @@ -97,24 +80,12 @@ private: bool m_BMGpresent; int m_BMEid; int m_BMGid; - - // bool m_debug; //!< If true, output debugging information - //MsgStream m_log; // variables to count how often the caching kicks in unsigned int m_nCache = 0; unsigned int m_nNotCache = 0; }; -/* -inline void MdtROD_Decoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, - MdtCsmContainer& rdoIDC) -{ - std::vector<unsigned int> ChambersToDecode; - - this->fillCollection (robFrag, rdoIDC, ChambersToDecode); -} -*/ #endif diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx index ffb04572e13e8c1e33d8a26cefd3e67333c103a7..b72b1fc24e0b8a4d5995493ff293207ebacde85d 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MdtRdoToPrepDataTool.h" Muon::MdtRdoToPrepDataTool::MdtRdoToPrepDataTool(const std::string& t, const std::string& n, const IInterface* p) @@ -15,10 +11,6 @@ Muon::MdtRdoToPrepDataTool::MdtRdoToPrepDataTool(const std::string& t, const std { } -Muon::MdtRdoToPrepDataTool::~MdtRdoToPrepDataTool() -{ -} - StatusCode Muon::MdtRdoToPrepDataTool::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -27,18 +19,13 @@ StatusCode Muon::MdtRdoToPrepDataTool::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::MdtRdoToPrepDataTool::finalize() -{ - return MdtRdoToPrepDataToolCore::finalize(); -} - Muon::MdtRdoToPrepDataTool::SetupMdtPrepDataContainerStatus Muon::MdtRdoToPrepDataTool::setupMdtPrepDataContainer() { if(!evtStore()->contains<Muon::MdtPrepDataContainer>(m_mdtPrepDataContainerKey.key())){ m_fullEventDone=false; SG::WriteHandle< Muon::MdtPrepDataContainer >handle(m_mdtPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max())); + StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max())); if (status.isFailure() || !handle.isValid() ) { ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key()); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.h index 39a863fcf9c6e2cb5f90cbf8ce7f58aaa7909e6e..5c648e499bcf4c8289601f1f2894d5dd4b26b267 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.h @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONMdtRdoToPrepDataTool_H #define MUONMdtRdoToPrepDataTool_H @@ -31,13 +27,10 @@ namespace Muon MdtRdoToPrepDataTool(const std::string&,const std::string&,const IInterface*); /** default destructor */ - virtual ~MdtRdoToPrepDataTool (); + virtual ~MdtRdoToPrepDataTool()=default; /** standard Athena-Algorithm method */ virtual StatusCode initialize() override; - - /** standard Athena-Algorithm method */ - virtual StatusCode finalize() override; protected: virtual SetupMdtPrepDataContainerStatus setupMdtPrepDataContainer() override; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx index 2b3cc6d12166caa257f92b0dec7bfb0940bcf9be..712de32de20654b9bfa8a8a70ac69b8d091b1a0c 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx @@ -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 */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataToolCore.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MdtRdoToPrepDataToolCore.h" #include "MuonReadoutGeometry/MuonStation.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MdtRDO_Decoder.h" - #include "MuonCalibEvent/MdtCalibHit.h" #include "MdtCalibSvc/MdtCalibrationTool.h" #include "MdtCalibSvc/MdtCalibrationSvcSettings.h" #include "MdtCalibSvc/MdtCalibrationSvcInput.h" - #include "MuonPrepRawData/MdtTwinPrepData.h" // TWIN TUBES - #include "GeoModelUtilities/GeoGetIds.h" - #include "GaudiKernel/ThreadLocalContext.h" + #include <vector> #include <algorithm> @@ -29,20 +22,15 @@ using namespace MuonGM; using namespace Trk; using namespace Muon; -Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, - const std::string& n, - const IInterface* p ) - : +Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_muonMgr(0), + m_muonMgr(nullptr), m_calibrationTool("MdtCalibrationTool",this), m_mdtCalibSvcSettings(new MdtCalibrationSvcSettings() ), - m_calibHit( 0 ), + m_calibHit(nullptr), m_invSpeed(1./299.792458), - //m_mdtPrepDataContainer("MDT_DriftCircles"), m_calibratePrepData(true), m_mdtDecoder("Muon::MdtRDO_Decoder/MdtRDO_Decoder", this), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool", this), m_fullEventDone(false), m_BMEpresent(false), m_BMGpresent(false), @@ -74,35 +62,15 @@ Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, declareProperty("CalibrationTool",m_calibrationTool); } - -Muon::MdtRdoToPrepDataToolCore::~MdtRdoToPrepDataToolCore() -{ - -} - -StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() -{ - if(detStore()->retrieve( m_muonMgr ).isFailure()) { - ATH_MSG_FATAL(" Cannot retrieve MuonDetectorManager "); - return StatusCode::FAILURE; - } - - StatusCode sc = m_calibrationTool.retrieve(); - if ( sc.isFailure() ){ - ATH_MSG_ERROR( "Could not retrieve MdtCalibrationTool" ); - } else { - ATH_MSG_VERBOSE("MdtCalibrationTool retrieved with statusCode = "<<sc<<" pointer = "<<m_calibrationTool ); - } - - /// create an empty MDT PrepData container for filling - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - +StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() { + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(detStore()->retrieve(m_muonMgr)); + ATH_CHECK(m_calibrationTool.retrieve()); + ATH_MSG_VERBOSE("MdtCalibrationTool retrieved with pointer = "<<m_calibrationTool); + ATH_CHECK(m_idHelperSvc.retrieve()); // Retrieve the RDO decoder ATH_CHECK(m_mdtDecoder.retrieve()); - ATH_CHECK(m_idHelper.retrieve()); - - // + TWIN TUBES // make an array of [multilayer][layer][twin-pair]; 2 multilayers, 3 layer per multilayer, 36 twin-pairs per layer if(m_useTwin){ @@ -124,15 +92,15 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() m_mdtCalibSvcSettings->initialize(); // check if the layout includes elevator chambers - m_BMEpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1; + m_BMEpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1; if(m_BMEpresent){ ATH_MSG_INFO("Processing configuration for layouts with BME chambers."); - m_BMEid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME"); + m_BMEid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME"); } - m_BMGpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG") != -1; + m_BMGpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG") != -1; if(m_BMGpresent){ ATH_MSG_INFO("Processing configuration for layouts with BMG chambers."); - m_BMGid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG"); + m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG"); for(int phi=6; phi<8; phi++) { // phi sectors for(int eta=1; eta<4; eta++) { // eta sectors for(int side=-1; side<2; side+=2) { // side @@ -165,8 +133,8 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::decode( const std::vector<uint32_t>& { SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; const MuonMDT_CablingMap* readCdo{*readHandle}; - if(readCdo==nullptr){ - ATH_MSG_ERROR("Null pointer to the read conditions object"); + if(!readCdo){ + ATH_MSG_ERROR("nullptr to the read conditions object"); return StatusCode::FAILURE; } const std::vector<IdentifierHash>& chamberHashInRobs = readCdo->getChamberHashVec(robIds); @@ -227,7 +195,7 @@ void Muon::MdtRdoToPrepDataToolCore::processRDOContainer( std::vector<Identifier // It is more practical to loop through all the hashes rather than all RDO elements // as we benefit from handling the 2 RDO to 1 PRD special case - for(unsigned int iHash = 0; iHash < m_muonIdHelperTool->mdtIdHelper().module_hash_max(); iHash++){ + for(unsigned int iHash = 0; iHash < m_idHelperSvc->mdtIdHelper().module_hash_max(); iHash++){ handlePRDHash( IdentifierHash(iHash), *rdoContainer, idWithDataVect); } //for (MdtCsmContainer::const_iterator rdoColli = rdoContainer->begin(); rdoColli!=rdoContainer->end(); ++rdoColli) { @@ -248,20 +216,20 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M IdentifierHash rdoHash = hash; // before BMEs were installed, RDOs were indexed by offline hashes (same as PRD) if (m_BMEpresent) { // after BMEs were installed, the RDOs are indexed by the detectorElement hash of a multilayer Identifier elementId; - IdContext tmp_context = m_muonIdHelperTool->mdtIdHelper().module_context(); - m_muonIdHelperTool->mdtIdHelper().get_id(hash, elementId, &tmp_context); + IdContext tmp_context = m_idHelperSvc->mdtIdHelper().module_context(); + m_idHelperSvc->mdtIdHelper().get_id(hash, elementId, &tmp_context); - Identifier multilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(elementId, 1); //first multilayer + Identifier multilayerId = m_idHelperSvc->mdtIdHelper().multilayerID(elementId, 1); //first multilayer IdentifierHash multilayerHash; - m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(multilayerId, multilayerHash); + m_idHelperSvc->mdtIdHelper().get_detectorElement_hash(multilayerId, multilayerHash); rdoHash = multilayerHash; // for BMEs there are 2 CSMs per chamber, registered with the hashes of the 2 multilayers // If this is BMEid then we handle two RDO at once, else just one - if (m_muonIdHelperTool->mdtIdHelper().stationName(elementId) == m_BMEid) { - Identifier multilayerId2 = m_muonIdHelperTool->mdtIdHelper().multilayerID(elementId, 2); //second multilayer + if (m_idHelperSvc->mdtIdHelper().stationName(elementId) == m_BMEid) { + Identifier multilayerId2 = m_idHelperSvc->mdtIdHelper().multilayerID(elementId, 2); //second multilayer IdentifierHash multilayerHash2; - m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(multilayerId2, multilayerHash2); + m_idHelperSvc->mdtIdHelper().get_detectorElement_hash(multilayerId2, multilayerHash2); IdentifierHash rdoHash2 = multilayerHash2; // Retrieve the two RDO MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); @@ -437,13 +405,13 @@ void Muon::MdtRdoToPrepDataToolCore::printPrepData( ) int nhitcoll = 0; if ( mdtColl->size() > 0 ) { - ATH_MSG_DEBUG("PrepData Collection ID "<<m_idHelper->toString(mdtColl->identify())); + ATH_MSG_DEBUG("PrepData Collection ID "<<m_idHelperSvc->toString(mdtColl->identify())); MdtPrepDataCollection::const_iterator it_mdtPrepData; for (it_mdtPrepData=mdtColl->begin(); it_mdtPrepData != mdtColl->end(); it_mdtPrepData++) { nhitcoll++; nhits++; ATH_MSG_DEBUG(" in this coll. "<<nhitcoll<<" prepData id = " - <<m_idHelper->toString((*it_mdtPrepData)->identify()) + <<m_idHelperSvc->toString((*it_mdtPrepData)->identify()) <<" tdc/adc ="<<(*it_mdtPrepData)->tdc()<<"/"<< (*it_mdtPrepData)->adc()); } ncoll++; @@ -465,9 +433,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std // two chambers in ATLAS are installed with Twin Tubes; in detector coordinates BOL4A13 & BOL4C13; only INNER multilayer(=1) is with twin tubes // implement twin tube writing to prepData either for all BOL (m_useAllBOLTwin = true) _OR_ only for two chambers really installed Identifier elementId = rdoColl->identify(); - MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(elementId); + MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(elementId); if( chIndex == MuonStationIndex::BOL && - ( m_useAllBOLTwin || (std::abs(m_muonIdHelperTool->mdtIdHelper().stationEta(elementId)) == 4 && m_muonIdHelperTool->mdtIdHelper().stationPhi(elementId) == 7) ) ) { + ( m_useAllBOLTwin || (std::abs(m_idHelperSvc->mdtIdHelper().stationEta(elementId)) == 4 && m_idHelperSvc->mdtIdHelper().stationPhi(elementId) == 7) ) ) { return processCsmTwin(rdoColl, idWithDataVect); } } @@ -476,12 +444,12 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std // Make some checks if we are in special circumstances if(rdoColl2){ - Identifier elementId1 = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl->identify()); - Identifier elementId2 = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl2->identify()); - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + Identifier elementId1 = m_idHelperSvc->mdtIdHelper().parentID(rdoColl->identify()); + Identifier elementId2 = m_idHelperSvc->mdtIdHelper().parentID(rdoColl2->identify()); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); IdentifierHash hash1, hash2; - m_muonIdHelperTool->mdtIdHelper().get_hash(elementId1, hash1, &mdtContext); - m_muonIdHelperTool->mdtIdHelper().get_hash(elementId2, hash2, &mdtContext); + m_idHelperSvc->mdtIdHelper().get_hash(elementId1, hash1, &mdtContext); + m_idHelperSvc->mdtIdHelper().get_hash(elementId2, hash2, &mdtContext); ATH_MSG_DEBUG("Special case with 2 RDO going into 1 PRD - ID1 " << elementId1 << " ID2 " << elementId2 << " hash 1 " << hash1 << " hash 2 " << hash2 ); // These should have the same PRD MDT hash otherwise we need to understand why we are here @@ -489,13 +457,13 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std ATH_MSG_ERROR("Hash1 and Hash2 are different for special case : " << hash1 << " " << hash2); return StatusCode::FAILURE; } - ATH_MSG_DEBUG(" Number of AmtHit in this Csm (1) " << rdoColl->size() <<" CSM id is "<<m_idHelper->toString(elementId1)); - ATH_MSG_DEBUG(" Number of AmtHit in this Csm (2) " << rdoColl2->size() <<" CSM id is "<<m_idHelper->toString(elementId2)); + ATH_MSG_DEBUG(" Number of AmtHit in this Csm (1) " << rdoColl->size() <<" CSM id is "<<m_idHelperSvc->toString(elementId1)); + ATH_MSG_DEBUG(" Number of AmtHit in this Csm (2) " << rdoColl2->size() <<" CSM id is "<<m_idHelperSvc->toString(elementId2)); } /// MDT hit context - //IdContext hitContext = m_muonIdHelperTool->mdtIdHelper().channel_context(); - Identifier elementId = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl->identify()); + //IdContext hitContext = m_idHelperSvc->mdtIdHelper().channel_context(); + Identifier elementId = m_idHelperSvc->mdtIdHelper().parentID(rdoColl->identify()); // prepare the special case of two chamber connected to the same CSM // create objects but do not initialize them @@ -506,18 +474,18 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std IdentifierHash secondMdtHashId; if(!rdoColl2) - ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size() <<" CSM id is "<<m_idHelper->toString(elementId)); + ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size() <<" CSM id is "<<m_idHelperSvc->toString(elementId)); uint16_t subdetId = rdoColl->SubDetId(); uint16_t mrodId = rdoColl->MrodId(); uint16_t csmId = rdoColl->CsmId(); - ATH_MSG_VERBOSE("Identifier = "<<m_idHelper->toString(elementId) + ATH_MSG_VERBOSE("Identifier = "<<m_idHelperSvc->toString(elementId) <<" subdetId/ mrodId/ csmId = "<<subdetId<<" / "<<mrodId<<" / "<<csmId); // Create prepdata collection - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); IdentifierHash mdtHashId; - if(m_muonIdHelperTool->mdtIdHelper().get_hash(elementId, mdtHashId, &mdtContext)) { + if(m_idHelperSvc->mdtIdHelper().get_hash(elementId, mdtHashId, &mdtContext)) { ATH_MSG_FATAL("Unable to get MDT hash id from MDT digit collection " << "context begin_index = " << mdtContext.begin_index() << " context end_index = " << mdtContext.end_index() @@ -558,11 +526,11 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std itD = rdoColl2->begin(); itD_e = rdoColl2->end(); - elementId = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl2->identify()); + elementId = m_idHelperSvc->mdtIdHelper().parentID(rdoColl2->identify()); subdetId = rdoColl2->SubDetId(); mrodId = rdoColl2->MrodId(); csmId = rdoColl2->CsmId(); - ATH_MSG_VERBOSE("Identifier = "<<m_idHelper->toString(elementId) + ATH_MSG_VERBOSE("Identifier = "<<m_idHelperSvc->toString(elementId) <<" subdetId/ mrodId/ csmId = "<<subdetId<<" / "<<mrodId<<" / "<<csmId); } } @@ -582,7 +550,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std MdtDigit * newDigit = m_mdtDecoder->getDigit(amtHit,subdetId, mrodId,csmId); - if (newDigit==NULL) { + if (!newDigit) { ATH_MSG_WARNING("Found issue MDT RDO decoder for subdetId/mrodId/csmId " <<subdetId<<"/"<<mrodId<<"/"<<csmId<<" amtHit channelId/tdcId =" <<amtHit->channelId()<<"/"<<amtHit->tdcId()); @@ -592,12 +560,12 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std // Do something with it Identifier channelId = newDigit->identify(); - Identifier parentId = m_muonIdHelperTool->mdtIdHelper().parentID(channelId); - if( m_muonIdHelperTool->mdtIdHelper().stationName(parentId) == m_BMGid && m_BMGpresent) { + Identifier parentId = m_idHelperSvc->mdtIdHelper().parentID(channelId); + if( m_idHelperSvc->mdtIdHelper().stationName(parentId) == m_BMGid && m_BMGpresent) { std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(m_muonMgr->getMdtReadoutElement(channelId)->identify()); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), channelId) != (myIt->second).end() ) { - ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_muonIdHelperTool->mdtIdHelper().show_to_string(channelId) ); + ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_idHelperSvc->mdtIdHelper().show_to_string(channelId) ); delete newDigit; itD++; continue; @@ -610,9 +578,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std if ( parentId != elementId ) { - int stationName = m_muonIdHelperTool->mdtIdHelper().stationName(channelId); + int stationName = m_idHelperSvc->mdtIdHelper().stationName(channelId); // check that at least the station name is the same, otherwise it must be an error - if ( stationName == m_muonIdHelperTool->mdtIdHelper().stationName(elementId) ) { + if ( stationName == m_idHelperSvc->mdtIdHelper().stationName(elementId) ) { doubleCsm = true; @@ -623,17 +591,17 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std ATH_MSG_DEBUG("A special case of single CSM reading two chambers has been found"); - ATH_MSG_DEBUG("First station: " << m_muonIdHelperTool->mdtIdHelper().stationNameString(stationName) << " eta: " - << m_muonIdHelperTool->mdtIdHelper().stationEta(elementId) << " phi: " << m_muonIdHelperTool->mdtIdHelper().stationPhi(elementId) ); + ATH_MSG_DEBUG("First station: " << m_idHelperSvc->mdtIdHelper().stationNameString(stationName) << " eta: " + << m_idHelperSvc->mdtIdHelper().stationEta(elementId) << " phi: " << m_idHelperSvc->mdtIdHelper().stationPhi(elementId) ); - ATH_MSG_DEBUG("Second station: " << m_muonIdHelperTool->mdtIdHelper().stationNameString(stationName) << " eta: " - << m_muonIdHelperTool->mdtIdHelper().stationEta(secondElementId) << " phi: " - << m_muonIdHelperTool->mdtIdHelper().stationPhi(secondElementId) ); + ATH_MSG_DEBUG("Second station: " << m_idHelperSvc->mdtIdHelper().stationNameString(stationName) << " eta: " + << m_idHelperSvc->mdtIdHelper().stationEta(secondElementId) << " phi: " + << m_idHelperSvc->mdtIdHelper().stationPhi(secondElementId) ); // // create the collection and initialize the hash Id // - if(m_muonIdHelperTool->mdtIdHelper().get_hash(secondElementId, secondMdtHashId, &mdtContext)) { + if(m_idHelperSvc->mdtIdHelper().get_hash(secondElementId, secondMdtHashId, &mdtContext)) { ATH_MSG_FATAL("Unable to get MDT hash id from MDT digit collection " << "context begin_index = " << mdtContext.begin_index() << " context end_index = " << mdtContext.end_index() @@ -660,24 +628,24 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std IdentifierHash channelHash = newDigit->identifyHash(); - ATH_MSG_VERBOSE("got digit with id ext / hash "<<m_idHelper->toString(channelId)<<" / "<<(int)channelHash); + ATH_MSG_VERBOSE("got digit with id ext / hash "<<m_idHelperSvc->toString(channelId)<<" / "<<(int)channelHash); double radius(0.); double errRadius(0.); Muon::MdtDriftCircleStatus digitStatus = Muon::MdtStatusDriftTime; // do lookup once const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); delete newDigit; itD++; continue; } if (!descriptor->containsId(channelId)) { - ATH_MSG_WARNING("Detector Element "<<m_idHelper->toString(descriptor->identify()) + ATH_MSG_WARNING("Detector Element "<<m_idHelperSvc->toString(descriptor->identify()) <<" does not contains candidate prd Identifier <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); delete newDigit; itD++; continue; @@ -690,7 +658,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std digitStatus = getMdtDriftRadius(newDigit, radius, errRadius, descriptor); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(channelId)); + << " Id is: "<<m_idHelperSvc->toString(channelId)); } } @@ -714,7 +682,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std hashId = secondMdtHashId; } - // We can make the MdtPrepData, but only if our collection is being used (ie not null) + // We can make the MdtPrepData, but only if our collection is being used (ie not nullptr) if(collectionToBeUpdated){ MdtPrepData* newPrepData = new MdtPrepData(channelId, hashId, @@ -743,11 +711,11 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std itD_e = rdoColl2->end(); mc = 0; // for logging // Update element information for next RDO - elementId = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl2->identify()); + elementId = m_idHelperSvc->mdtIdHelper().parentID(rdoColl2->identify()); subdetId = rdoColl2->SubDetId(); mrodId = rdoColl2->MrodId(); csmId = rdoColl2->CsmId(); - ATH_MSG_VERBOSE("Identifier = "<<m_idHelper->toString(elementId) + ATH_MSG_VERBOSE("Identifier = "<<m_idHelperSvc->toString(elementId) <<" subdetId/ mrodId/ csmId = "<<subdetId<<" / "<<mrodId<<" / "<<csmId); } } @@ -814,22 +782,21 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size()); /// MDT hit context - //IdContext hitContext = m_muonIdHelperTool->mdtIdHelper().channel_context(); - Identifier elementId = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl->identify()); + Identifier elementId = m_idHelperSvc->mdtIdHelper().parentID(rdoColl->identify()); uint16_t subdetId = rdoColl->SubDetId(); uint16_t mrodId = rdoColl->MrodId(); uint16_t csmId = rdoColl->CsmId(); - ATH_MSG_VERBOSE("Identifier = "<<m_idHelper->toString(elementId) + ATH_MSG_VERBOSE("Identifier = "<<m_idHelperSvc->toString(elementId) <<" subdetId/ mrodId/ csmId = "<<subdetId<<" / " <<mrodId<<" / "<<csmId); // Create prepdata collection - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); IdentifierHash mdtHashId; - if(m_muonIdHelperTool->mdtIdHelper().get_hash(elementId, mdtHashId, &mdtContext)) { + if(m_idHelperSvc->mdtIdHelper().get_hash(elementId, mdtHashId, &mdtContext)) { ATH_MSG_FATAL("Unable to get MDT hash id from MDT digit collection " << "context begin_index = " << mdtContext.begin_index() << " context end_index = " << mdtContext.end_index() @@ -874,11 +841,11 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, Identifier channelId = newDigit->identify(); //IdentifierHash channelHash = newDigit->identifyHash(); - if( m_muonIdHelperTool->mdtIdHelper().stationName(channelId) == m_BMGid && m_BMGpresent) { + if( m_idHelperSvc->mdtIdHelper().stationName(channelId) == m_BMGid && m_BMGpresent) { std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(m_muonMgr->getMdtReadoutElement(channelId)->identify()); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), channelId) != (myIt->second).end() ) { - ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_muonIdHelperTool->mdtIdHelper().show_to_string(channelId) ); + ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_idHelperSvc->mdtIdHelper().show_to_string(channelId) ); delete newDigit; continue; } @@ -886,9 +853,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, } // get tube params - int tube = m_muonIdHelperTool->mdtIdHelper().tube(channelId); - int layer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId); - int multilayer = m_muonIdHelperTool->mdtIdHelper().multilayer(channelId); + int tube = m_idHelperSvc->mdtIdHelper().tube(channelId); + int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(channelId); + int multilayer = m_idHelperSvc->mdtIdHelper().multilayer(channelId); // find the correct twin-pair (tube-1 & tube-3 are twin pair 1, tube-2 & tube-4 are twin pair 2) int twinPair = -1; @@ -918,10 +885,10 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, mdtDigitColl[ m_secondaryHit_twin_chamber[multilayer-1][layer-1][twinPair-1] ].second = newDigit; } else{ ATH_MSG_VERBOSE(" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for " - << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(channelId) << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(channelId) - << " ml = " <<m_muonIdHelperTool->mdtIdHelper().multilayer(channelId) << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId) - << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(channelId) << " with adc = " << newDigit->adc() << " tdc = " << newDigit->tdc()); + << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(channelId) << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(channelId) + << " ml = " <<m_idHelperSvc->mdtIdHelper().multilayer(channelId) << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(channelId) + << " tube = " << m_idHelperSvc->mdtIdHelper().tube(channelId) << " with adc = " << newDigit->adc() << " tdc = " << newDigit->tdc()); } } //end -- if(!m_discardSecondaryHitTwin){ else{ @@ -940,8 +907,8 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, MdtDigit* digit = iter_map->second.first; MdtDigit* second_digit = iter_map->second.second; - if (digit==NULL) { - ATH_MSG_FATAL("A null pointer to a digit "); + if (!digit) { + ATH_MSG_FATAL("nullptr to a digit "); return StatusCode::FAILURE; } @@ -949,17 +916,17 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, Identifier channelId = digit->identify(); IdentifierHash channelHash = digit->identifyHash(); - int multilayer = m_muonIdHelperTool->mdtIdHelper().multilayer(channelId); + int multilayer = m_idHelperSvc->mdtIdHelper().multilayer(channelId); //check if the hit is in multilayer=1 // two chambers in ATLAS are installed with Twin Tubes; in detector coordinates BOL4A13 & BOL4C13; only INNER multilayer(=1) is with twin tubes if(multilayer==1){ // if no twin hit present in data, use standard PRD making - if(second_digit == NULL){ + if(!second_digit){ ATH_MSG_VERBOSE("got digit with id ext / hash " - <<m_idHelper->toString(channelId)<<" / " + <<m_idHelperSvc->toString(channelId)<<" / " <<(int)channelHash); double radius(0.); double errRadius(0.); @@ -967,9 +934,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // do lookup once const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); delete digit; continue; } @@ -980,7 +947,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(channelId)); + << " Id is: "<<m_idHelperSvc->toString(channelId)); } } @@ -1001,16 +968,16 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size()); driftCircleColl->push_back(newPrepData); - ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId) - << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(channelId) + ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(channelId) + << " tube = " << m_idHelperSvc->mdtIdHelper().tube(channelId) << " radius = " << radius << " +- " << errRadius); delete digit; - }// end if(second_digit == NULL){ + }// end if(!second_digit){ else{ // define twin position and error @@ -1021,8 +988,8 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // call the function to calculate radii and twin coordinate digitStatus = getMdtTwinPosition(digit, second_digit, radius, errRadius, zTwin, errZTwin, secondHitIsPrompt); if( zTwin <-99999 ) { ATH_MSG_WARNING("MDT Twin PrepData with very large, negative twin coordinate " << zTwin - << " Id is: "<<m_idHelper->toString(digit->identify()) - << " Twin Id is: "<<m_idHelper->toString(second_digit->identify())); } + << " Id is: "<<m_idHelperSvc->toString(digit->identify()) + << " Twin Id is: "<<m_idHelperSvc->toString(second_digit->identify())); } // set the properties of PrepData-object to the tube that was PROMPT (= hit by the muon) Identifier promptHit_channelId = digit->identify(); @@ -1043,9 +1010,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // do lookup once const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(promptHit_channelId); - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the DetManager <" - <<m_idHelper->toString(promptHit_channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(promptHit_channelId)<<"> =>>ignore this hit"); delete digit; continue; } @@ -1055,7 +1022,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, digitStatus = Muon::MdtStatusMasked; }else if( radius < -999 ) { ATH_MSG_WARNING("MDT Twin PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(promptHit_channelId)); + << " Id is: "<<m_idHelperSvc->toString(promptHit_channelId)); } @@ -1082,11 +1049,11 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, twinHit_Digit->adc(), digitStatus); - ATH_MSG_DEBUG(" MADE A 2D TWINPREPDATA " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(promptHit_channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(promptHit_channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(promptHit_channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(promptHit_channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(promptHit_channelId) << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(promptHit_channelId) + ATH_MSG_DEBUG(" MADE A 2D TWINPREPDATA " << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(promptHit_channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(promptHit_channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(promptHit_channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(promptHit_channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(promptHit_channelId) << " tube = " << m_idHelperSvc->mdtIdHelper().tube(promptHit_channelId) << " zTwin = " << zTwin << " +- " << errZTwin << " radius = " << radius << " +- " << errRadius); @@ -1122,11 +1089,11 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, ATH_MSG_DEBUG(" MADE A 1D(=original) PREPDATA OUT OF TWINPAIR " << " TWIN COORDINATE IS NOT STORED IN PREPDATA " - << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(promptHit_channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(promptHit_channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(promptHit_channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(promptHit_channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(promptHit_channelId) << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(promptHit_channelId) + << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(promptHit_channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(promptHit_channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(promptHit_channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(promptHit_channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(promptHit_channelId) << " tube = " << m_idHelperSvc->mdtIdHelper().tube(promptHit_channelId) << " zTwin = " << zTwin << " +- " << errZTwin << " radius = " << radius << " +- " << errRadius); @@ -1138,15 +1105,15 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, delete digit; delete second_digit; - }// end else -- if(second_digit == NULL){ + }// end else -- if(!second_digit){ } // end -- if(multilayer==1) else if(multilayer==2){ // if multilayer=2, then treat every hit as a separate hit, no twin hit should be present here as the hardware is not installed - if(second_digit == NULL){ + if(!second_digit){ ATH_MSG_VERBOSE("got digit with id ext / hash " - <<m_idHelper->toString(channelId)<<" / " + <<m_idHelperSvc->toString(channelId)<<" / " <<(int)channelHash); double radius(0.); double errRadius(0.); @@ -1154,9 +1121,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // do lookup once const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); delete digit; continue; } @@ -1167,7 +1134,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(channelId)); + << " Id is: "<<m_idHelperSvc->toString(channelId)); } } @@ -1189,17 +1156,17 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size()); driftCircleColl->push_back(newPrepData); - ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId) - << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(channelId) + ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(channelId) + << " tube = " << m_idHelperSvc->mdtIdHelper().tube(channelId) << " radius = " << radius << " +- " << errRadius); delete digit; delete second_digit; - } //end -- if(second_digit == NULL){ + } //end -- if(!second_digit){ else{ // Do something with second_digit @@ -1207,12 +1174,12 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, IdentifierHash second_channelHash = second_digit->identifyHash(); ATH_MSG_VERBOSE("got digit with id ext / hash " - <<m_idHelper->toString(channelId)<<" / " + <<m_idHelperSvc->toString(channelId)<<" / " <<(int)channelHash); //second_digit ATH_MSG_VERBOSE("got second_digit with id ext / hash " - <<m_idHelper->toString(second_channelId)<<" / " + <<m_idHelperSvc->toString(second_channelId)<<" / " <<(int)second_channelHash); @@ -1226,9 +1193,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // do lookup once const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); delete digit; continue; } @@ -1239,14 +1206,14 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(channelId)); + << " Id is: "<<m_idHelperSvc->toString(channelId)); } } const MdtReadoutElement * second_descriptor = m_muonMgr->getMdtReadoutElement(second_channelId); - if (second_descriptor == NULL){ + if (!second_descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(second_channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(second_channelId)<<"> =>>ignore this hit"); delete second_digit; continue; } @@ -1258,7 +1225,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, second_digitStatus = getMdtDriftRadius(second_digit, second_radius, second_errRadius, second_descriptor); if( second_radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " - << " Id is: "<<m_idHelper->toString(second_channelId)); + << " Id is: "<<m_idHelperSvc->toString(second_channelId)); } } @@ -1299,26 +1266,26 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, second_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size()); driftCircleColl->push_back(second_newPrepData); - ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId) - << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(channelId) + ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(channelId) + << " tube = " << m_idHelperSvc->mdtIdHelper().tube(channelId) << " radius = " << radius << " +- " << errRadius); //second_digit - ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA FOR SECOND DIGIT " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(second_channelId)) - << " eta = " << m_muonIdHelperTool->mdtIdHelper().stationEta(second_channelId) - << " phi = " << m_muonIdHelperTool->mdtIdHelper().stationPhi(second_channelId) - << " ml = " << m_muonIdHelperTool->mdtIdHelper().multilayer(second_channelId) - << " layer = " << m_muonIdHelperTool->mdtIdHelper().tubeLayer(second_channelId) - << " tube = " << m_muonIdHelperTool->mdtIdHelper().tube(second_channelId) + ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA FOR SECOND DIGIT " << m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(second_channelId)) + << " eta = " << m_idHelperSvc->mdtIdHelper().stationEta(second_channelId) + << " phi = " << m_idHelperSvc->mdtIdHelper().stationPhi(second_channelId) + << " ml = " << m_idHelperSvc->mdtIdHelper().multilayer(second_channelId) + << " layer = " << m_idHelperSvc->mdtIdHelper().tubeLayer(second_channelId) + << " tube = " << m_idHelperSvc->mdtIdHelper().tube(second_channelId) << " radius = " << second_radius << " +- " << second_errRadius); delete digit; delete second_digit; - } //end -- else -- if(second_digit == NULL){ + } //end -- else -- if(!second_digit){ } else{ ATH_MSG_DEBUG("Something strange in MdtRdoToPrepDataToolCore, MDT multilayer (must be 1 or 2)= " << multilayer); @@ -1352,8 +1319,8 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtDriftRadius(const MdtDigit if (!descriptor->containsId(channelId)) { radius = -1000.; ATH_MSG_WARNING("Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> inconsistent with the geometry of detector element <" - <<m_idHelper->toString(descriptor->identify())<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> inconsistent with the geometry of detector element <" + <<m_idHelperSvc->toString(descriptor->identify())<<"> =>>ignore this hit"); return MdtStatusUnDefined; } @@ -1417,17 +1384,17 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit // here check validity // if invalid, reset flags - if (descriptor == NULL){ + if (!descriptor){ ATH_MSG_WARNING("getMdtTwinPosition(): Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); zTwin = -100000.; return MdtStatusUnDefined; } else if (!descriptor->containsId(channelId)){ zTwin = -100000.; ATH_MSG_WARNING("getMdtTwinPosition(): Identifier from the cabling service <" - <<m_idHelper->toString(channelId)<<"> inconsistent with the geometry of detector element <" - <<m_idHelper->toString(descriptor->identify())<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(channelId)<<"> inconsistent with the geometry of detector element <" + <<m_idHelperSvc->toString(descriptor->identify())<<"> =>>ignore this hit"); return MdtStatusUnDefined; } @@ -1450,17 +1417,17 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit // here check validity // if invalid, reset flags - if (second_descriptor == NULL){ + if (!second_descriptor){ ATH_MSG_WARNING("getMdtTwinPosition(): Detector Element not found for Identifier from the cabling service <" - <<m_idHelper->toString(second_channelId)<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(second_channelId)<<"> =>>ignore this hit"); zTwin = -100000.; return MdtStatusUnDefined; } else if (!second_descriptor->containsId(second_channelId)){ zTwin = -100000.; ATH_MSG_WARNING("getMdtTwinPosition(): Identifier from the cabling service <" - <<m_idHelper->toString(second_channelId)<<"> inconsistent with the geometry of detector element <" - <<m_idHelper->toString(second_descriptor->identify())<<"> =>>ignore this hit"); + <<m_idHelperSvc->toString(second_channelId)<<"> inconsistent with the geometry of detector element <" + <<m_idHelperSvc->toString(second_descriptor->identify())<<"> =>>ignore this hit"); return MdtStatusUnDefined; } @@ -1505,7 +1472,7 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit radius = 0.; errRadius = m_muonMgr->getMdtReadoutElement(channelId)->innerTubeRadius()/sqrt(12); // 14.6/sqrt(12) zTwin = 0.; - double tubelength = m_muonMgr->getMdtReadoutElement(channelId)->getTubeLength(m_muonIdHelperTool->mdtIdHelper().tubeLayer(channelId),m_muonIdHelperTool->mdtIdHelper().tube(channelId)); + double tubelength = m_muonMgr->getMdtReadoutElement(channelId)->getTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(channelId),m_idHelperSvc->mdtIdHelper().tube(channelId)); errZTwin = tubelength/2.; } @@ -1523,10 +1490,10 @@ void MdtRdoToPrepDataToolCore::initDeadChannels(const MuonGM::MdtReadoutElement* Identifier detElId = mydetEl->identify(); - int name = m_muonIdHelperTool->mdtIdHelper().stationName(detElId); - int eta = m_muonIdHelperTool->mdtIdHelper().stationEta(detElId); - int phi = m_muonIdHelperTool->mdtIdHelper().stationPhi(detElId); - int ml = m_muonIdHelperTool->mdtIdHelper().multilayer(detElId); + int name = m_idHelperSvc->mdtIdHelper().stationName(detElId); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId); + int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId); std::vector<Identifier> deadTubes; std::vector<int>::iterator it = tubes.begin(); @@ -1542,7 +1509,7 @@ void MdtRdoToPrepDataToolCore::initDeadChannels(const MuonGM::MdtReadoutElement* ++it; } else { - Identifier deadTubeId = m_muonIdHelperTool->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube ); + Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube ); deadTubes.push_back( deadTubeId ); ATH_MSG_VERBOSE("adding dead tube (" << tube << "), layer(" << layer << "), phi(" << phi << "), eta(" << eta << "), name(" << name diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h index 444b22d278f1a8cd2310c0ff9142a622b09e322a..5500a4f339661dfbafe18ba66e7936fb49082767 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h @@ -1,38 +1,29 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataToolCore.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONMdtRdoToPrepDataToolCore_H #define MUONMdtRdoToPrepDataToolCore_H +#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" +#include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonRDO/MdtCsmContainer.h" - #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" +#include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" +#include "MdtCalibSvc/MdtCalibrationTool.h" #include <string> -class AtlasDetectorID; -class Identifier; + class MdtDigit; -class MdtCalibrationTool; class MdtCalibrationSvcSettings; class MdtCalibHit; -//class MdtRDO_Decoder; -class MdtCsm; - namespace MuonGM { @@ -40,14 +31,8 @@ namespace MuonGM class MdtReadoutElement; } - namespace Muon { - - class IMuonRawDataProviderTool; - class IMDT_RDO_Decoder; - class MuonIdHelperTool; - /** @class MdtRdoToPrepDataToolCore This is for the Doxygen-Documentation. @@ -65,7 +50,7 @@ namespace Muon MdtRdoToPrepDataToolCore(const std::string&,const std::string&,const IInterface*); /** default destructor */ - virtual ~MdtRdoToPrepDataToolCore (); + virtual ~MdtRdoToPrepDataToolCore()=default; /** standard Athena-Algorithm method */ virtual StatusCode initialize() override; @@ -115,11 +100,9 @@ namespace Muon bool handlePRDHash( IdentifierHash hash, const MdtCsmContainer& rdoContainer, std::vector<IdentifierHash>& idWithDataVect ); /// Muon Detector Descriptor - const MuonGM::MuonDetectorManager * m_muonMgr; + const MuonGM::MuonDetectorManager* m_muonMgr; - /// Tool for MDT identifier helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /// MDT calibration service ToolHandle<MdtCalibrationTool> m_calibrationTool; @@ -139,9 +122,7 @@ namespace Muon bool m_decodeData; //!< toggle on/off the decoding of MDT RDO into MdtPrepData bool m_sortPrepData; //!< Toggle on/off the sorting of the MdtPrepData - ToolHandle<Muon::IMDT_RDO_Decoder> m_mdtDecoder; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; //keepTrackOfFullEventDecoding bool m_fullEventDone; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx index 940390f0f237fd8ab186802890fc1bfb410b4a45..40bea9a8208d8b0739832371e5524a8ab4ef5bcc 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx @@ -1,14 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataToolMT.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MdtRdoToPrepDataToolMT.h" - Muon::MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), @@ -17,10 +12,6 @@ Muon::MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT(const std::string& t, const declareProperty("MdtPrdContainerCacheKey", m_prdContainerCacheKey, "Optional external cache for the MDT PRD container"); } -Muon::MdtRdoToPrepDataToolMT::~MdtRdoToPrepDataToolMT() -{ -} - StatusCode Muon::MdtRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -30,11 +21,6 @@ StatusCode Muon::MdtRdoToPrepDataToolMT::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::MdtRdoToPrepDataToolMT::finalize() -{ - return MdtRdoToPrepDataToolCore::finalize(); -} - Muon::MdtRdoToPrepDataToolMT::SetupMdtPrepDataContainerStatus Muon::MdtRdoToPrepDataToolMT::setupMdtPrepDataContainer() { m_fullEventDone=false; @@ -45,7 +31,7 @@ Muon::MdtRdoToPrepDataToolMT::SetupMdtPrepDataContainerStatus Muon::MdtRdoToPrep const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); if (!externalCachePRD) { // without the cache we just record the container - StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max())); + StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max())); if (status.isFailure() || !handle.isValid() ) { ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key()); return FAILED; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h index 645d933bad0097c9019edd183c004f65ba5b38e2..df87cbabb7043b602e957336a43408a75eca6983 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataToolMT.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONMdtRdoToPrepDataToolMT_H #define MUONMdtRdoToPrepDataToolMT_H @@ -32,13 +28,10 @@ namespace Muon MdtRdoToPrepDataToolMT(const std::string&,const std::string&,const IInterface*); /** default destructor */ - virtual ~MdtRdoToPrepDataToolMT (); + virtual ~MdtRdoToPrepDataToolMT()=default; /** standard Athena-Algorithm method */ virtual StatusCode initialize() override; - - /** standard Athena-Algorithm method */ - virtual StatusCode finalize() override; protected: virtual SetupMdtPrepDataContainerStatus setupMdtPrepDataContainer() override; diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h index 7e361ec459b371ef32d2de7027336be6a29557df..68807b2844ba1d49acb656c95a3b16a502ea9fb1 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h @@ -1,26 +1,24 @@ /* - 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 TESTTOOL_H #define TESTTOOL_H #include "MuonPrdSelector/IMuonIdCutTool.h" - - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "Identifier/Identifier.h" -#include <vector> -#include <set> #include "MuonCalibTools/IdToFixedIdTool.h" #include "MuonCalibIdentifier/MuonFixedId.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -class MsgStream; -class MuonStationIntersectSvc; +#include <string> +#include <vector> +#include <set> +class MuonStationIntersectSvc; /** Implementation of an IMuonIdCutTool. @@ -35,13 +33,10 @@ class MuonIdCutTool : virtual public IMuonIdCutTool, public AthAlgTool { MuonIdCutTool(const std::string&, const std::string&, const IInterface*); /** destructor */ - virtual ~MuonIdCutTool(); + virtual ~MuonIdCutTool()=default; /** initialize method, method taken from bass-class AlgTool */ StatusCode initialize(); - - /** finialize method, method taken from bass-class AlgTool */ - StatusCode finalize(); virtual bool isCut(Identifier ID) const; virtual bool isCut(MuonCalib::MuonFixedId id) const; @@ -89,8 +84,7 @@ class MuonIdCutTool : virtual public IMuonIdCutTool, public AthAlgTool { ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool; //<! tool to assist with Identifiers - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::vector<int> m_EELeta; std::vector<int> m_EELsector; diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h index ad897947614a3a1a851e84ddd801432a16a1f632..10324d1a59865d2e3b3c34a5affc94db6c0e0445 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h @@ -1,34 +1,26 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonPrdSelectorAlg.h -// Header file for class MuonPrdSelectorAlg -/////////////////////////////////////////////////////////////////// - #ifndef MUONPRDSELECTORALG_H #define MUONPRDSELECTORALG_H -// Base class #include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/DataHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -//#include "MuonPrepRawData/MuonPrepDataContainer.h" + #include "MuonPrepRawData/MdtPrepDataContainer.h" #include "MuonPrepRawData/RpcPrepDataContainer.h" #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonPrepRawData/CscPrepDataContainer.h" #include "MuonPrepRawData/CscStripPrepDataContainer.h" #include "MuonPrdSelector/MuonIdCutTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + #include <utility> #include <vector> #include <string> - - - /* class MuonPrdSelectorAlg class to cut out hits from Muon PRDCollections @@ -46,7 +38,6 @@ class MuonPrdSelectorAlg : public AthAlgorithm { // Basic algorithm methods: virtual StatusCode initialize(); //!< Algorithm initialization: retrieves StoreGate/DetectorStore/MuonIdHelpers/MuonPrepDataContainers virtual StatusCode execute(); //!< Retrieves and records containers, performs selection - virtual StatusCode finalize(); //!< Does nothing private: void print(); //!< method for DEBUG purposes: prints the content of input and output MuonPrepDataContainer @@ -61,8 +52,7 @@ class MuonPrdSelectorAlg : public AthAlgorithm { StatusCode selectTGCs() ; //!< selects the hits from TGCcollections StatusCode selectCSCs() ; //!< selects the hits from CSCcollections - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<IMuonIdCutTool> m_muonIdCutTool; //defines the cuts diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx index 910b3b6b9bb6e1e59465b038b7cca7a5b42e284d..7ea6d41f79ae93baa7529d37386b5fe8a7fa98e9 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx @@ -1,12 +1,9 @@ /* - 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 "MuonPrdSelector/MuonIdCutTool.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" + #include "MuonCalibTools/IdToFixedIdTool.h" #include "MuonCalibIdentifier/MuonFixedId.h" @@ -64,14 +61,10 @@ MuonIdCutTool::MuonIdCutTool(const std::string& t,const std::string& n,const IIn //cut the whole technology } - -MuonIdCutTool::~MuonIdCutTool() { - -} StatusCode MuonIdCutTool::initialize() { ATH_CHECK( m_idToFixedIdTool.retrieve() ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_cutStationName && !m_cutStationRegion && !m_cutEta && !m_cutPhi && !m_cutEE){ ATH_MSG_WARNING( "MuonIdCutTool invoked with no cuts performed" ); @@ -115,15 +108,6 @@ StatusCode MuonIdCutTool::initialize() { return StatusCode::SUCCESS; } - -StatusCode MuonIdCutTool::finalize() -{ - ATH_MSG_DEBUG( "Finalize Called" ); - return StatusCode::SUCCESS; -} - - - bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are passed //some checks to see if the tool is configured in a state that makes sense @@ -149,27 +133,27 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are enum class IdEnum { MDT, CSC, RPC, TGC } idEnum; auto pIdHelper = [&]() -> const MuonIdHelper& { switch (idEnum) { - case IdEnum::MDT: { return m_muonIdHelperTool->mdtIdHelper(); } - case IdEnum::CSC: { return m_muonIdHelperTool->cscIdHelper(); } - case IdEnum::RPC: { return m_muonIdHelperTool->rpcIdHelper(); } - default: { return m_muonIdHelperTool->tgcIdHelper(); } + case IdEnum::MDT: { return m_idHelperSvc->mdtIdHelper(); } + case IdEnum::CSC: { return m_idHelperSvc->cscIdHelper(); } + case IdEnum::RPC: { return m_idHelperSvc->rpcIdHelper(); } + default: { return m_idHelperSvc->tgcIdHelper(); } } }; //determine technology - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(ID)){ + if (m_idHelperSvc->isMdt(ID)){ idEnum = IdEnum::MDT; ATH_MSG_DEBUG( "ID is an MDT" ); } - else if (m_muonIdHelperTool->cscIdHelper().is_csc(ID)){ + else if (m_idHelperSvc->isCsc(ID)){ idEnum = IdEnum::CSC; ATH_MSG_DEBUG( "ID is an CSC" ); } - else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(ID)){ + else if (m_idHelperSvc->isRpc(ID)){ idEnum = IdEnum::RPC; ATH_MSG_DEBUG( "ID is an RPC" ); } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ID)){ + else if (m_idHelperSvc->isTgc(ID)){ idEnum = IdEnum::TGC; ATH_MSG_DEBUG( "ID is a TGC" ); } @@ -202,16 +186,16 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are //Routine for cutting on Station Region if (m_cutStationRegion){ - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(ID)){ + if (m_idHelperSvc->isMdt(ID)){ cutList = m_mdtRegionList; } - else if (m_muonIdHelperTool->cscIdHelper().is_csc(ID)){ + else if (m_idHelperSvc->isCsc(ID)){ cutList = m_cscRegionList; } - else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(ID)){ + else if (m_idHelperSvc->isRpc(ID)){ cutList = m_rpcRegionList; } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ID)){ + else if (m_idHelperSvc->isTgc(ID)){ cutList = m_tgcRegionList; } else{ @@ -236,16 +220,16 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are if (m_cutStationName){ - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(ID)){ + if (m_idHelperSvc->isMdt(ID)){ cutList = m_mdtStationNameList; } - else if (m_muonIdHelperTool->cscIdHelper().is_csc(ID)){ + else if (m_idHelperSvc->isCsc(ID)){ cutList = m_cscStationNameList; } - else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(ID)){ + else if (m_idHelperSvc->isRpc(ID)){ cutList = m_rpcStationNameList; } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ID)){ + else if (m_idHelperSvc->isTgc(ID)){ cutList = m_tgcStationNameList; } else{ @@ -264,25 +248,25 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are else { //proceed with more specific cuts - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(ID)){ - ATH_MSG_DEBUG( "MDT multilayer " <<m_muonIdHelperTool->mdtIdHelper().multilayer(ID) + if (m_idHelperSvc->isMdt(ID)){ + ATH_MSG_DEBUG( "MDT multilayer " <<m_idHelperSvc->mdtIdHelper().multilayer(ID) << " compared with " << m_mdtMultilayerList[i] ); - if(m_mdtMultilayerList[i] == m_muonIdHelperTool->mdtIdHelper().multilayer(ID)) + if(m_mdtMultilayerList[i] == m_idHelperSvc->mdtIdHelper().multilayer(ID)) return true; } - else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(ID)){ - ATH_MSG_DEBUG( "RPC doublet R " <<m_muonIdHelperTool->rpcIdHelper().doubletR(ID) + else if (m_idHelperSvc->isRpc(ID)){ + ATH_MSG_DEBUG( "RPC doublet R " <<m_idHelperSvc->rpcIdHelper().doubletR(ID) << " compared with " << m_rpcDoubletRList[i] ); - if( m_rpcDoubletRList[i] == m_muonIdHelperTool->rpcIdHelper().doubletR(ID) ){ + if( m_rpcDoubletRList[i] == m_idHelperSvc->rpcIdHelper().doubletR(ID) ){ if (m_rpcGasGapList.size() == 0){ return true; } else { - ATH_MSG_DEBUG( "RPC gasgap " <<m_muonIdHelperTool->rpcIdHelper().gasGap(ID) + ATH_MSG_DEBUG( "RPC gasgap " <<m_idHelperSvc->rpcIdHelper().gasGap(ID) << " compared with " << m_rpcGasGapList[i] ); - if (m_rpcGasGapList[i] == m_muonIdHelperTool->rpcIdHelper().gasGap(ID)) + if (m_rpcGasGapList[i] == m_idHelperSvc->rpcIdHelper().gasGap(ID)) return true; } @@ -290,10 +274,10 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ID)){ - ATH_MSG_DEBUG( "TGC gasgap " <<m_muonIdHelperTool->tgcIdHelper().gasGap(ID) + else if (m_idHelperSvc->isTgc(ID)){ + ATH_MSG_DEBUG( "TGC gasgap " <<m_idHelperSvc->tgcIdHelper().gasGap(ID) << " compared with " << m_tgcGasGapList[i] ); - if (m_tgcGasGapList[i] == m_muonIdHelperTool->tgcIdHelper().gasGap(ID)) + if (m_tgcGasGapList[i] == m_idHelperSvc->tgcIdHelper().gasGap(ID)) return true; } @@ -326,7 +310,7 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are ATH_MSG_DEBUG( "Phi Sector is " << sector ); //Is it tgc? - if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ID)){ + if (m_idHelperSvc->isTgc(ID)){ //If no cuts specified, don't cut anything if (m_tgcEtaList.size()==0 && m_tgcEndPhiList.size()==0 && m_tgcForPhiList.size()==0) return false; @@ -341,7 +325,7 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are //mdt? - else if(m_muonIdHelperTool->mdtIdHelper().is_mdt(ID)){ + else if(m_idHelperSvc->isMdt(ID)){ //If no cuts specified, don't cut anything if (m_mdtSectorList.size()==0 && m_mdtEndEtaList.size()==0 && m_mdtBarEtaList.size()==0) return false; @@ -353,7 +337,7 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are } //rpc? - else if(m_muonIdHelperTool->rpcIdHelper().is_rpc(ID)){ + else if(m_idHelperSvc->isRpc(ID)){ //If no cuts specified, don't cut anything if (m_rpcSectorList.size()==0 && m_rpcEtaList.size()==0) return false; @@ -362,7 +346,7 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are } //csc? - else if(m_muonIdHelperTool->cscIdHelper().is_csc(ID)){ + else if(m_idHelperSvc->isCsc(ID)){ //If no cuts specified, don't cut anything if (m_cscSectorList.size()==0 && m_cscEtaList.size()==0) return false; diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx index 08b95ee3a900a04e93f7151f442cba9e47678b47..a406c8fc84ab3f5b1c5e2666851c9ead2f13ae52 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx @@ -1,32 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonPrdSelectorAlg.cxx -// Source file for class MuonPrdSelectorAlg -/////////////////////////////////////////////////////////////////// - #include "MuonPrdSelector/MuonPrdSelectorAlg.h" -// Gaudi includes -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "StoreGate/StoreGate.h" -#include "Identifier/IdentifierHash.h" -#include "Identifier/Identifier.h" #include <iomanip> // Constructor with parameters: MuonPrdSelectorAlg::MuonPrdSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_muonIdCutTool("MuonIdCutTool/MuonIdCutTool"), m_mdtPRDs_in(0), m_rpcPRDs_in(0), m_tgcPRDs_in(0), m_cscPRDs_in(0), m_mdtPRDs_out(0), m_rpcPRDs_out(0), m_tgcPRDs_out(0), m_cscPRDs_out(0) - - - { declareProperty("MDT_PRDinputContainer" , m_inputContainer_mdt = "MDT_DriftCircles_unfiltered" ); declareProperty("MDT_PRDoutputContainer" , m_outputContainer_mdt = "MDT_DriftCircles" ); @@ -39,15 +24,6 @@ MuonPrdSelectorAlg::MuonPrdSelectorAlg(const std::string &name, ISvcLocator *pSv declareProperty("CSC_PRDinputContainer" , m_inputContainer_csc = "CSC_Measurements_unfiltered" ); declareProperty("CSC_PRDoutputContainer" , m_outputContainer_csc = "CSC_Measurements" ); - - - - - - - - - } @@ -56,14 +32,13 @@ StatusCode MuonPrdSelectorAlg::initialize() { ATH_MSG_DEBUG( "initialize() called" ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // retrieve test tool ATH_CHECK( m_muonIdCutTool.retrieve() ); - try { - m_mdtPRDs_out = new Muon::MdtPrepDataContainer(m_muonIdHelperTool->mdtIdHelper().module_hash_max()); + m_mdtPRDs_out = new Muon::MdtPrepDataContainer(m_idHelperSvc->mdtIdHelper().module_hash_max()); } catch(const std::bad_alloc&) { ATH_MSG_FATAL( "Could not create a new MDT PrepRawData container!" ); return StatusCode::FAILURE; @@ -73,7 +48,7 @@ StatusCode MuonPrdSelectorAlg::initialize() try { - m_rpcPRDs_out = new Muon::RpcPrepDataContainer(m_muonIdHelperTool->rpcIdHelper().module_hash_max()); + m_rpcPRDs_out = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); } catch(const std::bad_alloc&) { ATH_MSG_FATAL( "Could not create a new RPC PrepRawData container!" ); return StatusCode::FAILURE; @@ -81,7 +56,7 @@ StatusCode MuonPrdSelectorAlg::initialize() m_rpcPRDs_out->addRef(); try { - m_tgcPRDs_out = new Muon::TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max()); + m_tgcPRDs_out = new Muon::TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()); } catch(const std::bad_alloc&) { ATH_MSG_FATAL( "Could not create a new TGC PrepRawData container!" ); return StatusCode::FAILURE; @@ -90,7 +65,7 @@ StatusCode MuonPrdSelectorAlg::initialize() try { - m_cscPRDs_out = new Muon::CscStripPrepDataContainer(m_muonIdHelperTool->cscIdHelper().module_hash_max()); + m_cscPRDs_out = new Muon::CscStripPrepDataContainer(m_idHelperSvc->cscIdHelper().module_hash_max()); } catch(const std::bad_alloc&) { ATH_MSG_FATAL( "Could not create a new CSC PrepRawData container!" ); return StatusCode::FAILURE; @@ -110,13 +85,6 @@ StatusCode MuonPrdSelectorAlg::execute() return StatusCode::SUCCESS; } -StatusCode MuonPrdSelectorAlg::finalize() -{ - ATH_MSG_DEBUG( "finalize() called" ); - return StatusCode::SUCCESS; -} - - StatusCode MuonPrdSelectorAlg::retrieveContainers() { ATH_MSG_DEBUG( "retrieveContainers() called" ); diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.cxx b/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.cxx index f5136aaff87e11ef78f833766c8ea6ab1e244a3c..6fc50e50ffedb0a84432fba8c3cbcf338cd37fa9 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.cxx @@ -1,57 +1,36 @@ /* - 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 "MuonPRDSelectionTool.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "EventPrimitives/EventPrimitivesHelpers.h" -#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" - -// #include "TrkToolInterfaces/IResidualPullCalculator.h" -// #include "TrkEventPrimitives/ResidualPull.h" namespace Muon { MuonPRDSelectionTool::MuonPRDSelectionTool(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_mdtCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", this), m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator", this), - m_recoValidationTool("", this), // ("Muon::MuonRecoValidationTool/MuonRecoValidationTool"), - // m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"), + m_recoValidationTool("", this), m_distanceToTubeCut(1000.), m_secondCoordinateCut(1500.) { declareInterface<IMuonPRDSelectionTool>(this); - - declareProperty("MuonIdHelperTool",m_idHelper ); declareProperty("MdtDriftCircleOnTrackCreator",m_mdtCreator); declareProperty("MuonClusterOnTrackCreator",m_clusterCreator); declareProperty("MuonRecoValidationTool",m_recoValidationTool); - - } - - MuonPRDSelectionTool::~MuonPRDSelectionTool() { } - - StatusCode MuonPRDSelectionTool::finalize() { - return StatusCode::SUCCESS; } StatusCode MuonPRDSelectionTool::initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_mdtCreator.retrieve()); ATH_CHECK(m_clusterCreator.retrieve()); if( !m_recoValidationTool.empty() ) ATH_CHECK(m_recoValidationTool.retrieve()); - // ATH_CHECK(m_pullCalculator.retrieve()); - return StatusCode::SUCCESS; } - - bool MuonPRDSelectionTool::calibrateAndSelect( const MuonSystemExtension::Intersection& intersection, const MuonLayerPrepRawData& layerPrepRawData, MuonLayerROTs& layerROTs ) const { if( msgLvl(MSG::DEBUG) ){ @@ -118,7 +97,7 @@ namespace Muon { const Trk::Surface& surface = mdt.detectorElement()->surface(id); Amg::Vector2D localPosition; if( !surface.globalToLocal(intersect,direction,localPosition) ){ - ATH_MSG_VERBOSE(" globalToLocal failed for " << m_idHelper->toString(id) ); + ATH_MSG_VERBOSE(" globalToLocal failed for " << m_idHelperSvc->toString(id) ); return 0; } @@ -126,10 +105,10 @@ namespace Muon { if( !m_recoValidationTool.empty() ) m_recoValidationTool->add(intersection,mdt,localPosition.x(),err_precision ); // bound checks - double tubeHalfLen = 0.5*detEl->getActiveTubeLength( m_idHelper->mdtIdHelper().tubeLayer(id),m_idHelper->mdtIdHelper().tube(id) ); + double tubeHalfLen = 0.5*detEl->getActiveTubeLength( m_idHelperSvc->mdtIdHelper().tubeLayer(id),m_idHelperSvc->mdtIdHelper().tube(id) ); double distanceAlongTube = localPosition[Trk::locZ]; - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Intersected " << m_idHelper->toString(id) << " distance to wire " << localPosition[Trk::locR] + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Intersected " << m_idHelperSvc->toString(id) << " distance to wire " << localPosition[Trk::locR] << " error " << err_precision << " along tube (%) " << distanceAlongTube/tubeHalfLen; if( std::abs(distanceAlongTube) > tubeHalfLen + m_secondCoordinateCut ) { @@ -152,7 +131,7 @@ namespace Muon { // calibrate hit const MdtDriftCircleOnTrack* mdtROT = m_mdtCreator->createRIO_OnTrack( mdt, intersect, &direction ); - if( !mdtROT ) ATH_MSG_VERBOSE(" Failed to calibrate " << m_idHelper->toString(id)); + if( !mdtROT ) ATH_MSG_VERBOSE(" Failed to calibrate " << m_idHelperSvc->toString(id)); return mdtROT; } @@ -172,11 +151,11 @@ namespace Muon { // get local position Amg::Vector2D localPosition; if( !surf.globalToLocal(intersect,direction,localPosition) ){ - ATH_MSG_VERBOSE(" globalToLocal failed for " << m_idHelper->toString(id) ); + ATH_MSG_VERBOSE(" globalToLocal failed for " << m_idHelperSvc->toString(id) ); return 0; } - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Intersected " << m_idHelper->toString(id) << " local position " << localPosition[Trk::loc1] << " " << localPosition[Trk::loc2]; + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Intersected " << m_idHelperSvc->toString(id) << " local position " << localPosition[Trk::loc1] << " " << localPosition[Trk::loc2]; if( !surf.insideBounds(localPosition, m_distanceToTubeCut, m_secondCoordinateCut) ) { if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " outside bounds, dropping " << endmsg; @@ -211,16 +190,12 @@ namespace Muon { const Amg::Vector3D& planeposition = tubePos; // always project on plane with normal in radial direction - Amg::Vector3D planenormal = !m_idHelper->isEndcap(id) ? amdbToGlobal.linear()*Amg::Vector3D(0.,0.,1.) : amdbToGlobal.linear()*Amg::Vector3D(0.,1.,0.); + Amg::Vector3D planenormal = !m_idHelperSvc->isEndcap(id) ? amdbToGlobal.linear()*Amg::Vector3D(0.,0.,1.) : amdbToGlobal.linear()*Amg::Vector3D(0.,1.,0.); double denom = direction.dot(planenormal); double u = (planenormal.dot(planeposition - position))/denom; Amg::Vector3D piOnPlane = ( position + u * direction); return piOnPlane; - //Amg::Vector3D lpiOnPlane = amdbToGlobal.inverse()*piOnPlane; - //Amg::Vector3D ltubePos = amdbToGlobal.inverse()*tubePos; - - //return amdbToGlobal*lpiOnPlane;//Amg::Vector3D( lpiOnPlane.x(), ltubePos.y(), ltubePos.z() ); } Trk::Intersection intersection = mdt.detectorElement()->surface(mdt.identify()).straightLineIntersection(position,direction,false,false); return intersection.position; diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.h b/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.h index d508869db1de509089ae841147aef4ba64246d63..4c4ec8de9a80b2e75f822b49a052105ce160ca75 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.h +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataProviderTools/src/MuonPRDSelectionTool.h @@ -1,40 +1,37 @@ /* - 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 MUON_MUONPRDSELECTIONTOOL_H #define MUON_MUONPRDSELECTIONTOOL_H #include "MuonRecToolInterfaces/IMuonPRDSelectionTool.h" - -#include <vector> - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuonLayerEvent/MuonSystemExtension.h" #include "MuonLayerEvent/MuonLayerPrepRawData.h" #include "MuonLayerEvent/MuonLayerROTs.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" +#include "MuonPrepRawData/MdtPrepDataCollection.h" + +#include <vector> +#include <string> namespace Muon { - - class MuonIdHelperTool; - class IMdtDriftCircleOnTrackCreator; - class IMuonClusterOnTrackCreator; - class IMuonRecoValidationTool; - class MdtPrepData; class MuonPRDSelectionTool : virtual public Muon::IMuonPRDSelectionTool, public AthAlgTool { public: /** Default AlgTool functions */ MuonPRDSelectionTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonPRDSelectionTool(); + virtual ~MuonPRDSelectionTool()=default; StatusCode initialize(); - StatusCode finalize(); /**IMuonPRDSelectionTool interface: calibrateAndSelect */ bool calibrateAndSelect( const MuonSystemExtension::Intersection& intersection, const MuonLayerPrepRawData& layerPrepRawData, MuonLayerROTs& layerROTs ) const; @@ -84,13 +81,11 @@ namespace Muon { bool calibrateAndSelectCluster( const MuonSystemExtension::Intersection& intersection, const COL& prds, MuonLayerROTs& layerROTs ) const { std::vector<const MuonClusterOnTrack*> rots; calibrateAndSelectCluster(intersection,prds,rots); - if( !rots.empty() ) layerROTs.addClusters(rots,m_idHelper->technologyIndex(rots.front()->identify())); + if( !rots.empty() ) layerROTs.addClusters(rots,m_idHelperSvc->technologyIndex(rots.front()->identify())); return true; } - - /** tool handles */ - ToolHandle<MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtCreator; //<! pointer to mdt rio ontrack creator ToolHandle<IMuonClusterOnTrackCreator> m_clusterCreator; //<! pointer to muon cluster rio ontrack creator mutable ToolHandle<IMuonRecoValidationTool> m_recoValidationTool; //<! FIXME! diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx index 0eb150e725ec45403b7fae140077e744416ba082..463ba003112d075c7076cb757356428c1ca47cd3 100644 --- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx @@ -1,16 +1,9 @@ /* - 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 "MuonPRDCacheCreator.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonIdHelpers/sTgcIdHelper.h" -#include "MuonIdHelpers/MmIdHelper.h" - #include "AthViews/View.h" /// Constructor @@ -38,10 +31,6 @@ MuonPRDCacheCreator::MuonPRDCacheCreator(const std::string &name,ISvcLocator *pS declareProperty("DisableViewWarning", m_disableWarning); } -MuonPRDCacheCreator::~MuonPRDCacheCreator() { - -} - StatusCode MuonPRDCacheCreator::initialize() { ATH_CHECK( m_CscCacheKey.initialize( !m_CscCacheKey.key().empty() )); ATH_CHECK( m_CscStripCacheKey.initialize( !m_CscStripCacheKey.key().empty() )); @@ -53,26 +42,25 @@ StatusCode MuonPRDCacheCreator::initialize() { ATH_CHECK( m_RpcCoinCacheKey.initialize( !m_RpcCoinCacheKey.key().empty() )); ATH_CHECK( m_TgcCoinCacheKey.initialize( !m_TgcCoinCacheKey.key().empty() )); - // Retrieve ID tools - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); // Check we have the tools to allow us to setup cache - if( !m_muonIdHelperTool->hasCscIdHelper() && !m_CscCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasCSC() && !m_CscCacheKey.key().empty() ){ ATH_MSG_WARNING("CSC ID Helper is not available and CSC PRD cache was requested - This will not be created"); } - if( !m_muonIdHelperTool->hasMdtIdHelper() && !m_MdtCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasMDT() && !m_MdtCacheKey.key().empty() ){ ATH_MSG_WARNING("MDT ID Helper is not available and MDT PRD cache was requested - This will not be created"); } - if( !m_muonIdHelperTool->hasRpcIdHelper() && !m_RpcCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasRPC() && !m_RpcCacheKey.key().empty() ){ ATH_MSG_WARNING("RPC ID Helper is not available and RPC PRD cache was requested - This will not be created"); } - if( !m_muonIdHelperTool->hasTgcIdHelper() && !m_TgcCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasTGC() && !m_TgcCacheKey.key().empty() ){ ATH_MSG_WARNING("TGC ID Helper is not available and TGC PRD cache was requested - This will not be created"); } - if( !m_muonIdHelperTool->hasSTgcIdHelper() && !m_sTgcCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasSTgc() && !m_sTgcCacheKey.key().empty() ){ ATH_MSG_WARNING("STGC ID Helper is not available and STGC PRD cache was requested - This will not be created"); } - if( !m_muonIdHelperTool->hasMmIdHelper() && !m_MmCacheKey.key().empty() ){ + if( !m_idHelperSvc->hasMM() && !m_MmCacheKey.key().empty() ){ ATH_MSG_WARNING("MM ID Helper is not available and MM PRD cache was requested - This will not be created"); } @@ -98,37 +86,37 @@ StatusCode MuonPRDCacheCreator::execute (const EventContext& ctx) const { // Create all the cache containers (if the tools are available) // CSC - if( m_muonIdHelperTool->hasCscIdHelper() ){ - ATH_CHECK(createContainer(m_CscCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); - ATH_CHECK(createContainer(m_CscStripCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); + if( m_idHelperSvc->hasCSC() ){ + ATH_CHECK(createContainer(m_CscCacheKey, m_idHelperSvc->cscIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_CscStripCacheKey, m_idHelperSvc->cscIdHelper().module_hash_max(), ctx)); } // MDT - if( m_muonIdHelperTool->hasMdtIdHelper() ){ - auto maxHashMDTs = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1 ? m_muonIdHelperTool->mdtIdHelper().detectorElement_hash_max() : m_muonIdHelperTool->mdtIdHelper().module_hash_max(); + if( m_idHelperSvc->hasMDT() ){ + auto maxHashMDTs = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1 ? m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() : m_idHelperSvc->mdtIdHelper().module_hash_max(); ATH_CHECK(createContainer(m_MdtCacheKey, maxHashMDTs, ctx)); } // RPC - if( m_muonIdHelperTool->hasRpcIdHelper() ){ - ATH_CHECK(createContainer(m_RpcCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); - ATH_CHECK(createContainer(m_RpcCoinCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); + if( m_idHelperSvc->hasRPC() ){ + ATH_CHECK(createContainer(m_RpcCacheKey, m_idHelperSvc->rpcIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_RpcCoinCacheKey, m_idHelperSvc->rpcIdHelper().module_hash_max(), ctx)); } // TGC - if( m_muonIdHelperTool->hasTgcIdHelper() ){ - ATH_CHECK(createContainer(m_TgcCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); - ATH_CHECK(createContainer(m_TgcCoinCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); + if( m_idHelperSvc->hasTGC() ){ + ATH_CHECK(createContainer(m_TgcCacheKey, m_idHelperSvc->tgcIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_TgcCoinCacheKey, m_idHelperSvc->tgcIdHelper().module_hash_max(), ctx)); } // NSW STGC - if( m_muonIdHelperTool->hasSTgcIdHelper() ){ - ATH_CHECK(createContainer(m_sTgcCacheKey, m_muonIdHelperTool->stgcIdHelper().module_hash_max(), ctx)); + if( m_idHelperSvc->hasSTgc() ){ + ATH_CHECK(createContainer(m_sTgcCacheKey, m_idHelperSvc->stgcIdHelper().module_hash_max(), ctx)); } // NSW MM - if( m_muonIdHelperTool->hasMmIdHelper() ){ - ATH_CHECK(createContainer(m_MmCacheKey, m_muonIdHelperTool->mmIdHelper().module_hash_max(), ctx)); + if( m_idHelperSvc->hasMM() ){ + ATH_CHECK(createContainer(m_MmCacheKey, m_idHelperSvc->mmIdHelper().module_hash_max(), ctx)); } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h index 41b3b48b9a68a7116d834c27400e4e492a7faabc..8b06e325f0dffa012c2406de8adc83c8ab74171d 100644 --- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h +++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h @@ -1,15 +1,15 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #pragma once #include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" #include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" // Class for setting up PRD cache containers @@ -19,7 +19,7 @@ class MuonPRDCacheCreator : public AthReentrantAlgorithm { /// Constructor MuonPRDCacheCreator(const std::string &name,ISvcLocator *pSvcLocator); /// Destructor - virtual ~MuonPRDCacheCreator() ; + virtual ~MuonPRDCacheCreator()=default; /// Initialize the algorithm virtual StatusCode initialize () override; @@ -43,9 +43,7 @@ protected: SG::WriteHandleKey<RpcCoinDataCollection_Cache> m_RpcCoinCacheKey; SG::WriteHandleKey<TgcCoinDataCollection_Cache> m_TgcCoinCacheKey; - - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; mutable bool m_disableWarning = false; bool isInsideView(const EventContext&) const; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx index 9d2c3cc9d06e3f6be65b79ccefcd6a4987aa540e..e71b11aaaa0ff98f486300a33893b38ad4e5735c 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx @@ -1,14 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_RawDataProviderTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "TGC_RawDataProviderTool.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "MuonRDO/TgcRdoContainer.h" //================ Constructor ================================================= @@ -22,11 +17,6 @@ Muon::TGC_RawDataProviderTool::TGC_RawDataProviderTool( declareInterface<IMuonRawDataProviderTool>(this); } -//================ Destructor ================================================= - -Muon::TGC_RawDataProviderTool::~TGC_RawDataProviderTool() -{} - //================ Initialisation ================================================= StatusCode Muon::TGC_RawDataProviderTool::initialize() @@ -38,13 +28,6 @@ StatusCode Muon::TGC_RawDataProviderTool::initialize() return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::TGC_RawDataProviderTool::finalize() -{ - return StatusCode::SUCCESS; -} - //============================================================================================ StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h index 8f32d41044846110234dfc78d2023d40e2bc8390..945aad7ef50ffcd2fe7c24519b5a61a55b171983 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.h @@ -1,17 +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 */ -/////////////////////////////////////////////////////////////////// -// TGC_RawDataProviderTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOL_H #define MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOL_H #include "TGC_RawDataProviderToolCore.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" + #include "TGC_Hid2RESrcID.h" namespace Muon @@ -31,12 +27,10 @@ namespace Muon /** Default constructor */ TGC_RawDataProviderTool(const std::string& t, const std::string& n, const IInterface* p); /** Default destructor */ - virtual ~TGC_RawDataProviderTool(); + virtual ~TGC_RawDataProviderTool()=default; /** Standard AlgTool method */ virtual StatusCode initialize(); - /** Standard AlgTool method */ - virtual StatusCode finalize(); /** Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool */ virtual StatusCode convert(const ROBFragmentList& vecRobs); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx index 9d1445444c2a0ef447c757a3286e35be4caa77a0..748e08c9535163328b8a9fe3a68391942fa361a8 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx @@ -8,11 +8,9 @@ #include "TGC_RawDataProviderToolCore.h" -#include "MuonTGC_CnvTools/ITGC_RodDecoder.h" #include "MuonRDO/TgcRdoContainer.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/IJobOptionsSvc.h" @@ -31,42 +29,26 @@ Muon::TGC_RawDataProviderToolCore::TGC_RawDataProviderToolCore( declareProperty("Decoder", m_decoder); } -//================ Destructor ================================================= - -Muon::TGC_RawDataProviderToolCore::~TGC_RawDataProviderToolCore() -{} - //================ Initialisation ================================================= StatusCode Muon::TGC_RawDataProviderToolCore::initialize() { - StatusCode sc = AthAlgTool::initialize(); - - if(sc.isFailure()) return sc; - + ATH_CHECK(AthAlgTool::initialize()); ATH_CHECK(m_idHelperSvc.retrieve()); - if(m_decoder.retrieve().isFailure()) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_decoder ); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO( "Retrieved tool " << m_decoder ); - } + ATH_CHECK(m_decoder.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_decoder ); // Get ROBDataProviderSvc - if(m_robDataProvider.retrieve().isFailure()) { - ATH_MSG_FATAL( "Failed to retrieve serive " << m_robDataProvider ); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO( "Retrieved service " << m_robDataProvider ); - } + ATH_CHECK(m_robDataProvider.retrieve()); + ATH_MSG_DEBUG( "Retrieved service " << m_robDataProvider ); m_maxhashtoUse = m_idHelperSvc->tgcIdHelper().module_hash_max(); ATH_CHECK(m_rdoContainerKey.initialize()); //try to configure the cabling service - sc = getCabling(); + StatusCode sc = getCabling(); if(sc.isFailure()) { ATH_MSG_INFO( "TGCcablingServerSvc not yet configured; postone TGCcabling initialization at first event. " ); } @@ -74,13 +56,6 @@ StatusCode Muon::TGC_RawDataProviderToolCore::initialize() return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::TGC_RawDataProviderToolCore::finalize() -{ - return StatusCode::SUCCESS; -} - //============================================================================================ StatusCode Muon::TGC_RawDataProviderToolCore::convertIntoContainer(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, TgcRdoContainer& tgcRdoContainer) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h index d9012911b507810fec7f2cc1376952b430f09fea..f1ca7f5bd6af2f7c85b8820836ea9942fbb15999 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h @@ -1,29 +1,24 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_RawDataProviderToolCore.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOLCORE_H #define MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOLCORE_H #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" + #include "TGC_Hid2RESrcID.h" #include "ByteStreamData/RawEvent.h" -#include "Identifier/IdentifierHash.h" -#include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" +#include "MuonTGC_CnvTools/ITGC_RodDecoder.h" +#include "TGCcablingInterface/ITGCcablingSvc.h" class TgcRdoContainer; -class IROBDataProviderSvc; -class ITGCcablingSvc; -namespace Muon -{ - class ITGC_RodDecoder; +namespace Muon { /** @class TGC_RawDataProviderToolCore * A tool to decode TGC ROB fragments into TGC RDO. @@ -38,12 +33,10 @@ namespace Muon /** Default constructor */ TGC_RawDataProviderToolCore(const std::string& t, const std::string& n, const IInterface* p); /** Default destructor */ - virtual ~TGC_RawDataProviderToolCore(); + virtual ~TGC_RawDataProviderToolCore()=default; /** Standard AlgTool method */ virtual StatusCode initialize(); - /** Standard AlgTool method */ - virtual StatusCode finalize(); /** Method that converts the ROBFragments into the passed container */ virtual StatusCode convertIntoContainer(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, TgcRdoContainer& tgcRdoContainer); @@ -53,7 +46,6 @@ namespace Muon /** Function to get the ROB data from a vector of IdentifierHash **/ std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> getROBData(const std::vector<IdentifierHash>& rdoIdhVect); - /** Get tgcIdHelper */ ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** Decoder for ROB fragment RDO conversion */ ToolHandle<ITGC_RodDecoder> m_decoder; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx index 47d00f730063472c435fd7f4565e3e80e8d65366..75a89d01873e6da1bcb46217e106da72e2e48831 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx @@ -1,14 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_RawDataProviderToolMT.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "TGC_RawDataProviderToolMT.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "MuonRDO/TgcRdoContainer.h" //================ Constructor ================================================= @@ -23,11 +18,6 @@ Muon::TGC_RawDataProviderToolMT::TGC_RawDataProviderToolMT( declareProperty("TgcContainerCacheKey", m_rdoContainerCacheKey, "Optional external cache for the TGC container"); } -//================ Destructor ================================================= - -Muon::TGC_RawDataProviderToolMT::~TGC_RawDataProviderToolMT() -{} - //================ Initialisation ================================================= StatusCode Muon::TGC_RawDataProviderToolMT::initialize() @@ -42,13 +32,6 @@ StatusCode Muon::TGC_RawDataProviderToolMT::initialize() return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::TGC_RawDataProviderToolMT::finalize() -{ - return StatusCode::SUCCESS; -} - //============================================================================================ StatusCode Muon::TGC_RawDataProviderToolMT::convert(const ROBFragmentList& vecRobs) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.h index 1e82db99e589ea1d140f3d9da328022e21bfabed..7bcd24af68d54e00323ca017d77a4ea1da43e20c 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.h @@ -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 */ -/////////////////////////////////////////////////////////////////// -// TGC_RawDataProviderToolMT.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOLMT_H #define MUONTGC_CNVTOOLS_TGC_RAWDATAPROVIDERTOOLMT_H #include "TGC_RawDataProviderToolCore.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" + #include "TGC_Hid2RESrcID.h" #include "MuonRDO/TgcRdo_Cache.h" @@ -31,12 +28,10 @@ namespace Muon /** Default constructor */ TGC_RawDataProviderToolMT(const std::string& t, const std::string& n, const IInterface* p); /** Default destructor */ - virtual ~TGC_RawDataProviderToolMT(); + virtual ~TGC_RawDataProviderToolMT()=default; /** Standard AlgTool method */ virtual StatusCode initialize(); - /** Standard AlgTool method */ - virtual StatusCode finalize(); /** Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool */ virtual StatusCode convert(const ROBFragmentList& vecRobs); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx index b9bb337e2bac11886529835c39d997c978941d0d..48d8d1a0b26cc2dae313a4be39cd92cc08534f41 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx @@ -1,15 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////// - #include "TgcPrepDataReplicationTool.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" - #include "MuonDigitContainer/TgcDigit.h" #include "EventPrimitives/EventPrimitives.h" @@ -21,24 +16,16 @@ Muon::TgcPrepDataReplicationTool::TgcPrepDataReplicationTool for(int ibc = 0; ibc < BC_NUM; ibc++) m_tgcPrepDataContainer[ibc] = 0; } - -//================ Destructor ================================================== -Muon::TgcPrepDataReplicationTool::~TgcPrepDataReplicationTool() -{} - - //================ Initialization ============================================== StatusCode Muon::TgcPrepDataReplicationTool::initialize() { - StatusCode sc = AthAlgTool::initialize(); - if(sc.isFailure()) return sc; - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK( m_idHelperSvc.retrieve() ); /// create an empty TGC container for filling for(int ibc = 0; ibc < BC_NUM; ibc++) { try { - m_tgcPrepDataContainer[ibc] = new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max()); + m_tgcPrepDataContainer[ibc] = new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()); } catch(const std::bad_alloc&) { ATH_MSG_FATAL("Could not create a new TGC PrepRawData container!"); return StatusCode::FAILURE; @@ -132,11 +119,11 @@ StatusCode Muon::TgcPrepDataReplicationTool::convertAllBCto3BC() hasBC[BC_NEXT] = TgcPrepData::BCBIT_NEXT; Identifier channelId = (*tgcAllColItr)->identify(); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId); for (int ibc = 0; ibc < BC_ALL; ibc++) { collections[ibc] = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, m_tgcPrepDataContainer[ibc], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcPrepDataContainer[ibc], m_idHelperSvc->tgcIdHelper(), msg()); if (!hasBC[ibc]) continue; Muon::TgcPrepData* newPrepData = makeTgcPrepData(tgcAllColItr, hasBC[ibc]); @@ -199,10 +186,10 @@ StatusCode Muon::TgcPrepDataReplicationTool::convert3BCtoAllBC() for (; tgcColItr != tgcColItrE; ++tgcColItr) { Identifier channelId = (*tgcColItr)->identify(); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId); collection = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, m_tgcPrepDataContainer[BC_ALL], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcPrepDataContainer[BC_ALL], m_idHelperSvc->tgcIdHelper(), msg()); bool duplicateInAllBCs = false; TgcPrepDataCollection::iterator tgcAllItr = collection->begin(); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h index 4b8196fa1adaa4c3ff0a52a0824bd7c1a2a6fc3f..99f0f0dc1db70fcbbdd75a662ef240032d1c3edd 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL_H #define MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL_H -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonPrepRawData/TgcPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -23,7 +22,7 @@ namespace Muon TgcPrepDataReplicationTool(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcPrepDataReplicationTool(); + virtual ~TgcPrepDataReplicationTool()=default; /** Provide InterfaceID */ static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; @@ -40,9 +39,7 @@ namespace Muon private: enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; - /** TGC identifier helper */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** TgcPrepRawData (hit PRD) containers */ TgcPrepDataContainer* m_tgcPrepDataContainer[BC_NUM]; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx index 20b26f56285ddebbf8115baf31a71a24416b113f..41e840aa2b208cddf36f66af7269064c33c07fbb 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////// - #include "TgcPrepDataReplicationTool3BCtoAllBC.h" #include "TgcPrepDataReplicationToolAllBCto3BC.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" @@ -24,18 +20,11 @@ Muon::TgcPrepDataReplicationTool3BCtoAllBC::TgcPrepDataReplicationTool3BCtoAllBC declareProperty("AllBCKey", m_AllBCKey); } - -//================ Destructor ================================================== -Muon::TgcPrepDataReplicationTool3BCtoAllBC::~TgcPrepDataReplicationTool3BCtoAllBC() -{} - //================ Initialization ============================================== StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::initialize() { - StatusCode sc = AthAlgTool::initialize(); - if(sc.isFailure()) return sc; - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); for(int ibc = 0; ibc < BC_ALL; ibc++) { std::ostringstream location; @@ -56,18 +45,11 @@ StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::replicate() return convert3BCtoAllBC(); } -StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::finalize() -{ - - return AthAlgTool::finalize(); -} - - StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() { SG::WriteHandle<TgcPrepDataContainer> tgcPrepDataContainerAll(m_AllBCKey); - tgcPrepDataContainerAll = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max()) ); + tgcPrepDataContainerAll = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()) ); auto tgc3BCs = m_3BCKeys.makeHandles(); @@ -94,10 +76,10 @@ StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() for (; tgcColItr != tgcColItrE; ++tgcColItr) { Identifier channelId = (*tgcColItr)->identify(); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId); Muon::TgcPrepDataCollection* collection = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, tgcPrepDataContainerAll.ptr(), m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, tgcPrepDataContainerAll.ptr(), m_idHelperSvc->tgcIdHelper(), msg()); bool duplicateInAllBCs = false; TgcPrepDataCollection::iterator tgcAllItr = collection->begin(); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h index e93f5990125a26332d629d88219fc418ab86db46..34d5d3baf7a9e8359dc53e4bfc1cd43eb9f91f85 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h @@ -1,18 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL3BCtoALLBC_H #define MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL3BCtoALLBC_H -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonPrepRawData/TgcPrepDataContainer.h" -#include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -24,7 +22,7 @@ namespace Muon TgcPrepDataReplicationTool3BCtoAllBC(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcPrepDataReplicationTool3BCtoAllBC(); + virtual ~TgcPrepDataReplicationTool3BCtoAllBC()=default; /** Provide InterfaceID */ static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; @@ -33,7 +31,6 @@ namespace Muon virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; virtual StatusCode replicate() override; StatusCode convert3BCtoAllBC(); @@ -41,8 +38,7 @@ namespace Muon private: enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKeyArray<TgcPrepDataContainer> m_3BCKeys; SG::WriteHandleKey<TgcPrepDataContainer> m_AllBCKey; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx index 667196766c12f5c6c4bc9fc8da5f61f70ed14121..0a78da92a2feeb0c9b8b12ff68cede13323039e6 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////// - #include "TgcPrepDataReplicationToolAllBCto3BC.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" @@ -25,26 +21,11 @@ Muon::TgcPrepDataReplicationToolAllBCto3BC::TgcPrepDataReplicationToolAllBCto3BC declareProperty("AllBCKey", m_AllBCKey); } - -//================ Destructor ================================================== -Muon::TgcPrepDataReplicationToolAllBCto3BC::~TgcPrepDataReplicationToolAllBCto3BC() -{} - -//================ Finalization ================================================ -StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::finalize() -{ - - return AthAlgTool::finalize(); -} - - //================ Initialization ============================================== StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::initialize() { - StatusCode sc = AthAlgTool::initialize(); - if(sc.isFailure()) return sc; - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); for(int ibc = 0; ibc < BC_ALL; ibc++) { std::ostringstream location; @@ -79,7 +60,7 @@ StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC() // convert auto tgc3BCHandles = m_3BCKeys.makeHandles(); for (int ibc = 0; ibc < BC_ALL; ibc++){ - tgc3BCHandles.at(ibc) = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max()) ); + tgc3BCHandles.at(ibc) = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()) ); } Muon::TgcPrepDataContainer::const_iterator tgcAllItr = tgcAll->begin(); @@ -101,11 +82,11 @@ StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC() hasBC[BC_NEXT] = TgcPrepData::BCBIT_NEXT; Identifier channelId = (*tgcAllColItr)->identify(); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId); std::array<Muon::TgcPrepDataCollection*, BC_ALL> collections; for (int ibc = 0; ibc < BC_ALL; ibc++) { collections[ibc] = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, tgc3BCHandles[ibc].ptr(), m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, tgc3BCHandles[ibc].ptr(), m_idHelperSvc->tgcIdHelper(), msg()); if (!hasBC[ibc]) continue; Muon::TgcPrepData* newPrepData = makeTgcPrepData(tgcAllColItr, hasBC[ibc]); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h index 28a54c966713480bef57443eba0fe4dbb8f6e8b4..a3d6a0efc5a3aaf69ebcbed3fb54761a51eb181b 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h @@ -1,18 +1,16 @@ - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TgcPrepDataReplicationTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOLAllBCto3BC_H #define MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOLAllBCto3BC_H -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonPrepRawData/TgcPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -24,7 +22,7 @@ namespace Muon TgcPrepDataReplicationToolAllBCto3BC(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcPrepDataReplicationToolAllBCto3BC(); + virtual ~TgcPrepDataReplicationToolAllBCto3BC()=default; /** Provide InterfaceID */ static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; @@ -33,7 +31,6 @@ namespace Muon virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; virtual StatusCode replicate() override; StatusCode convertAllBCto3BC(); @@ -43,8 +40,7 @@ namespace Muon private: enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::WriteHandleKeyArray<TgcPrepDataContainer> m_3BCKeys; SG::ReadHandleKey<TgcPrepDataContainer> m_AllBCKey; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx index 5ec934b890b2b617e0d0156eb4ddfebcb4140067..864fe64509875f83897ed3a6e1bce8abbd092ad0 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx @@ -1,27 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// TGC_CnvTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #include "TgcRdoToPrepDataTool.h" #include "MuonDigitContainer/TgcDigit.h" #include "MuonTrigCoinData/TgcCoinData.h" - Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), TgcRdoToPrepDataToolCore(t, n, p) { } -Muon::TgcRdoToPrepDataTool::~TgcRdoToPrepDataTool() -{ -} - StatusCode Muon::TgcRdoToPrepDataTool::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -30,11 +21,6 @@ StatusCode Muon::TgcRdoToPrepDataTool::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::TgcRdoToPrepDataTool::finalize() -{ - return TgcRdoToPrepDataToolCore::finalize(); -} - StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& requestedIdHashVect, std::vector<IdentifierHash>& selectedIdHashVect) { @@ -64,7 +50,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque SG::WriteHandle<TgcPrepDataContainer> handle(m_outputprepdataKeys[ibc]); // record the container in storeGate - handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max())); // cache the pointer, storegate retains ownership m_tgcPrepDataContainer[ibc] = handle.ptr(); if(!handle.isValid()) { @@ -113,13 +99,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque for(int ibc=0; ibc<NBC; ibc++) { if(!nothingToDo[ibc]) nothingToDoForAllBC = false; } - - /*if(nothingToDoForAllBC) { - ATH_MSG_DEBUG("Whole events at all " << NBC << " BCs have already been decoded; nothing to do"); - return StatusCode::SUCCESS; - }*/ - /// clean up containers for Coincidence for(int ibc=0; ibc<NBC; ibc++) { @@ -128,7 +108,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque SG::WriteHandle<TgcCoinDataContainer> handle(m_outputCoinKeys[ibc]); // record the container in storeGate - handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max())); // cache the pointer, storegate retains ownership m_tgcCoinDataContainer[ibc] = handle.ptr(); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h index d005d9e78afb1cdf1b75dcf099e342c0e856d679..8526cce9fb816e9eb2ef2af75ac508507c935c4c 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h @@ -1,10 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TgcRdoToPrepDataTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_TGCRDOTOPREPDATATOOL_H #define MUONTGC_CNVTOOLS_TGCRDOTOPREPDATATOOL_H @@ -28,12 +25,10 @@ namespace Muon TgcRdoToPrepDataTool(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcRdoToPrepDataTool(); + virtual ~TgcRdoToPrepDataTool()=default; /** Standard AthAlgTool initialize method */ virtual StatusCode initialize() override; - /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize() override; using TgcRdoToPrepDataToolCore::decode; // To prevent the decode below from hiding the superclass decode methods virtual StatusCode decode(std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& idWithDataVect) override; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx index 4ff6f30d7b7d763184bc2843f1376f4a572f740b..39a45acd92f3f69b53f6bcf4086bd4764277e505 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.cxx @@ -1,32 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// TGC_CnvTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #include "TgcRdoToPrepDataToolCore.h" -#include "GaudiKernel/ISvcLocator.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" - -#include "TGCcablingInterface/ITGCcablingSvc.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" #include "TGCcablingInterface/TGCIdBase.h" - #include "MuonDigitContainer/TgcDigit.h" - #include "MuonTrigCoinData/TgcCoinData.h" - #include "TrkSurfaces/Surface.h" - #include "MuonCnvToolInterfaces/IDC_Helper.h" - #include "EventPrimitives/EventPrimitives.h" - #include "GaudiKernel/ThreadLocalContext.h" #include <cfloat> @@ -70,11 +56,6 @@ Muon::TgcRdoToPrepDataToolCore::TgcRdoToPrepDataToolCore(const std::string& t, c for(int ibc=0; ibc<NBC+1; ibc++) m_fullEventDone[ibc]=false; } -//================ Destructor ================================================= - -Muon::TgcRdoToPrepDataToolCore::~TgcRdoToPrepDataToolCore() -{} - //___________________________________________________________________________ StatusCode Muon::TgcRdoToPrepDataToolCore::queryInterface(const InterfaceID& riid, void** ppvIf) { @@ -92,17 +73,9 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::queryInterface(const InterfaceID& rii StatusCode Muon::TgcRdoToPrepDataToolCore::initialize() { - StatusCode sc = AthAlgTool::initialize(); - if(sc.isFailure()) return sc; - - sc = detStore()->retrieve(m_muonMgr); - if(sc.isFailure()) { - ATH_MSG_FATAL("Cannot retrieve MuonDetectorManager"); - return sc; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(detStore()->retrieve(m_muonMgr)); + ATH_CHECK(m_idHelperSvc.retrieve()); for(int ibc=0; ibc<NBC+1; ibc++) { int bcTag=ibc+1; @@ -127,7 +100,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::initialize() ATH_CHECK( m_rdoContainerKey.initialize() ); //try to configure the cabling service - sc = getCabling(); + StatusCode sc = getCabling(); if(sc.isFailure()) { ATH_MSG_INFO("TGCcablingServerSvc not yet configured; postpone TGCcabling initialization at first event."); } @@ -151,8 +124,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::finalize() "HiPt: " << m_nHiPtRDOs << "->" << m_nHiPtPRDs << ", " << "SL: " << m_nSLRDOs << "->" << m_nSLPRDs << "]"); - StatusCode sc = AthAlgTool::finalize(); - return sc; + return AthAlgTool::finalize(); } //================ Decoding ================================================= @@ -166,7 +138,7 @@ void Muon::TgcRdoToPrepDataToolCore::printInputRdo() ATH_MSG_INFO("***************** Listing input TgcRdo Collections *****************************************"); /// TGC context - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); /// TGC RDO container --- assuming it is available auto rdoContainer = SG::makeHandle(m_rdoContainerKey); @@ -206,12 +178,12 @@ void Muon::TgcRdoToPrepDataToolCore::printInputRdo() IdentifierHash tgcHashId = rdoColl->identifyHash(); Identifier rdoId; - int code = m_muonIdHelperTool->tgcIdHelper().get_id(tgcHashId, rdoId, &tgcContext); + int code = m_idHelperSvc->tgcIdHelper().get_id(tgcHashId, rdoId, &tgcContext); if(code!=0) { ATH_MSG_INFO("*** A problem in hash -> id conversion for hashId= " << static_cast<int>(tgcHashId)); } - std::string extIdstring = m_muonIdHelperTool->tgcIdHelper().show_to_string(rdoId); + std::string extIdstring = m_idHelperSvc->tgcIdHelper().show_to_string(rdoId); ATH_MSG_INFO("*** Offine HashId = " << tgcHashId << " extended = " << extIdstring); int iHit = 0; @@ -329,13 +301,13 @@ void Muon::TgcRdoToPrepDataToolCore::printPrepData() << (ibc==2 ? "NextBC" : "")); ATH_MSG_INFO("PrepData Collection ID " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(tgcColl->identify())); + << m_idHelperSvc->tgcIdHelper().show_to_string(tgcColl->identify())); TgcPrepDataCollection::const_iterator it_tgcPrepData = tgcColl->begin(); TgcPrepDataCollection::const_iterator it_tgcPrepData_e = tgcColl->end(); for(; it_tgcPrepData!=it_tgcPrepData_e; it_tgcPrepData++) { ATH_MSG_INFO("PrepData Offline ID " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*it_tgcPrepData)->identify())); + << m_idHelperSvc->tgcIdHelper().show_to_string((*it_tgcPrepData)->identify())); } } } @@ -359,13 +331,13 @@ void Muon::TgcRdoToPrepDataToolCore::printPrepData() << (ibc==2 ? "NextBC" : "")); ATH_MSG_INFO("CoinData Collection ID " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(tgcCoinColl->identify())); + << m_idHelperSvc->tgcIdHelper().show_to_string(tgcCoinColl->identify())); TgcCoinDataCollection::const_iterator it_tgcCoinData = tgcCoinColl->begin(); TgcCoinDataCollection::const_iterator it_tgcCoinData_e = tgcCoinColl->end(); for(; it_tgcCoinData!=it_tgcCoinData_e; it_tgcCoinData++) { ATH_MSG_INFO("CoinData Offline ID " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*it_tgcCoinData)->identify())); + << m_idHelperSvc->tgcIdHelper().show_to_string((*it_tgcCoinData)->identify())); } } } @@ -428,7 +400,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat TgcPrepDataCollection* collection = 0; TgcPrepDataCollection* collectionAllBcs = 0; IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); // select current Hits, =0 for backward compatibility // BC_CURRENT=2, BC_UNDEFINED=0 @@ -502,7 +474,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat continue; } - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -511,7 +483,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat } collection = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, m_tgcPrepDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcPrepDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); // convert RawData to PrepRawData Identifier channelId; @@ -540,7 +512,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat if(channelId==(*cit_tgcPrepData)->identify()) { duplicate = true; ATH_MSG_DEBUG("Duplicated TgcPrepData(removed) = " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId)); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelId)); break; } } @@ -554,7 +526,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat ATH_MSG_WARNING("decodeHits: MuonGM::TgcReadoutElement is invalid."); continue; } - ATH_MSG_DEBUG("TGC RDO->PrepRawdata: " << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId)); + ATH_MSG_DEBUG("TGC RDO->PrepRawdata: " << m_idHelperSvc->tgcIdHelper().show_to_string(channelId)); std::vector<Identifier> identifierList; identifierList.push_back(channelId); @@ -568,10 +540,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat continue; } - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(channelId); - int channel = m_muonIdHelperTool->tgcIdHelper().channel(channelId); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(channelId); + int channel = m_idHelperSvc->tgcIdHelper().channel(channelId); double width = 0.; - if(!static_cast<bool>(m_muonIdHelperTool->tgcIdHelper().isStrip(channelId))) { // wire + if(!static_cast<bool>(m_idHelperSvc->tgcIdHelper().isStrip(channelId))) { // wire width = getWidthWire(descriptor, gasGap, channel); } else { // strip width = getWidthStrip(descriptor, gasGap, channel, channelId); @@ -601,7 +573,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHits(const TgcRdo::const_iterat // for All Bcs collectionAllBcs = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> - (elementId, m_tgcPrepDataContainer[NBC], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcPrepDataContainer[NBC], m_idHelperSvc->tgcIdHelper(), msg()); uint16_t bcBitMap = 0; if (locId == 0) bcBitMap = TgcPrepData::BCBIT_PREVIOUS; else if (locId == 1) bcBitMap = TgcPrepData::BCBIT_CURRENT; @@ -691,9 +663,9 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it //*** Get OfflineId of non-pivot plane (TGC2) end ***// IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelIdOut); - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelIdOut); + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -705,7 +677,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it ? 1 : (*itD)->bcTag()-1; TgcCoinDataCollection* coincollection = Muon::IDC_Helper::getCollection<TgcCoinDataContainer, TgcIdHelper> - (elementId, m_tgcCoinDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcCoinDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); int subMatrix = static_cast<int>((*itD)->subMatrix()); int trackletId = static_cast<int>(2*(*itD)->slbId()+subMatrix); @@ -723,12 +695,12 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it (subMatrix==(*it_tgcCoinData)->sub()) // subMatrix ) { ATH_MSG_DEBUG("Duplicated TgcCoinData (Tracklet) = " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdIn)); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdIn)); return StatusCode::SUCCESS; } } - ATH_MSG_DEBUG("TGC RDO->Coindata for LowPT: " << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdOut)); + ATH_MSG_DEBUG("TGC RDO->Coindata for LowPT: " << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdOut)); //*** Get geometry of pivot plane (TGC3) start ***// const MuonGM::TgcReadoutElement* descriptor_o = m_muonMgr->getTgcReadoutElement(channelIdOut); @@ -736,10 +708,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it return StatusCode::SUCCESS; } - int gasGap_o = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdOut); - int channel_o = m_muonIdHelperTool->tgcIdHelper().channel(channelIdOut); + int gasGap_o = m_idHelperSvc->tgcIdHelper().gasGap(channelIdOut); + int channel_o = m_idHelperSvc->tgcIdHelper().channel(channelIdOut); double width_o = 0.; - if(!(static_cast<bool> (m_muonIdHelperTool->tgcIdHelper().isStrip(channelIdOut)))) { // wire + if(!(static_cast<bool> (m_idHelperSvc->tgcIdHelper().isStrip(channelIdOut)))) { // wire width_o = getWidthWire(descriptor_o, gasGap_o, channel_o); } else { // strip width_o = getWidthStrip(descriptor_o, gasGap_o, channel_o, channelIdOut); @@ -764,10 +736,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it return StatusCode::SUCCESS; } - int gasGap_i = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdIn); - int channel_i = m_muonIdHelperTool->tgcIdHelper().channel(channelIdIn); + int gasGap_i = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn); + int channel_i = m_idHelperSvc->tgcIdHelper().channel(channelIdIn); double width_i = 0.; - if(!(static_cast<bool>(m_muonIdHelperTool->tgcIdHelper().isStrip(channelIdIn)))) { // wire + if(!(static_cast<bool>(m_idHelperSvc->tgcIdHelper().isStrip(channelIdIn)))) { // wire width_i = getWidthWire(descriptor_i, gasGap_i, channel_i); } else { // strip width_i = getWidthStrip(descriptor_i, gasGap_i, channel_i, channelIdIn); @@ -795,10 +767,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTracklet(const TgcRdo::const_it descriptor_o, // determined from channelIdOut TgcCoinData::TYPE_TRACKLET, ((*itD)->subDetectorId()==ASIDE), // isAside - static_cast<int>(m_muonIdHelperTool->tgcIdHelper().stationPhi(channelIdOut)), // phi + static_cast<int>(m_idHelperSvc->tgcIdHelper().stationPhi(channelIdOut)), // phi 0, // isInner ((*itD)->sswId()==7||(*itD)->sswId()==2), // isForward - static_cast<bool>(m_muonIdHelperTool->tgcIdHelper().isStrip(channelIdOut)), // isStrip + static_cast<bool>(m_idHelperSvc->tgcIdHelper().isStrip(channelIdOut)), // isStrip trackletId, // trackletId hitPosition_i, // determined from channelIdIn hitPosition_o, // determined from channelIdOut @@ -929,12 +901,12 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons } // Retrieve ElementID from OfflineID - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelIdIn); + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelIdIn); // Retrieve Hash from ElementID IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -948,7 +920,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons // Get corresponding collection TgcCoinDataCollection* coincollection = Muon::IDC_Helper::getCollection<TgcCoinDataContainer, TgcIdHelper> - (elementId, m_tgcCoinDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcCoinDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); // Check duplicate digits TgcCoinDataCollection::const_iterator it_tgcCoinData = coincollection->begin(); @@ -958,7 +930,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons (channelIdIn==(*it_tgcCoinData)->channelIdIn()) && // channelIdIn (static_cast<int>((*itD)->subMatrix())==(*it_tgcCoinData)->sub())) { // sub ATH_MSG_DEBUG("Duplicated TgcCoinData (TrackletEIFI) = " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdIn)); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdIn)); return StatusCode::SUCCESS; } } @@ -967,7 +939,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons const MuonGM::TgcReadoutElement* descriptor = m_muonMgr->getTgcReadoutElement(channelIdIn); if(!isOfflineIdOKForTgcReadoutElement(descriptor, channelIdIn)) { ATH_MSG_WARNING("Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI descriptor doesn't contain " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdIn)); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdIn)); return StatusCode::SUCCESS; } @@ -983,8 +955,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons // Get width from channelIdIn, one subMatrix covers 8 channels per gasGap double width = 0.; - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdIn); // 1 - int channel = m_muonIdHelperTool->tgcIdHelper().channel(channelIdIn); // 4, 12, 20, 28 + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn); // 1 + int channel = m_idHelperSvc->tgcIdHelper().channel(channelIdIn); // 4, 12, 20, 28 if(isStrip) { // Strip double localZ = (descriptor->transform(channelIdIn).inverse()*descriptor->channelPos(channelIdIn)).z(); double stripMaxX = descriptor->stripMaxX(gasGap, channel+4, localZ); @@ -1010,7 +982,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeTrackletEIFI(const TgcRdo::cons descriptor, // determined from channelIdIn TgcCoinData::TYPE_TRACKLET_EIFI, isAside, - m_muonIdHelperTool->tgcIdHelper().stationPhi(channelIdIn), + m_idHelperSvc->tgcIdHelper().stationPhi(channelIdIn), isForward, isStrip, hitPosition, // determined from channelIdIn @@ -1047,7 +1019,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat TgcCoinDataCollection* coincollection = 0; IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); int slbsubMatrix = 0; bool isBackward = isBackwardBW(itD); // Backward or Forward @@ -1134,10 +1106,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat //} //*** TGC1 end ***// - ATH_MSG_DEBUG("TGC RDO->Coindata for HIPT: " << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdOut[1])); + ATH_MSG_DEBUG("TGC RDO->Coindata for HIPT: " << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdOut[1])); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelIdOut[1]); - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelIdOut[1]); + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -1149,7 +1121,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat ? 1 : (*itD)->bcTag()-1; coincollection = Muon::IDC_Helper::getCollection<TgcCoinDataContainer, TgcIdHelper> - (elementId, m_tgcCoinDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcCoinDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); //*** TGC3 start ***// // Get geometry of pivot plane @@ -1162,8 +1134,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat } for(int i=0; i<2; i++) { - gasGap_o[i] = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdOut[i]); - channel_o[i] = m_muonIdHelperTool->tgcIdHelper().channel(channelIdOut[i]); + gasGap_o[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelIdOut[i]); + channel_o[i] = m_idHelperSvc->tgcIdHelper().channel(channelIdOut[i]); } if(!((*itD)->isStrip())) { // wire @@ -1205,8 +1177,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat } } for(int i=0; i<4; i++) { - gasGap_i[i] = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdIn[i]); - channel_i[i] = m_muonIdHelperTool->tgcIdHelper().channel(channelIdIn[i]); + gasGap_i[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn[i]); + channel_i[i] = m_idHelperSvc->tgcIdHelper().channel(channelIdIn[i]); } if(!(*itD)->isStrip()) { // WIRE @@ -1256,7 +1228,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat m_nHiPtRDOs--; // Reduce the number of input RDOs. } ATH_MSG_DEBUG("Duplicated TgcCoinData (HiPt) = " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelIdOut_tmp)); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelIdOut_tmp)); return StatusCode::SUCCESS; } } @@ -1273,7 +1245,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeHiPt(const TgcRdo::const_iterat descriptor_oo, // determined from channelIdOut_tmp TgcCoinData::TYPE_HIPT, // Coincidence type ((*itD)->subDetectorId()==ASIDE), // isAside - static_cast<int>(m_muonIdHelperTool->tgcIdHelper().stationPhi(channelIdOut_tmp)), // phi + static_cast<int>(m_idHelperSvc->tgcIdHelper().stationPhi(channelIdOut_tmp)), // phi 0, // isInner static_cast<bool>((*itD)->isForward()), // isForward static_cast<bool>((*itD)->isStrip()), // isStrip @@ -1316,7 +1288,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeInner(const TgcRdo::const_itera TgcCoinDataCollection* coincollection = 0; IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); Identifier channelIdIn; Identifier channelIdOut; @@ -1343,8 +1315,8 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeInner(const TgcRdo::const_itera int stationEta = isAside ? 1 : -1; int stationPhi = phi; - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(stationName, stationEta, stationPhi, true); - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(stationName, stationEta, stationPhi, true); + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -1353,7 +1325,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeInner(const TgcRdo::const_itera } coincollection = Muon::IDC_Helper::getCollection<TgcCoinDataContainer, TgcIdHelper> - (elementId, m_tgcCoinDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcCoinDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); ATH_MSG_DEBUG("Inner Data Word, phi: " << phi << " isAside: " << isAside << " isEndcap: " << isEndcap << " subDetectorId: " << subDetectorId << " isStrip: " << (*itD)->isStrip() @@ -1402,7 +1374,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator TgcCoinDataCollection* coincollection = 0; IdentifierHash tgcHashId; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); bool found = false; @@ -1440,10 +1412,10 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator return StatusCode::SUCCESS; } - ATH_MSG_DEBUG("TGC RDO->TgcCoindata(SL): " << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId_wire[1])); + ATH_MSG_DEBUG("TGC RDO->TgcCoindata(SL): " << m_idHelperSvc->tgcIdHelper().show_to_string(channelId_wire[1])); - Identifier elementId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId_wire[1]); - if(m_muonIdHelperTool->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { + Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId_wire[1]); + if(m_idHelperSvc->tgcIdHelper().get_hash(elementId, tgcHashId, &tgcContext)) { ATH_MSG_WARNING("Unable to get TGC hash id from TGC RDO collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() @@ -1455,7 +1427,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator ? 1 : (*itD)->bcTag()-1; coincollection = Muon::IDC_Helper::getCollection<TgcCoinDataContainer, TgcIdHelper> - (elementId, m_tgcCoinDataContainer[locId], m_muonIdHelperTool->tgcIdHelper(), msg()); + (elementId, m_tgcCoinDataContainer[locId], m_idHelperSvc->tgcIdHelper(), msg()); int trackletId = 2*sbLoc_w + subMatrix_w; int trackletIdStrip = 2*sbLoc_s + subMatrix_s; @@ -1478,7 +1450,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator (isPositiveDeltaR==(*it_tgcCoinData)->isPositiveDeltaR()) ) { ATH_MSG_DEBUG("Duplicated TgcCoinData (SL) = " - << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId_wire[2])); + << m_idHelperSvc->tgcIdHelper().show_to_string(channelId_wire[2])); return StatusCode::SUCCESS; } } @@ -1546,7 +1518,7 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::decodeSL(const TgcRdo::const_iterator descriptor_w2, // determined from channelId_wire[2] TgcCoinData::TYPE_SL, // Coincidence type static_cast<bool>((*itD)->subDetectorId()==ASIDE), // isAside - static_cast<int>(m_muonIdHelperTool->tgcIdHelper().stationPhi(channelId_wire[2])), // phi + static_cast<int>(m_idHelperSvc->tgcIdHelper().stationPhi(channelId_wire[2])), // phi static_cast<bool> ((*itD)->isForward()), // isForward trackletId, // trackletId trackletIdStrip, // trackletIdStrip @@ -1698,7 +1670,7 @@ bool Muon::TgcRdoToPrepDataToolCore::isOfflineIdOKForTgcReadoutElement(const Muo const Identifier channelId) { if(!descriptor || !descriptor->containsId(channelId)) { - ATH_MSG_DEBUG("Illegal OfflineID for TgcReadoutElement" << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId)); + ATH_MSG_DEBUG("Illegal OfflineID for TgcReadoutElement" << m_idHelperSvc->tgcIdHelper().show_to_string(channelId)); return false; } return true; @@ -1723,7 +1695,7 @@ void Muon::TgcRdoToPrepDataToolCore::showIdentifierHashVector(std::vector<Identi void Muon::TgcRdoToPrepDataToolCore::fillIdentifierHashVector(std::vector<IdentifierHash>& selectedIdHashVect) { // Fill the hashes with hits or coincidences - unsigned int HashId_max = m_muonIdHelperTool->tgcIdHelper().module_hash_max(); + unsigned int HashId_max = m_idHelperSvc->tgcIdHelper().module_hash_max(); for(unsigned int HashId=0; HashId<HashId_max; HashId++) { IdentifierHash offlineCollHash(static_cast<IdentifierHash>(HashId)); if(isIdentifierHashFoundInAnyTgcPrepDataContainer(offlineCollHash) || @@ -1740,7 +1712,7 @@ void Muon::TgcRdoToPrepDataToolCore::showIdentifierHash() { if(!(this->msgLvl(MSG::DEBUG))) return; unsigned int nc = 0; - unsigned int HashId_max = m_muonIdHelperTool->tgcIdHelper().module_hash_max(); + unsigned int HashId_max = m_idHelperSvc->tgcIdHelper().module_hash_max(); for(unsigned int HashId=0; HashId<HashId_max; HashId++) { nc++; IdentifierHash offlineCollHash(static_cast<IdentifierHash>(HashId)); @@ -2295,8 +2267,8 @@ bool Muon::TgcRdoToPrepDataToolCore::getSLWireGeometry(const Identifier* channel int gasGap_w[3] = {0, 0, 0}; int channel_w[3] = {0, 0, 0}; for(int i=0; i<3; i++) { - gasGap_w[i] = m_muonIdHelperTool->tgcIdHelper().gasGap(channelId_wire[i]); - channel_w[i] = m_muonIdHelperTool->tgcIdHelper().channel(channelId_wire[i]); + gasGap_w[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_wire[i]); + channel_w[i] = m_idHelperSvc->tgcIdHelper().channel(channelId_wire[i]); } double tmp_r_w[3] = {0., 0., 0.}; double tmp_phi_w[3] = {0., 0., 0.}; @@ -2368,8 +2340,8 @@ bool Muon::TgcRdoToPrepDataToolCore::getSLStripGeometry(const Identifier* channe int gasGap_s[3] = {0, 0, 0}; int channel_s[3] = {0, 0, 0}; for(int i=0; i<3; i++) { - gasGap_s[i] = m_muonIdHelperTool->tgcIdHelper().gasGap(channelId_strip[i]); - channel_s[i] = m_muonIdHelperTool->tgcIdHelper().channel(channelId_strip[i]); + gasGap_s[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_strip[i]); + channel_s[i] = m_idHelperSvc->tgcIdHelper().channel(channelId_strip[i]); } Amg::Vector3D localPos[3]; @@ -2605,8 +2577,8 @@ bool Muon::TgcRdoToPrepDataToolCore::getPosAndIdWireIn(const MuonGM::TgcReadoutE return false; } - int gasGap_tmp = m_muonIdHelperTool->tgcIdHelper().gasGap(channelIdIn_tmp); - int channel_tmp = m_muonIdHelperTool->tgcIdHelper().channel(channelIdIn_tmp); + int gasGap_tmp = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn_tmp); + int channel_tmp = m_idHelperSvc->tgcIdHelper().channel(channelIdIn_tmp); double half_width = getWidthWire(descriptor_iw, gasGap_tmp, channel_tmp)/2.; if(half_width<s_cutDropPrdsWithZeroWidth/2. && m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are dropped. return false; @@ -3190,16 +3162,16 @@ StatusCode Muon::TgcRdoToPrepDataToolCore::getCabling() { } // check the relation between hash and onlineId (onlineId depends on cabling) - unsigned int hashId_max = m_muonIdHelperTool->tgcIdHelper().module_hash_max(); + unsigned int hashId_max = m_idHelperSvc->tgcIdHelper().module_hash_max(); m_hashToOnlineId.reserve(hashId_max); - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); // TGC context + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); // TGC context Identifier elementId; int subDetectorId = 0; // 103(=0x67) for A side, 104(=0x68) for C side int rodId = 0; // 1 to 12 (12-fold cabling), 0 to 7 (8-fold cabling) TgcRdo tgcRdo; // For onlineId conversion for(unsigned int hashId=0; hashId<hashId_max; hashId++) { IdentifierHash hash(hashId); - m_muonIdHelperTool->tgcIdHelper().get_id(hash, elementId, &tgcContext); + m_idHelperSvc->tgcIdHelper().get_id(hash, elementId, &tgcContext); m_tgcCabling->getReadoutIDfromElementID(elementId, subDetectorId, rodId); // onlineId: 0 to 11 on A side and 12 to 23 on C side (12-fold cabling) // 0 to 7 on A side and 8 to 15 on C side (8-fold cabling) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h index 7b420bcdb74509cc11b62e5cc8bcac0f62dc8257..cebc7c625133bd023b41a4106dcafff759933c7d 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolCore.h @@ -1,31 +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 */ -/////////////////////////////////////////////////////////////////// -// TgcRdoToPrepDataToolCore.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef MUONTGC_CNVTOOLS_TGCRDOTOPREPDATATOOLCORE_H #define MUONTGC_CNVTOOLS_TGCRDOTOPREPDATATOOLCORE_H -#include <string> - -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonRDO/TgcRdo.h" #include "MuonTrigCoinData/TgcCoinDataContainer.h" - #include "MuonRDO/TgcRdoContainer.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "TGCcablingInterface/ITGCcablingSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class AtlasDetectorID; -class Identifier; - -class ITGCcablingSvc; +#include <string> namespace MuonGM { @@ -53,7 +44,7 @@ namespace Muon TgcRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcRdoToPrepDataToolCore(); + virtual ~TgcRdoToPrepDataToolCore()=default; /** Query the IMuonRdoToPrepDataTool interface */ virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; @@ -312,11 +303,9 @@ namespace Muon const Amg::Vector2D* getSLLocalPosition(const MuonGM::TgcReadoutElement* readout, const Identifier, const double eta, const double phi) const; /** muon detector manager */ - const MuonGM::MuonDetectorManager * m_muonMgr; + const MuonGM::MuonDetectorManager* m_muonMgr; - /** Tool for TGC identifier helper */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /* TGC Cabling service */ const ITGCcablingSvc* m_tgcCabling; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx index d8f629fbe5c2b8971b6d3e4a194a31e635f74ebf..b36db087959922e7080f1f1217bf688bf04cdffc 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx @@ -1,27 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// TGC_CnvTool.cxx, (c) ATLAS Detector software -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #include "TgcRdoToPrepDataToolMT.h" #include "MuonDigitContainer/TgcDigit.h" #include "MuonTrigCoinData/TgcCoinData.h" - Muon::TgcRdoToPrepDataToolMT::TgcRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), TgcRdoToPrepDataToolCore(t, n, p) { } -Muon::TgcRdoToPrepDataToolMT::~TgcRdoToPrepDataToolMT() -{ -} - StatusCode Muon::TgcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -30,11 +21,6 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::TgcRdoToPrepDataToolMT::finalize() -{ - return TgcRdoToPrepDataToolCore::finalize(); -} - StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& requestedIdHashVect, std::vector<IdentifierHash>& selectedIdHashVect) { @@ -61,7 +47,7 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& req SG::WriteHandle<TgcPrepDataContainer> handle(m_outputprepdataKeys[ibc]); // record the container in storeGate - handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max())); // cache the pointer, storegate retains ownership m_tgcPrepDataContainer[ibc] = handle.ptr(); if(!handle.isValid()) { @@ -82,13 +68,7 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& req bool nothingToDoForAllBC = true; for(int ibc=0; ibc<NBC; ibc++) { if(!nothingToDo[ibc]) nothingToDoForAllBC = false; - } - - /*if(nothingToDoForAllBC) { - ATH_MSG_DEBUG("Whole events at all " << NBC << " BCs have already been decoded; nothing to do"); - return StatusCode::SUCCESS; - }*/ - + } /// clean up containers for Coincidence for(int ibc=0; ibc<NBC; ibc++) { @@ -96,7 +76,7 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& req SG::WriteHandle<TgcCoinDataContainer> handle(m_outputCoinKeys[ibc]); // record the container in storeGate - handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max())); // cache the pointer, storegate retains ownership m_tgcCoinDataContainer[ibc] = handle.ptr(); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h index ef08a36cd1df8a1677fe53478c7277665f62e6f2..a4ff379ab83d436f1df00ba066196593f0c30db5 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h @@ -29,12 +29,10 @@ namespace Muon TgcRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcRdoToPrepDataToolMT(); + virtual ~TgcRdoToPrepDataToolMT()=default; /** Standard AthAlgTool initialize method */ virtual StatusCode initialize() override; - /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize() override; using TgcRdoToPrepDataToolCore::decode; // To prevent the decode below from hiding the superclass decode methods virtual StatusCode decode(std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& idWithDataVect) override; diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TSOS.h b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TSOS.h index 0ae0fb273075b9568d19d52be1a8e1ac8f2b0782..6f2d99ef53cd9c7758ff13bd6cbc244f94fda4e7 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TSOS.h +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/AscObj_TSOS.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 */ @@ -20,12 +20,9 @@ #include "VP1TrackSystems/AssociatedObjectHandleBase.h" #include "VP1TrackSystems/TrackCommonFlags.h" -#include "VP1TrackSystems/MeasurementToSoNode.h" #include "VP1TrackSystems/TrkObjToString.h" #include "TrkParameters/TrackParameters.h" -// Eigen migration -//#include "TrkEventPrimitives/GlobalPosition.h" #include "GeoPrimitives/GeoPrimitives.h" #include <QTreeWidgetItem> @@ -110,7 +107,6 @@ private: void ensureInitSeps( SoSeparator*&shape_simple, SoSeparator*&shape_detailed); SoTranslation* getZTranslationTube( const Trk::Surface *, const double& maxTrans ) const; - Trk::MeasurementToSoNode m_measCnv; TrkObjToString m_objToType; HitToSoNode m_hitToSoNode; }; diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/MeasurementToSoNode.h b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/MeasurementToSoNode.h deleted file mode 100644 index 7f94a4a5c21cc589e172adfe2aef03cda4b1c1ae..0000000000000000000000000000000000000000 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/MeasurementToSoNode.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRK_VP1TRACKSYSTEMS_MEASUREMENTTOSONODE_H -#define TRK_VP1TRACKSYSTEMS_MEASUREMENTTOSONODE_H -#include <vector> -#include <map> -#include <string> -#include "Identifier/Identifier.h" -#include "VP1Utils/HitsSoNodeManager.h" -#include "VP1TrackSystems/TrkObjToString.h" - -class SoNode; -class SoCube; -class SoTubs; -class SoSeparator; -class SoTransform; -class SoMaterial; -class CscIdHelper; -class RpcIdHelper; -class TgcIdHelper; -class MdtIdHelper; - -namespace Muon { - class CscPrepData; - class RpcPrepData; - class TgcPrepData; - class MdtPrepData; - class MuonIdHelperTool; -} - -namespace InDet { - class PixelCluster; - class SCT_Cluster; - class TRT_DriftCircle; -} - -namespace InDetDD { - class SiDetectorElement; -} - -namespace MuonGM { - class CscReadoutElement; - class RpcReadoutElement; - class TgcReadoutElement; - class MdtReadoutElement; -} - -namespace Trk { -// class LocalPosition; - class TrkDetElementBase; - class PrepRawData; - class RIO_OnTrack; - class CompetingRIOsOnTrack; - class PseudoMeasurementOnTrack; - class MeasurementBase; - - class MeasurementToSoNode { - public: - - enum ClusterDrawMode { SingleStrip=0, MultipleStrips=1, Errors=2 }; - enum DriftTubeDrawMode { ShortLength=0, FullLength=1 }; - - MeasurementToSoNode(); - - void initialize( const Muon::MuonIdHelperTool* muonIdHelperTool ); - - /** This is the most general and most complete method - it returns a separator with nodes and transform. The material is not - added here as it should be at the top of the tree (in general) */ - std::pair<SoSeparator*, std::vector<SoNode*> > \ - createMeasSep( const Trk::MeasurementBase& meas); - - /** Returns a vector of SoNodes to represent the RIO_OnTrack. The cluster mode determines how the clusters are drawn - - i.e. as single central strip or the strips contributing to the cluster*/ - std::vector<SoNode*> toSoNodes( const Trk::RIO_OnTrack& prd); - - std::vector<SoNode*> toSoNodes( const Trk::CompetingRIOsOnTrack& crot); - - std::vector<SoNode*> toSoNodes( const Trk::PseudoMeasurementOnTrack& crot); - - // create basic shapes - SoNode* createDriftTubeMarker( double halfLength, double radius); - SoNode* createProjectedDriftTubeMarker( double strawLength, double radius ); - - // SoNode* createPointMarker(); - SoNode* createLineMarker(double halfLength, bool isTube=false ); - - /** Generic routine which creates SoNode from passed detector element, plus measurement type*/ - SoNode* toSoNode(const Trk::TrkDetElementBase* baseDetEl, Identifier id, TrkObjToString::MeasurementType prdType, Amg::Vector2D locPos); - - /** handles both drift circle types*/ - SoNode* toSoNodeDriftTube(const Trk::TrkDetElementBase* detEl, Identifier id, TrkObjToString::MeasurementType detType, double radius); - - //specific types - SoNode* toSoNode(const InDetDD::SiDetectorElement* detElement, Identifier id, TrkObjToString::MeasurementType detType, Amg::Vector2D& locPos); - SoNode* toSoNode(const MuonGM::CscReadoutElement* detElement, Identifier id); - SoNode* toSoNode(const MuonGM::RpcReadoutElement* detElement, Identifier id); - SoNode* toSoNode(const MuonGM::TgcReadoutElement* detElement, Identifier id); - - void setClusterDrawMode (ClusterDrawMode mode); - ClusterDrawMode clusterDrawMode (); - void setDriftTubeDrawMode (DriftTubeDrawMode mode); - void setDriftTubeLength (float length); - DriftTubeDrawMode driftTubeDrawMode (); - void setSimpleView( TrkObjToString::MeasurementType type, bool value ); - void setSimpleViewAll( bool value ); - bool isSimpleView( TrkObjToString::MeasurementType type ); - - void setTRTProjection( bool ); - bool isTRTProjection() const; - - /** Uses the local coords & the surface of the passed PRD to create a transform for the strip*/ - // SoTransform* createTransform( const Trk::PrepRawData& prd, - // MeasurementType detType); - - /** Uses the local coords & the surface of the passed Trk::MeasurementBase to create a transform for the strip*/ - SoTransform* createTransform( const Trk::MeasurementBase& rot, - TrkObjToString::MeasurementType detType); - - private: - std::vector<bool> m_simpleView; - bool m_trtProjection; - const Muon::MuonIdHelperTool* m_muonIdHelperTool = nullptr; - double m_stripThickness; //!< Depth/Thickness of strips in z (local coords) - std::vector< SoMaterial* > m_materials; - - DriftTubeDrawMode m_dtDrawMode; - ClusterDrawMode m_clusDrawMode; - float m_dtLength; //!< Only used when in ShortMode - - HitsSoNodeManager m_nodeManager; - TrkObjToString m_objToType; - }; -} - -inline void -Trk::MeasurementToSoNode::setClusterDrawMode(Trk::MeasurementToSoNode::ClusterDrawMode mode) -{ - m_clusDrawMode=mode; -} - -inline void -Trk::MeasurementToSoNode::setDriftTubeDrawMode(Trk::MeasurementToSoNode::DriftTubeDrawMode mode) -{ - m_dtDrawMode=mode; -} - -inline void -Trk::MeasurementToSoNode::setDriftTubeLength (float length) -{ - m_dtLength=length; -} - -inline Trk::MeasurementToSoNode::ClusterDrawMode -Trk::MeasurementToSoNode::clusterDrawMode() -{ - return m_clusDrawMode; -} - -inline Trk::MeasurementToSoNode::DriftTubeDrawMode -Trk::MeasurementToSoNode::driftTubeDrawMode() -{ - return m_dtDrawMode; -} - -inline void -Trk::MeasurementToSoNode::setSimpleView(TrkObjToString::MeasurementType type, bool value) -{ - m_simpleView[type]=value; -} - - -inline void -Trk::MeasurementToSoNode::setTRTProjection( bool b ) -{ - m_trtProjection = b; -} - -inline bool -Trk::MeasurementToSoNode::isTRTProjection() const -{ - return m_trtProjection; -} - -inline void -Trk::MeasurementToSoNode::setSimpleViewAll( bool value) -{ - unsigned int end = static_cast<TrkObjToString::MeasurementType>(TrkObjToString::Unknown); - for (unsigned int i=0; i<end; ++i) m_simpleView[i]=value; -} - -inline bool -Trk::MeasurementToSoNode::isSimpleView(TrkObjToString::MeasurementType type) -{ - return m_simpleView[type]; -} - - -#endif - diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TrkTrack.h b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TrkTrack.h index 1d4ffb9b82b0292d8951024849abb56caea123d5..5cf284ee68524fb4bd312a0a19b27be0756c0eed 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TrkTrack.h +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/VP1TrackSystems/TrackHandle_TrkTrack.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 */ @@ -18,7 +18,6 @@ #define TRACKHANDLE_TRKTRACK_H #include "VP1TrackSystems/TrackHandleBase.h" -#include "VP1TrackSystems/MeasurementToSoNode.h" #include "GeoPrimitives/GeoPrimitives.h" @@ -78,7 +77,6 @@ private: protected: const Trk::Track* m_trk; - Trk::MeasurementToSoNode m_measToSoNode; //!< Just used to get types, so probably better to hive that functionality off. @FIXME }; #endif diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/MeasurementToSoNode.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/MeasurementToSoNode.cxx deleted file mode 100644 index 74f966ec1a033049284107b818c320106398ec1a..0000000000000000000000000000000000000000 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/MeasurementToSoNode.cxx +++ /dev/null @@ -1,530 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "VP1TrackSystems/MeasurementToSoNode.h" - -#include <Inventor/C/errors/debugerror.h> -#include <Inventor/nodes/SoSeparator.h> -#include <Inventor/nodes/SoTransform.h> -#include <Inventor/nodes/SoSphere.h> -#include "VP1HEPVis/nodes/SoTubs.h" -#include "VP1HEPVis/nodes/SoGenericBox.h" -#include <Inventor/nodes/SoPointSet.h> -#include <Inventor/nodes/SoLineSet.h> -#include <Inventor/nodes/SoCylinder.h> -#include <Inventor/nodes/SoRotationXYZ.h> - -#include "VP1Utils/VP1LinAlgUtils.h" -#include "VP1Utils/HitsSoNodeManager.h" -#include "VP1Base/VP1Msg.h" - - - -// Amg Eigen objects -#include "GeoPrimitives/GeoPrimitives.h" - -//MeasurementBase -#include "TrkMeasurementBase/MeasurementBase.h" - -//ROTs -#include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "InDetRIO_OnTrack/PixelClusterOnTrack.h" -#include "InDetRIO_OnTrack/SCT_ClusterOnTrack.h" -#include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h" -#include "InDetRIO_OnTrack/SiClusterOnTrack.h" -#include "MuonRIO_OnTrack/MuonClusterOnTrack.h" -#include "MuonRIO_OnTrack/CscClusterOnTrack.h" -#include "MuonRIO_OnTrack/RpcClusterOnTrack.h" -#include "MuonRIO_OnTrack/TgcClusterOnTrack.h" -#include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" - -//CompetingROTs -#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" - -//Pseudo Measurements -#include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" - -//Segments -#include "TrkSegment/Segment.h" - -// PRDs -#include "InDetPrepRawData/PixelCluster.h" -#include "InDetPrepRawData/SCT_Cluster.h" -#include "InDetPrepRawData/TRT_DriftCircle.h" -#include "MuonPrepRawData/CscPrepData.h" -#include "MuonPrepRawData/RpcPrepData.h" -#include "MuonPrepRawData/TgcPrepData.h" -#include "MuonPrepRawData/MdtPrepData.h" - -//IdHelpers -#include "MuonIdHelpers/MuonIdHelperTool.h" - -Trk::MeasurementToSoNode::MeasurementToSoNode() - : - m_trtProjection(false), - m_stripThickness(0.8), - m_dtDrawMode(Trk::MeasurementToSoNode::ShortLength), - m_clusDrawMode(Trk::MeasurementToSoNode::SingleStrip), - m_dtLength(10.0) -{ - SoTubs::initClass(); - SoGenericBox::initClass(); - // Have simple view on by default - for (int i=0; i<TrkObjToString::Unknown ; i++) m_simpleView.push_back(true); -} - -void -Trk::MeasurementToSoNode::initialize( const Muon::MuonIdHelperTool* muonIdHelperTool ) -{ - m_muonIdHelperTool=muonIdHelperTool; -} - -std::pair<SoSeparator*, std::vector<SoNode*> > -Trk::MeasurementToSoNode::createMeasSep( const Trk::MeasurementBase& meas) -{ - - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::createMeasSep()"); - - // Vector to hold all the nodes associated with this measurement - std::vector<SoNode*> measurements; - SoTransform* theHitTransform=0; - TrkObjToString::MeasurementType detType = m_objToType.type(&meas); - // Find the correct type and call that method. - - switch (detType) - { - case TrkObjToString::Pixel: - case TrkObjToString::SCT: - case TrkObjToString::TRT: - case TrkObjToString::CSC: - case TrkObjToString::TGC: - case TrkObjToString::RPC: - case TrkObjToString::MDT: - { - const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(&meas); - if (rot){ - measurements = toSoNodes( *rot ); - theHitTransform=createTransform(*rot, detType); - } - break; - } - case TrkObjToString::CompetingROT: - { - const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(&meas); - if (crot){ - measurements = toSoNodes(*crot); - const Trk::RIO_OnTrack* mostProbROT = &(crot->rioOnTrack( crot->indexOfMaxAssignProb ())); - theHitTransform=createTransform( static_cast<const Trk::MeasurementBase&>(*mostProbROT), TrkObjToString::type( mostProbROT )); - } - break; - } - case TrkObjToString::PseudoMeasurement: - { - const Trk::PseudoMeasurementOnTrack* pseudo = dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(&meas) ; - if (pseudo){ - measurements = toSoNodes(*pseudo); - theHitTransform=createTransform( *pseudo, detType); - } - break; - } - case TrkObjToString::Segment: - case TrkObjToString::Hole: - case TrkObjToString::Unknown: - { - std::cerr<< "MeasurementToSoNode::createMeasSep: WARNING - Unknown detector type!"<<std::endl; - std::cerr<<" Dumping MeasurementBase: "<<meas<<std::endl; - } - - } - // Add all the above to the separator - SoSeparator *theHitMarkerSep = new SoSeparator; - theHitMarkerSep->addChild(theHitTransform); - - std::vector<SoNode*>::const_iterator it, itEnd=measurements.end(); - for ( it = measurements.begin(); it!=itEnd; it++) - { - theHitMarkerSep->addChild(*it); - } - //std::cout<<"MeasurementToSoNode::createMeasSep - done"<<std::endl; - - return std::make_pair(theHitMarkerSep, measurements); -} - -std::vector<SoNode*> -Trk::MeasurementToSoNode::toSoNodes(const Trk::RIO_OnTrack& rot) -{ - //std::cout<<"toSoNodes"<<std::endl; - - //TODO Implement modes properly - std::vector<SoNode*> nodes ; - switch (m_clusDrawMode) - { - case SingleStrip: - case MultipleStrips: - case Errors: - { - double coord1 = rot.localParameters().get(Trk::loc1); - double coord2 = 0.0; - if (rot.localParameters().dimension()>1) coord2 = rot.localParameters().get(Trk::loc2); -// nodes.push_back( toSoNode(rot.detectorElement(), rot.identify(), m_objToType.type(&rot), Trk::LocalPosition(coord1,coord2) ) ); - nodes.push_back( toSoNode(rot.detectorElement(), rot.identify(), m_objToType.type(&rot), Amg::Vector2D(coord1,coord2) ) ); - break; - } - default: - break; - } - return nodes; -} - -std::vector<SoNode*> -Trk::MeasurementToSoNode::toSoNodes(const Trk::CompetingRIOsOnTrack& crot) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::CompetingRIOsOnTrack()"); - - // - // ++++++++++++++++++++++ TO DO! +++++++++++++++++++++++++ - // - const Trk::RIO_OnTrack* mostProbROT = &(crot.rioOnTrack( crot.indexOfMaxAssignProb ())); - std::vector<SoNode*> nodes = toSoNodes( *mostProbROT ); // Temporary hack - should draw all competing ROTs and show them linked somehow. - return nodes; -} - -std::vector<SoNode*> -Trk::MeasurementToSoNode::toSoNodes(const Trk::PseudoMeasurementOnTrack& /*rot*/) -{ - // - // ++++++++++++++++++++++ TO DO! +++++++++++++++++++++++++ - // - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::PseudoMeasurementOnTrack()"); - - std::vector<SoNode*> nodes ; - nodes.push_back( m_nodeManager.getShapeNode_Strip(10.0, 10.0, 10.0) ); - return nodes; -} - -SoNode* -Trk::MeasurementToSoNode::toSoNode(const Trk::TrkDetElementBase* baseDetEl, Identifier id, TrkObjToString::MeasurementType prdType, Amg::Vector2D locPos) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNode(Trk)"); - - SoNode *theHitMarker = 0; - switch (prdType) - { - case TrkObjToString::Pixel: - case TrkObjToString::SCT: - { - const InDetDD::SiDetectorElement* detEl = dynamic_cast<const InDetDD::SiDetectorElement*>(baseDetEl); - if(detEl){ // by definition this should never fail - theHitMarker = toSoNode(detEl, id, prdType, locPos); - } - break; - } - case TrkObjToString::MDT: - case TrkObjToString::TRT: - { - theHitMarker = toSoNodeDriftTube(baseDetEl, id, prdType, locPos[0]); - break; - } - case TrkObjToString::CSC: - { - const MuonGM::CscReadoutElement* detEl = dynamic_cast<const MuonGM::CscReadoutElement*>(baseDetEl); - if(detEl){ // by definition this should never fail - theHitMarker=toSoNode( detEl, id ); - } - break; - } - case TrkObjToString::RPC: - { - const MuonGM::RpcReadoutElement* detEl = dynamic_cast<const MuonGM::RpcReadoutElement*>(baseDetEl); - if(detEl){ // by definition this should never fail - theHitMarker=toSoNode( detEl, id ); - } - break; - } - case TrkObjToString::TGC: - { - const MuonGM::TgcReadoutElement* detEl = dynamic_cast<const MuonGM::TgcReadoutElement*>(baseDetEl); - if(detEl){ // by definition this should never fail - theHitMarker=toSoNode( detEl, id ); - } - break; - } - - default: - //message( "Specific Hit type could not be identified."); - theHitMarker = m_nodeManager.getShapeNode_Strip(10.0, 10.0, 10.0); - break; - } - return theHitMarker; -} - - -SoNode* -Trk::MeasurementToSoNode::toSoNode( const InDetDD::SiDetectorElement* detEl, Identifier /*id*/, TrkObjToString::MeasurementType detType, Amg::Vector2D& locPos) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNode(InDetDD)"); - - SoNode *theHitMarker = 0; - if ( isSimpleView(TrkObjToString::Pixel) && detType==TrkObjToString::Pixel) - { - // theHitMarker = createPointMarker(); // Simple Pixel - theHitMarker = m_nodeManager.getShapeNode_Point(); // Simple Pixel - } - else - { - - double stripLength=detEl->etaPitch() ; - if (isSimpleView(TrkObjToString::SCT) && detType==TrkObjToString::SCT) - { - theHitMarker = createLineMarker(stripLength/2.0); // Simple SCT - } - else - { - double stripWidth=detEl->phiPitch( locPos ); - theHitMarker = m_nodeManager.getShapeNode_Strip(stripLength, stripWidth, m_stripThickness); // Detailed SCT/Pixel - } - } - return theHitMarker; -} - - -SoNode* -Trk::MeasurementToSoNode::toSoNodeDriftTube(const Trk::TrkDetElementBase* detEl, Identifier id, TrkObjToString::MeasurementType detType, double radius) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNodeDriftTube(Trk)"); - - //////std::cout<<"Drift tube : isSimpleView = "<<isSimpleView(type)<<std::endl; - SoNode *theHitMarker = 0; - const Trk::CylinderBounds* ccbo = dynamic_cast<const Trk::CylinderBounds*>(&(detEl->surface(id).bounds())); - if (not ccbo) return theHitMarker; - - double hlength = ccbo->halflengthZ(); // the halflength of the actual tube - - if (m_dtDrawMode==ShortLength && m_dtLength < hlength){ - hlength = m_dtLength; - } - - if ( m_trtProjection && detType==TrkObjToString::TRT ) { - theHitMarker = createProjectedDriftTubeMarker(hlength, true); - } else if ( isSimpleView(detType) ) - { - theHitMarker = createLineMarker(hlength, true); - } - else - { - //TKP1 if (detType==Trk::MeasurementToSoNode::TRT) radius = 1.999;//CLHEP::mm - //TKP1 else if (fabs(radius)<5.0) radius = 5.0; - theHitMarker = createDriftTubeMarker(hlength, radius); - } - return theHitMarker; -} - -SoNode* -Trk::MeasurementToSoNode::toSoNode(const MuonGM::CscReadoutElement* detEl, Identifier id) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNode(MuonGM::CscReadoutElement)"); - - SoNode *theHitMarker = 0; - int measPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi( id ); - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer( id ); - double stripWidth=detEl->cathodeReadoutPitch(chamberLayer, measPhi) ; - double stripLength=detEl->stripLength( id ); - if ( isSimpleView(TrkObjToString::CSC) ) - { - theHitMarker = createLineMarker(stripLength/2.0); - } - else - { - theHitMarker = m_nodeManager.getShapeNode_Strip(stripLength, stripWidth, m_stripThickness); - } - return theHitMarker; -} - -SoNode* -Trk::MeasurementToSoNode::toSoNode(const MuonGM::RpcReadoutElement* detEl, Identifier id) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNode(MuonGM::RpcReadoutElement)"); - - SoNode *theHitMarker = 0; - int measPhi = m_muonIdHelperTool->rpcIdHelper().measuresPhi( id ); - double stripWidth=detEl->StripWidth(measPhi) ; - double stripLength=detEl->StripLength(measPhi) ; - //////std::cout<<"RPC measPhi: "<< measPhi<<std::endl; - - if ( isSimpleView(TrkObjToString::RPC) ) - { - theHitMarker = createLineMarker(stripLength/2.0); - } - else - { - theHitMarker = m_nodeManager.getShapeNode_Strip(stripLength, stripWidth, m_stripThickness); - } - return theHitMarker; -} - -SoNode* -Trk::MeasurementToSoNode::toSoNode(const MuonGM::TgcReadoutElement* detEl, Identifier id) -{ - VP1Msg::messageVerbose("Trk::MeasurementToSoNode::toSoNode(MuonGM::TgcReadoutElement)"); - - SoNode *theHitMarker = 0; - int plane = m_muonIdHelperTool->tgcIdHelper().gasGap( id ); - int strip = m_muonIdHelperTool->tgcIdHelper().channel( id ); - int isStrip = m_muonIdHelperTool->tgcIdHelper().isStrip( id ); - - double striplength =0.0, stripWidth = 0.0; - - if (isStrip){ - striplength = detEl->stripLength(plane, strip); - stripWidth = detEl->stripWidth(plane, strip); - } else { - striplength = detEl->gangShortWidth(plane, strip); - stripWidth = detEl->gangLength(plane, strip); - } - - if ( isSimpleView(TrkObjToString::TGC) ) - { - theHitMarker = createLineMarker(striplength/2.0); - } - else - { - theHitMarker = m_nodeManager.getShapeNode_Strip(striplength, stripWidth, m_stripThickness); - } - return theHitMarker; -} - -SoNode* -Trk::MeasurementToSoNode::createLineMarker( double halfLength, bool isTube ) -{ - //////std::cout<<"createLineMarker. halfLength="<<halfLength<<std::endl; - SoVertexProperty * scatVtxProperty = new SoVertexProperty(); - if (isTube) - { - scatVtxProperty->vertex.set1Value(0, 0.0,0.0,-halfLength); - scatVtxProperty->vertex.set1Value(1, 0.0,0.0, halfLength); - } - else - { - scatVtxProperty->vertex.set1Value(0, 0.0,-halfLength,0.0); - scatVtxProperty->vertex.set1Value(1, 0.0,halfLength,0.0); - } - SoLineSet * line = new SoLineSet(); - line->numVertices = 2; - line->vertexProperty = scatVtxProperty; - return line; -} - -SoNode* -Trk::MeasurementToSoNode::createDriftTubeMarker(double halfLength, double radius) -{ - //Fixme: Use SoCylinder instead!!! - SoTubs* tubeSurface = new SoTubs(); -// (*lineSurface).pRMin = fabs(radius)-0.2; - (*tubeSurface).pRMin = 0.0; - - (*tubeSurface).pRMax = std::max(float(fabs(radius)),0.05f);//min 50 micron (fixme: use line/point instead) - (*tubeSurface).pDz = halfLength; - //////std::cout<<"createDriftTubeMarker: done"<<std::endl; - return tubeSurface; -} - - -SoNode* -Trk::MeasurementToSoNode::createProjectedDriftTubeMarker(double strawLength, double /*radius*/) -{ - //Fix to put the hits from short barrel straws onto same z as the long barrel straws: - if (strawLength<160.0) - strawLength = 2*349.3150-strawLength;//Yeah, we hardcode a lot here... but dimensions of TRT barrel straws are not likely to change. - -// SoSeparator * sep = new SoSeparator; - -// SoDrawStyle * ds = new SoDrawStyle; -// ds->pointSize.setValue(2.0f); -// sep->addChild(ds); - - SoPointSet * scatPointSet = new SoPointSet; - SoVertexProperty * scatVtxProperty = new SoVertexProperty; - scatVtxProperty->vertex.set1Value(0,0.0f,0.0f,strawLength); - scatPointSet->numPoints=1; - scatPointSet->vertexProperty.setValue(scatVtxProperty); - return scatPointSet; - -// sep->addChild(scatPointSet); -// return sep; -} - - - -SoTransform* -Trk::MeasurementToSoNode::createTransform( const Trk::MeasurementBase& mb, TrkObjToString::MeasurementType detType) -{ - const Trk::Surface& theSurface = mb.associatedSurface(); - - // We need to handle various cases: - // -> full tubes - use the surface position (or equivalent, global position of straw) - // -> short tubes/strips - use the global position of the ROT (but this is now done inside AscoObj_TSOS) - // -> long strips - use the global position of centre of strip. - - SoTransform* theHitTransform = VP1LinAlgUtils::toSoTransform(theSurface.transform()); - - Amg::Vector3D theHitGPos={-999.0,-999.0,-999.0} ; - // Amg::Vector3D theHitGPos = mb.globalPosition(); - if ( detType==TrkObjToString::MDT || detType==TrkObjToString::TRT ) - { - // for tubes, should use position of center of tube (if drawing full tube), or position of ROT for short tubes - if (m_dtDrawMode==FullLength) - theHitGPos = theSurface.center(); - else - theHitGPos = mb.globalPosition(); - } else { - // so, strips - switch (detType) { - case TrkObjToString::CSC: - { - const Muon::CscClusterOnTrack* csc = dynamic_cast<const Muon::CscClusterOnTrack* >(&mb); - if (csc){ - theHitGPos = csc->detectorElement()->stripPos( csc->identify() ); - } - break; - } - case TrkObjToString::TGC: - { - const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack* >(&mb); - if (tgc && tgc->detectorElement()){ - theHitGPos = tgc->detectorElement()->channelPos( tgc->identify() ); - } - break; - } - case TrkObjToString::RPC: - { - const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack* >(&mb); - if (rpc){ - theHitGPos = rpc->detectorElement()->stripPos( rpc->identify() ); - } - break; - } - case TrkObjToString::SCT: - case TrkObjToString::Pixel: - - { // For strips we should use the centre of the strip - this is a bit of a hack - should use detector elements (add above) - const Amg::Vector3D* tempHitGPos = theSurface.localToGlobal( mb.localParameters() ); - theHitGPos=*tempHitGPos; - delete tempHitGPos; - break; - } - //case TrkObjToString::MDT: can't reach here - //case TrkObjToString::TRT: can't reach here - default: - // shouldn't ever get in here! - // initializations to avoid warnings - theHitGPos[0]=-999.; - theHitGPos[1]=-999.; - theHitGPos[2]=-999.; - break; - } - } - - theHitTransform->translation.setValue(theHitGPos[0], theHitGPos[1], theHitGPos[2]); - return theHitTransform; -}