ATLAS Offline Software
L1TopoByteStreamAuxCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ============================================================================
6 // Includes
7 // ============================================================================
8 // STD
9 // ============================================================================
10 #include <vector>
11 #include <cstdint>
12 #include <memory>
13 #include <algorithm>
14 // ============================================================================
15 // Athena
16 // ============================================================================
20 
22 #include "ByteStreamData/ROBData.h"
23 
25 #include "GaudiKernel/DataObject.h"
26 #include "GaudiKernel/IOpaqueAddress.h"
27 #include "GaudiKernel/IRegistry.h"
28 #include "GaudiKernel/ISvcLocator.h"
29 #include "GaudiKernel/StatusCode.h"
30 
33 #include "StoreGate/StoreGateSvc.h"
34 
35 // ============================================================================
36 // TrigT1
37 // ============================================================================
39 // ============================================================================
40 // xAOD
41 // ============================================================================
45 // ============================================================================
46 // Local
47 // ============================================================================
48 #include "L1TopoByteStreamAuxCnv.h"
49 #include "L1TopoByteStreamTool.h"
50 // ============================================================================
51 
52 namespace LVL1BS {
54  : Converter(storageType(), classID(), svcloc),
55  AthMessaging(svcloc != 0 ? msgSvc() : 0, "L1TopoByteStreamAuxCnv"),
56  m_name("L1TopoByteStreamAuxCnv"),
57  m_readTool("L1TopoByteStreamTool/L1TopoByteStreamTool") {}
58 
61 }
62 
65 }
66 
67 // Init method gets all necessary services etc.
68 
70  ATH_MSG_DEBUG("Initializing " << m_name);
71 
73  CHECK(m_readTool.retrieve());
74 
75  return StatusCode::SUCCESS;
76 }
77 
78 // createObj should create the RDO from bytestream.
80  DataObject*& pObj) {
81  ATH_MSG_DEBUG("createObj() called");
82  // -------------------------------------------------------------------------
83  ByteStreamAddress* pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
84  CHECK(pBS_Addr != nullptr);
85  // -------------------------------------------------------------------------
86  const std::string nm = *(pBS_Addr->par());
87  ATH_MSG_DEBUG("Creating Objects " << nm);
88 
89  auto aux = new xAOD::L1TopoRawDataAuxContainer;
90  xAOD::L1TopoRawDataContainer topoContainer;
91  topoContainer.setStore(aux);
92  // -------------------------------------------------------------------------
93  L1TopoRDOCollection topoRDOCollection;
94  StatusCode sc = m_readTool->convert(nm, &topoRDOCollection);
95  if (sc.isFailure()) {
96  ATH_MSG_ERROR("Failed to create objects");
97  delete aux;
98  return sc;
99  }
100 
101  for (auto topoRDO : topoRDOCollection) {
103  topoContainer.push_back(item);
104  item->initialize(topoRDO->getDataWords(), topoRDO->getStatusWords(),
105  topoRDO->getError(), topoRDO->getSourceID());
106  }
107 
108  // -------------------------------------------------------------------------
109  // ATH_MSG_VERBOSE(ToString(cpmCollection));
110  ATH_MSG_DEBUG("Number of readed Topo: " << aux->size());
111  // -------------------------------------------------------------------------
112  pObj = SG::asStorable(aux);
113  return StatusCode::SUCCESS;
114 }
115 
116 // createRep should create the bytestream from RDOs.
118  IOpaqueAddress*& /*pAddr*/) {
119  return StatusCode::FAILURE;
120 }
121 
122 } // end namespace
LVL1BS::L1TopoByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: L1TopoByteStreamAuxCnv.h:59
StorableConversions.h
convert to and from a SG storable
ROBData.h
Defines the ROB data entity. The ROB data is an abstract entity that is used to discase the raw event...
initialize
void initialize()
Definition: run_EoverP.cxx:894
LVL1BS::L1TopoByteStreamAuxCnv::m_readTool
ToolHandle< L1TopoByteStreamTool > m_readTool
Do the main job - retrieve xAOD Topo from robs.
Definition: L1TopoByteStreamAuxCnv.h:62
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
IByteStreamEventAccess.h
L1TopoRawDataAuxContainer.h
LVL1BS::L1TopoByteStreamAuxCnv::storageType
static long storageType()
Definition: L1TopoByteStreamAuxCnv.cxx:63
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1BS::L1TopoByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: L1TopoByteStreamAuxCnv.cxx:79
L1TopoRawDataContainer.h
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
LVL1BS::L1TopoByteStreamAuxCnv::L1TopoByteStreamAuxCnv
L1TopoByteStreamAuxCnv(ISvcLocator *svcloc)
Definition: L1TopoByteStreamAuxCnv.cxx:53
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::L1TopoRawData_v1
Description of L1TopoRawData_v1.
Definition: L1TopoRawData_v1.h:28
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
L1TopoRDOCollection.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ByteStreamAddress.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
L1TopoRDOCollection
Container of L1TopoRDOs (standard Athena boilerplate)
Definition: L1TopoRDOCollection.h:13
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
Converter
Definition: Converter.h:27
L1TopoByteStreamAuxCnv.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
item
Definition: ItemListSvc.h:43
L1TopoRawData.h
xAOD::L1TopoRawData
L1TopoRawData_v1 L1TopoRawData
Define the latest version of the L1TopoRawData class.
Definition: L1TopoRawData.h:14
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::L1TopoByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition: L1TopoByteStreamAuxCnv.cxx:69
LVL1BS::L1TopoByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: L1TopoByteStreamAuxCnv.cxx:117
StoreGateSvc.h
LVL1BS::L1TopoByteStreamAuxCnv::classID
static const CLID & classID()
Definition: L1TopoByteStreamAuxCnv.cxx:59
xAOD::L1TopoRawDataAuxContainer
L1TopoRawDataAuxContainer_v1 L1TopoRawDataAuxContainer
Define the latest version of the L1TopoRawData auxiliary container.
Definition: L1TopoRawDataAuxContainer.h:13
IROBDataProviderSvc.h
L1TopoByteStreamTool.h