The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
CopyInputStream.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 "OutputStream.h"
22
24
25public:
27 CopyInputStream( const std::string& name, ISvcLocator* pSvcLocator );
28
30 StatusCode collectObjects() override;
31
32private:
33 Gaudi::Property<std::vector<std::string>> m_tesVetoList{ this, "TESVetoList", {}, "names of TES locations to Veto" };
34
36 "/Event/InputFileLeaves" };
37
38protected:
40 bool hasInput() const override { return true; }
41};
42
43// implementation
44
45// Standard Constructor
46CopyInputStream::CopyInputStream( const std::string& name, ISvcLocator* pSvcLocator )
47 : OutputStream( name, pSvcLocator ) {
48 setProperty( "Preload", false ).ignore();
49 setProperty( "PreloadOptItems", false ).ignore();
50}
51
54 // Get the objects in the same file as the root node
55 try {
56 // Get all the leaves on the input stream
57 const auto& leaves = *m_inputFileLeaves.get();
58
59 // Do we need to veto anything ?
60 if ( !m_tesVetoList.empty() ) {
61 // Veto out locations
62 IDataStoreLeaves::LeavesList filteredLeaves;
63 filteredLeaves.reserve( leaves.size() );
64 std::copy_if( leaves.begin(), leaves.end(), std::back_inserter( filteredLeaves ),
65 [&]( IDataStoreLeaves::LeavesList::const_reference i ) {
66 return i && i->registry() &&
67 std::find( m_tesVetoList.begin(), m_tesVetoList.end(), i->registry()->identifier() ) ==
68 m_tesVetoList.end();
69 } );
70 // save the veto'ed list
71 m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
72
73 } else {
74 // no veto'ing, so save everything
75 m_objects.assign( leaves.begin(), leaves.end() );
76 }
77 } catch ( const GaudiException& e ) {
78 error() << e.message() << endmsg;
80 }
81
82 // Collect the other objects from the transient store (mandatory and optional)
84}
85
bool PyHelper setProperty(IInterface *p, char *name, char *value)
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)
DataObjectReadHandle< IDataStoreLeaves::LeavesList > m_inputFileLeaves
bool hasInput() const override
Overridden from the base class (CopyInputStream has always input).
StatusCode collectObjects() override
Collect all objects to be written to the output stream.
CopyInputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
Gaudi::Property< std::vector< std::string > > m_tesVetoList
const std::string & name() const override
The identifying name of the algorithm object.
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
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
A small to stream Data I/O.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
IDataSelector m_objects
Collection of objects being selected.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto FAILURE
Definition StatusCode.h:100