ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
ByteStreamCnvSvc
src
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
5
#include "
ByteStreamToRawEventAlg.h
"
6
#include <mutex>
7
8
StatusCode
ByteStreamToRawEventAlg::initialize
() {
9
ATH_CHECK
(
m_robsSvc
.retrieve());
10
ATH_CHECK
(
m_byteStreamCnvSvc
.retrieve());
11
12
m_eventsCache =
SG::SlotSpecificObj<Cache>
(
SG::getNSlots
());
13
14
return
StatusCode::SUCCESS;
15
}
16
17
StatusCode
ByteStreamToRawEventAlg::execute
(
const
EventContext& ctx)
const
{
18
RawEventWrite
rew;
19
20
FullEventAssembler<SrcIdMap>
* fea = 0;
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ByteStreamToRawEventAlg.h
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition
RawEvent.h:37
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
ByteStreamToRawEventAlg::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition
ByteStreamToRawEventAlg.h:37
ByteStreamToRawEventAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
ByteStreamToRawEventAlg.cxx:17
ByteStreamToRawEventAlg::m_RawContainers
Gaudi::Property< std::vector< std::string > > m_RawContainers
Definition
ByteStreamToRawEventAlg.h:43
ByteStreamToRawEventAlg::initialize
virtual StatusCode initialize() override
Definition
ByteStreamToRawEventAlg.cxx:8
ByteStreamToRawEventAlg::m_robsSvc
ServiceHandle< IROBDataProviderSvc > m_robsSvc
Definition
ByteStreamToRawEventAlg.h:40
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition
FullEventAssembler.h:38
FullEventAssembler::clear
void clear()
Clear internal stack.
FullEventAssembler::fill
void fill(RawEventWrite *re, MsgStream &log)
Fill the FullEventFragment with all the ROD data stored in this.
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition
AthenaKernel/AthenaKernel/SlotSpecificObj.h:84
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
SG::getNSlots
size_t getNSlots()
Return the number of event slots.
Definition
SlotSpecificObj.cxx:64
ByteStreamToRawEventAlg::Cache
Definition
ByteStreamToRawEventAlg.h:46
ByteStreamToRawEventAlg::Cache::m_mutex
std::mutex m_mutex
Definition
ByteStreamToRawEventAlg.h:47
Generated on
for ATLAS Offline Software by
1.17.0