ATLAS Offline Software
ByteStreamRDP_OutputSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //===================================================================
6 // Implementation of ByteStreamRDP_OutputSvc
7 // Initial implementation Jan 10, 2003
8 //
9 //===================================================================
10 //
11 
12 // Include files.
15 
16 // Constructor.
17 ByteStreamRDP_OutputSvc::ByteStreamRDP_OutputSvc(const std::string& name, ISvcLocator* svcloc)
18  : base_class(name, svcloc) {
20 }
21 
22 // Open the first input file and read the first event.
24  ATH_MSG_INFO("Initializing");
25 
26  // Retrieve ROBDataProviderSvc
27  ATH_CHECK( m_robProvider.retrieve() );
28 
29  return(StatusCode::SUCCESS);
30 }
31 
32 // Receive the next event without explicit context
34  return putEvent(re, Gaudi::Hive::currentContext());
35 }
36 
37 // Receive the next event
38 bool ByteStreamRDP_OutputSvc::putEvent(const RawEvent* re, const EventContext& ctx) {
39  EventCache* cache = m_eventsCache.get(ctx);
40  cache->releaseEvent();
41  const uint32_t reSize = re->fragment_size_word();
42  const uint32_t* reStart = re->start();
43  cache->dataBuffer = std::make_unique<uint32_t[]>(reSize);
44  std::copy(reStart, reStart+reSize, cache->dataBuffer.get());
45 
46  // Create a cached RawEvent object from the cached data buffer
47  cache->rawEvent = std::make_unique<RawEvent>(cache->dataBuffer.get());
48 
49  // Give the RawEvent to ROBDataProvider
50  m_robProvider->setNextEvent(ctx, cache->rawEvent.get());
51 
52  return true;
53 }
ByteStreamRDP_OutputSvc::putEvent
virtual bool putEvent(const RawEvent *re) override
Implementation of the IByteStreamOutputSvc interface methods.
Definition: ByteStreamRDP_OutputSvc.cxx:33
ByteStreamRDP_OutputSvc::EventCache::releaseEvent
void releaseEvent()
Definition: ByteStreamRDP_OutputSvc.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ByteStreamRDP_OutputSvc::EventCache
Definition: ByteStreamRDP_OutputSvc.h:39
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
ROBDataProviderSvc.h
ByteStreamRDP_OutputSvc::m_bsOutputStreamName
Gaudi::Property< std::string > m_bsOutputStreamName
Definition: ByteStreamRDP_OutputSvc.h:51
ByteStreamRDP_OutputSvc::EventCache::rawEvent
std::unique_ptr< RawEvent > rawEvent
Current event fragment.
Definition: ByteStreamRDP_OutputSvc.h:44
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamRDP_OutputSvc::m_robProvider
ServiceHandle< IROBDataProviderSvc > m_robProvider
Definition: ByteStreamRDP_OutputSvc.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ByteStreamRDP_OutputSvc::ByteStreamRDP_OutputSvc
ByteStreamRDP_OutputSvc(const std::string &name, ISvcLocator *svcloc)
Constructors:
Definition: ByteStreamRDP_OutputSvc.cxx:17
ByteStreamRDP_OutputSvc.h
ByteStreamRDP_OutputSvc::EventCache::dataBuffer
std::unique_ptr< uint32_t[]> dataBuffer
Underlying data structure.
Definition: ByteStreamRDP_OutputSvc.h:45
re
const boost::regex re(r_e)
ByteStreamRDP_OutputSvc::m_eventsCache
SG::SlotSpecificObj< EventCache > m_eventsCache
Cache of event data for each slot.
Definition: ByteStreamRDP_OutputSvc.h:47
ByteStreamRDP_OutputSvc::initialize
virtual StatusCode initialize() override
Required of all Gaudi Services.
Definition: ByteStreamRDP_OutputSvc.cxx:23
calibdata.copy
bool copy
Definition: calibdata.py:27