22 #define GAUDISVC_NTUPLESVC_CPP
108 if ( !pRegistry )
return nullptr;
120 long need_update = 0;
129 for (
auto d = leaves.begin(); d != leaves.end(); d++ ) {
130 if ( !(*d)->object() )
continue;
133 unsigned long typ = pA->
ipar()[1];
134 if ( typ !=
'R' && typ !=
'N' && typ !=
'U' )
continue;
137 if ( !svc )
continue;
143 for(
int i = sel->
size()-1;
i >= 0;
i-- ) {
151 for(
int j = sel->
size()-1; j >= 0; j-- ) {
155 if ( !status.
isSuccess() ) iret = status;
165 else if ( need_update > 0 ) {
166 info() <<
"NTuples saved successfully" <<
endmsg;
174 if ( isvc ) isvc->finalize().ignore();
193 m_connections.clear();
208 return connect(ident, logName);
217 long loc = ident.
find(
" ");
219 logname = ident.
substr(0, loc);
223 for (
auto attrib: Parser(ident.
substr(loc + 1))) {
224 switch( ::
toupper(attrib.tag[0]) ) {
232 switch( ::
toupper(attrib.value[0]) ) {
270 error() <<
"Cannot add " << ident <<
" invalid filename!" <<
endmsg;
289 StatusCode sts = appPropMgr->getProperty( &sp );
291 error() <<
"Could not get NTuple Persistency format"
292 <<
" from ApplicationMgr properties" <<
endmsg;
297 if ( sp.
value() ==
"HBOOK" ) {
300 else if ( sp.
value() ==
"ROOT" ) {
309 warning() <<
"NTuple persistency type is "
311 <<
"Type given by job option "
312 <<
"NTupleSvc.Input/Output ignored!" <<
endmsg;
328 auto status = pService->sysInitialize();
329 if ( !status.isSuccess() )
return status;
337 if ( typ == CLID_ColumnWiseTuple ) {
340 else if ( typ == CLID_RowWiseTuple ) {
365 error() <<
"Cannot book N-tuple " << path <<
" (Exists already)" <<
endmsg;
369 if ( sep == std::string::npos ) {
370 error() <<
"Cannot book N-tuple " << path <<
" (Invalid path)" <<
endmsg;
378 error() <<
"Cannot book N-tuple " << path <<
" (Invalid parent directory)" <<
endmsg;
384 error() <<
"Cannot book N-tuple " << path <<
" (Unknown reason)" <<
endmsg;
394 return book(full, type, title);
399 return book( dirPath,
toStr(
id), type, title);
409 status =
create( type, title, pObj);
425 return book( pParent,
toStr(
id), type, title);
435 if (relPath[0]!=
'/') full +=
"/";
456 if (relPath[0]!=
'/') full +=
"/";
469 entryname += logname;
471 new GenericAddress(t, CLID_NTupleFile, filename, entryname, 0, typ);
474 info() <<
"Added stream file:" << filename <<
" as " << logname <<
endmsg;
479 error() <<
"Cannot add file:" << filename <<
" as " << logname <<
endmsg;
489 if ( sep2 != std::string::npos ) {
527 return status.
isSuccess() ?
save ( pObj ) : INVALID_OBJ_PATH;
537 if ( pSvc && pReg ) {
550 return INVALID_OBJECT;
557 return status.
isSuccess() ?
save ( pObj ) : INVALID_OBJ_PATH;
585 return INVALID_OBJECT;
616 status = pSvc->
updateObj(pAddr, n_tuple);
625 status = INVALID_OBJECT;
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Parse attribute strings allowing iteration over the various attributes.
void releaseConnection(Connection &c)
Finalize single service.
const long TEST_StorageType
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const long HBOOK_StorageType
DataSelectionAgent base in charge of collecting all the refereces to DataObjects in a transient store...
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual StatusCode finalize()
DataSvc overrides: stop the service.
virtual StatusCode save(const std::string &fullPath)
Save N tuple to disk. Must be called in order to close the ntuple file properly.
bool isSuccess() const
Test for a status code of SUCCESS.
unsigned long release() override
release reference to object
No data loader available.
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
std::string m_rootName
Name of root event.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
Generic Transient Address.
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
virtual StatusCode readRecord(NTuple::Tuple *tuple)
Read single record from N tuple.
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.
#define DECLARE_COMPONENT(type)
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
const std::string & name() const override
Retrieve name of the service.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
virtual StatusCode reinitialize()
DataSvc overrides: reinitialize service.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
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 retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
virtual StatusCode connect(const std::string &ident)
Add file to list I/O list.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
const TYPE & value() const
explicit conversion
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
DBaseEntries m_input
Input streams.
Abstract base class which allows the user to interact with the actual N tuple implementation.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual StatusCode writeRecord(NTuple::Tuple *tuple)
Write single record to N tuple.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
virtual unsigned long release()
release reference to object
virtual unsigned long release()=0
Release Interface instance.
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
StatusCode initialize() override
Service initialization.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
void setTupleService(INTupleSvc *svc)
Access conversion service.
DBaseEntries m_output
Output streams.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual NTuple::Tuple * access(const std::string &fullPath, const std::string &filename)
Access N tuple on disk.
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
virtual StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)
Create requested N tuple (Hide constructor)
virtual StatusCode initialize()
DataSvc overrides: Initialize the service.
virtual const id_type & identifier() const =0
Full identifier (or key)
void setConversionService(IConversionSvc *svc)
Access conversion service.
Opaque address interface definition.
Base class for all conversion services.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
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 StatusCode disconnect(const std::string &nam)
Close open connection.
StatusCode traverseSubTree(const std::string &sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
virtual StatusCode disconnectAll()
Close all open connections.
A DataObject is the base class of any identifiable object on any data store.
Small class representing an N tuple directory in the transient store.
virtual bool isConnected(const std::string &identifier) const
Check if a datasource is connected.
virtual ~NTupleSvc()
Standard Destructor.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
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.