diff --git a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.cxx b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.cxx index 56c3f79a9b4ea52c9108f248b6f6056b197e6eea..428993d07138300a96096d77d0abab3bc3ac07d0 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.cxx @@ -1,10 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Gaudi/Athena include(s): -#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IRegistry.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" @@ -27,8 +26,7 @@ * base class in the correct way. */ L1TopoByteStreamCnv::L1TopoByteStreamCnv(ISvcLocator* svcloc) - : Converter(storageType(), classID(), svcloc), - AthMessaging(svcloc != 0 ? msgSvc() : 0, "L1TopoByteStreamCnv"), + : AthConstConverter(storageType(), classID(), svcloc, "L1TopoByteStreamCnv"), m_tool("L1TopoByteStreamTool"), m_srcIdMap(0), m_robDataProvider("ROBDataProviderSvc", "L1TopoByteStreamCnv"), @@ -69,19 +67,17 @@ StatusCode L1TopoByteStreamCnv::initialize() { return sc; } - MsgStream log(msgSvc(), "L1TopoByteStreamCnv"); - log << MSG::DEBUG << "L1TopoByteStreamCnv in initialize() " << endmsg; + ATH_MSG_DEBUG("L1TopoByteStreamCnv in initialize() "); // // Get ByteStreamCnvSvc: // sc = m_ByteStreamEventAccess.retrieve(); if (sc.isFailure()) { - log << MSG::FATAL << "Can't get ByteStreamEventAccess interface" << endmsg; + ATH_MSG_FATAL("Can't get ByteStreamEventAccess interface"); return sc; } else { - log << MSG::DEBUG << "Connected to ByteStreamEventAccess interface" - << endmsg; + ATH_MSG_DEBUG("Connected to ByteStreamEventAccess interface"); } // @@ -89,10 +85,10 @@ StatusCode L1TopoByteStreamCnv::initialize() { // sc = m_tool.retrieve(); if (sc.isFailure()) { - log << MSG::FATAL << "Can't get L1TopoByteStreamTool" << endmsg; + ATH_MSG_FATAL("Can't get L1TopoByteStreamTool"); return sc; } else { - log << MSG::DEBUG << "Connected to L1TopoByteStreamTool" << endmsg; + ATH_MSG_DEBUG("Connected to L1TopoByteStreamTool"); } // @@ -100,10 +96,10 @@ StatusCode L1TopoByteStreamCnv::initialize() { // sc = m_robDataProvider.retrieve(); if (sc.isFailure()) { - log << MSG::WARNING << "Can't get ROBDataProviderSvc" << endmsg; + ATH_MSG_WARNING("Can't get ROBDataProviderSvc"); // return is disabled for Write BS which does not requre ROBDataProviderSvc } else { - log << MSG::DEBUG << "Connected to ROBDataProviderSvc" << endmsg; + ATH_MSG_DEBUG("Connected to ROBDataProviderSvc"); } // @@ -119,8 +115,8 @@ StatusCode L1TopoByteStreamCnv::initialize() { * the ROB fragments with the ROB IDs of the L1Topo DAQ modules and gives these * fragments to the L1TopoByteStreamTool for conversion. */ -StatusCode L1TopoByteStreamCnv::createObj(IOpaqueAddress* pAddr, - DataObject*& pObj) { +StatusCode L1TopoByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, + DataObject*& pObj) const { ATH_MSG_DEBUG("createObj() called"); // ------------------------------------------------------------------------- ByteStreamAddress* pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr); @@ -148,21 +144,18 @@ StatusCode L1TopoByteStreamCnv::createObj(IOpaqueAddress* pAddr, * of the L1Topo to the current raw event using the IByteStreamEventAccess * interface. */ -StatusCode L1TopoByteStreamCnv::createRep(DataObject* pObj, - IOpaqueAddress*& pAddr) { - MsgStream log(msgSvc(), "L1TopoByteStreamCnv"); - - log << MSG::DEBUG << "createRep() called" << endmsg; +StatusCode L1TopoByteStreamCnv::createRepConst(DataObject* pObj, + IOpaqueAddress*& pAddr) const { + ATH_MSG_DEBUG("createRep() called"); RawEventWrite* re = m_ByteStreamEventAccess->getRawEvent(); L1TopoRDOCollection* result; if (!SG::fromStorable(pObj, result)) { - log << MSG::ERROR << " Cannot cast to L1TopoRDOCollection" << endmsg; + ATH_MSG_ERROR(" Cannot cast to L1TopoRDOCollection"); return StatusCode::FAILURE; } else { - log << MSG::DEBUG << " Found " << result->size() - << " L1TopoRDOs to convert to ROBs" << endmsg; + ATH_MSG_DEBUG(" Found " << result->size() << " L1TopoRDOs to convert to ROBs"); } ByteStreamAddress* addr = @@ -175,8 +168,7 @@ StatusCode L1TopoByteStreamCnv::createRep(DataObject* pObj, it != result->end(); ++it) { StatusCode sc = m_tool->convert(*it, re); if (sc.isFailure()) { - log << MSG::ERROR << " Failed to create ROB for L1TopoRDO: " << **it - << endmsg; + ATH_MSG_ERROR(" Failed to create ROB for L1TopoRDO: " << **it); return sc; } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.h b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.h index 1e3e06f4011557d74e3d0acc6bfe7cba1c17da78..0f5ed54f5a2cc8c1e0ca2d82dc06df28b3566bce 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.h +++ b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamCnv.h @@ -1,21 +1,20 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TOPOBYTESTREAM_L1TOPOBYTESTREAMCNV_H #define L1TOPOBYTESTREAM_L1TOPOBYTESTREAMCNV_H // Gaudi/Athena include(s): -#include "GaudiKernel/Converter.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" #include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" -#include "AthenaBaseComps/AthMessaging.h" +#include "AthenaBaseComps/AthConstConverter.h" // Local include(s): #include "L1TopoByteStreamTool.h" @@ -38,7 +37,7 @@ class L1TopoSrcIdMap; * @author Simon George * @date $Date: 2014-11-12 00:00:00 $ */ -class L1TopoByteStreamCnv : public Converter, public AthMessaging { +class L1TopoByteStreamCnv : public AthConstConverter { public: /// Standard constructor @@ -52,10 +51,10 @@ public: virtual StatusCode initialize(); /// Function creating the L1TopoRDOCollection object from a L1Topo ROB /// fragment - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual StatusCode createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const; /// Function creating the L1Topo ROB fragment from a L1TopoRDOCollection /// object - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); + virtual StatusCode createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const; /// Function needed by the framework virtual long repSvcType() const { return i_repSvcType(); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.cxx b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.cxx index 1f1d27c3f1c19b783f9d7e6fcf013637a08104f4..a168ec8764000f22a0a0c645d861765b37ea5f5d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.cxx @@ -1,12 +1,11 @@ /* - 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 <exception> #include <bitset> // Gaudi/Athena include(s): -#include "GaudiKernel/MsgStream.h" #include "ByteStreamData/ROBData.h" // Trigger include(s): @@ -68,10 +67,12 @@ StatusCode L1TopoByteStreamTool::initialize() { ATH_MSG_INFO( "ROBSourceIDs property is set: this overrides decodeDAQROBs and " "decodeROIROBs"); + } else { + m_sourceIDs = sourceIDs(); } ATH_MSG_DEBUG(m_doDAQROBs); ATH_MSG_DEBUG(m_doROIROBs); - ATH_MSG_DEBUG("using sourceIDs " << std::hex << std::showbase << sourceIDs() + ATH_MSG_DEBUG("using sourceIDs " << std::hex << std::showbase << m_sourceIDs << std::dec << std::noshowbase); CHECK(m_robDataProvider.retrieve()); @@ -127,20 +128,20 @@ const std::vector<uint32_t>& L1TopoByteStreamTool::sourceIDs() { * This is called from the L1TopoByteStreamCnv::createRep method. */ StatusCode L1TopoByteStreamTool::convert(const L1TopoRDO* result, - RawEventWrite* re) { + RawEventWrite* re) const{ ATH_MSG_DEBUG("executing convert() from RDO to ROBFragment"); - // Clear Event Assembler - m_fea.clear(); + // Create Event Assembler + FullEventAssembler<L1TopoSrcIdMap> fea; // Reset lumi-block number to 1 - m_fea.setDetEvtType(1); + fea.setDetEvtType(1); // Set L1Apos to center of readout window // uint16_t minorVersion = ( result->getNumberOfBunches() - 1u ) / 2u; // minorVersion &= ctpVersion.getL1APositionMask(); // minorVersion <<= ctpVersion.getL1APositionShift(); uint16_t minorVersion = 0; - m_fea.setRodMinorVersion(minorVersion); + fea.setRodMinorVersion(minorVersion); FullEventAssembler<L1TopoSrcIdMap>::RODDATA* theROD; @@ -149,11 +150,10 @@ StatusCode L1TopoByteStreamTool::convert(const L1TopoRDO* result, // produce one with an unconventional ID of 0x91000000. const uint32_t rodId = m_srcIdMap->getRodID(); ATH_MSG_DEBUG(" ROD ID:" << MSG::hex << rodId); - const std::vector<uint32_t> rodIds = sourceIDs(); - ATH_MSG_DEBUG(" ROD IDs:" << MSG::hex << rodIds << " NOT YET IMPLEMENTED"); + ATH_MSG_DEBUG(" ROD IDs:" << MSG::hex << m_sourceIDs << " NOT YET IMPLEMENTED"); // get the ROD data container to be filled - theROD = m_fea.getRodData(rodId); + theROD = fea.getRodData(rodId); ATH_MSG_VERBOSE(" Dumping L1Topo data words:"); // fill Data Words @@ -167,21 +167,18 @@ StatusCode L1TopoByteStreamTool::convert(const L1TopoRDO* result, // Now fill full event ATH_MSG_DEBUG("Now filling the event with the L1Topo fragment"); - m_fea.fill(re, msg()); + fea.fill(re, msg()); return StatusCode::SUCCESS; } StatusCode L1TopoByteStreamTool::convert(const std::string& sgKey, - L1TopoRDOCollection* result) { - std::vector<uint32_t> vID; - vID = sourceIDs(); - + L1TopoRDOCollection* result) const { // // Get the ROB fragment: // IROBDataProviderSvc::VROBFRAG robFrags; - m_robDataProvider->getROBData(vID, robFrags); + m_robDataProvider->getROBData(m_sourceIDs, robFrags); if (robFrags.size() == 0) { ATH_MSG_WARNING("No ROB fragments found"); @@ -209,18 +206,17 @@ StatusCode L1TopoByteStreamTool::convert(const std::string& sgKey, */ // change to VROBFRAG and use IROBDataProviderSvc::VROBFRAG::const_iterator to // loop over them -StatusCode L1TopoByteStreamTool::convert(const ROBF* rob, L1TopoRDO*& result) { +StatusCode L1TopoByteStreamTool::convert(const ROBF* rob, L1TopoRDO*& result) const { ATH_MSG_DEBUG("executing convert() from ROBFragment to RDO"); - const std::vector<uint32_t> l1TopoRodIds = sourceIDs(); uint32_t rodId = rob->rob_source_id(); - ATH_MSG_DEBUG("expected ROD sub-detector ID: " << MSG::hex << l1TopoRodIds + ATH_MSG_DEBUG("expected ROD sub-detector ID: " << MSG::hex << m_sourceIDs << " ID found: " << MSG::hex << rodId << MSG::dec); bool idMatch = false; - for (auto id : l1TopoRodIds) { + for (auto id : m_sourceIDs) { if (rodId == id) { idMatch = true; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.h b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.h index 9e232cf733e87dcb688b35a173cf60ae7bb70be0..487b3d18d51afe1bb3545e84a34bb6492cd7fcbd 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.h +++ b/Trigger/TrigT1/L1Topo/L1TopoByteStream/src/L1TopoByteStreamTool.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - 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 L1TOPOBYTESTREAM_L1TOPOBYTESTREAMTOOL_H @@ -55,11 +55,11 @@ class L1TopoByteStreamTool : public AthAlgTool { /// return list of L1Topo ROD source IDs to use, defaults to DAQ ROD IDs const std::vector<uint32_t>& sourceIDs(); /// Convert ROBFragment to L1TopoRDO - StatusCode convert(const std::string& sgKey, L1TopoRDOCollection* result); + StatusCode convert(const std::string& sgKey, L1TopoRDOCollection* result) const; /// Convert ROBFragment to L1TopoRDO - StatusCode convert(const ROBF* rob, L1TopoRDO*& result); + StatusCode convert(const ROBF* rob, L1TopoRDO*& result) const; /// convert L1TopoRDO to ByteStream - StatusCode convert(const L1TopoRDO* result, RawEventWrite* re); + StatusCode convert(const L1TopoRDO* result, RawEventWrite* re) const; private: /// Object to generate and convert between the various IDs of the L1Topo @@ -67,8 +67,6 @@ class L1TopoByteStreamTool : public AthAlgTool { L1TopoSrcIdMap* m_srcIdMap; /// Source IDs of L1Topo RODs std::vector<uint32_t> m_sourceIDs; - /// Object used in creating the L1Topo ROB fragment - FullEventAssembler<L1TopoSrcIdMap> m_fea; BooleanProperty m_doDAQROBs; BooleanProperty m_doROIROBs;