diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileBeamElemContByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileBeamElemContByteStreamCnv.h index 031d19e9c9d1cda3e9d44fcbd8fe15ad893ff13c..768c77b43d4483bd7d6f5a874b847439fdb150b3 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileBeamElemContByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileBeamElemContByteStreamCnv.h @@ -9,10 +9,13 @@ #include "GaudiKernel/Converter.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ContextSpecificPtr.h" // Athena includes #include "AthenaBaseComps/AthMessaging.h" +#include "TileEvent/TileMutableBeamElemContainer.h" +#include "AthenaKernel/RecyclableDataObject.h" #include "eformat/ROBFragment.h" @@ -21,7 +24,6 @@ class DataObject; class StatusCode; class IAddressCreator; -class TileBeamElemContainer; class IROBDataProviderSvc; class TileHid2RESrcID; class TileROD_Decoder; @@ -49,18 +51,21 @@ class TileBeamElemContByteStreamCnv public: TileBeamElemContByteStreamCnv(ISvcLocator* svcloc); - virtual StatusCode initialize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; + virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode finalize() override; /// Storage type and class ID - virtual long repSvcType() const { return ByteStream_StorageType; } + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } static const CLID& classID(); - inline const eformat::FullEventFragment<const uint32_t*> * eventFragment() const { return m_event; } - inline const eformat::ROBFragment<const uint32_t*> * robFragment() const { return m_robFrag; } + // FIXME: Eliminate this backdoor access to RAW data. + // If clients need raw data, they should get it from the + // existing ByteStreamSvc interfaces. + inline const eformat::FullEventFragment<const uint32_t*> * eventFragment() const { return m_event.get(); } + inline const eformat::ROBFragment<const uint32_t*> * robFragment() const { return m_robFrag.get(); } inline bool validBeamFrag() const { return m_robFrag != 0; } private: @@ -73,22 +78,19 @@ class TileBeamElemContByteStreamCnv /** Pointer to TileROD_Decoder */ ToolHandle<TileROD_Decoder> m_decoder; - const eformat::FullEventFragment<const uint32_t*>* m_event; - //const EventFormat::Abstract::FullEventFragment * m_event; - //const EventFormat::FullEventHeader m_eventHeader; + Gaudi::Hive::ContextSpecificPtr< + const eformat::FullEventFragment<const uint32_t*> > m_event; - const eformat::ROBFragment<const uint32_t*>* m_robFrag; - // const EventFormat::Abstract::RODFragment * m_rodFrag; - // const EventFormat::RODHeader m_RODHeader; + Gaudi::Hive::ContextSpecificPtr< + const eformat::ROBFragment<const uint32_t*> > m_robFrag; std::vector<uint32_t> m_ROBID; /** Pointer to TileHid2RESrcID */ const TileHid2RESrcID* m_hid2re; - /** Pointer to TileBeamElemContainer */ - TileBeamElemContainer* m_container ; - + /** Queue of data objects to recycle. */ + Athena::RecyclableDataQueue<TileMutableBeamElemContainer> m_queue; }; #endif diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileDigitsContByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileDigitsContByteStreamCnv.h index c7d7776849454676f0596fc6de1b111bf00511d6..4f104533e8562dac7f103009bf14a0b35eecfd76 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileDigitsContByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileDigitsContByteStreamCnv.h @@ -6,15 +6,14 @@ #ifndef TILEBYTESTREAM_TILEDIGITS_BYTESTREAMCNV_H #define TILEBYTESTREAM_TILEDIGITS_BYTESTREAMCNV_H -// Gaudi inludes + +#include "AthenaBaseComps/AthMessaging.h" +#include "TileEvent/TileMutableDigitsContainer.h" +#include "AthenaKernel/RecyclableDataObject.h" #include "GaudiKernel/Converter.h" -#include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -// Athena includes -#include "AthenaBaseComps/AthMessaging.h" - class DataObject; @@ -49,7 +48,6 @@ extern long ByteStream_StorageType; class TileDigitsContByteStreamCnv : public Converter - , public IIncidentListener , public ::AthMessaging { @@ -58,16 +56,13 @@ class TileDigitsContByteStreamCnv typedef TileDigitsContByteStreamTool BYTESTREAMTOOL; - virtual StatusCode initialize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); - virtual StatusCode finalize(); - - /// Incident listener - virtual void handle( const Incident& incident ); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; + virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode finalize() override; /// Storage type and class ID - virtual long repSvcType() const { return ByteStream_StorageType; } + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } static const CLID& classID(); @@ -93,10 +88,8 @@ class TileDigitsContByteStreamCnv /** Pointer to TileHid2RESrcID */ const TileHid2RESrcID* m_hid2re; - /** Pointer to TileDigitsContainer */ - std::vector<TileDigitsContainer*> m_containers; - - + /** Queue of data objects to recycle. */ + Athena::RecyclableDataQueue<TileMutableDigitsContainer> m_queue; }; #endif diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileL2ContByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileL2ContByteStreamCnv.h index c15f3054c1b989f1bfacb47c4a5a7ebbdeae3a1f..889d2778e57b0d1c9853b6d83d1493a4a1a984b1 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileL2ContByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileL2ContByteStreamCnv.h @@ -5,16 +5,15 @@ #ifndef TILEBYTESTREAM_TILEL2_BYTESTREAMCNV_H #define TILEBYTESTREAM_TILEL2_BYTESTREAMCNV_H -// Gaudi includes + +#include "TileEvent/TileContainer.h" +#include "AthenaBaseComps/AthMessaging.h" +#include "AthenaKernel/RecyclableDataObject.h" +#include "AthenaKernel/BaseInfo.h" #include "GaudiKernel/Converter.h" -#include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -// Athena includes -#include "AthenaBaseComps/AthMessaging.h" - -#include "TileEvent/TileContainer.h" class DataObject; class StatusCode; @@ -32,6 +31,29 @@ template <class TYPE> class CnvFactory; // Externals extern long ByteStream_StorageType; + +class TileRecyclableL2Container + : public TileL2Container, public DataObject +{ +public: + TileRecyclableL2Container (const TileROD_Decoder& decoder); + + +protected: + /** + * @brief Recycle this object for use in another event. + * + * This is called from AthenaKernel/RecyclableDataObject when this object + * is released by StoreGate. Unlock the object so that non-const access + * is again possible, and clear out the contents if the collections. + */ + void recycle(); +}; + + +SG_BASE (TileRecyclableL2Container, TileL2Container); + + /** * @class TileL2ContByteStreamCnv * @brief This Converter class provides conversion between ByteStream and TileL2Container @@ -44,7 +66,6 @@ extern long ByteStream_StorageType; class TileL2ContByteStreamCnv : public Converter - , public IIncidentListener , public ::AthMessaging { public: @@ -52,16 +73,13 @@ class TileL2ContByteStreamCnv typedef TileL2ContByteStreamTool BYTESTREAMTOOL ; - virtual StatusCode initialize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); - virtual StatusCode finalize(); - - /// Incident listener - virtual void handle( const Incident& incident ); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; + virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode finalize() override; /// Storage type and class ID - virtual long repSvcType() const { return ByteStream_StorageType; } + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } static const CLID& classID(); @@ -83,10 +101,9 @@ class TileL2ContByteStreamCnv /** Pointer to TileROD_Decoder */ ToolHandle<TileROD_Decoder> m_decoder; - - /** Pointer to TileL2Container */ - TileL2Container* m_container; - + + /** Queue of data objects to recycle. */ + Athena::RecyclableDataQueue<TileRecyclableL2Container> m_queue; }; #endif diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileLaserObjByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileLaserObjByteStreamCnv.h index 0bb1b3629037c35fc15cd5d3f46c6b635e923544..6d314588435048e2e86b95f030957ae7ca552a23 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileLaserObjByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileLaserObjByteStreamCnv.h @@ -66,16 +66,9 @@ class TileLaserObjByteStreamCnv /** Pointer to TileROD_Decoder */ ToolHandle<TileROD_Decoder> m_decoder; - const eformat::ROBFragment<const uint32_t*>* m_robFrag; - std::vector<uint32_t> m_ROBID; /** Pointer to TileHid2RESrcID */ const TileHid2RESrcID* m_hid2re; - - /* Pointer to TileLaserObject */ - TileLaserObject* m_container; - - }; #endif diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileMuRcvContByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileMuRcvContByteStreamCnv.h index 63f2274d85f42915939353b491e2aecc561ad1f0..67ba746f3faaaf993e852ad3e336f217d2459505 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileMuRcvContByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileMuRcvContByteStreamCnv.h @@ -5,16 +5,12 @@ #ifndef TILEBYTESTREAM_TILEMURCVCONTBYTESTREAMCNV_H #define TILEBYTESTREAM_TILEMURCVCONTBYTESTREAMCNV_H -// Gaudi includes +#include "TileEvent/TileContainer.h" +#include "AthenaBaseComps/AthMessaging.h" #include "GaudiKernel/Converter.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -// Athena includes -#include "AthenaBaseComps/AthMessaging.h" - -#include "TileEvent/TileContainer.h" - class DataObject; class StatusCode; class IAddressCreator; @@ -31,6 +27,7 @@ template <class TYPE> class CnvFactory; // Externals extern long ByteStream_StorageType; + /** * @class TileMuRcvContByteStreamCnv * @brief This Converter class provides conversion between ByteStream and TileMuRcvCont @@ -48,13 +45,13 @@ class TileMuRcvContByteStreamCnv typedef TileMuRcvContByteStreamTool BYTESTREAMTOOL ; - virtual StatusCode initialize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; + virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode finalize() override; /// Storage type and class ID - virtual long repSvcType() const { return ByteStream_StorageType; } + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } static const CLID& classID(); diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileRawChannelContByteStreamCnv.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileRawChannelContByteStreamCnv.h index 66fc8fa02b99714480850c75d4130d0b9a84bbcf..809cf89ee65b88212270672df6a9a432f3f0fe33 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileRawChannelContByteStreamCnv.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileRawChannelContByteStreamCnv.h @@ -5,16 +5,14 @@ #ifndef TILEBYTESTREAM_TILERAWCHANNELCONTRAWEVENTCNV_H #define TILEBYTESTREAM_TILERAWCHANNELCONTRAWEVENTCNV_H -// Gauid includes -#include "GaudiKernel/Converter.h" -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -// Athena includes #include "AthenaBaseComps/AthMessaging.h" +#include "TileEvent/TileMutableRawChannelContainer.h" +#include "AthenaKernel/RecyclableDataObject.h" #include "ByteStreamCnvSvcBase/IByteStreamEventAccess.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" +#include "GaudiKernel/Converter.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include <vector> @@ -46,7 +44,6 @@ extern long ByteStream_StorageType; class TileRawChannelContByteStreamCnv : public Converter - , public IIncidentListener , public ::AthMessaging { public: @@ -54,16 +51,13 @@ class TileRawChannelContByteStreamCnv typedef TileRawChannelContByteStreamTool BYTESTREAMTOOL ; - virtual StatusCode initialize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); - virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr); - virtual StatusCode finalize(); - - /// Incident listener - virtual void handle( const Incident& incident ); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; + virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override; + virtual StatusCode finalize() override; /// Storage type and class ID - virtual long repSvcType() const { return ByteStream_StorageType; } + virtual long repSvcType() const override { return ByteStream_StorageType; } static long storageType() { return ByteStream_StorageType; } static const CLID& classID(); @@ -89,9 +83,9 @@ class TileRawChannelContByteStreamCnv /** Pointer to TileHid2RESrcID */ const TileHid2RESrcID* m_hid2re; - /** Pointer to TileDigitsContainer */ - std::vector<TileRawChannelContainer*> m_containers; + /** Queue of data objects to recycle. */ + Athena::RecyclableDataQueue<TileMutableRawChannelContainer> m_queue; }; #endif diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileBeamElemContByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileBeamElemContByteStreamCnv.cxx index 81d242cb3ce98ef0fe1fe56a7beedc495c26d6cf..e79682d06430d2848744db87bde31f6ec98decfc 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileBeamElemContByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileBeamElemContByteStreamCnv.cxx @@ -35,11 +35,8 @@ TileBeamElemContByteStreamCnv::TileBeamElemContByteStreamCnv(ISvcLocator* svcloc , m_name("TileBeamElemContByteStreamCnv") , m_robSvc("ROBDataProviderSvc", m_name) , m_decoder("TileROD_Decoder") - , m_event(0) - , m_robFrag(0) , m_ROBID() - , m_hid2re(0) - , m_container(0) + , m_hid2re(nullptr) { } @@ -62,10 +59,6 @@ StatusCode TileBeamElemContByteStreamCnv::initialize() { m_ROBID.push_back( m_hid2re->getRobFromFragID(DIGI_PAR_FRAG) ); m_ROBID.push_back( m_hid2re->getRobFromFragID(LASER_OBJ_FRAG) ); - // create empty TileBeamElemContainer and all collections inside - m_container = new TileBeamElemContainer(true); - m_container->addRef(); // make sure it's not deleted at the end of event - return StatusCode::SUCCESS; } @@ -90,11 +83,12 @@ StatusCode TileBeamElemContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataO m_robSvc->getROBData(m_ROBID, robf); m_robFrag = (robf.size() > 0 ) ? robf[0] : 0; - // iterate over all collections in a container and fill them - - for(const TileBeamElemCollection* constBeamCollection : *m_container) { + TileMutableBeamElemContainer* cont = m_queue.get (true); + ATH_CHECK( cont->status() ); - TileBeamElemCollection* beamCollection = const_cast<TileBeamElemCollection*>(constBeamCollection); + // iterate over all collections in a container and fill them + for (IdentifierHash hash : cont->GetAllCurrentHashes()) { + TileBeamElemCollection* beamCollection = cont->indexFindPtr (hash); beamCollection->clear(); TileBeamElemCollection::ID collID = beamCollection->identify(); @@ -114,7 +108,8 @@ StatusCode TileBeamElemContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataO ATH_MSG_DEBUG( " Creating Container " << *(pRE_Addr->par()) ); - pObj = SG::asStorable( m_container ) ; + TileBeamElemContainer* basecont = cont; + pObj = SG::asStorable( basecont ) ; return StatusCode::SUCCESS; } @@ -126,16 +121,7 @@ StatusCode TileBeamElemContByteStreamCnv::createRep(DataObject* /* pObj */, IOpa return StatusCode::FAILURE ; } -StatusCode TileBeamElemContByteStreamCnv::finalize() { - - ATH_MSG_DEBUG( " Clearing Container " ); - - // iterate over all collections in a container and clear them - for(const TileBeamElemCollection* beamCollection : *m_container) { - const_cast<TileBeamElemCollection*>(beamCollection)->clear(); - } - - m_container->release(); - +StatusCode TileBeamElemContByteStreamCnv::finalize() +{ return Converter::finalize(); } diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileDigitsContByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileDigitsContByteStreamCnv.cxx index 2114d33cba105f69e5dad40955918d2b6076ebbe..14ffca14625428127ce5386f60f5ec6d97f5a8e0 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileDigitsContByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileDigitsContByteStreamCnv.cxx @@ -7,7 +7,6 @@ #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/DataObject.h" #include "GaudiKernel/IRegistry.h" -#include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/IToolSvc.h" @@ -51,7 +50,6 @@ TileDigitsContByteStreamCnv::TileDigitsContByteStreamCnv(ISvcLocator* svcloc) , m_robSvc("ROBDataProviderSvc", m_name) , m_decoder("TileROD_Decoder") , m_hid2re(0) - , m_containers(2,0) { } @@ -76,21 +74,6 @@ StatusCode TileDigitsContByteStreamCnv::initialize() { ATH_CHECK( m_robSvc.retrieve() ); - // create empty TileDigitsContainer and all collections inside - m_containers[0] = new TileDigitsContainer(true); - m_containers[0]->addRef(); // make sure it's not deleted at the end of event - - m_containers[1] = new TileDigitsContainer(true); - m_containers[1]->addRef(); // make sure it's not deleted at the end of event - - // Register incident handler - ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", m_name); - if ( !incSvc.retrieve().isSuccess() ) { - ATH_MSG_WARNING("Unable to retrieve the IncidentSvc"); - } else { - incSvc->addListener(this, "StoreCleared"); - } - ATH_CHECK( m_activeStore.retrieve() ); return StatusCode::SUCCESS; @@ -116,12 +99,14 @@ StatusCode TileDigitsContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataObj std::vector<uint32_t> robid(1); robid[0] = 0; std::vector<const ROBDataProviderSvc::ROBF*> robf; + + TileMutableDigitsContainer* cont = m_queue.get (true); + ATH_CHECK( cont->status() ); // iterate over all collections in a container and fill them // - for (const TileDigitsCollection* constDigitsCollection : *m_containers[icnt]) { - - TileDigitsCollection* digitsCollection = const_cast<TileDigitsCollection*>(constDigitsCollection); + for (IdentifierHash hash : cont->GetAllCurrentHashes()) { + TileDigitsCollection* digitsCollection = cont->indexFindPtr (hash); digitsCollection->clear(); TileDigitsCollection::ID collID = digitsCollection->identify(); @@ -152,10 +137,11 @@ StatusCode TileDigitsContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataObj ATH_MSG_DEBUG( "Creating digits container " << *(pRE_Addr->par()) ); + TileDigitsContainer* basecont = cont; if (isTMDB) { - ATH_CHECK( m_activeStore->activeStore()->record( m_containers[icnt], "MuRcvDigitsCnt" ) ); + ATH_CHECK( m_activeStore->activeStore()->record( basecont, "MuRcvDigitsCnt" ) ); } else { - pObj = SG::asStorable( m_containers[icnt] ) ; + pObj = SG::asStorable( basecont ) ; } } @@ -196,32 +182,7 @@ StatusCode TileDigitsContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddre return m_tool->convert(digicont, fea); } -StatusCode TileDigitsContByteStreamCnv::finalize() { - - ATH_MSG_DEBUG(" Clearing Container "); - - for (TileDigitsContainer* digitsContainer : m_containers){ - for (const TileDigitsCollection* digitsCollection : *digitsContainer) { - const_cast<TileDigitsCollection*>(digitsCollection)->clear(); - } - - digitsContainer->release(); - } - +StatusCode TileDigitsContByteStreamCnv::finalize() +{ return Converter::finalize(); } - -void TileDigitsContByteStreamCnv::handle(const Incident& incident) { - - if (incident.type() == "StoreCleared") { - if (const StoreClearedIncident* inc = dynamic_cast<const StoreClearedIncident*> (&incident)) { - if (inc->store() == m_activeStore->activeStore()) { - for (TileDigitsContainer* digitsContainer : m_containers){ - for (const TileDigitsCollection* digitsCollection : *digitsContainer) { - const_cast<TileDigitsCollection*>(digitsCollection)->clear(); - } - } - } - } - } -} diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileL2ContByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileL2ContByteStreamCnv.cxx index f319b82256870e72f6ced62dce751806a25d794f..de99d00cdbe9dcba34c0cfdb75519e26dad7e356 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileL2ContByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileL2ContByteStreamCnv.cxx @@ -31,7 +31,32 @@ #include "TileL2Algs/TileL2Builder.h" -#include <string> +#include <string> + + +TileRecyclableL2Container::TileRecyclableL2Container (const TileROD_Decoder& decoder) +{ + this->reserve(256); + for(int i = 0; i < 256; ++i) { + int collId = decoder.hashFunc()->identifier(i); + this->push_back (std::make_unique<TileL2> (collId)); + } +} + + +/** + * @brief Recycle this object for use in another event. + * + * This is called from AthenaKernel/RecyclableDataObject when this object + * is released by StoreGate. Unlock the object so that non-const access + * is again possible, and clear out the contents if the collections. + */ +void TileRecyclableL2Container::recycle() +{ + for (TileL2* elt : *this) { + elt->clear(); + } +} TileL2ContByteStreamCnv::TileL2ContByteStreamCnv(ISvcLocator* svcloc) @@ -44,7 +69,6 @@ TileL2ContByteStreamCnv::TileL2ContByteStreamCnv(ISvcLocator* svcloc) , m_storeGate("StoreGateSvc", m_name) , m_robSvc("ROBDataProviderSvc", m_name) , m_decoder("TileROD_Decoder") - , m_container(0) { } @@ -67,24 +91,6 @@ StatusCode TileL2ContByteStreamCnv::initialize() { ATH_CHECK( m_tool.retrieve() ); ATH_CHECK( m_robSvc.retrieve() ); - - // create empty TileL2Container and all TileL2 inside - m_container = new TileL2Container(); - m_container->reserve(256); - - for(int i = 0; i < 256; ++i) { - int collId = m_decoder->hashFunc()->identifier(i); - TileL2 *l2 = new TileL2(collId); - m_container->push_back(l2); - } - - // Register incident handler - ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", m_name); - if ( !incSvc.retrieve().isSuccess() ) { - ATH_MSG_WARNING( "Unable to retrieve the IncidentSvc" ); - } else { - incSvc->addListener(this, "StoreCleared"); - } ATH_CHECK( m_storeGate.retrieve() ); @@ -109,14 +115,13 @@ StatusCode TileL2ContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataObject* return StatusCode::FAILURE; } - if (!m_decoder->convert(re, m_container).isSuccess()) { + TileL2Container* cont = m_queue.get (*m_decoder); + + if (!m_decoder->convert(re, cont).isSuccess()) { ATH_MSG_WARNING( "Conversion tool returned an error. TileL2Container might be empty." ); } - // new container will not own elements, i.e. TileL2 will not be deleted - TileL2Container* new_container = new TileL2Container(*m_container); - - pObj = SG::asStorable( new_container ) ; + pObj = SG::asStorable( cont ) ; return StatusCode::SUCCESS; } @@ -152,27 +157,7 @@ StatusCode TileL2ContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& } -StatusCode TileL2ContByteStreamCnv::finalize() { - - ATH_MSG_DEBUG( " Clearing TileL2 Container " ); - - m_container->clear(); - - delete m_container; - +StatusCode TileL2ContByteStreamCnv::finalize() +{ return Converter::finalize(); } - -void TileL2ContByteStreamCnv::handle(const Incident& incident) { - - if (incident.type() == "StoreCleared") { - if (const StoreClearedIncident* inc = dynamic_cast<const StoreClearedIncident*> (&incident)) { - if (inc->store() == &*m_storeGate) { - for (const TileL2* tileL2 : *m_container) { - const_cast<TileL2*>(tileL2)->clear(); - } - } - } - } - -} diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileLaserObjByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileLaserObjByteStreamCnv.cxx index d5a20ffa1742a4d02299c0e73bdf1b1e228cd373..7a2b97fe265328b60a59fc717e635ce06af62ade 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileLaserObjByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileLaserObjByteStreamCnv.cxx @@ -41,10 +41,8 @@ TileLaserObjByteStreamCnv::TileLaserObjByteStreamCnv(ISvcLocator* svcloc) , m_name("TileLaserObjByteStreamCnv") , m_robSvc("ROBDataProviderSvc", m_name) , m_decoder("TileROD_Decoder") - , m_robFrag(0) , m_ROBID() , m_hid2re(0) - , m_container(0) { } @@ -89,17 +87,15 @@ StatusCode TileLaserObjByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataObjec m_robSvc->getROBData(m_ROBID, robf); // create TileLaserObject - m_container = new TileLaserObject() ; + auto cont = std::make_unique<TileLaserObject>() ; if (robf.size() > 0 ) { - m_robFrag = robf[0]; - m_decoder->fillTileLaserObj(m_robFrag, *m_container); + m_decoder->fillTileLaserObj(robf[0], *cont); } else { ATH_MSG_DEBUG( " No LASTROD fragment in BS, TileLaserObject will be empty." ); - m_robFrag = 0; } - pObj = SG::asStorable( m_container ) ; + pObj = SG::asStorable( std::move(cont) ) ; return StatusCode::SUCCESS; } diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileMuRcvContByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileMuRcvContByteStreamCnv.cxx index 98a2ffc7265cdeb21237d759ff45c499c881affa..b03a78f8a53b1760ea95c82f807ae7691003ba55 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileMuRcvContByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileMuRcvContByteStreamCnv.cxx @@ -90,6 +90,7 @@ StatusCode TileMuRcvContByteStreamCnv::createObj(IOpaqueAddress* pAddr, DataObje } auto cont = std::make_unique<TileMuonReceiverContainer>(); + StatusCode sc=m_decoder->convertTMDBDecision(re,cont.get()); if (sc!=StatusCode::SUCCESS) { ATH_MSG_WARNING( "Conversion tool returned an error. TileMuonReceiverContainer might be empty." ); @@ -134,4 +135,3 @@ StatusCode TileMuRcvContByteStreamCnv::finalize() { return Converter::finalize(); } - diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileRawChannelContByteStreamCnv.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileRawChannelContByteStreamCnv.cxx index 9b22d6beb86e4a80b203b66fa0b1e84cc015ace1..c75ee42be3008a102661f715fdc14dfb9747b9e3 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileRawChannelContByteStreamCnv.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileRawChannelContByteStreamCnv.cxx @@ -8,7 +8,6 @@ #include "GaudiKernel/DataObject.h" #include "GaudiKernel/IRegistry.h" #include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/ServiceHandle.h" // Athena includes @@ -47,8 +46,6 @@ TileRawChannelContByteStreamCnv::TileRawChannelContByteStreamCnv(ISvcLocator* sv , m_robSvc("ROBDataProviderSvc", m_name) , m_decoder("TileROD_Decoder") , m_hid2re(0) - , m_containers(2,0) - { } @@ -72,28 +69,6 @@ StatusCode TileRawChannelContByteStreamCnv::initialize() { ATH_CHECK( m_robSvc.retrieve() ); - TileFragHash::TYPE type; - TileRawChannelUnit::UNIT unit; - - // create empty TileRawChannelContainer and all collections inside - type = TileFragHash::OptFilterDsp; - unit = TileRawChannelUnit::ADCcounts; - m_containers[0] = new TileRawChannelContainer(true, type, unit); - m_containers[0]->addRef(); // make sure it's not deleted at the end of event - - type = TileFragHash::MF; - unit = TileRawChannelUnit::ADCcounts; - m_containers[1] = new TileRawChannelContainer(true, type, unit); - m_containers[1]->addRef(); // make sure it's not deleted at the end of event - - // Register incident handler - ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", m_name); - if ( !incSvc.retrieve().isSuccess() ) { - ATH_MSG_WARNING("Unable to retrieve the IncidentSvc"); - } else { - incSvc->addListener(this, "StoreCleared"); - } - ATH_CHECK( m_activeStore.retrieve() ); return StatusCode::SUCCESS; @@ -121,10 +96,19 @@ StatusCode TileRawChannelContByteStreamCnv::createObj(IOpaqueAddress* pAddr, Dat robid[0] = 0; std::vector<const ROBDataProviderSvc::ROBF*> robf; - // iterate over all collections in a container and fill them - for (const TileRawChannelCollection* constRawChCollection : *m_containers[icnt]) { - TileRawChannelCollection* rawChannelCollection = const_cast<TileRawChannelCollection*>(constRawChCollection); + TileMutableRawChannelContainer* cont = m_queue.get (true); + ATH_CHECK( cont->status() ); + if (isTMDB) { + cont->set_type (TileFragHash::MF); + } + else { + cont->set_type (TileFragHash::OptFilterDsp); + } + + // iterate over all collections in a container and fill them + for (IdentifierHash hash : cont->GetAllCurrentHashes()) { + TileRawChannelCollection* rawChannelCollection = cont->indexFindPtr (hash); rawChannelCollection->clear(); TileRawChannelCollection::ID collID = rawChannelCollection->identify(); @@ -146,7 +130,7 @@ StatusCode TileRawChannelContByteStreamCnv::createObj(IOpaqueAddress* pAddr, Dat if (isTMDB) {// reid for TMDB 0x5x010x m_decoder->fillCollection_TileMuRcv_RawChannel(robf[0], *rawChannelCollection); } else { - m_decoder->fillCollection(robf[0], *rawChannelCollection, m_containers[icnt]); + m_decoder->fillCollection(robf[0], *rawChannelCollection, cont); } } else { rawChannelCollection->setFragGlobalCRC(TileROD_Decoder::NO_ROB); @@ -155,10 +139,11 @@ StatusCode TileRawChannelContByteStreamCnv::createObj(IOpaqueAddress* pAddr, Dat ATH_MSG_DEBUG( "Creating Container " << *(pRE_Addr->par()) ); + TileRawChannelContainer* basecont = cont; if (isTMDB) { - ATH_CHECK( m_activeStore->activeStore()->record( m_containers[icnt], "MuRcvRawChCnt" ) ); + ATH_CHECK( m_activeStore->activeStore()->record( basecont, "MuRcvRawChCnt" ) ); } else { - pObj = SG::asStorable( m_containers[icnt] ) ; + pObj = SG::asStorable( basecont ); } } @@ -195,32 +180,8 @@ StatusCode TileRawChannelContByteStreamCnv::createRep(DataObject* pObj, IOpaqueA return StatusCode::SUCCESS; } -StatusCode TileRawChannelContByteStreamCnv::finalize() { - - ATH_MSG_DEBUG(" Clearing Container "); - - for (TileRawChannelContainer* rawChannelContainer : m_containers){ - for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) { - const_cast<TileRawChannelCollection*>(rawChannelCollection)->clear(); - } - - rawChannelContainer->release(); - } - +StatusCode TileRawChannelContByteStreamCnv::finalize() +{ return Converter::finalize(); } -void TileRawChannelContByteStreamCnv::handle(const Incident& incident) { - - if (incident.type() == "StoreCleared") { - if (const StoreClearedIncident* inc = dynamic_cast<const StoreClearedIncident*> (&incident)) { - if (inc->store() == m_activeStore->activeStore()) { - for (TileRawChannelContainer* rawChannelContainer : m_containers){ - for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) { - const_cast<TileRawChannelCollection*>(rawChannelCollection)->clear(); - } - } - } - } - } -}