ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloByteStreamAuxCnv.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <vector>
6#include <stdint.h>
7
8#include "ByteStreamCnvSvcBase/ByteStreamAddress.h"
9#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
10
11#include "ByteStreamData/RawEvent.h"
12#include "ByteStreamData/ROBData.h"
13
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"
20
21#include "AthenaKernel/ClassID_traits.h"
22#include "AthenaKernel/StorableConversions.h"
23#include "StoreGate/StoreGateSvc.h"
24
25
26#include "../ToString.h"
27#include "L1CaloByteStreamReadTool.h"
28
29namespace LVL1BS {
30
31template<typename ContainerT, typename AuxContainerT>
32L1CaloByteStreamAuxCnv<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") {
37
38}
39
40// CLID
41template<typename ContainerT, typename AuxContainerT>
42const CLID& L1CaloByteStreamAuxCnv<ContainerT,AuxContainerT>::classID() {
43 return ClassID_traits<ContainerT>::ID();
44}
45
46long L1CaloByteStreamAuxCnv<ContainerT,AuxContainerT>::storageType()
47{
48 return ByteStreamAddress::storageType();
49}
50
51// Init method gets all necessary services etc.
52
53
54template<typename ContainerT, typename AuxContainerT>
55StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::initialize() {
56 ATH_MSG_DEBUG("Initializing " << m_name);
57
58 CHECK(Converter::initialize());
59 CHECK(m_readTool.retrieve());
60
61 return StatusCode::SUCCESS;
62}
63
64// createObj should create the RDO from bytestream.
65
66template<typename ContainerT, typename AuxContainerT>
67StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::createObj(IOpaqueAddress* pAddr,
68 DataObject*& pObj) {
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);
76
77 AuxContainerT* aux = new AuxContainerT();
78 ContainerT* const ttCollection = new ContainerT();
79 ttCollection->setStore(aux);
80
81 StatusCode sc = m_readTool->convert(ttCollection);
82 if (sc.isFailure()) {
83 ATH_MSG_ERROR("Failed to create Objects");
84 delete ttCollection;
85 return sc;
86 }
87 ATH_MSG_VERBOSE(ToString(*ttCollection));
88 ATH_MSG_DEBUG("Number of readed objects: " << ttCollection->size());
89
90
91 pObj = SG::asStorable(aux);
92
93 return StatusCode::SUCCESS;
94}
95
96// createRep should create the bytestream from RDOs.
97
98template<typename ContainerT, typename AuxContainerT>
99StatusCode L1CaloByteStreamAuxCnv<ContainerT, AuxContainerT>::createRep(DataObject* /*pObj*/,
100 IOpaqueAddress*& /*pAddr*/) {
101 return StatusCode::FAILURE;
102}
103
104} // end namespace