ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
33
34// ============================================================================
35// TrigT1
36// ============================================================================
38// ============================================================================
39// xAOD
40// ============================================================================
44// ============================================================================
45// Local
46// ============================================================================
49// ============================================================================
50
51namespace LVL1BS {
53 : Converter(storageType(), classID(), svcloc),
54 AthMessaging(svcloc != 0 ? msgSvc() : 0, "L1TopoByteStreamAuxCnv"),
55 m_name("L1TopoByteStreamAuxCnv"),
56 m_readTool("L1TopoByteStreamTool/L1TopoByteStreamTool") {}
57
61
65
66// Init method gets all necessary services etc.
67
69 ATH_MSG_DEBUG("Initializing " << m_name);
70
71 CHECK(Converter::initialize());
72 CHECK(m_readTool.retrieve());
73
74 return StatusCode::SUCCESS;
75}
76
77// createObj should create the RDO from bytestream.
78StatusCode L1TopoByteStreamAuxCnv::createObj(IOpaqueAddress* pAddr,
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
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.
116StatusCode L1TopoByteStreamAuxCnv::createRep(DataObject* /*pObj*/,
117 IOpaqueAddress*& /*pAddr*/) {
118 return StatusCode::FAILURE;
119}
120
121} // end namespace
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
static Double_t sc
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
convert to and from a SG storable
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Container of L1TopoRDOs (standard Athena boilerplate)
std::string m_name
Converter name.
ToolHandle< L1TopoByteStreamTool > m_readTool
Do the main job - retrieve xAOD Topo from robs.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
L1TopoRawDataAuxContainer_v1 L1TopoRawDataAuxContainer
Define the latest version of the L1TopoRawData auxiliary container.
L1TopoRawData_v1 L1TopoRawData
Define the latest version of the L1TopoRawData class.
L1TopoRawDataContainer_v1 L1TopoRawDataContainer
Define the latest version of the L1TopoRawData container.