The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
InputCopyStream.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11// Framework include files
12#include "InputCopyStream.h"
21
22// Define the algorithm factory for the standard output data writer
24
25// Standard Constructor
26InputCopyStream::InputCopyStream( const std::string& name, ISvcLocator* pSvcLocator )
27 : OutputStream( name, pSvcLocator ) {
28 m_doPreLoad = false;
29 m_doPreLoadOpt = false;
30}
31
32// Initialize the instance.
35 if ( sc.isFailure() ) return sc;
36
37 sc = toolSvc()->retrieveTool( "DataSvcFileEntriesTool", "InputCopyStreamTool", m_leavesTool );
38 return sc;
39}
40
41// Finalize the instance.
47
50 // Get the objects in the same file as the root node
51 try {
52 // Get all the leaves on the input stream
53 const IDataStoreLeaves::LeavesList& leaves = m_leavesTool->leaves();
54
55 // Do we need to veto anything ?
56 if ( !m_tesVetoList.empty() ) {
57 // Veto out locations
58 IDataStoreLeaves::LeavesList filteredLeaves;
59 filteredLeaves.reserve( leaves.size() );
60 std::copy_if( leaves.begin(), leaves.end(), std::back_inserter( filteredLeaves ),
61 [&]( IDataStoreLeaves::LeavesList::const_reference i ) {
62 return i && i->registry() &&
63 std::find( m_tesVetoList.begin(), m_tesVetoList.end(), i->registry()->identifier() ) ==
64 m_tesVetoList.end();
65 } );
66 // save the veto'ed list
67 m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
68
69 } else {
70 // no veto'ing, so save everything
71 m_objects.assign( leaves.begin(), leaves.end() );
72 }
73 } catch ( const GaudiException& e ) {
74 error() << e.message() << endmsg;
76 }
77
78 // Collect the other objects from the transient store (mandatory and optional)
80}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
const std::string & name() const override
The identifying name of the algorithm object.
SmartIF< IToolSvc > & toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Define general base for Gaudi exception.
virtual const std::string & message() const
error message to be printed
std::vector< DataObject * > LeavesList
Returned type.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
StatusCode retrieveTool(std::string_view 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:147
Extension of OutputStream to copy the content of the main input file.
StatusCode finalize() override
Finalize the instance.
StatusCode initialize() override
Initialize the instance.
InputCopyStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
IDataStoreLeaves * m_leavesTool
Pointer to the (public) tool used to retrieve the objects in a file.
Gaudi::Property< std::vector< std::string > > m_tesVetoList
StatusCode collectObjects() override
Collect all objects to be written to the output stream.
A small to stream Data I/O.
Gaudi::Property< bool > m_doPreLoadOpt
StatusCode finalize() override
Terminate OutputStream.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
IDataSelector m_objects
Collection of objects being selected.
StatusCode initialize() override
Initialize OutputStream.
Gaudi::Property< bool > m_doPreLoad
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:129
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
constexpr static const auto FAILURE
Definition StatusCode.h:100
STL namespace.