The Gaudi Framework
master (6507eef1)
Toggle main menu visibility
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
"
13
#include <
GaudiKernel/DataObject.h
>
14
#include <
GaudiKernel/DataObjectHandle.h
>
15
#include <
GaudiKernel/DataStoreItem.h
>
16
#include <
GaudiKernel/IDataManagerSvc.h
>
17
#include <
GaudiKernel/IDataProviderSvc.h
>
18
#include <
GaudiKernel/IDataStoreLeaves.h
>
19
#include <
GaudiKernel/IOpaqueAddress.h
>
20
#include <
GaudiKernel/IRegistry.h
>
21
#include <
GaudiKernel/MsgStream.h
>
22
23
class
CopyInputStream
:
public
OutputStream
{
24
25
public
:
27
CopyInputStream
(
const
std::string&
name
,
ISvcLocator
* pSvcLocator );
28
30
StatusCode
collectObjects
()
override
;
31
32
private
:
33
Gaudi::Property<std::vector<std::string>
>
m_tesVetoList
{
this
,
"TESVetoList"
, {},
"names of TES locations to Veto"
};
34
35
DataObjectReadHandle<IDataStoreLeaves::LeavesList>
m_inputFileLeaves
{
this
,
"InputFileLeavesLocation"
,
36
"/Event/InputFileLeaves"
};
37
38
protected
:
40
bool
hasInput
()
const override
{
return
true
; }
41
};
42
43
// implementation
44
45
// Standard Constructor
46
CopyInputStream::CopyInputStream
(
const
std::string&
name
,
ISvcLocator
* pSvcLocator )
47
:
OutputStream
(
name
, pSvcLocator ) {
48
setProperty
(
"Preload"
,
false
).ignore();
49
setProperty
(
"PreloadOptItems"
,
false
).ignore();
50
}
51
53
StatusCode
CopyInputStream::collectObjects
() {
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
;
79
return
StatusCode::FAILURE
;
80
}
81
82
// Collect the other objects from the transient store (mandatory and optional)
83
return
OutputStream::collectObjects
();
84
}
85
86
DECLARE_COMPONENT
(
CopyInputStream
)
setProperty
bool PyHelper setProperty(IInterface *p, char *name, char *value)
Definition
Bootstrap.cpp:211
DataObject.h
DataObjectHandle.h
DataStoreItem.h
IDataManagerSvc.h
IDataProviderSvc.h
IDataStoreLeaves.h
IOpaqueAddress.h
IRegistry.h
MsgStream.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
OutputStream.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition
CommonMessaging.h:109
CopyInputStream
Definition
CopyInputStream.cpp:23
CopyInputStream::m_inputFileLeaves
DataObjectReadHandle< IDataStoreLeaves::LeavesList > m_inputFileLeaves
Definition
CopyInputStream.cpp:35
CopyInputStream::hasInput
bool hasInput() const override
Overridden from the base class (CopyInputStream has always input).
Definition
CopyInputStream.cpp:40
CopyInputStream::collectObjects
StatusCode collectObjects() override
Collect all objects to be written to the output stream.
Definition
CopyInputStream.cpp:53
CopyInputStream::CopyInputStream
CopyInputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
Definition
CopyInputStream.cpp:46
CopyInputStream::m_tesVetoList
Gaudi::Property< std::vector< std::string > > m_tesVetoList
Definition
CopyInputStream.cpp:33
DataObjectReadHandle
Definition
DataObjectHandle.h:444
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition
GaudiException.h:66
IDataStoreLeaves::LeavesList
std::vector< DataObject * > LeavesList
Returned type.
Definition
IDataStoreLeaves.h:30
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
OutputStream
A small to stream Data I/O.
Definition
OutputStream.h:37
OutputStream::collectObjects
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
Definition
OutputStream.cpp:252
OutputStream::m_objects
IDataSelector m_objects
Collection of objects being selected.
Definition
OutputStream.h:114
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
GaudiCommonSvc
src
PersistencySvc
CopyInputStream.cpp
Generated on
for The Gaudi Framework by
1.17.0