ATLAS Offline Software
Loading...
Searching...
No Matches
TileL2ContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
104 if(!pRE_Addr) {
105 ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
106 return StatusCode::FAILURE;
107 }
108
109 const RawEvent* re = m_robSvc->getEvent(Gaudi::Hive::currentContext());
110 if (!re) {
111 ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
112 return StatusCode::FAILURE;
113 }
114
115 TileL2Container* cont = m_queue.get (*m_decoder);
116
117 if (!m_decoder->convert(re, cont).isSuccess()) {
118 ATH_MSG_WARNING( "Conversion tool returned an error. TileL2Container might be empty." );
119 }
120
121 pObj = SG::asStorable( cont ) ;
122
123 return StatusCode::SUCCESS;
124}
125
126StatusCode TileL2ContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const
127{
128 // convert TileL2s in the container into ByteStream
129
130 ATH_MSG_DEBUG( " Executing createRep method" );
131
132 // get Full Event Assembler
134 std::string key("Tile");
135
136 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler(fea, key) );
137
138 // create TileL2Container
139 TileL2Container* l2cont(0);
140 SG::fromStorable(pObj, l2cont);
141 if(!l2cont){
142 ATH_MSG_ERROR( " Can not cast to TileL2Container " );
143 return StatusCode::FAILURE;
144 }
145
146 std::string name = pObj->registry()->name();
148
149 pAddr = addr;
150
151 // call TileL2ContByteStreamTool
152 ATH_CHECK( m_tool->convert(l2cont, fea) );
153
154 return StatusCode::SUCCESS;
155}
156
157
159{
160 return Converter::finalize();
161}
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.
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)