27 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
35 m_doPreLoadOpt =
false;
37 m_outputType =
"UPDATE";
38 m_storeName =
"EventDataSvc";
39 m_persName =
"EventPersistencySvc";
42 m_fireIncidents =
true;
43 declareProperty(
"ItemList", m_itemNames);
44 declareProperty(
"OptItemList", m_optItemNames);
45 declareProperty(
"AlgDependentItemList", m_algDependentItemList);
46 declareProperty(
"Preload", m_doPreLoad);
47 declareProperty(
"PreloadOptItems", m_doPreLoadOpt);
48 declareProperty(
"Output", m_output);
49 declareProperty(
"OutputFile", m_outputName);
50 declareProperty(
"EvtDataSvc", m_storeName);
51 declareProperty(
"EvtConversionSvc", m_persName);
52 declareProperty(
"AcceptAlgs", m_acceptNames);
53 declareProperty(
"RequireAlgs", m_requireNames);
54 declareProperty(
"VetoAlgs", m_vetoNames);
55 declareProperty(
"VerifyItems", m_verifyItems);
77 fatal() <<
"Unable to locate IDataManagerSvc interface" <<
endmsg;
95 fatal() <<
"Unable to connect to conversion service." <<
endmsg;
97 IncidentType::FailOutputFile));
128 for (
const auto&
i : a.second )
addItem( items,
i );
162 IncidentType::EndOutputFile));
186 IncidentType::WroteToOutputFile));
191 IncidentType::FailOutputFile));
213 for (
auto& j : *sel )
229 j->registry()->identifier() :
"UnRegistered" );
231 <<
"std::exception during createRep for '" << loc <<
"' "
238 for (
auto& j : *sel )
249 j->registry()->identifier() :
"UnRegistered" );
251 <<
"std::exception during fillRepRefs for '" << loc <<
"'"
275 if ( level < m_currentItem->depth() ) {
305 error() <<
"Cannot write mandatory object(s) (Not found) "
321 debug() <<
"Ignore request to write non-mandatory object(s) "
330 const Items& items = iAlgItems.second;
334 debug() <<
"Algorithm '" << alg->
name() <<
"' fired. Adding " << items <<
endmsg;
335 for (
const auto&
i : items )
347 error() <<
"Cannot write mandatory (algorithm dependent) object(s) (Not found) "
362 if (!unique.
count(o)) {
381 for (
auto&
i : itms )
delete i;
400 auto sep = descriptor.
rfind(
"#");
402 if ( sep != std::string::npos ) {
404 level = ( slevel ==
"*" ) ? 9999999 :
std::stoi(slevel);
407 size_t idx = obj_path.
find(
"/",1);
408 while(idx != std::string::npos) {
411 idx = obj_path.
find(
"/",idx+1);
417 debug() <<
"Adding OutputStream item " <<
item->path()
418 <<
" with " <<
item->depth()
419 <<
" level(s)." <<
endmsg;
439 case 'V': svc = val;
break;
440 case 'H': shr =
"YES";
break;
446 if ( ::strncasecmp(val.
c_str(),
"RECREATE",3)==0 )
448 else if ( ::strncasecmp(val.
c_str(),
"READ",3)==0 )
481 status = ipers->getService(typ, cnvSvc);
483 fatal() <<
"Unable to locate IConversionSvc interface of database type " << typ <<
endmsg;
492 <<
"Unable to locate IConversionSvc interface (Unknown technology) " <<
endmsg
493 <<
"You either have to specify a technology name or a service name!" <<
endmsg
494 <<
"Please correct the job option \"" <<
name() <<
".Output\" !" <<
endmsg;
510 "OutputStream::acceptAlgsHandler",sc);
524 "OutputStream::requireAlgsHandler",sc);
538 "OutputStream::vetoAlgsHandler",sc);
566 fatal() <<
"Can't locate ApplicationMgr!!!" <<
endmsg;
571 warning() <<
"Failed to decode Algorithm name " << theName <<
endmsg;
586 for (
const auto& it : theNames.
value() )
594 theAlgorithm->addRef();
600 info() << it <<
" doesn't exist - ignored" <<
endmsg;
610 auto passed = [](
const Algorithm* alg) {
return alg->isExecuted()
611 && alg->filterPassed(); };
Parse attribute strings allowing iteration over the various attributes.
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
bool isEventAccepted() const
Test whether this event should be output.
void clearItems(Items &itms)
Clear item list.
virtual bool hasInput() const
Tell if the instance has been configured with input items or not.
Define general base for Gaudi exception.
StatusCode decodeRequireAlgs()
Decode list of Algorithms that this stream requires.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
IDataSelector m_objects
Collection of objects being selected.
StatusCode finalize() override
Terminate OutputStream.
std::string m_storeName
Name of the service managing the data store.
int m_events
Number of events written to this output stream.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
DataStoreItem * m_currentItem
Keep track of the current item.
bool isSuccess() const
Test for a status code of SUCCESS.
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
std::string m_outputName
Name of the output file.
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
void requireAlgsHandler(Property &theProp)
Handler for RequireAlgs Property.
std::string m_persName
Name of the persistency service capable to write data from the store.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
std::vector< Algorithm * > m_requireAlgs
Vector of Algorithms that this stream requires.
IDataSelector * selectedObjects()
Return the list of selected objects.
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Description of the DataStoreItem class.
bool isFailure() const
Test for a status code of FAILURE.
#define DECLARE_COMPONENT(type)
std::unique_ptr< OutputStreamAgent > m_agent
Keep reference of agent.
const std::string & path() const
Accessor: Retrieve load path.
A small to stream Data I/O.
std::vector< Algorithm * > m_acceptAlgs
Vector of Algorithms that this stream accepts.
const std::string & name() const override
The identifying name of the algorithm object.
virtual bool collect(IRegistry *dir, int level)
Store agent's classback.
TYPE * get() const
Get interface pointer.
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
virtual StatusCode writeObjects()
Select the different objects and write them to file.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
virtual StatusCode connectOutput(const std::string &outputFile)=0
Connect the output file to the service.
StatusCode initialize() override
Initialize OutputStream.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual StatusCode connectConversionSvc()
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
AlgDependentItems m_algDependentItems
Items to be saved for specific algorithms.
virtual StatusCode commitOutput(const std::string &outputFile, bool do_commit)=0
Commit pending output.
bool m_verifyItems
Flag to indicate that item consistency should be checked.
This class is used for returning status codes from appropriate routines.
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Items m_itemList
Vector of items to be saved to this stream.
bool m_doPreLoad
Flag indicating whether data pre-loading should be performed.
void addItem(Items &itms, const std::string &descriptor)
Add item to output streamer list.
bool m_doPreLoadOpt
Flag indicating whether optional items should be preloaded.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
void clearSelection()
Clear list of selected objects.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
const TYPE & value() const
explicit conversion
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode decodeVetoAlgs()
Decode list of Algorithms that this stream is vetoed by.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
StatusCode execute() override
Working entry point.
Base class from which all concrete algorithm classes should be derived.
ItemNames m_itemNames
Vector of item names.
Property base class allowing Property* collections to be "homogeneous".
ItemNames m_optItemNames
Vector of item names.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs)
Decode specified list of Algorithms.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
Base class for all Incidents (computing events).
void acceptAlgsHandler(Property &theProp)
Handler for AcceptAlgs Property.
StringArrayProperty m_requireNames
Vector of names of Algorithms that this stream requires.
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
OutputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
Data persistency service interface.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Opaque address interface definition.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
std::string m_output
Name of the output file specification.
std::vector< Algorithm * > m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
virtual StatusCode traverseSubTree(const std::string &sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
A DataObject is the base class of any identifiable object on any data store.
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
void toupper(std::string &s)
void vetoAlgsHandler(Property &theProp)
Handler for VetoAlgs Property.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode decodeAcceptAlgs()
Decode list of Algorithms that this stream accepts.
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Items m_optItemList
Vector of optional items to be saved to this stream.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.