All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  m_leavesTool ( NULL ),
19  m_tesVetoList ( )
20 {
21  m_doPreLoad = false;
22  m_doPreLoadOpt = false;
23  declareProperty( "TESVetoList", m_tesVetoList );
24 }
25 
26 // Standard Destructor
28 
29 // Initialize the instance.
31 {
33  if ( sc.isFailure() ) return sc;
34 
35  sc = toolSvc()->retrieveTool("DataSvcFileEntriesTool", "InputCopyStreamTool",
36  m_leavesTool);
37 
38  return sc;
39 }
40 
41 // Finalize the instance.
43 {
44  toolSvc()->releaseTool(m_leavesTool).ignore();
45  m_leavesTool = NULL;
46  return OutputStream::finalize();
47 }
48 
51 {
52  // Get the objects in the same file as the root node
53  try
54  {
55  // Get all the leaves on the input stream
57 
58  // Do we need to veto anything ?
59  if ( UNLIKELY( !m_tesVetoList.empty() ) )
60  {
61  // Veto out locations
62  IDataStoreLeaves::LeavesList filteredLeaves;
63  filteredLeaves.reserve( leaves.size() );
64  for ( IDataStoreLeaves::LeavesList::const_iterator iL = leaves.begin();
65  iL != leaves.end(); ++iL )
66  {
67  if ( *iL && (*iL)->registry() )
68  {
69  if ( std::find( m_tesVetoList.begin(),
70  m_tesVetoList.end(),
71  (*iL)->registry()->identifier() ) == m_tesVetoList.end() )
72  {
73  filteredLeaves.push_back( (*iL) );
74  }
75  }
76  }
77 
78  // saved the veto'ed list
79  m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
80 
81  }
82  else
83  {
84  // no veto'ing, so save everything
85  m_objects.assign( leaves.begin(), leaves.end() );
86  }
87  }
88  catch ( const GaudiException & e )
89  {
90  MsgStream log(msgSvc(), name());
91  log << MSG::ERROR << e.message() << endmsg;
92  return StatusCode::FAILURE;
93  }
94 
95  // Collect the other objects from the transient store (mandatory and optional)
97 }
virtual const std::string & message() const
error message to be printed
#define UNLIKELY(x)
Definition: Kernel.h:127
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalize()
Finalize the instance.
Extension of OutputStream to copy the content of the main input file.
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:26
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
virtual StatusCode initialize()
Initialize the instance.
virtual ~InputCopyStream()
Standard Destructor.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
std::vector< DataObject * > LeavesList
Returned type.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
A small to stream Data I/O.
Definition: OutputStream.h:27
SmartIF< IToolSvc > & toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
std::vector< std::string > m_tesVetoList
Names of TES locations to Veto.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
IDataStoreLeaves * m_leavesTool
Pointer to the (public) tool used to retrieve the objects in a file.
virtual StatusCode finalize()
Terminate OutputStream.
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
virtual const LeavesList & leaves() const =0
Return the list of leaves.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
virtual StatusCode initialize()
Initialize OutputStream.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244