2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
8 #include "ByteStreamCnvSvcBase/ByteStreamAddress.h"
9 #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
11 #include "ByteStreamData/RawEvent.h"
12 #include "ByteStreamData/ROBData.h"
14 #include "AthenaKernel/errorcheck.h"
15 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/IOpaqueAddress.h"
17 #include "GaudiKernel/IRegistry.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/StatusCode.h"
21 #include "AthenaKernel/ClassID_traits.h"
22 #include "AthenaKernel/StorableConversions.h"
23 #include "StoreGate/StoreGateSvc.h"
26 #include "../ToString.h"
27 #include "L1CaloByteStreamReadTool.h"
31 template<typename ContainerT, typename AuxContainerT>
32 L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::L1CaloByteStreamAuxCnv(ISvcLocator* svcloc) :
33 Converter(storageType(), classID(), svcloc),
34 AthMessaging(svcloc != 0 ? msgSvc() : 0, "L1CaloByteStreamAuxCnv"),
35 m_name("L1CaloByteStreamAuxCnv"),
36 m_readTool("LVL1BS::L1CaloByteStreamReadTool/L1CaloByteStreamReadTool") {
41 template<typename ContainerT, typename AuxContainerT>
42 const CLID& L1CaloByteStreamAuxCnv<ContainerT,AuxContainerT>::classID() {
43 return ClassID_traits<ContainerT>::ID();
46 long L1CaloByteStreamAuxCnv<ContainerT,AuxContainerT>::storageType()
48 return ByteStreamAddress::storageType();
51 // Init method gets all necessary services etc.
54 template<typename ContainerT, typename AuxContainerT>
55 StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::initialize() {
56 ATH_MSG_DEBUG("Initializing " << m_name);
58 CHECK(Converter::initialize());
59 CHECK(m_readTool.retrieve());
61 return StatusCode::SUCCESS;
64 // createObj should create the RDO from bytestream.
66 template<typename ContainerT, typename AuxContainerT>
67 StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::createObj(IOpaqueAddress* pAddr,
69 ATH_MSG_DEBUG("createObj() called");
70 // -------------------------------------------------------------------------
71 ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
72 CHECK(pBS_Addr != nullptr);
73 // -------------------------------------------------------------------------
74 const std::string nm = *(pBS_Addr->par());
75 ATH_MSG_DEBUG("Creating Objects " << nm);
77 AuxContainerT* aux = new AuxContainerT();
78 ContainerT* const ttCollection = new ContainerT();
79 ttCollection->setStore(aux);
81 StatusCode sc = m_readTool->convert(ttCollection);
83 ATH_MSG_ERROR("Failed to create Objects");
87 ATH_MSG_VERBOSE(ToString(*ttCollection));
88 ATH_MSG_DEBUG("Number of readed objects: " << ttCollection->size());
91 pObj = SG::asStorable(aux);
93 return StatusCode::SUCCESS;
96 // createRep should create the bytestream from RDOs.
98 template<typename ContainerT, typename AuxContainerT>
99 StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::createRep(DataObject* /*pObj*/,
100 IOpaqueAddress*& /*pAddr*/) {
101 return StatusCode::FAILURE;