| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

OutputStream.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_PERSISTENCYSVC_OUTPUTSTREAM_H
2 #define GAUDISVC_PERSISTENCYSVC_OUTPUTSTREAM_H
3
4 // Required for inheritance
5 #include "GaudiKernel/Algorithm.h"
6 #include "GaudiKernel/IDataSelector.h"
7 #include "GaudiKernel/IIncidentSvc.h"
8 #include "GaudiKernel/Property.h"
9 #include "OutputStreamAgent.h"
10
11 // STL include files
12 #include <memory>
13 #include <string>
14 #include <vector>
15
16 // forward declarations
17 class IIncidentSvc;
18 class IRegistry;
19 class IConversionSvc;
20 class IDataManagerSvc;
21 class OutputStreamAgent;
22 class DataStoreItem;
23
29 class OutputStream : public Algorithm
30 {
31 public:
32 typedef std::vector<DataStoreItem*> Items;
33 typedef std::vector<std::string> ItemNames;
34 typedef std::map<Algorithm*, Items> AlgDependentItems;
35 typedef std::map<std::string, ItemNames> AlgDependentItemNames;
36
37 protected:
38 Gaudi::Property<ItemNames> m_itemNames{this, "ItemList", {}, "vector of item names to be saved to this stream"};
39 Gaudi::Property<ItemNames> m_optItemNames{
40 this, "OptItemList", {}, "vector of optional item names to be saved to this stream"};
41 Gaudi::Property<AlgDependentItemNames> m_algDependentItemList{
42 this,
43 "AlgDependentItemList",
44 {},
45 "mapping between algorithm names, and a list of items for which, if the "
46 "algorithm in question accepted the event, they should be also stored"};
47 Gaudi::Property<bool> m_doPreLoad{this, "Preload", true,
48 "flag indicating whether data pre-loading should be performed"};
49 Gaudi::Property<bool> m_doPreLoadOpt{this, "PreloadOptItems", false,
50 "flag indicating whether optional items should be preloaded"};
51 Gaudi::Property<std::string> m_output{this, "Output", {}, "name of the output file specification"};
52 Gaudi::Property<std::string> m_outputName{this, "OutputFile", {}, "name of the output file"};
53 Gaudi::Property<std::string> m_storeName{this, "EvtDataSvc", "EventDataSvc",
54 "name of the service managing the data store"};
55 Gaudi::Property<std::string> m_persName{this, "EvtConversionSvc", "EventPersistencySvc",
56 "name of the persistency service capable to write data from the store"};
57 Gaudi::Property<std::vector<std::string>> m_acceptNames{
58 this, "AcceptAlgs", {}, "names of Algorithms that this stream accepts"};
59 Gaudi::Property<std::vector<std::string>> m_requireNames{
60 this, "RequireAlgs", {}, "names of Algorithms that this stream requires"};
61 Gaudi::Property<std::vector<std::string>> m_vetoNames{
62 this, "VetoAlgs", {}, "names of Algorithms that this stream is vetoed by"};
63 Gaudi::Property<bool> m_verifyItems{this, "VerifyItems", true,
64 "flag to indicate that item consistency should be checked"};
65
69 bool m_fireIncidents = true;
70
72 SmartIF<IIncidentSvc> m_incidentSvc;
73
75 std::string m_outputType = "UPDATE";
77 std::unique_ptr<OutputStreamAgent> m_agent;
79 SmartIF<IDataProviderSvc> m_pDataProvider;
81 SmartIF<IDataManagerSvc> m_pDataManager;
83 SmartIF<IConversionSvc> m_pConversionSvc;
85 DataStoreItem* m_currentItem;
87 Items m_itemList;
89 Items m_optItemList;
91 AlgDependentItems m_algDependentItems;
93 IDataSelector m_objects;
95 int m_events;
96
98 std::vector<Algorithm*> m_acceptAlgs;
100 std::vector<Algorithm*> m_requireAlgs;
102 std::vector<Algorithm*> m_vetoAlgs;
103
104 public:
106 OutputStream( const std::string& name, ISvcLocator* pSvcLocator );
108 virtual ~OutputStream() = default;
109
110 protected:
112 StatusCode decodeAcceptAlgs();
114 void acceptAlgsHandler( Gaudi::Details::PropertyBase& theProp );
116 StatusCode decodeRequireAlgs();
118 void requireAlgsHandler( Gaudi::Details::PropertyBase& theProp );
120 StatusCode decodeVetoAlgs();
122 void vetoAlgsHandler( Gaudi::Details::PropertyBase& theProp );
124 Algorithm* decodeAlgorithm( const std::string& theName );
126 StatusCode decodeAlgorithms( Gaudi::Property<std::vector<std::string>>& theNames, std::vector<Algorithm*>& theAlgs );
128 bool isEventAccepted() const;
130 DataStoreItem* findItem( const std::string& path );
132 virtual StatusCode writeObjects();
133
135 virtual bool hasInput() const;
136
137 public:
139 StatusCode initialize() override;
141 StatusCode finalize() override;
143 StatusCode execute() override;
144 // Connect to proper conversion service
145 virtual StatusCode connectConversionSvc();
147 virtual bool collect( IRegistry* dir, int level );
149 virtual StatusCode collectObjects();
151 void clearSelection();
152
153 private:
155 void clearItems( Items& itms );
157 void addItem( Items& itms, const std::string& descriptor );
159 IDataSelector* selectedObjects() { return &m_objects; }
160 };
161
162 #endif // GAUDISVC_PERSISTENCYSVC_OUTPUTSTREAM_H
OutputStream::m_acceptNames
Gaudi::Property< std::vector< std::string > > m_acceptNames
Definition: OutputStream.h:57
IDataSelector.h
OutputStream::isEventAccepted
bool isEventAccepted() const
Test whether this event should be output.
Definition: OutputStream.cpp:533
OutputStream::clearItems
void clearItems(Items &itms)
Clear item list.
Definition: OutputStream.cpp:312
OutputStream::hasInput
virtual bool hasInput() const
Tell if the instance has been configured with input items or not.
Definition: OutputStream.cpp:561
Algorithm.h
SmartIF< IIncidentSvc >
OutputStream::m_vetoNames
Gaudi::Property< std::vector< std::string > > m_vetoNames
Definition: OutputStream.h:61
OutputStream::decodeRequireAlgs
StatusCode decodeRequireAlgs()
Decode list of Algorithms that this stream requires.
Definition: OutputStream.cpp:449
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
OutputStream::m_objects
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:93
OutputStream::finalize
StatusCode finalize() override
Terminate OutputStream.
Definition: OutputStream.cpp:128
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:731
OutputStream::~OutputStream
virtual ~OutputStream()=default
Standard Destructor.
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
IConversionSvc
Definition: IConversionSvc.h:37
OutputStream::m_events
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:95
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
OutputStream::AlgDependentItemNames
std::map< std::string, ItemNames > AlgDependentItemNames
Definition: OutputStream.h:35
OutputStream::AlgDependentItems
std::map< Algorithm *, Items > AlgDependentItems
Definition: OutputStream.h:34
OutputStream::m_outputType
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:75
OutputStream::m_verifyItems
Gaudi::Property< bool > m_verifyItems
Definition: OutputStream.h:63
OutputStream::m_currentItem
DataStoreItem * m_currentItem
Keep track of the current item.
Definition: OutputStream.h:85
OutputStream::m_output
Gaudi::Property< std::string > m_output
Definition: OutputStream.h:51
OutputStream::m_outputName
Gaudi::Property< std::string > m_outputName
Definition: OutputStream.h:52
OutputStream::m_optItemNames
Gaudi::Property< ItemNames > m_optItemNames
Definition: OutputStream.h:39
OutputStreamAgent
Definition: OutputStreamAgent.h:30
OutputStream::m_requireAlgs
std::vector< Algorithm * > m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:100
OutputStream::selectedObjects
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: OutputStream.h:159
OutputStreamAgent.h
OutputStream::m_pDataProvider
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:79
DataStoreItem
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
OutputStream::m_doPreLoad
Gaudi::Property< bool > m_doPreLoad
Definition: OutputStream.h:47
std::map< Algorithm *, Items >
OutputStream::m_agent
std::unique_ptr< OutputStreamAgent > m_agent
Keep reference of agent.
Definition: OutputStream.h:77
OutputStream
A small to stream Data I/O.
Definition: OutputStream.h:29
OutputStream::m_acceptAlgs
std::vector< Algorithm * > m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:98
std::string
STL class.
OutputStream::decodeAlgorithms
StatusCode decodeAlgorithms(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Algorithm * > &theAlgs)
Decode specified list of Algorithms.
Definition: OutputStream.cpp:506
OutputStream::collect
virtual bool collect(IRegistry *dir, int level)
Store agent&#39;s classback.
Definition: OutputStream.cpp:216
OutputStream::findItem
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
Definition: OutputStream.cpp:319
OutputStream::requireAlgsHandler
void requireAlgsHandler(Gaudi::Details::PropertyBase &theProp)
Handler for RequireAlgs Property.
Definition: OutputStream.cpp:456
OutputStream::writeObjects
virtual StatusCode writeObjects()
Select the different objects and write them to file.
Definition: OutputStream.cpp:162
OutputStream::m_pConversionSvc
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
Definition: OutputStream.h:83
OutputStream::initialize
StatusCode initialize() override
Initialize OutputStream.
Definition: OutputStream.cpp:40
OutputStream::connectConversionSvc
virtual StatusCode connectConversionSvc()
Definition: OutputStream.cpp:355
OutputStream::m_algDependentItems
AlgDependentItems m_algDependentItems
Items to be saved for specific algorithms.
Definition: OutputStream.h:91
OutputStream::Items
std::vector< DataStoreItem * > Items
Definition: OutputStream.h:32
IIncidentSvc.h
OutputStream::m_requireNames
Gaudi::Property< std::vector< std::string > > m_requireNames
Definition: OutputStream.h:59
OutputStream::vetoAlgsHandler
void vetoAlgsHandler(Gaudi::Details::PropertyBase &theProp)
Handler for VetoAlgs Property.
Definition: OutputStream.cpp:471
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
OutputStream::m_itemList
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:87
OutputStream::addItem
void addItem(Items &itms, const std::string &descriptor)
Add item to output streamer list.
Definition: OutputStream.cpp:331
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
OutputStream::m_algDependentItemList
Gaudi::Property< AlgDependentItemNames > m_algDependentItemList
Definition: OutputStream.h:41
OutputStream::m_pDataManager
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
Definition: OutputStream.h:81
OutputStream::clearSelection
void clearSelection()
Clear list of selected objects.
Definition: OutputStream.cpp:309
OutputStream::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:72
OutputStream::decodeVetoAlgs
StatusCode decodeVetoAlgs()
Decode list of Algorithms that this stream is vetoed by.
Definition: OutputStream.cpp:464
OutputStream::acceptAlgsHandler
void acceptAlgsHandler(Gaudi::Details::PropertyBase &theProp)
Handler for AcceptAlgs Property.
Definition: OutputStream.cpp:441
OutputStream::execute
StatusCode execute() override
Working entry point.
Definition: OutputStream.cpp:142
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
OutputStream::m_storeName
Gaudi::Property< std::string > m_storeName
Definition: OutputStream.h:53
std::vector< DataStoreItem * >
std::unique_ptr< OutputStreamAgent >
IDataManagerSvc
Definition: IDataManagerSvc.h:45
OutputStream::ItemNames
std::vector< std::string > ItemNames
Definition: OutputStream.h:33
Property.h
OutputStream::m_doPreLoadOpt
Gaudi::Property< bool > m_doPreLoadOpt
Definition: OutputStream.h:49
OutputStream::decodeAlgorithm
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
Definition: OutputStream.cpp:479
OutputStream::OutputStream
OutputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
Definition: OutputStream.cpp:30
gaudirun.level
level
Definition: gaudirun.py:271
OutputStream::m_persName
Gaudi::Property< std::string > m_persName
Definition: OutputStream.h:55
OutputStream::m_vetoAlgs
std::vector< Algorithm * > m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:102
OutputStream::m_itemNames
Gaudi::Property< ItemNames > m_itemNames
Definition: OutputStream.h:38
OutputStream::collectObjects
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
Definition: OutputStream.cpp:235
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
OutputStream::decodeAcceptAlgs
StatusCode decodeAcceptAlgs()
Decode list of Algorithms that this stream accepts.
Definition: OutputStream.cpp:434
OutputStream::m_fireIncidents
bool m_fireIncidents
should I fire incidents for writing opening/closing etc? in the baseclass, always fire the incidents ...
Definition: OutputStream.h:69
OutputStream::m_optItemList
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:89