Skip to content
Snippets Groups Projects
Commit 524bd1f8 authored by Scott Snyder's avatar Scott Snyder Committed by Walter Lampl
Browse files

MuonMDT_CnvTools: const fixes.

Make interface of MsgCsmContByteStreamTool const.
Remove duplicate declaration of IMDT_RDOtoByteStreamTool.
parent b68eee3d
No related branches found
No related tags found
No related merge requests found
/* /*
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 #ifndef MUONCNVTOOLINTERFACES_IMDT_RDOTOBYTESTREAMTOOL_H
#define MUONCNVTOOLINTERFACES_IMDT_RDOTOBYTESTREAMTOOL_H #define MUONCNVTOOLINTERFACES_IMDT_RDOTOBYTESTREAMTOOL_H
#include "GaudiKernel/IAlgTool.h" #include "GaudiKernel/IAlgTool.h"
#include "ByteStreamData/RawEvent.h"
class MdtCsmContainer; class MdtCsmContainer;
class MsgStream ; class MsgStream ;
class RawEventWrite;
static const InterfaceID IID_IMDT_RDOtoByteStreamTool( "Muon::IMDT_RDOtoByteStreamTool", 1, 0 );
namespace Muon { namespace Muon {
...@@ -25,14 +23,11 @@ namespace Muon { ...@@ -25,14 +23,11 @@ namespace Muon {
* Jan-14-2003, BNL * Jan-14-2003, BNL
* Conversion of Rpc Pad Container to byte stream * Conversion of Rpc Pad Container to byte stream
*/ */
class IMDT_RDOtoByteStreamTool: public IAlgTool { class IMDT_RDOtoByteStreamTool: virtual public IAlgTool {
public: public:
static const InterfaceID& interfaceID() { return IID_IMDT_RDOtoByteStreamTool; }; DeclareInterfaceID( IMDT_RDOtoByteStreamTool, 1, 0 );
virtual StatusCode initialize();
virtual StatusCode finalize();
/** Conversion method, which takes the RDO container and converts it into raw data, filled into RawEventWrite. /** 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 @param cont RDO container which will be used to fill the raw event
...@@ -40,10 +35,12 @@ public: ...@@ -40,10 +35,12 @@ public:
@param log MsgStream to be filled by method. @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. @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 #endif
......
# 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. # Declare the package name.
atlas_subdir( MuonMDT_CnvTools ) atlas_subdir( MuonMDT_CnvTools )
...@@ -20,4 +20,4 @@ atlas_add_component( MuonMDT_CnvTools ...@@ -20,4 +20,4 @@ atlas_add_component( MuonMDT_CnvTools
AthenaBaseComps StoreGateLib AtlasDetDescr Identifier ByteStreamCnvSvcBaseLib AthenaBaseComps StoreGateLib AtlasDetDescr Identifier ByteStreamCnvSvcBaseLib
MdtCalibSvcLib MuonCalibEvent MuonReadoutGeometry MuonDigitContainer MdtCalibSvcLib MuonCalibEvent MuonReadoutGeometry MuonDigitContainer
MuonIdHelpersLib MuonRDO MuonPrepRawData MuonCablingData GeoModelUtilities MuonIdHelpersLib MuonRDO MuonPrepRawData MuonCablingData GeoModelUtilities
MuonCnvToolInterfacesLib MuonMDT_CnvToolsLib ) MuonCnvToolInterfacesLib MuonMDT_CnvToolsLib ByteStreamCnvSvcLib )
/* /*
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 #ifndef MUONMDT_CNVTOOLS_IMDT_RDOTOBYTESTREAMTOOL_H
#define MUONMDT_CNVTOOLS_IMDT_RDOTOBYTESTREAMTOOL_H #define MUONMDT_CNVTOOLS_IMDT_RDOTOBYTESTREAMTOOL_H
#include "GaudiKernel/IAlgTool.h"
#include "ByteStreamData/RawEvent.h"
class MdtCsmContainer; #include "MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h"
class MsgStream ;
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 #endif
/* /*
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" #include "MDT_Hid2RESrcID.h"
...@@ -35,7 +35,7 @@ StatusCode MDT_Hid2RESrcID::set(const MdtIdHelper* mdtId) { ...@@ -35,7 +35,7 @@ StatusCode MDT_Hid2RESrcID::set(const MdtIdHelper* mdtId) {
return StatusCode::SUCCESS; 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 // this method returns a RESrcID for the ROD, for a
// given MDT ID offline ID // given MDT ID offline ID
...@@ -116,7 +116,7 @@ uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { ...@@ -116,7 +116,7 @@ uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) {
/** mapping SrcID from ROD to ROB /** 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 id = SourceIdentifier(rod_id);
SourceIdentifier id2 = SourceIdentifier(id.subdetector_id(),id.module_id()); SourceIdentifier id2 = SourceIdentifier(id.subdetector_id(),id.module_id());
...@@ -131,7 +131,7 @@ uint32_t MDT_Hid2RESrcID::getRobID( uint32_t rod_id) { ...@@ -131,7 +131,7 @@ uint32_t MDT_Hid2RESrcID::getRobID( uint32_t rod_id) {
/** mapping SrcID from ROB to ROS /** 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 // Change Module Type to ROS, moduleid = 0
SourceIdentifier id (rob_id); SourceIdentifier id (rob_id);
...@@ -141,7 +141,7 @@ uint32_t MDT_Hid2RESrcID::getRosID( uint32_t rob_id) { ...@@ -141,7 +141,7 @@ uint32_t MDT_Hid2RESrcID::getRosID( uint32_t rob_id) {
/** mapping SrcID from ROS to Det /** 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 // ROS to DET
SourceIdentifier id (ros_id); SourceIdentifier id (ros_id);
......
/* /*
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__ #ifndef __MDT_HID2RESRCID__
...@@ -44,19 +44,19 @@ public: ...@@ -44,19 +44,19 @@ public:
void setSpecialROBNumber(int specialROBNumber) {m_specialROBNumber=specialROBNumber;} 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 /** 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 /** 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 /** Make a SubDetector ID from ROS source ID
*/ */
uint32_t getDetID ( uint32_t ros_id); uint32_t getDetID ( uint32_t ros_id) const;
private: private:
......
/* /*
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" #include "MdtCsmContByteStreamTool.h"
...@@ -14,35 +14,35 @@ ...@@ -14,35 +14,35 @@
Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool
( const std::string& type, const std::string& name,const IInterface* parent ) ( const std::string& type, const std::string& name,const IInterface* parent )
: :
AthAlgTool(type,name,parent), base_class(type,name,parent)
m_hid2re(0)
{ {
declareInterface< Muon::IMDT_RDOtoByteStreamTool >( this );
} }
StatusCode Muon::MdtCsmContByteStreamTool::initialize() { StatusCode Muon::MdtCsmContByteStreamTool::initialize() {
ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_idHelperSvc.retrieve() );
m_hid2re = new MDT_Hid2RESrcID (); m_hid2re = std::make_unique<MDT_Hid2RESrcID> ();
StatusCode status = m_hid2re->set(&m_idHelperSvc->mdtIdHelper()); ATH_CHECK( m_hid2re->set(&m_idHelperSvc->mdtIdHelper()) );
if ( status.isFailure() ){
ATH_MSG_FATAL("Could not initialize MDT mapping !"); ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode Muon::MdtCsmContByteStreamTool::finalize() { StatusCode Muon::MdtCsmContByteStreamTool::finalize() {
delete m_hid2re;
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrite* re, StatusCode Muon::MdtCsmContByteStreamTool::convert(const MdtCsmContainer* cont, RawEventWrite* re,
MsgStream& log ) { MsgStream& /*log*/ ) const {
m_fea.clear(); // Get the event assembler
StatusCode status = m_fea.idMap().set(&m_idHelperSvc->mdtIdHelper()); FullEventAssembler<MDT_Hid2RESrcID>* fea = nullptr;
ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
"MdtCsmContByteStream") );
StatusCode status = fea->idMap().set(&m_idHelperSvc->mdtIdHelper());
if ( status.isFailure() ){ if ( status.isFailure() ){
ATH_MSG_FATAL("Could not initialize MDT mapping !"); ATH_MSG_FATAL("Could not initialize MDT mapping !");
return StatusCode::FAILURE; return StatusCode::FAILURE;
...@@ -69,14 +69,10 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit ...@@ -69,14 +69,10 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit
ATH_MSG_DEBUG(" start to fill Rod "); ATH_MSG_DEBUG(" start to fill Rod ");
for (auto& p : mapEncoder) { for (auto& p : mapEncoder) {
theROD = m_fea.getRodData( p.first ); theROD = fea->getRodData( p.first );
p.second.fillROD( *theROD ) ; 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()); ATH_MSG_DEBUG(" RawEvent size in 32 bit word " << re->size_word());
// log <<MSG::DEBUG<<" RawEvent header " << re->header() << endmsg; // log <<MSG::DEBUG<<" RawEvent header " << re->header() << endmsg;
......
/* /*
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 #ifndef MUONMDT_CNVTOOLS_MDTCSMCONTRAWEVENTTOOL_H
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#include "MDT_Hid2RESrcID.h" #include "MDT_Hid2RESrcID.h"
#include "ByteStreamData/RawEvent.h" #include "ByteStreamData/RawEvent.h"
#include "ByteStreamCnvSvcBase/FullEventAssembler.h" #include "ByteStreamCnvSvcBase/FullEventAssembler.h"
#include "MuonMDT_CnvTools/IMDT_RDOtoByteStreamTool.h" #include "ByteStreamCnvSvc/ByteStreamCnvSvc.h"
#include "MuonCnvToolInterfaces/IMDT_RDOtoByteStreamTool.h"
#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h"
class MdtCsmContainer; class MdtCsmContainer;
...@@ -23,8 +24,6 @@ namespace Muon { ...@@ -23,8 +24,6 @@ namespace Muon {
/** An AlgTool class to provide conversion from LArRawChannelContainer /** An AlgTool class to provide conversion from LArRawChannelContainer
* to ByteStream, and fill it in RawEvent * to ByteStream, and fill it in RawEvent
* created: Sept 25, 2002, by Hong Ma * 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 * Adapted for Muons by Ketevi A. Assamagan
* Jan-14-2003, BNL * Jan-14-2003, BNL
...@@ -35,32 +34,32 @@ namespace Muon { ...@@ -35,32 +34,32 @@ namespace Muon {
* Conversion of a Mdt Csm to ByteStream * Conversion of a Mdt Csm to ByteStream
*/ */
class MdtCsmContByteStreamTool: public AthAlgTool, virtual public IMDT_RDOtoByteStreamTool class MdtCsmContByteStreamTool: public extends<AthAlgTool, IMDT_RDOtoByteStreamTool>
{ {
public: public:
typedef MdtCsmContainer CONTAINER ;
/** constructor /** constructor
*/ */
MdtCsmContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent ) ; MdtCsmContByteStreamTool( const std::string& type, const std::string& name, const IInterface* parent ) ;
virtual StatusCode initialize(); virtual StatusCode initialize() override;
virtual StatusCode finalize(); 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: private:
MDT_Hid2RESrcID* m_hid2re; std::unique_ptr<MDT_Hid2RESrcID> m_hid2re;
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; 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 #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment