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 // ============================================================================
19 
21 #include "ByteStreamData/ROBData.h"
22 
24 #include "GaudiKernel/DataObject.h"
25 #include "GaudiKernel/IOpaqueAddress.h"
26 #include "GaudiKernel/IRegistry.h"
27 #include "GaudiKernel/ISvcLocator.h"
28 #include "GaudiKernel/StatusCode.h"
29 
32 #include "StoreGate/StoreGateSvc.h"
33 
34 // ============================================================================
35 // TrigT1
36 // ============================================================================
38 // ============================================================================
39 // xAOD
40 // ============================================================================
44 // ============================================================================
45 // Local
46 // ============================================================================
47 #include "L1TopoByteStreamAuxCnv.h"
48 #include "L1TopoByteStreamTool.h"
49 // ============================================================================
50 
51 namespace LVL1BS {
53  : Converter(storageType(), classID(), svcloc),
54  AthMessaging(svcloc != 0 ? msgSvc() : 0, "L1TopoByteStreamAuxCnv"),
55  m_name("L1TopoByteStreamAuxCnv"),
56  m_readTool("L1TopoByteStreamTool/L1TopoByteStreamTool") {}
57 
60 }
61 
64 }
65 
66 // Init method gets all necessary services etc.
67 
69  ATH_MSG_DEBUG("Initializing " << m_name);
70 
72  CHECK(m_readTool.retrieve());
73 
74  return StatusCode::SUCCESS;
75 }
76 
77 // createObj should create the RDO from bytestream.
79  DataObject*& pObj) {
80  ATH_MSG_DEBUG("createObj() called");
81  // -------------------------------------------------------------------------
82  ByteStreamAddress* pBS_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
83  CHECK(pBS_Addr != nullptr);
84  // -------------------------------------------------------------------------
85  const std::string nm = *(pBS_Addr->par());
86  ATH_MSG_DEBUG("Creating Objects " << nm);
87 
88  auto aux = new xAOD::L1TopoRawDataAuxContainer;
89  xAOD::L1TopoRawDataContainer topoContainer;
90  topoContainer.setStore(aux);
91  // -------------------------------------------------------------------------
92  L1TopoRDOCollection topoRDOCollection;
93  StatusCode sc = m_readTool->convert(nm, &topoRDOCollection);
94  if (sc.isFailure()) {
95  ATH_MSG_ERROR("Failed to create objects");
96  delete aux;
97  return sc;
98  }
99 
100  for (auto topoRDO : topoRDOCollection) {
102  topoContainer.push_back(item);
103  item->initialize(topoRDO->getDataWords(), topoRDO->getStatusWords(),
104  topoRDO->getError(), topoRDO->getSourceID());
105  }
106 
107  // -------------------------------------------------------------------------
108  // ATH_MSG_VERBOSE(ToString(cpmCollection));
109  ATH_MSG_DEBUG("Number of readed Topo: " << aux->size());
110  // -------------------------------------------------------------------------
111  pObj = SG::asStorable(aux);
112  return StatusCode::SUCCESS;
113 }
114 
115 // createRep should create the bytestream from RDOs.
117  IOpaqueAddress*& /*pAddr*/) {
118  return StatusCode::FAILURE;
119 }
120 
121 } // end namespace
LVL1BS::L1TopoByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: L1TopoByteStreamAuxCnv.h:58
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:61
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
L1TopoRawDataAuxContainer.h
LVL1BS::L1TopoByteStreamAuxCnv::storageType
static long storageType()
Definition: L1TopoByteStreamAuxCnv.cxx:62
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1BS::L1TopoByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: L1TopoByteStreamAuxCnv.cxx:78
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:52
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:68
LVL1BS::L1TopoByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: L1TopoByteStreamAuxCnv.cxx:116
StoreGateSvc.h
LVL1BS::L1TopoByteStreamAuxCnv::classID
static const CLID & classID()
Definition: L1TopoByteStreamAuxCnv.cxx:58
xAOD::L1TopoRawDataAuxContainer
L1TopoRawDataAuxContainer_v1 L1TopoRawDataAuxContainer
Define the latest version of the L1TopoRawData auxiliary container.
Definition: L1TopoRawDataAuxContainer.h:13
IROBDataProviderSvc.h
L1TopoByteStreamTool.h