ATLAS Offline Software
Loading...
Searching...
No Matches
ByteStreamToRawEventAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <mutex>
7
9 ATH_CHECK(m_robsSvc.retrieve());
10 ATH_CHECK(m_byteStreamCnvSvc.retrieve());
11
13
14 return StatusCode::SUCCESS;
15}
16
17StatusCode ByteStreamToRawEventAlg::execute(const EventContext& ctx) const {
18 RawEventWrite rew;
19
21 for (std::string const & raw_container: m_RawContainers) {
22 ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, raw_container));
23 fea->fill(&rew, msg());
24 }
25
26 const uint32_t rawSize = rew.size_word();
27 ATH_MSG_DEBUG("rawSize after fill: " << rew.size_word() << " words");
28
29 Cache* event_cache = m_eventsCache.get(ctx);
30 { // lock scope
31 std::lock_guard<std::mutex> event_cache_lock(event_cache->m_mutex);
32
33 std::vector<uint32_t>& buffer = m_eventsCache.get(ctx)->m_data;
34 buffer.resize(rawSize);
35 const uint32_t count =
36 eformat::write::copy(*(rew.bind()), buffer.data(), rawSize);
37 if (count != rawSize) {
38 ATH_MSG_ERROR("Memcopy failed");
39 return StatusCode::FAILURE;
40 }
41
42 RawEvent* fullEvent = &(m_eventsCache.get(ctx)->m_event);
43 fullEvent->assign(buffer.data());
44 ATH_CHECK(fullEvent->check_tree_noex());
45 m_robsSvc->setNextEvent(ctx, fullEvent);
46 } // lock scope
47
48 // Clean for next event
49 for (std::string const & raw_container: m_RawContainers) {
50 ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, raw_container));
51 fea->clear();
52 }
53
54 return StatusCode::SUCCESS;
55}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition RawEvent.h:39
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< std::vector< std::string > > m_RawContainers
virtual StatusCode initialize() override
ServiceHandle< IROBDataProviderSvc > m_robsSvc
Template class for assembling a full atlas raw event from subfragments.
void clear()
Clear internal stack.
void fill(RawEventWrite *re, MsgStream &log)
Fill the FullEventFragment with all the ROD data stored in this.
Maintain a set of objects, one per slot.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
size_t getNSlots()
Return the number of event slots.