ATLAS Offline Software
ByteStreamOutputStreamCopyTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 
12 // Gaudi
13 #include "GaudiKernel/GaudiException.h"
14 #include "GaudiKernel/ISvcLocator.h"
15 
18  const std::string& type,
19  const std::string& name,
20  const IInterface* parent)
21  : base_class(type, name, parent),
22  m_outputSvc("ByteStreamEventStorageOutputSvc", name),
23  m_inputSvc("ByteStreamEventStorageInputSvc", name)
24 {
25  // Declare IAthenaOutputStreamTool interface
26  declareInterface<IAthenaOutputStreamTool>(this);
27  declareProperty("ByteStreamOutputSvc", m_outputSvc);
28  declareProperty("ByteStreamInputSvc", m_inputSvc);
29 }
30 
31 //__________________________________________________________________________
33 
34  ATH_MSG_INFO("Initializing");
35 
36  // retrieve services
37  ATH_CHECK( m_inputSvc.retrieve() );
38  ATH_CHECK( m_outputSvc.retrieve() );
39 
40  return StatusCode::SUCCESS;
41 }
42 
43 //__________________________________________________________________________
45  const std::string& /*cnvSvc*/,
46  bool /*extendProvenenceRecord*/) {
48  return StatusCode::SUCCESS;
49 }
50 //__________________________________________________________________________
51 StatusCode ByteStreamOutputStreamCopyTool::connectOutput(const std::string& /*outputName*/) {
53  return StatusCode::SUCCESS;
54 }
55 //__________________________________________________________________________
57 
58  ATH_MSG_DEBUG("In commitOutput");
59  const RawEvent* re = m_inputSvc->currentEvent() ;
60  if(!re){
61  ATH_MSG_ERROR(" failed to get the current event from ByteStreamInputSvc");
62  return StatusCode::FAILURE ;
63  }
64  if( ! m_outputSvc->putEvent(re) ) {
65  ATH_MSG_ERROR(" failed to write event to ByteStreamOutputSvc");
66  return StatusCode::FAILURE ;
67  }
68  ATH_MSG_DEBUG(" done in commitOutput");
69  return StatusCode::SUCCESS;
70 }
71 //__________________________________________________________________________
73  return StatusCode::SUCCESS;
74 }
75 //__________________________________________________________________________
76 StatusCode ByteStreamOutputStreamCopyTool::streamObjects(const TypeKeyPairs& typeKeys, const std::string&
77  /*outputName*/) {
78  if (typeKeys.size() != 0){
79  ATH_MSG_WARNING("Streaming objects is not supported. The whole input event is written out");
80  }
81  return StatusCode::SUCCESS;
82 }
83 //__________________________________________________________________________
84 StatusCode ByteStreamOutputStreamCopyTool::streamObjects(const DataObjectVec& dataObjects, const std::string&
85  /*outputName*/) {
86  if (dataObjects.size() != 0){
87  ATH_MSG_WARNING("Streaming objects is not supported. The whole input event is written out");
88  }
89  return StatusCode::SUCCESS;
90 }
91 //__________________________________________________________________________
93  return StatusCode::SUCCESS;
94 }
ByteStreamOutputStreamCopyTool::m_outputSvc
ServiceHandle< IByteStreamOutputSvc > m_outputSvc
Handle for BS output Svc.
Definition: ByteStreamOutputStreamCopyTool.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
ByteStreamOutputStreamCopyTool.h
Implementation of IAthenaOutputStreamTool for Copying ByteStream from input.
ByteStreamOutputStreamCopyTool::ByteStreamOutputStreamCopyTool
ByteStreamOutputStreamCopyTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: ByteStreamOutputStreamCopyTool.cxx:17
SG::IFolder
a run-time configurable list of data objects
Definition: SGIFolder.h:24
ByteStreamOutputStreamCopyTool::connectOutput
virtual StatusCode connectOutput(const std::string &outputName="") override
Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wan...
Definition: ByteStreamOutputStreamCopyTool.cxx:51
ByteStreamOutputStreamCopyTool::initialize
virtual StatusCode initialize() override
Initialize.
Definition: ByteStreamOutputStreamCopyTool.cxx:32
ByteStreamOutputStreamCopyTool::m_inputSvc
ServiceHandle< IByteStreamInputSvc > m_inputSvc
Handle for BS input Svc.
Definition: ByteStreamOutputStreamCopyTool.h:79
ByteStreamOutputStreamCopyTool::finalizeOutput
virtual StatusCode finalizeOutput() override
Finalize the output stream after the last commit, e.g.
Definition: ByteStreamOutputStreamCopyTool.cxx:72
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ByteStreamOutputStreamCopyTool::commitOutput
virtual StatusCode commitOutput(bool doCommit=false) override
Commit the output stream after having streamed out objects Must commitOutput AFTER streaming.
Definition: ByteStreamOutputStreamCopyTool.cxx:56
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamOutputStreamCopyTool::getInputItemList
virtual StatusCode getInputItemList(SG::IFolder *m_p2BWrittenFromTool) override
Get ItemList from the OutputStreamTool (e.g. all input objects)
Definition: ByteStreamOutputStreamCopyTool.cxx:92
ByteStreamOutputStreamCopyTool::connectServices
virtual StatusCode connectServices(const std::string &dataStore, const std::string &cnvSvc, bool extendProvenenceRecord=false) override
No need to connect Services.
Definition: ByteStreamOutputStreamCopyTool.cxx:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ByteStreamOutputStreamCopyTool::streamObjects
virtual StatusCode streamObjects(const TypeKeyPairs &typeKeys, const std::string &outputName="") override
No object written for this tool.
Definition: ByteStreamOutputStreamCopyTool.cxx:76
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
re
const boost::regex re(r_e)