ATLAS Offline Software
RodHeaderByteStreamAuxCnv.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 // ============================================================================
48 #include "../RodHeaderByteStreamTool.h"
49 #include "../ToString.h"
50 // ============================================================================
51 
52 namespace LVL1BS {
54  Converter(storageType(), classID(), svcloc),
55  AthMessaging(svcloc != 0 ? msgSvc() : 0, "RodHeaderByteStreamAuxCnv"),
56  m_name("RodHeaderByteStreamAuxCnv"),
57  m_readTool("LVL1BS::RodHeaderByteStreamTool/RodHeaderByteStreamTool")
58 {
59 }
60 
63 }
64 
66 {
68 }
69 
70 // Init method gets all necessary services etc.
71 
73  ATH_MSG_DEBUG("Initializing " << m_name);
74 
76  CHECK(m_readTool.retrieve());
77 
78  return StatusCode::SUCCESS;
79 }
80 
81 // createObj should create the RDO from bytestream.
83  DataObject*& pObj) {
84  ATH_MSG_DEBUG("createObj() called");
85  // -------------------------------------------------------------------------
86  ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
87  CHECK(pBS_Addr != nullptr);
88  // -------------------------------------------------------------------------
89  const std::string nm = *(pBS_Addr->par());
90  ATH_MSG_DEBUG("Creating Objects " << nm);
91 
92  auto aux = new xAOD::RODHeaderAuxContainer;
93  xAOD::RODHeaderContainer container;
94  container.setStore(aux);
95  // -------------------------------------------------------------------------
97  StatusCode sc = m_readTool->convert(nm, &vec);
98  if (sc.isFailure()) {
99  ATH_MSG_ERROR("Failed to create objects");
100  delete aux;
101  return sc;
102  }
103 
104  for (auto source : vec) {
106  container.push_back(item);
107  item->initialize(source->version(), source->sourceID(), source->run(),
108  source->l1ID(), source->bunchCrossing(), source->l1TriggerType(),
109  source->detEventType(), source->statusWords(), source->payloadSize());
110  }
111 
112  // -------------------------------------------------------------------------
113  //ATH_MSG_VERBOSE(ToString(container));
114  ATH_MSG_DEBUG("Number of readed RODHeaders: " << aux->size());
115  // -------------------------------------------------------------------------
116  pObj = SG::asStorable(aux);
117  return StatusCode::SUCCESS;
118 }
119 
120 // createRep should create the bytestream from RDOs.
122  IOpaqueAddress*& /*pAddr*/) {
123  return StatusCode::FAILURE;
124 }
125 
126 } // end namespace
LVL1BS::RodHeaderByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: RodHeaderByteStreamAuxCnv.cxx:82
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
RODHeader.h
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
RODHeaderContainer.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
RODHeader.h
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
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
LVL1BS::RodHeaderByteStreamAuxCnv::RodHeaderByteStreamAuxCnv
RodHeaderByteStreamAuxCnv(ISvcLocator *svcloc)
Definition: RodHeaderByteStreamAuxCnv.cxx:53
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
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
xAOD::RODHeaderAuxContainer
RODHeaderAuxContainer_v2 RODHeaderAuxContainer
Define the latest version of the RODHeader auxiliary container.
Definition: RODHeaderAuxContainer.h:13
ByteStreamAddress.h
xAOD::RODHeader_v2
Description of RODHeader_v2.
Definition: RODHeader_v2.h:23
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
LVL1BS::RodHeaderByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: RodHeaderByteStreamAuxCnv.cxx:121
RodHeaderByteStreamAuxCnv.h
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
Converter
Definition: Converter.h:27
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
xAOD::RODHeader
RODHeader_v2 RODHeader
Define the latest version of the RODHeader class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/RODHeader.h:14
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
LVL1BS::RodHeaderByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition: RodHeaderByteStreamAuxCnv.cxx:72
LVL1BS::RodHeaderByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: RodHeaderByteStreamAuxCnv.h:56
LVL1BS::RodHeaderByteStreamAuxCnv::storageType
static long storageType()
Definition: RodHeaderByteStreamAuxCnv.cxx:65
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
RODHeaderAuxContainer.h
copySelective.source
string source
Definition: copySelective.py:32
LVL1BS::RodHeaderByteStreamAuxCnv::classID
static const CLID & classID()
Definition: RodHeaderByteStreamAuxCnv.cxx:61
LVL1BS::RodHeaderByteStreamAuxCnv::m_readTool
ToolHandle< RodHeaderByteStreamTool > m_readTool
Do the main job - retrieve objects from robs.
Definition: RodHeaderByteStreamAuxCnv.h:59
StoreGateSvc.h
IROBDataProviderSvc.h