From 76d94e61d73619017a9ae260a42b7e250d8a8140 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Wed, 27 Jan 2021 15:03:20 -0500 Subject: [PATCH 1/3] MuonMDT_CnvTools: const fixes. Make interface of MsgCsmContByteStreamTool const. Remove duplicate declaration of IMDT_RDOtoByteStreamTool. --- .../MuonCnv/MuonMDT_CnvTools/CMakeLists.txt | 4 +-- .../IMDT_RDOtoByteStreamTool.h | 35 ++---------------- .../MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx | 10 +++--- .../MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h | 10 +++--- .../src/MdtCsmContByteStreamTool.cxx | 36 +++++++++---------- .../src/MdtCsmContByteStreamTool.h | 27 +++++++------- 6 files changed, 43 insertions(+), 79 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/CMakeLists.txt index b93dfe777b3a..abc4c57d336e 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # Declare the package name. atlas_subdir( MuonMDT_CnvTools ) @@ -20,4 +20,4 @@ atlas_add_component( MuonMDT_CnvTools AthenaBaseComps StoreGateLib AtlasDetDescr Identifier ByteStreamCnvSvcBaseLib MdtCalibSvcLib MuonCalibEvent MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonCablingData GeoModelUtilities - MuonCnvToolInterfacesLib MuonMDT_CnvToolsLib ) + MuonCnvToolInterfacesLib MuonMDT_CnvToolsLib ByteStreamCnvSvcLib ) diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h index a40e675fe2d3..81db08f748e1 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h @@ -1,43 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONMDT_CNVTOOLS_IMDT_RDOTOBYTESTREAMTOOL_H #define MUONMDT_CNVTOOLS_IMDT_RDOTOBYTESTREAMTOOL_H -#include "GaudiKernel/IAlgTool.h" -#include "ByteStreamData/RawEvent.h" -class MdtCsmContainer; -class MsgStream ; +#include "MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h" -static const InterfaceID IID_IMDT_RDOtoByteStreamTool("Muon::IMDT_RDOtoByteStreamTool", 1, 0); -namespace Muon { - - - class IMDT_RDOtoByteStreamTool: virtual public IAlgTool { - - public: - - // IMdtCsmContByteStreamTool() {}; - - typedef MdtCsmContainer CONTAINER ; - - /** AlgTool InterfaceID - */ - static const InterfaceID& interfaceID( ); - - virtual StatusCode convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log )=0; - - }; - -} -inline const InterfaceID& Muon::IMDT_RDOtoByteStreamTool::interfaceID() -{ - return IID_IMDT_RDOtoByteStreamTool; -} #endif - - - diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx index 3ca1dfb5c2c7..92c80f962a9f 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "MDT_Hid2RESrcID.h" @@ -35,7 +35,7 @@ StatusCode MDT_Hid2RESrcID::set(const MdtIdHelper* mdtId) { return StatusCode::SUCCESS; } -uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { +uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) const { // this method returns a RESrcID for the ROD, for a // given MDT ID offline ID @@ -116,7 +116,7 @@ uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { /** mapping SrcID from ROD to ROB */ -uint32_t MDT_Hid2RESrcID::getRobID( uint32_t rod_id) { +uint32_t MDT_Hid2RESrcID::getRobID( uint32_t rod_id) const { SourceIdentifier id = SourceIdentifier(rod_id); SourceIdentifier id2 = SourceIdentifier(id.subdetector_id(),id.module_id()); @@ -131,7 +131,7 @@ uint32_t MDT_Hid2RESrcID::getRobID( uint32_t rod_id) { /** mapping SrcID from ROB to ROS */ -uint32_t MDT_Hid2RESrcID::getRosID( uint32_t rob_id) { +uint32_t MDT_Hid2RESrcID::getRosID( uint32_t rob_id) const { // Change Module Type to ROS, moduleid = 0 SourceIdentifier id (rob_id); @@ -141,7 +141,7 @@ uint32_t MDT_Hid2RESrcID::getRosID( uint32_t rob_id) { /** mapping SrcID from ROS to Det */ -uint32_t MDT_Hid2RESrcID::getDetID ( uint32_t ros_id) { +uint32_t MDT_Hid2RESrcID::getDetID ( uint32_t ros_id) const { // ROS to DET SourceIdentifier id (ros_id); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h index 404413e9bb1b..f6a11abcb289 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-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef __MDT_HID2RESRCID__ @@ -44,19 +44,19 @@ public: void setSpecialROBNumber(int specialROBNumber) {m_specialROBNumber=specialROBNumber;} /** */ - uint32_t getRodID(const Identifier& offlineId); + uint32_t getRodID(const Identifier& offlineId) const; /** Make a ROB Source ID from a ROD source ID */ - uint32_t getRobID ( uint32_t rod_id); + uint32_t getRobID ( uint32_t rod_id) const; /** Make a ROS Source ID from a ROB source ID */ - uint32_t getRosID ( uint32_t rob_id); + uint32_t getRosID ( uint32_t rob_id) const; /** Make a SubDetector ID from ROS source ID */ - uint32_t getDetID ( uint32_t ros_id); + uint32_t getDetID ( uint32_t ros_id) const; private: diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx index 32010ab07ac2..5c896d8d3808 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "MdtCsmContByteStreamTool.h" @@ -14,35 +14,35 @@ Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool ( const std::string& type, const std::string& name,const IInterface* parent ) : - AthAlgTool(type,name,parent), - m_hid2re(0) + base_class(type,name,parent) { - declareInterface< Muon::IMDT_RDOtoByteStreamTool >( this ); } StatusCode Muon::MdtCsmContByteStreamTool::initialize() { ATH_CHECK( m_idHelperSvc.retrieve() ); - m_hid2re = new MDT_Hid2RESrcID (); - StatusCode status = m_hid2re->set(&m_idHelperSvc->mdtIdHelper()); - if ( status.isFailure() ){ - ATH_MSG_FATAL("Could not initialize MDT mapping !"); - return StatusCode::FAILURE; - } + m_hid2re = std::make_unique<MDT_Hid2RESrcID> (); + ATH_CHECK( m_hid2re->set(&m_idHelperSvc->mdtIdHelper()) ); + + ATH_CHECK( m_byteStreamCnvSvc.retrieve() ); + return StatusCode::SUCCESS; } StatusCode Muon::MdtCsmContByteStreamTool::finalize() { - delete m_hid2re; return StatusCode::SUCCESS; } -StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re, - MsgStream& log ) { +StatusCode Muon::MdtCsmContByteStreamTool::convert(const MdtCsmContainer* cont, RawEventWrite* re, + MsgStream& /*log*/ ) const { - m_fea.clear(); - StatusCode status = m_fea.idMap().set(&m_idHelperSvc->mdtIdHelper()); + // Get the event assembler + FullEventAssembler<MDT_Hid2RESrcID>* fea = nullptr; + ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea, + "MdtCsmContByteStream") ); + + StatusCode status = fea->idMap().set(&m_idHelperSvc->mdtIdHelper()); if ( status.isFailure() ){ ATH_MSG_FATAL("Could not initialize MDT mapping !"); return StatusCode::FAILURE; @@ -69,14 +69,10 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit ATH_MSG_DEBUG(" start to fill Rod "); for (auto& p : mapEncoder) { - theROD = m_fea.getRodData( p.first ); + theROD = fea->getRodData( p.first ); p.second.fillROD( *theROD ) ; } - ATH_MSG_DEBUG(" filling the Raw Event ... "); - - m_fea.fill(re,log); - ATH_MSG_DEBUG(" RawEvent size in 32 bit word " << re->size_word()); // log <<MSG::DEBUG<<" RawEvent header " << re->header() << endmsg; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h index 20d3d3ec4570..66071577b791 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONMDT_CNVTOOLS_MDTCSMCONTRAWEVENTTOOL_H @@ -11,7 +11,8 @@ #include "MDT_Hid2RESrcID.h" #include "ByteStreamData/RawEvent.h" #include "ByteStreamCnvSvcBase/FullEventAssembler.h" -#include "MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h" +#include "ByteStreamCnvSvc/ByteStreamCnvSvc.h" +#include "MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" class MdtCsmContainer; @@ -23,8 +24,6 @@ namespace Muon { /** An AlgTool class to provide conversion from LArRawChannelContainer * to ByteStream, and fill it in RawEvent * created: Sept 25, 2002, by Hong Ma - * requirements: typedef for CONTAINER class method - * statusCode convert(CONTAINER* cont, RawEvent* re, MsgStream& log ); * * Adapted for Muons by Ketevi A. Assamagan * Jan-14-2003, BNL @@ -35,32 +34,32 @@ namespace Muon { * Conversion of a Mdt Csm to ByteStream */ -class MdtCsmContByteStreamTool: public AthAlgTool, virtual public IMDT_RDOtoByteStreamTool +class MdtCsmContByteStreamTool: public extends<AthAlgTool, IMDT_RDOtoByteStreamTool> { public: - typedef MdtCsmContainer CONTAINER ; - /** constructor */ MdtCsmContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent ) ; - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; - StatusCode convert(CONTAINER* cont, RawEventWrite* re, MsgStream& log ); + virtual StatusCode convert(const MdtCsmContainer* cont, RawEventWrite* re, MsgStream& log ) const override; private: - MDT_Hid2RESrcID* m_hid2re; + std::unique_ptr<MDT_Hid2RESrcID> m_hid2re; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - FullEventAssembler<MDT_Hid2RESrcID> m_fea ; + ServiceHandle<ByteStreamCnvSvc> m_byteStreamCnvSvc + { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }; }; -} + +} // namespace Muon + #endif -- GitLab From 766c866da8f2398a886465b76197c3d895aeaa27 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Wed, 27 Jan 2021 14:59:39 -0500 Subject: [PATCH 2/3] MuonCnvToolInterfaces: Make interfaces of IMDT_RDOtoByteStreamTool const. Make interfaces of IMDT_RDOtoByteStreamTool const. --- .../IMDT_RDOtoByteStreamTool.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h index 4010afd01d88..98c1cbbe7ef5 100755 --- a/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces/MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h @@ -1,17 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCNVTOOLINTERFACES_IMDT_RDOTOBYTESTREAMTOOL_H #define MUONCNVTOOLINTERFACES_IMDT_RDOTOBYTESTREAMTOOL_H #include "GaudiKernel/IAlgTool.h" +#include "ByteStreamData/RawEvent.h" class MdtCsmContainer; class MsgStream ; -class RawEventWrite; - -static const InterfaceID IID_IMDT_RDOtoByteStreamTool( "Muon::IMDT_RDOtoByteStreamTool", 1, 0 ); namespace Muon { @@ -25,14 +23,11 @@ namespace Muon { * Jan-14-2003, BNL * Conversion of Rpc Pad Container to byte stream */ -class IMDT_RDOtoByteStreamTool: public IAlgTool { +class IMDT_RDOtoByteStreamTool: virtual public IAlgTool { public: - static const InterfaceID& interfaceID() { return IID_IMDT_RDOtoByteStreamTool; }; - - virtual StatusCode initialize(); - virtual StatusCode finalize(); + DeclareInterfaceID( IMDT_RDOtoByteStreamTool, 1, 0 ); /** Conversion method, which takes the RDO container and converts it into raw data, filled into RawEventWrite. @param cont RDO container which will be used to fill the raw event @@ -40,10 +35,12 @@ public: @param log MsgStream to be filled by method. @todo Do we really need to pass in a logfile? This is a AlgTool and so can provide its own log objects. */ - StatusCode convert(MdtCsmContainer* cont, RawEventWrite* re, MsgStream& log )=0; + virtual StatusCode convert (const MdtCsmContainer* cont, RawEventWrite* re, MsgStream& log ) const = 0; }; -} + +} // namespace Muon + #endif -- GitLab From 3f55bce368ba0bc9438cd38b898cd0a78d392090 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Mon, 29 Mar 2021 18:46:51 +0200 Subject: [PATCH 3/3] Fix indentation --- .../MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx index 5c896d8d3808..4f0fb0b37273 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx @@ -37,10 +37,10 @@ StatusCode Muon::MdtCsmContByteStreamTool::finalize() { StatusCode Muon::MdtCsmContByteStreamTool::convert(const MdtCsmContainer* cont, RawEventWrite* re, MsgStream& /*log*/ ) const { - // Get the event assembler - FullEventAssembler<MDT_Hid2RESrcID>* fea = nullptr; - ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea, - "MdtCsmContByteStream") ); + // Get the event assembler + FullEventAssembler<MDT_Hid2RESrcID>* fea = nullptr; + ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea, + "MdtCsmContByteStream") ); StatusCode status = fea->idMap().set(&m_idHelperSvc->mdtIdHelper()); if ( status.isFailure() ){ -- GitLab