All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::RootDirectoryCnv Class Reference

Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples. More...

#include <src/RootDirectoryCnv.h>

Inheritance diagram for Gaudi::RootDirectoryCnv:
Collaboration diagram for Gaudi::RootDirectoryCnv:

Public Member Functions

 RootDirectoryCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor. More...
 
virtual ~RootDirectoryCnv ()
 Standard Destructor. More...
 
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Converter overrides: Create transient object from persistent data. More...
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Resolve the references of the transient object. More...
 
virtual StatusCode updateObj (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Update transient object from persistent data. More...
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Update the references of an updated transient object. More...
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
 Converter overrides: Convert the transient object to the requested representation. More...
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Fill references of persistent object representation. More...
 
virtual StatusCode updateRep (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Update persistent object representation. More...
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Converter overrides: Update references of persistent object representation. More...
 
- Public Member Functions inherited from Gaudi::RootStatCnv
 RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor. More...
 
virtual ~RootStatCnv ()
 Standard Destructor. More...
 
- Public Member Functions inherited from Gaudi::RootConverter
 RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor. More...
 
virtual ~RootConverter ()
 Standard Destructor. More...
 
virtual long repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
- Public Member Functions inherited from Converter
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
 Set Data provider service. More...
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Get Data provider service. More...
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Set conversion service the converter is connected to. More...
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 Get conversion service the converter is connected to. More...
 
virtual StatusCode setAddressCreator (IAddressCreator *creator)
 Set address creator facility. More...
 
virtual SmartIF
< IAddressCreator > & 
addressCreator () const
 Retrieve address creator facility. More...
 
virtual const CLIDobjType () const
 Retrieve the class type of objects the converter produces. More...
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name") More...
 
- Public Member Functions inherited from extend_interfaces1< IConverter >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConverter
 DeclareInterfaceID (IConverter, 3, 0)
 InterfaceID. More...
 
virtual ~IConverter ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from Converter
typedef
Gaudi::PluginService::Factory
< IConverter *, ISvcLocator * > 
Factory
 
- Public Types inherited from implements1< IConverter >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IConverter
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces1< IConverter >
typedef IConverter::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IConverter
enum  Status {
  INVALID_ADDRESS = IInterface::LAST_ERROR+1, INVALID_OBJECT, NO_MEMORY, BAD_STORAGE_TYPE,
  NO_SOURCE_OBJECT, ICONVERSIONSVC_LAST_ERROR
}
 Status code. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Gaudi::RootStatCnv
MsgStreamlog () const
 Helper to use mesage logger. More...
 
virtual StatusCode initialize ()
 Initialize converter object. More...
 
virtual StatusCode finalize ()
 Finalize converter object. More...
 
virtual const std::string containerName (IRegistry *pDir) const
 Retrieve the name of the container a given object is placed into. More...
 
virtual const std::string fileName (IRegistry *pReg) const
 Retrieve the name of the file a given object is placed into. More...
 
virtual const std::string topLevel (IRegistry *pReg) const
 Retrieve the full path of the file a given object is placed into. More...
 
StatusCode makeError (const std::string &msg, bool throw_exception=false) const
 Helper method to issue error messages. More...
 
StatusCode saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
 Save statistics object description. More...
 
- Protected Member Functions inherited from Converter
virtual ~Converter ()
 Standard Destructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service. More...
 
- Protected Attributes inherited from Gaudi::RootStatCnv
IDataManagerSvcm_dataMgr
 Reference to data manager service to manipulate the TES. More...
 
MsgStreamm_log
 Reference to logger object. More...
 
- Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvcm_dbMgr
 Conversion service needed for proper operation to forward requests. More...
 

Detailed Description

Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples.

Author
M.Frank
Version
1.0

Definition at line 31 of file RootDirectoryCnv.h.

Constructor & Destructor Documentation

RootDirectoryCnv::RootDirectoryCnv ( long  typ,
const CLID clid,
ISvcLocator svc,
RootCnvSvc mgr 
)

Initializing Constructor.

Parameters
typ[IN] Concrete storage type of the converter
clid[IN] Class identifier of the object
svc[IN] Pointer to service locator object
Returns
Reference to RootBaseCnv object

Definition at line 31 of file RootDirectoryCnv.cpp.

34  : RootStatCnv(typ, clid, svc, mgr)
35 {
36 }
RootStatCnv(long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
Initializing Constructor.
Definition: RootStatCnv.cpp:25
virtual Gaudi::RootDirectoryCnv::~RootDirectoryCnv ( )
inlinevirtual

Standard Destructor.

Definition at line 44 of file RootDirectoryCnv.h.

44 { }

Member Function Documentation

StatusCode RootDirectoryCnv::createObj ( IOpaqueAddress pAddr,
DataObject *&  refpObj 
)
virtual

Converter overrides: Create transient object from persistent data.

Parameters
pAddr[IN] Pointer to object address.
refpObj[OUT] Location to pointer to store data object
Returns
Status code indicating success or failure.

Reimplemented from Gaudi::RootConverter.

Reimplemented in Gaudi::RootDatabaseCnv.

Definition at line 40 of file RootDirectoryCnv.cpp.

40  {
41  refpObj = new NTuple::Directory();
42  return StatusCode::SUCCESS;
43 }
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1065
StatusCode RootDirectoryCnv::createRep ( DataObject pObj,
IOpaqueAddress *&  refpAddr 
)
virtual

Converter overrides: Convert the transient object to the requested representation.

Parameters
pObj[IN] Pointer to data object
refpAddr[OUT] Location to store pointer to object address.
Returns
Status code indicating success or failure.

Reimplemented from Gaudi::RootConverter.

Definition at line 47 of file RootDirectoryCnv.cpp.

47  {
48  string dsc;
49  if ( objType() == CLID_StatisticsDirectory ) {
50  dsc = "Directory containing statistics results.";
51  }
52  else if ( objType() == CLID_StatisticsFile ) {
53  dsc = "File containing statistics results.";
54  }
55  else {
56  return StatusCode::FAILURE;
57  }
58  string ident = containerName(pObj->registry());
59  string path = fileName(pObj->registry());
60  return saveDescription(path, ident, dsc, ident, objType());
61 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
virtual const CLID & objType() const
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:16
virtual const std::string fileName(IRegistry *pReg) const
Retrieve the name of the file a given object is placed into.
Definition: RootStatCnv.cpp:75
StatusCode saveDescription(const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
Save statistics object description.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual const std::string containerName(IRegistry *pDir) const
Retrieve the name of the container a given object is placed into.
Definition: RootStatCnv.cpp:58
StatusCode RootDirectoryCnv::fillObjRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Resolve the references of the transient object.

Parameters
pAddr[IN] Pointer to object address.
pObj[IN] Pointer to data object
Returns
Status code indicating success or failure.

Reimplemented from Gaudi::RootConverter.

Definition at line 64 of file RootDirectoryCnv.cpp.

64  {
65  return updateObjRefs(pAddr, pObj);
66 }
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddr, DataObject *pObj)
Converter overrides: Update the references of an updated transient object.
StatusCode RootDirectoryCnv::fillRepRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Fill references of persistent object representation.

Parameters
pObj[IN] Pointer to data object
refpAddr[OUT] Location to store pointer to object address.
Returns
Status code indicating success or failure.

Reimplemented from Gaudi::RootConverter.

Definition at line 196 of file RootDirectoryCnv.cpp.

198 {
199  return StatusCode::SUCCESS;
200 }
StatusCode RootDirectoryCnv::updateObj ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Update transient object from persistent data.

Parameters
pAddr[IN] Pointer to object address.
pObj[IN] Pointer to data object
Returns
Status code indicating success or failure.

Reimplemented from Converter.

Definition at line 172 of file RootDirectoryCnv.cpp.

174 {
175  return StatusCode::SUCCESS;
176 }
StatusCode RootDirectoryCnv::updateObjRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Update the references of an updated transient object.

Parameters
pAddr[IN] Pointer to object address.
pObj[IN] Pointer to data object
Returns
Status code indicating success or failure.

Reimplemented from Converter.

Definition at line 70 of file RootDirectoryCnv.cpp.

72 {
73  typedef vector<RootNTupleDescriptor*> REFS;
74  REFS refs;
76  if ( pAddr ) {
77  IRegistry* pReg = pAddr->registry();
78  if ( pReg ) {
79  typedef vector<IRegistry*> Leaves;
80  string ident = pReg->identifier();
81  string fname = fileName(pReg);
82  string cntName = containerName(pReg);
83  RootDataConnection* con = 0;
84  Leaves leaves;
85  status = m_dbMgr->connectDatabase(fname, IDataConnection::READ, &con);
86  if ( status.isSuccess() ) {
87  TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription");
88  if ( b ) {
89  for(Long64_t n=b->GetEntries(), i=0; i<n; ++i) {
90  RootNTupleDescriptor* ref=0;
91  b->SetAddress(&ref);
92  int nb = b->GetEntry(i);
93  if ( nb > 1 ) {
94  string s = ref->container.substr(0,cntName.length());
95  log() << MSG::VERBOSE << "Read description:" << ref->container
96  << " " << ident << " " << cntName << endmsg;
97  if ( s == cntName ) {
98  if ( ref->container.length() >= cntName.length()+1 ) {
99  if ( ref->container.find('/',cntName.length()+1) == string::npos ) {
100  refs.push_back(ref);
101  continue;
102  }
103  }
104  }
105  }
106  delete ref;
107  }
108  }
109  log() << MSG::DEBUG << "Got " << refs.size() << " tuple connection(s)....." << endmsg;
110  status = m_dataMgr->objectLeaves(pObject, leaves);
111  if ( status.isSuccess() ) {
112  for(REFS::iterator i = refs.begin(); i != refs.end(); ++i) {
113  REFS::value_type& ref = *i;
114  if ( ref ) {
115  bool need_to_add = true;
116  for(Leaves::iterator j=leaves.begin(); j != leaves.end(); ++j ) {
117  string curr_leaf = containerName(*j);
118  if ( curr_leaf == ref->container ) {
119  need_to_add = false;
120  break;
121  }
122  }
123  if ( need_to_add ) {
124  IOpaqueAddress* pA= 0;
125  if ( ref->clid == CLID_StatisticsDirectory ||
126  ref->clid == CLID_StatisticsFile ||
127  ref->clid == CLID_RowWiseTuple ||
128  ref->clid == CLID_ColumnWiseTuple )
129  {
130  string spar[] = { fname, ref->container};
131  unsigned long ipar[] = { ~0x0UL, ~0x0UL };
132  status = m_dbMgr->createAddress(repSvcType(),
133  ref->clid,
134  spar,
135  ipar,
136  pA);
137  }
138  if ( status.isSuccess() ) {
139  string top = topLevel(pReg);
140  string leaf_name = top + ref->container.substr(7);
141  status = m_dataMgr->registerAddress(leaf_name, pA);
142  if ( status.isSuccess() ) {
143  log() << MSG::DEBUG << "Created address for " << leaf_name
144  << " of type " << ref->clid << endmsg;
145  continue;
146  }
147  makeError("Failed to register leaves to directory:"+ident,false).ignore();
148  break;
149  }
150  makeError("Failed to create leave address to directory:"+ident,false).ignore();
151  break;
152  }
153  }
154  makeError("Failed to add leaves to directory:"+ident,false).ignore();
155  break;
156  }
157  }
158  }
159  else {
160  return makeError("Failed to access required tuple data description.",false);
161  }
162  }
163  }
164  for(REFS::iterator k = refs.begin(); k != refs.end(); ++k) {
165  if ( *k ) delete (*k);
166  }
167  return status;
168 }
MsgStream & log() const
Helper to use mesage logger.
Definition: RootStatCnv.h:39
virtual const std::string topLevel(IRegistry *pReg) const
Retrieve the full path of the file a given object is placed into.
Definition: RootStatCnv.cpp:89
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:391
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
RootCnvSvc * m_dbMgr
Conversion service needed for proper operation to forward requests.
Definition: RootConverter.h:37
StatusCode makeError(const std::string &msg, bool throw_exception=false) const
Helper method to issue error messages.
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:224
virtual IRegistry * registry() const =0
Update branch name.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string fileName(IRegistry *pReg) const
Retrieve the name of the file a given object is placed into.
Definition: RootStatCnv.cpp:75
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: RootConverter.h:55
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
std::string container
Identifier of description.
Definition: RootRefs.h:105
string s
Definition: gaudirun.py:210
virtual const id_type & identifier() const =0
Full identifier (or key)
virtual StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:94
virtual const std::string containerName(IRegistry *pDir) const
Retrieve the name of the container a given object is placed into.
Definition: RootStatCnv.cpp:58
list i
Definition: ana.py:128
Concrete implementation of the IDataConnection interface to access ROOT files.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IDataManagerSvc * m_dataMgr
Reference to data manager service to manipulate the TES.
Definition: RootStatCnv.h:34
StatusCode RootDirectoryCnv::updateRep ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Update persistent object representation.

Parameters
pObj[IN] Pointer to data object
refpAddr[OUT] Location to store pointer to object address.
Returns
Status code indicating success or failure.

Reimplemented from Converter.

Definition at line 180 of file RootDirectoryCnv.cpp.

182 {
183  return StatusCode::SUCCESS;
184 }
StatusCode RootDirectoryCnv::updateRepRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Converter overrides: Update references of persistent object representation.

Parameters
pObj[IN] Pointer to data object
refpAddr[OUT] Location to store pointer to object address.
Returns
Status code indicating success or failure.

Reimplemented from Converter.

Definition at line 188 of file RootDirectoryCnv.cpp.

190 {
191  return StatusCode::SUCCESS;
192 }

The documentation for this class was generated from the following files: