|
Gaudi Framework, version v23r2p1 |
| Home | Generated: Fri Jun 29 2012 |
Description: Base class converter for N-tuples and related classes. More...
#include <Root/RootStatCnv.h>


Public Member Functions | |
| RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr) | |
| Initializing Constructor. | |
| virtual | ~RootStatCnv () |
| Standard Destructor. | |
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. | |
Description: Base class converter for N-tuples and related classes.
Definition at line 31 of file RootStatCnv.h.
| RootStatCnv::RootStatCnv | ( | long | typ, |
| const CLID & | clid, | ||
| ISvcLocator * | svc, | ||
| RootCnvSvc * | mgr | ||
| ) |
Initializing Constructor.
| typ | [IN] Concrete storage type of the converter |
| clid | [IN] Class identifier of the object |
| svc | [IN] Pointer to service locator 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] |
| const string RootStatCnv::containerName | ( | IRegistry * | pDir ) | const [protected, virtual] |
Retrieve the name of the container a given object is placed into.
| pReg | [IN] Pointer to registry entry. |
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.
| pReg | [IN] Pointer to registry entry. |
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] |
| 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] |
| StatusCode RootStatCnv::makeError | ( | const std::string & | msg, |
| bool | throw_exception = false |
||
| ) | const [protected] |
Helper method to issue error messages.
| msg | [IN] Text of the error message |
| throw_exc[IN] | If true throw an exception of type std::runtime_error |
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.
| 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 |
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);
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.
| pReg | [IN] Pointer to registry entry. |
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 "";
}
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.