ATLAS Offline Software
LUCID_ByteStreamRawDataCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
8 
10 
11 LUCID_ByteStreamRawDataCnv::LUCID_ByteStreamRawDataCnv(const std::string& name, ISvcLocator* pSvcLocator):
12  AthReentrantAlgorithm (name , pSvcLocator),
13  m_robDataProvider("ROBDataProviderSvc", name) {
14 }
15 
17 
19 
20  ATH_MSG_INFO("LUCID_ByteStreamRawDataCnv::initialize");
21 
22  StatusCode sc = m_robDataProvider.retrieve();
23 
24  if (sc.isFailure()) ATH_MSG_WARNING(" Could not retrieve ROBDataProviderSvc ");
25  else ATH_MSG_DEBUG (" Retrieved service ROBDataProviderSvc ");
26 
27  ATH_CHECK( m_lucid_RawDataContainerKey.initialize() );
28 
29  return StatusCode::SUCCESS;
30 }
31 
32 StatusCode LUCID_ByteStreamRawDataCnv::execute(const EventContext& ctx) const{
33 
34  ATH_MSG_DEBUG(" LUCID_ByteStreamRawDataCnv::execute ");
35 
36  std::vector<const ROBFragment*> listOfRobf;
37  std::vector<unsigned int> ROBIDs;
38 
39  ROBIDs.push_back(m_rodDecoder.getSourceID());
40 
41  m_robDataProvider->getROBData(ctx, ROBIDs, listOfRobf);
42 
43  auto container = std::make_unique<LUCID_RawDataContainer>();
44 
45  StatusCode sc = fillContainer(listOfRobf, *container);
46 
47  if (sc.isFailure()) ATH_MSG_WARNING(" fillContainer failed ");
48  else ATH_MSG_DEBUG (" fillContainer success ");
49 
50  ATH_CHECK( SG::makeHandle (m_lucid_RawDataContainerKey, ctx).record (std::move (container)) );
51 
52  return StatusCode::SUCCESS;
53 }
54 
56 LUCID_ByteStreamRawDataCnv::fillContainer(const std::vector<const ROBFragment*>& listOfRobf,
57  LUCID_RawDataContainer& container) const {
58 
59  ATH_MSG_DEBUG(" LUCID_ByteStreamRawDataCnv::fillContainer ");
60 
61  int nLucidFragments = listOfRobf.size();
62 
63  ATH_MSG_DEBUG(" Number of LUCID ROB fragments: " << nLucidFragments);
64 
65  if (!nLucidFragments) return StatusCode::SUCCESS;
66 
67  for (const ROBFragment* frag : listOfRobf) {
68 
69  uint32_t robid = frag->rod_source_id();
70 
71  ATH_MSG_DEBUG(" ROB Fragment with ID: " << std::hex << robid << std::dec);
72 
73  std::vector<uint32_t> data_block;
74 
75  StatusCode sc = m_rodDecoder.decode(frag, data_block, msg());
76 
77  if (sc.isFailure()) ATH_MSG_WARNING(" Conversion from ByteStream to RawData failed ");
78  else {
79 
80  ATH_MSG_DEBUG(" Number of data_block elements: " << data_block.size());
81 
82  LUCID_RawData* lrd = new LUCID_RawData(data_block);
83 
84  ATH_MSG_DEBUG(lrd->str());
85 
86  lrd->decodeLumatMapping();
87 
88  container.push_back(lrd);
89  }
90  }
91 
92  for (const LUCID_RawData* data : container)
93  ATH_MSG_DEBUG(data->str());
94 
95  return StatusCode::SUCCESS;
96 }
97 
99 
100  ATH_MSG_INFO(" LUCID_ByteStreamRawDataCnv::finalize ");
101 
102  return StatusCode::SUCCESS;
103 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LUCID_ByteStreamRawDataCnv::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: LUCID_ByteStreamRawDataCnv.cxx:32
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LUCID_RawData::decodeLumatMapping
void decodeLumatMapping(void)
Definition: LUCID_RawData.cxx:205
LUCID_RawData
Definition: LUCID_RawData.h:40
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
WriteHandle.h
Handle class for recording to StoreGate.
LUCID_RawData::str
std::string str() const
Definition: LUCID_RawData.h:129
LUCID_RawDataContainer
Definition: LUCID_RawDataContainer.h:12
LUCID_ByteStreamRawDataCnv.h
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
LUCID_ByteStreamRawDataCnv::~LUCID_ByteStreamRawDataCnv
virtual ~LUCID_ByteStreamRawDataCnv()
Definition: LUCID_ByteStreamRawDataCnv.cxx:16
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
NSWL1::PadTriggerAdapter::fillContainer
StatusCode fillContainer(const std::unique_ptr< Muon::NSW_PadTriggerDataContainer > &out, const std::vector< std::unique_ptr< NSWL1::PadTrigger >> &triggers, const uint32_t l1id)
Definition: PadTriggerAdapter.cxx:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition: RawEvent.h:27
LUCID_ByteStreamRawDataCnv::fillContainer
StatusCode fillContainer(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &, LUCID_RawDataContainer &container) const
Definition: LUCID_ByteStreamRawDataCnv.cxx:56
LUCID_ByteStreamRawDataCnv.LUCID_ByteStreamRawDataCnv
LUCID_ByteStreamRawDataCnv
Definition: LUCID_ByteStreamRawDataCnv.py:8
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
LUCID_ByteStreamRawDataCnv::finalize
virtual StatusCode finalize() override
Definition: LUCID_ByteStreamRawDataCnv.cxx:98
LUCID_ByteStreamRawDataCnv::initialize
virtual StatusCode initialize() override
Definition: LUCID_ByteStreamRawDataCnv.cxx:18