22 #define GAUDISVC_NTUPLESVC_CPP 104 if ( !pRegistry )
return nullptr;
116 long need_update = 0;
125 for (
auto d = leaves.begin(); d != leaves.end(); d++ ) {
126 if ( !( *d )->object() )
continue;
129 unsigned long typ = pA->
ipar()[1];
130 if ( typ !=
'R' && typ !=
'N' && typ !=
'U' )
continue;
133 if ( !svc )
continue;
139 for (
int i = sel->
size() - 1; i >= 0; i-- ) {
147 for (
int j = sel->
size() - 1; j >= 0; j-- ) {
151 if ( !status.
isSuccess() ) iret = status;
160 }
else if ( need_update > 0 ) {
161 info() <<
"NTuples saved successfully" <<
endmsg;
170 if ( isvc ) isvc->finalize().ignore();
191 m_connections.clear();
208 return connect( ident, logName );
218 long loc = ident.
find(
" " );
220 logname = ident.
substr( 0, loc );
224 for (
auto attrib : Parser( ident.
substr( loc + 1 ) ) ) {
225 switch (::
toupper( attrib.tag[0] ) ) {
233 switch (::
toupper( attrib.value[0] ) ) {
271 error() <<
"Cannot add " << ident <<
" invalid filename!" <<
endmsg;
288 StatusCode sts = appPropMgr->getProperty( &sp );
290 error() <<
"Could not get NTuple Persistency format" 291 <<
" from ApplicationMgr properties" <<
endmsg;
296 if ( sp.
value() ==
"HBOOK" ) {
298 }
else if ( sp.
value() ==
"ROOT" ) {
306 warning() <<
"NTuple persistency type is " << sp.
value() <<
"." <<
endmsg <<
"Type given by job option " 307 <<
"NTupleSvc.Input/Output ignored!" <<
endmsg;
323 auto status = pService->sysInitialize();
324 if ( !status.isSuccess() )
return status;
333 if ( typ == CLID_ColumnWiseTuple ) {
335 }
else if ( typ == CLID_RowWiseTuple ) {
360 error() <<
"Cannot book N-tuple " << path <<
" (Exists already)" <<
endmsg;
364 if ( sep == std::string::npos ) {
365 error() <<
"Cannot book N-tuple " << path <<
" (Invalid path)" <<
endmsg;
373 error() <<
"Cannot book N-tuple " << path <<
" (Invalid parent directory)" <<
endmsg;
379 error() <<
"Cannot book N-tuple " << path <<
" (Unknown reason)" <<
endmsg;
391 return book( full, type, title );
397 return book( dirPath,
toStr(
id ), type, title );
409 status =
create( type, title, pObj );
423 return book( pParent,
toStr(
id ), type, title );
433 if ( relPath[0] !=
'/' ) full +=
"/";
457 if ( relPath[0] !=
'/' ) full +=
"/";
472 entryname += logname;
476 info() <<
"Added stream file:" << filename <<
" as " << logname <<
endmsg;
481 error() <<
"Cannot add file:" << filename <<
" as " << logname <<
endmsg;
492 if ( sep2 != std::string::npos ) {
529 return status.
isSuccess() ?
save( pObj ) : Status::INVALID_OBJ_PATH;
540 if ( pSvc && pReg ) {
548 return Status::NO_DATA_LOADER;
552 return Status::INVALID_OBJECT;
560 return status.
isSuccess() ?
save( pObj ) : Status::INVALID_OBJ_PATH;
584 return Status::NO_DATA_LOADER;
588 return Status::INVALID_OBJECT;
622 status = pSvc->
updateObj( pAddr, n_tuple );
628 status = Status::NO_DATA_LOADER;
630 status = Status::INVALID_OBJECT;
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Parse attribute strings allowing iteration over the various attributes.
Gaudi::Property< CLID > m_rootCLID
void releaseConnection(Connection &c)
Finalize single service.
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
const long TEST_StorageType
constexpr static const auto FAILURE
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const long HBOOK_StorageType
const std::string & name() const override
Retrieve name of the service.
DataSelectionAgent base in charge of collecting all the refereces to DataObjects in a transient store...
Implementation of property with value of concrete type.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode initialize() override
DataSvc overrides: Initialize the service.
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
unsigned long release() override
release reference to object
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
Gaudi::Property< std::string > m_rootName
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title) override
Book Ntuple and register it with the data store.
NTuple::Tuple * access(const std::string &fullPath, const std::string &filename) override
Access N tuple on disk.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
StatusCode disconnect(const std::string &nam) override
Close open connection.
Generic Transient Address.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IRegistry * registry() const
Get pointer to Registry.
StatusCode updateDirectories()
Update directory data.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
virtual const id_type & identifier() const =0
Full identifier (or key)
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Gaudi::Property< DBaseEntries > m_output
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title) override
Create Ntuple directory and register it with the data store.
bool isConnected(const std::string &identifier) const override
Check if a datasource is connected.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
const long ROOT_StorageType
StatusCode finalize() override
Service initialization.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
unsigned int CLID
Class ID definition.
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
constexpr static const auto SUCCESS
Abstract base class which allows the user to interact with the actual N tuple implementation.
virtual unsigned long release()
release reference to object
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
StatusCode finalize() override
DataSvc overrides: stop the service.
virtual unsigned long release()=0
Release Interface instance.
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
StatusCode initialize() override
Service initialization.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
void setTupleService(INTupleSvc *svc)
Access conversion service.
StatusCode save(const std::string &fullPath) override
Save N tuple to disk. Must be called in order to close the ntuple file properly.
StatusCode traverseSubTree(boost::string_ref sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
Gaudi::Property< DBaseEntries > m_input
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode connect(const std::string &ident) override
Add file to list I/O list.
StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
Create requested N tuple (Hide constructor)
Small class representing an N tuple directory in the transient store.
void setConversionService(IConversionSvc *svc)
Access conversion service.
const ValueType & value() const
Backward compatibility (.
StatusCode disconnectAll() override
Close all open connections.
Opaque address interface definition.
Base class for all conversion services.
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
The IProperty is the basic interface for all components which have properties that can be set or get...
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
A DataObject is the base class of any identifiable object on any data store.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
IConversionSvc * conversionService() const
Access conversion service.
Connections m_connections
Container of connection points.