| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Gaudi::RootStatCnv Class Reference

Description: Base class converter for N-tuples and related classes. More...

`#include <Root/RootStatCnv.h>`

Inheritance diagram for Gaudi::RootStatCnv:
[legend]
Collaboration diagram for Gaudi::RootStatCnv:
[legend]

## Public Member Functions
| RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor.
virtual | ~RootStatCnv ()
| Standard Destructor.
Public Member Functions inherited from Gaudi::RootConverter
| RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor.
virtual | ~RootConverter ()
| Standard Destructor.
virtual long | repSvcType () const
| Retrieve the class type of the data store the converter uses.
virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Converter overrides: Create transient object from persistent data.
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
| Resolve the references of the created transient object.
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
| Converter overrides: Convert the transient object to the requested representation.
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
| Resolve the references of the created transient object.
Public Member Functions inherited from Converter
virtual StatusCode | setDataProvider (IDataProviderSvc *svc)
| Set Data provider service.
virtual SmartIF < IDataProviderSvc > & | dataProvider () const
| Get Data provider service.
virtual StatusCode | setConversionSvc (IConversionSvc *svc)
| Set conversion service the converter is connected to.
virtual SmartIF< IConversionSvc > & | conversionSvc () const
| Get conversion service the converter is connected to.
virtual StatusCode | setAddressCreator (IAddressCreator *creator)
| Set address creator facility.
virtual SmartIF < IAddressCreator > & | addressCreator () const
| Retrieve address creator facility.
virtual const CLID & | objType () const
| Retrieve the class type of objects the converter produces.
virtual long | i_repSvcType () const
| Retrieve the class type of the data store the converter uses.
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
| Update the transient object from the other representation.
virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the references of an updated transient object.
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the converted representation of a transient object.
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the references of an already converted object.
| Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
| Standard Constructor.
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.
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.
SmartIF< IService > | service (const std::string &name, const bool createIf=true) const
| Return a pointer to the service identified by name (or "type/name")

## Protected Member Functions
MsgStream & | log () const
| Helper to use mesage logger.
virtual StatusCode | initialize ()
| Initialize converter object.
virtual StatusCode | finalize ()
| Finalize converter object.
virtual const std::string | containerName (IRegistry *pDir) const
| Retrieve the name of the container a given object is placed into.
virtual const std::string | fileName (IRegistry *pReg) const
| Retrieve the name of the file a given object is placed into.
virtual const std::string | topLevel (IRegistry *pReg) const
| Retrieve the full path of the file a given object is placed into.
StatusCode | makeError (const std::string &msg, bool throw_exception=false) const
| Helper method to issue error messages.
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.

## Protected Attributes
IDataManagerSvc * | m_dataMgr
| Reference to data manager service to manipulate the TES.
MsgStream * | m_log
| Reference to logger object.
Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvc * | m_dbMgr
| Conversion service needed for proper operation to forward requests.

## Additional Inherited Members
Public Types inherited from Converter
typedef Gaudi::PluginService::Factory1 < IConverter *, ISvcLocator * > | Factory
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.

## Detailed Description

Description: Base class converter for N-tuples and related classes.

Author
  M.Frank

Version
  1.0

Definition at line 31 of file RootStatCnv.h.

## Constructor & Destructor Documentation

