All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
InputCopyStream.cpp
Go to the documentation of this file.
1 // Framework include files
10 #include "InputCopyStream.h"
11 
12 // Define the algorithm factory for the standard output data writer
14 
15 // Standard Constructor
16 InputCopyStream::InputCopyStream(const std::string& name, ISvcLocator* pSvcLocator)
17  : OutputStream ( name, pSvcLocator)
18 {
19  m_doPreLoad = false;
20  m_doPreLoadOpt = false;
21 }
22 
23 // Initialize the instance.
25 {
27  if ( sc.isFailure() ) return sc;
28 
29  sc = toolSvc()->retrieveTool("DataSvcFileEntriesTool", "InputCopyStreamTool",
30  m_leavesTool);
31  return sc;
32 }
33 
34 // Finalize the instance.
36 {
38  m_leavesTool = nullptr;
39  return OutputStream::finalize();
40 }
41 
44 {
45  // Get the objects in the same file as the root node
46  try
47  {
48  // Get all the leaves on the input stream
50 
51  // Do we need to veto anything ?
52  if ( UNLIKELY( !m_tesVetoList.empty() ) )
53  {
54  // Veto out locations
55  IDataStoreLeaves::LeavesList filteredLeaves;
56  filteredLeaves.reserve( leaves.size() );
57  std::copy_if( leaves.begin(), leaves.end(),
58  std::back_inserter(filteredLeaves),
59  [&](IDataStoreLeaves::LeavesList::const_reference i) {
60  return i && i->registry() &&
61  std::find( m_tesVetoList.begin(),
62  m_tesVetoList.end(),
63  i->registry()->identifier() ) == m_tesVetoList.end();
64 
65  });
66  // save the veto'ed list
67  m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
68 
69  }
70  else
71  {
72  // no veto'ing, so save everything
73  m_objects.assign( leaves.begin(), leaves.end() );
74  }
75  }
76  catch ( const GaudiException & e )
77  {
78  error() << e.message() << endmsg;
79  return StatusCode::FAILURE;
80  }
81 
82  // Collect the other objects from the transient store (mandatory and optional)
84 }
virtual const LeavesList & leaves() const =0
Return the list of leaves.
virtual const std::string & message() const
error message to be printed
Extension of OutputStream to copy the content of the main input file.
T copy_if(T...args)
StatusCode initialize() override
Initialize the instance.
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:93
StatusCode finalize() override
Terminate OutputStream.
SmartIF< IToolSvc > & toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Definition: Algorithm.cpp:781
#define UNLIKELY(x)
Definition: Kernel.h:126
STL namespace.
T end(T...args)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
StatusCode retrieveTool(const std::string &type, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
Retrieve specified tool sub-type with tool dependent part of the name automatically assigned...
Definition: IToolSvc.h:146
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
A small to stream Data I/O.
Definition: OutputStream.h:29
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode initialize() override
Initialize OutputStream.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStoreLeaves * m_leavesTool
Pointer to the (public) tool used to retrieve the objects in a file.
Gaudi::Property< std::vector< std::string > > m_tesVetoList
T find(T...args)
T size(T...args)
T assign(T...args)
T begin(T...args)
T back_inserter(T...args)
StatusCode finalize() override
Finalize the instance.
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
void ignore() const
Definition: StatusCode.h:106
StatusCode collectObjects() override
Collect all objects to be written to the output stream.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
T reserve(T...args)