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  declareProperty( "TESVetoList", m_tesVetoList );
22 }
23 
24 // Initialize the instance.
26 {
28  if ( sc.isFailure() ) return sc;
29 
30  sc = toolSvc()->retrieveTool("DataSvcFileEntriesTool", "InputCopyStreamTool",
31  m_leavesTool);
32  return sc;
33 }
34 
35 // Finalize the instance.
37 {
39  m_leavesTool = nullptr;
40  return OutputStream::finalize();
41 }
42 
45 {
46  // Get the objects in the same file as the root node
47  try
48  {
49  // Get all the leaves on the input stream
51 
52  // Do we need to veto anything ?
53  if ( UNLIKELY( !m_tesVetoList.empty() ) )
54  {
55  // Veto out locations
56  IDataStoreLeaves::LeavesList filteredLeaves;
57  filteredLeaves.reserve( leaves.size() );
58  std::copy_if( leaves.begin(), leaves.end(),
59  std::back_inserter(filteredLeaves),
60  [&](IDataStoreLeaves::LeavesList::const_reference i) {
61  return i && i->registry() &&
64  i->registry()->identifier() ) == m_tesVetoList.end();
65 
66  });
67  // save the veto'ed list
68  m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
69 
70  }
71  else
72  {
73  // no veto'ing, so save everything
74  m_objects.assign( leaves.begin(), leaves.end() );
75  }
76  }
77  catch ( const GaudiException & e )
78  {
79  error() << e.message() << endmsg;
80  return StatusCode::FAILURE;
81  }
82 
83  // Collect the other objects from the transient store (mandatory and optional)
85 }
virtual const std::string & message() const
error message to be printed
#define UNLIKELY(x)
Definition: Kernel.h:126
T empty(T...args)
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:78
StatusCode finalize() override
Terminate OutputStream.
STL namespace.
T end(T...args)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
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:145
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
A small to stream Data I/O.
Definition: OutputStream.h:29
SmartIF< IToolSvc > & toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
std::vector< std::string > m_tesVetoList
Names of TES locations to Veto.
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.
T find(T...args)
T size(T...args)
T assign(T...args)
virtual const LeavesList & leaves() const =0
Return the list of leaves.
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:108
StatusCode collectObjects() override
Collect all objects to be written to the output stream.
list i
Definition: ana.py:128
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)