RootStatCnv::RootStatCnv | ( | 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 25 of file RootStatCnv.cpp.

: RootConverter(typ, clid, svc, mgr), m_dataMgr(0), m_log(0)
{
}

virtual Gaudi::RootStatCnv::~RootStatCnv | ( |  | ) |
| inline virtual

Standard Destructor.

Definition at line 106 of file RootStatCnv.h.

{ }

## Member Function Documentation

const string RootStatCnv::containerName | ( | IRegistry * | pDir | ) | const
| protected virtual

Retrieve the name of the container a given object is placed into.

Parameters

  pReg | [IN] Pointer to registry entry.

Returns
  Name of the container the object should be put to.

Reimplemented in Gaudi::RootDatabaseCnv.

Definition at line 58 of file RootStatCnv.cpp.

{
const string& path = pReg->identifier();
long loc = path.find('/',1);
string local = "<local>";
//local = "";
if ( loc > 0 ) {
loc = path.find('/',++loc);
if ( loc > 0 ) {
local += path.substr(loc,path.length()-loc);
}
}
//for(size_t i=0; i<local.length();++i)
// if ( !isalnum(local[i])) local[i] = '_';
return local;
}

const string RootStatCnv::fileName | ( | IRegistry * | pReg | ) | const
| protected virtual

Retrieve the name of the file a given object is placed into.

Parameters

  pReg | [IN] Pointer to registry entry.

Returns
  Name of the file the object should be put to.

Definition at line 75 of file RootStatCnv.cpp.

{
string path = topLevel(pReg);
DataObject* pObj = 0;
dataProvider()->retrieveObject(path, pObj);
if ( pObj ) {
NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
if ( fptr ) {
return fptr->name();
}
}
return "";
}

StatusCode RootStatCnv::finalize | ( |  | ) |
| protected virtual

Finalize converter object.

Reimplemented from Converter.

Definition at line 45 of file RootStatCnv.cpp.

{
if ( m_log ) {
delete m_log;
m_log = 0;
}
if ( m_dataMgr ) {
m_dataMgr->release();
m_dataMgr = 0;
}
return RootConverter::finalize();
}

StatusCode RootStatCnv::initialize | ( |  | ) |
| protected virtual

Initialize converter object.

Reimplemented from Converter.

Definition at line 31 of file RootStatCnv.cpp.

{
StatusCode sc = RootConverter::initialize();
if ( sc.isSuccess() ) {
sc = dataProvider()->queryInterface(IDataManagerSvc::interfaceID(),(void**)&m_dataMgr);
if ( !sc.isSuccess() ) {
return makeError("Failed to access IDataManagerSvc interface.");
}
}
if ( m_log ) delete m_log;
m_log = new MsgStream(msgSvc(),System::typeinfoName(typeid(*this)));
return sc;
}

MsgStream& Gaudi::RootStatCnv::log | ( |  | ) | const
| inline protected

Helper to use mesage logger.

Definition at line 39 of file RootStatCnv.h.

{ return *m_log; }

StatusCode RootStatCnv::makeError | ( | const std::string & | msg,
|  | bool | throw_exception = `false`
| ) |  | const
| protected

Helper method to issue error messages.

Parameters

  msg | [IN] Text of the error message
  throw_exc[IN] | If true throw an exception of type std::runtime_error

Returns
  Status code indicating success or failure.

Definition at line 105 of file RootStatCnv.cpp.

{
if ( m_log ) {
log() << MSG::ERROR << msg << endmsg;
}
else {
MsgStream l(msgSvc(),"RootConverter");
l << MSG::ERROR << msg << endmsg;
}
if ( throw_exc ) {
}
return StatusCode::FAILURE;
}

StatusCode RootStatCnv::saveDescription | ( | const std::string & | path,
|  | const std::string & | ident,
|  | const std::string & | desc,
|  | const std::string & | opt,
|  | const CLID & | clid
| ) |  |
| protected

Save statistics object description.

Parameters

  path | [IN] Path of file to save the description on.
  ident | [IN] Identifier of description to be saved.
  desc | [IN] Description
  opt | [IN] Optional description
  guid | [IN] Object giud of described object
  openMode | [IN] Mode of opening the file to save description

Returns
  Status code indicating success or failure.

Definition at line 120 of file RootStatCnv.cpp.

{
RootDataConnection* con = 0;
StatusCode status = m_dbMgr->connectDatabase(path, IDataConnection::UPDATE, &con);
if ( status.isSuccess() ) {
TClass* cl = gROOT->GetClass("Gaudi::RootNTupleDescriptor",kTRUE);
if ( cl ) {
RootNTupleDescriptor* ptr;
auto_ptr<RootNTupleDescriptor> dsc(ptr=new RootNTupleDescriptor());
TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription",cl,ptr,512,0);
if ( b ) {
dsc->description = desc;
dsc->optional = opt;
dsc->container = ident;
dsc->clid = clid;
b->SetAddress(&ptr);
int nb = b->Fill();
if ( nb > 1 ) {
log() << MSG::DEBUG << "Save description for " << ident << endmsg;
return StatusCode::SUCCESS;
}
}
return makeError("Failed to access ROOT branch GaudiStatisticsDescription");
}
return makeError("Failed to access TClass RootNTupleDescriptor");
}
return makeError("Failed to access Tuple file:"+path);
}

const string RootStatCnv::topLevel | ( | IRegistry * | pReg | ) | const
| protected virtual

Retrieve the full path of the file a given object is placed into.

Parameters

  pReg | [IN] Pointer to registry entry.

Returns
  Name of the file the object should be put to.

Definition at line 89 of file RootStatCnv.cpp.

{
if ( pReg ) {
string path = pReg->identifier();
size_t idx = path.find('/', 1);
if ( idx != string::npos ) {
idx = path.find('/', idx+1);
if ( idx != string::npos ) {
path = path.substr(0, idx);
}
return path;
}
}
return "";
}

## Member Data Documentation

IDataManagerSvc* Gaudi::RootStatCnv::m_dataMgr
| protected

Reference to data manager service to manipulate the TES.

Definition at line 34 of file RootStatCnv.h.

MsgStream* Gaudi::RootStatCnv::m_log
| protected

Reference to logger object.

Definition at line 36 of file RootStatCnv.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/RootCnv/RootCnv/RootStatCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/RootCnv/src/RootStatCnv.cpp