| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
2 #include "GaudiKernel/IRegistry.h"
3 #include "GaudiKernel/IDataManagerSvc.h"
4 #include "GaudiKernel/IDataProviderSvc.h"
5 #include "GaudiKernel/IOpaqueAddress.h"
6 #include "GaudiKernel/DataStoreItem.h"
7 #include "GaudiKernel/DataObject.h"
8 #include "GaudiKernel/IDataStoreLeaves.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "InputCopyStream.h"
11
12 // Define the algorithm factory for the standard output data writer
13 DECLARE_COMPONENT(InputCopyStream)
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
27 InputCopyStream::~InputCopyStream() { }
28
29 // Initialize the instance.
30 StatusCode InputCopyStream::initialize()
31 {
32 StatusCode sc = OutputStream::initialize();
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.
42 StatusCode InputCopyStream::finalize()
43 {
44 toolSvc()->releaseTool(m_leavesTool).ignore();
45 m_leavesTool = NULL;
46 return OutputStream::finalize();
47 }
48
50 StatusCode InputCopyStream::collectObjects()
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
56 const IDataStoreLeaves::LeavesList & leaves = m_leavesTool->leaves();
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)
96 return OutputStream::collectObjects();
97 }