ATLAS Offline Software
Loading...
Searching...
No Matches
TileL2ContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi includes
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/StatusCode.h"
8#include "GaudiKernel/DataObject.h"
9#include "GaudiKernel/IRegistry.h"
10#include "GaudiKernel/IToolSvc.h"
11
12// Athena includes
14
20
23
24// Tile includes
30
31
32#include <string>
33
34
36{
37 this->reserve(256);
38 for(int i = 0; i < 256; ++i) {
39 int collId = decoder.hashFunc()->identifier(i);
40 this->push_back (std::make_unique<TileL2> (collId));
41 }
42}
43
44
53{
54 for (TileL2* elt : *this) {
55 elt->clear();
56 }
57}
58
59
61 : AthConstConverter(storageType(), classID(), svcloc, "TileL2ContByteStreamCnv")
62 , m_tool("TileL2ContByteStreamTool")
63 , m_byteStreamCnvSvc("ByteStreamCnvSvc", name())
64 , m_storeGate("StoreGateSvc", name())
65 , m_robSvc("ROBDataProviderSvc", name())
66 , m_decoder("TileROD_Decoder")
67 , m_hid2re(0)
68{
69}
70
72
74
76
77 ATH_CHECK(Converter::initialize());
78
79 ATH_MSG_DEBUG(" initialize ");
80
81 // Get ByteStreamCnvSvc
82 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
83
84 // retrieve Tool
85 ATH_CHECK( m_decoder.retrieve() );
86 m_hid2re = m_decoder->getHid2re();
87
88 ATH_CHECK( m_tool.retrieve() );
89
90 ATH_CHECK( m_robSvc.retrieve() );
91
92 ATH_CHECK( m_storeGate.retrieve() );
93
94 return StatusCode::SUCCESS ;
95}
96
97
98StatusCode TileL2ContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
99{
100 ATH_MSG_DEBUG( " Executing createObj method" );
101
102 ByteStreamAddress* pRE_Addr{};
103 ATH_CHECK( (pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr)) != nullptr );
104
105 const EventContext& ctx = pRE_Addr->getEventContext();
106 const RawEvent* re = m_robSvc->getEvent(ctx);
107 if (!re) {
108 ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
109 return StatusCode::FAILURE;
110 }
111
112 TileL2Container* cont = m_queue.get (*m_decoder);
113
114 if (!m_decoder->convert(re, cont).isSuccess()) {
115 ATH_MSG_WARNING( "Conversion tool returned an error. TileL2Container might be empty." );
116 }
117
118 pObj = SG::asStorable( cont ) ;
119
120 return StatusCode::SUCCESS;
121}
122
123StatusCode TileL2ContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const
124{
125 // convert TileL2s in the container into ByteStream
126
127 ATH_MSG_DEBUG( " Executing createRep method" );
128
129 // get Full Event Assembler
131 std::string key("Tile");
132
133 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler(fea, key) );
134
135 // create TileL2Container
136 TileL2Container* l2cont(0);
137 SG::fromStorable(pObj, l2cont);
138 if(!l2cont){
139 ATH_MSG_ERROR( " Can not cast to TileL2Container " );
140 return StatusCode::FAILURE;
141 }
142
143 std::string name = pObj->registry()->name();
145
146 pAddr = addr;
147
148 // call TileL2ContByteStreamTool
149 ATH_CHECK( m_tool->convert(l2cont, fea) );
150
151 return StatusCode::SUCCESS;
152}
153
154
156{
157 return Converter::finalize();
158}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
macros to associate a CLID to a type
Helpers for checking error return status codes and reporting errors.
uint32_t CLID
The Class ID type.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
Incident sent after a store is cleared.
TileContainer< TileL2 > TileL2Container
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
const std::string & name() const
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
const EventContext & getEventContext() const
static constexpr long storageType()
void reserve(size_type n)
value_type push_back(value_type pElem)
Template class for assembling a full atlas raw event from subfragments.
const TileHid2RESrcID * m_hid2re
Pointer to TileHid2RESrcID.
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
ServiceHandle< IROBDataProviderSvc > m_robSvc
Pointer to IROBDataProviderSvc.
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
TileL2ContByteStreamCnv(ISvcLocator *svcloc)
ToolHandle< TileROD_Decoder > m_decoder
Pointer to TileROD_Decoder.
virtual StatusCode finalize() override
ToolHandle< BYTESTREAMTOOL > m_tool
ServiceHandle< StoreGateSvc > m_storeGate
Pointer to StoreGateSvc.
virtual StatusCode initialize() override
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition TileL2.h:33
void clear()
Clear all vectors in TileL2.
Definition TileL2.cxx:104
Decodes the different TileCal ROD subfragment types in bytestream data and fills TileDigitsContainer,...
TileRecyclableL2Container(const TileROD_Decoder &decoder)
void recycle()
Recycle this object for use in another event.
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)