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

NTuple converter class definition for NTuples writted/read using ROOT. More...

#include <Root/RootNTupleCnv.h>

Inheritance diagram for Gaudi::RootNTupleCnv:
Collaboration diagram for Gaudi::RootNTupleCnv:

Public Member Functions

 RootNTupleCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Standard constructor.
 
virtual ~RootNTupleCnv ()
 Standard destructor.
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAdd)
 Converter overrides: Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAdd, DataObject *pObj)
 Resolve the references of the converted object.
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the transient object: NTuples end here when reading records.
 
virtual StatusCode updateObjRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode updateRep (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the converted representation of a transient object.
 
virtual StatusCode updateRepRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the converted representation of a transient object.
 
 RootNTupleCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Standard constructor.
 
virtual ~RootNTupleCnv ()
 Standard destructor.
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAdd)
 Converter overrides: Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAdd, DataObject *pObj)
 Resolve the references of the converted object.
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the transient object: NTuples end here when reading records.
 
virtual StatusCode updateObjRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the references of an updated transient object.
 
virtual StatusCode updateRep (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the converted representation of a transient object.
 
virtual StatusCode updateRepRefs (IOpaqueAddress *, DataObject *)
 Converter overrides: Update the converted representation of a transient object.
 
- Public Member Functions inherited from Gaudi::RootStatCnv
 RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
virtual ~RootStatCnv ()
 Standard Destructor.
 
 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.
 
 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.
 
- 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 CLIDobjType () 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.
 
 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< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name")
 
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 CLIDobjType () 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.
 
 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< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name")
 

Protected Member Functions

StatusCode i__updateObjRoot (RootAddress *rpA, INTuple *tupl, TTree *tree, RootDataConnection *con)
 Update the transient object: NTuples end here when reading records.
 
StatusCode i__updateObjRoot (RootAddress *rpA, INTuple *tupl, TTree *tree, RootDataConnection *con)
 Update the transient object: NTuples end here when reading records.
 
- Protected Member Functions inherited from Gaudi::RootStatCnv
MsgStreamlog () 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.
 
MsgStreamlog () 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.
 

Additional Inherited Members

- Public Types inherited from Converter
typedef
Gaudi::PluginService::Factory
< IConverter *, ISvcLocator * > 
Factory
 
typedef
Gaudi::PluginService::Factory
< IConverter *, ISvcLocator * > 
Factory
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
- Protected Attributes inherited from Gaudi::RootStatCnv
IDataManagerSvcm_dataMgr
 Reference to data manager service to manipulate the TES.
 
MsgStreamm_log
 Reference to logger object.
 

Detailed Description

NTuple converter class definition for NTuples writted/read using ROOT.

Description: Definition of the generic converter for row wise and column wise Ntuples.

Author
M.Frank
Version
1.0

Definition at line 35 of file RootNTupleCnv.h.

Constructor & Destructor Documentation

Gaudi::RootNTupleCnv::RootNTupleCnv ( long  typ,
const CLID clid,
ISvcLocator svc,
RootCnvSvc mgr 
)
inline

Standard constructor.

Parameters
clid[IN] Class ID of the object type to be converted.
db[IN] Pointer to POOL database interface
svc[IN] Pointer to Gaudi service locator
Returns
Reference to RootNTupleCnv object

Definition at line 55 of file RootNTupleCnv.h.

: RootStatCnv(typ, clid, svc, mgr) {}
virtual Gaudi::RootNTupleCnv::~RootNTupleCnv ( )
inlinevirtual

Standard destructor.

Definition at line 59 of file RootNTupleCnv.h.

{}
Gaudi::RootNTupleCnv::RootNTupleCnv ( long  typ,
const CLID clid,
ISvcLocator svc,
RootCnvSvc mgr 
)
inline

Standard constructor.

Parameters
clid[IN] Class ID of the object type to be converted.
db[IN] Pointer to POOL database interface
svc[IN] Pointer to Gaudi service locator
Returns
Reference to RootNTupleCnv object

Definition at line 55 of file RootNTupleCnv.h.

: RootStatCnv(typ, clid, svc, mgr) {}
virtual Gaudi::RootNTupleCnv::~RootNTupleCnv ( )
inlinevirtual

Standard destructor.

Definition at line 59 of file RootNTupleCnv.h.

{}

Member Function Documentation

StatusCode RootNTupleCnv::createObj ( IOpaqueAddress pAddress,
DataObject *&  refpObject 
)
virtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
refpObject[OUT] Location to store pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

Definition at line 137 of file RootNTupleCnv.cpp.

{
StatusCode status = S_FAIL;
IRegistry* pRegistry = pAddr->registry();
RootAddress* rpA = dynamic_cast<RootAddress*>(pAddr);
string path = fileName(pRegistry);
string cntName = containerName(pRegistry);
string* par = const_cast<string*>(pAddr->par());
if ( status.isSuccess() ) {
string par_val, par_guid;
TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription");
if ( b ) {
auto_ptr<RootNTupleDescriptor> dsc(ptr=new RootNTupleDescriptor());
b->SetAddress(&ptr);
for(Long64_t i=0, nent = b->GetEntries(); i<nent; ++i) {
int nb = b->GetEntry(i);
if ( nb > 1 ) {
if ( ptr->container == cntName ) {
par_val = ptr->description;
break;
}
}
}
}
par[2] = _tr(cntName);
TTree* tree = con->getSection(par[2]);
if ( 0 == tree ) {
return makeError("Failed to access N-Tuple tree:"+cntName);
}
if ( !par_val.empty() ) {
if ( ntupleSvc.isValid() ) {
char c;
CLID clid;
int siz, typ;
string title;
NTuple::Tuple* nt = 0;
istringstream is(par_val);
getline(is, title, ';') >> clid >> c >> siz >> c;
status = ntupleSvc->create(clid, title, nt);
for ( int j = 0; j < siz && status.isSuccess(); j++ ) {
is >> c;
getline(is, title, ';') >> typ >> c;
switch ( typ )
{
status = createItem(tree, nt, is, title, true, (unsigned char)0);
break;
status = createItem(tree, nt, is, title, true, (unsigned short)0);
break;
status = createItem(tree, nt, is, title, true, (unsigned int)0);
break;
status = createItem(tree, nt, is, title, true, (unsigned long)0);
break;
status = createItem(tree, nt, is, title, true, char(0));
break;
status = createItem(tree, nt, is, title, true, short(0));
break;
status = createItem(tree, nt, is, title, true, int(0));
break;
status = createItem(tree, nt, is, title, true, long(0));
break;
status = createItem(tree, nt, is, title, true, false);
break;
status = createItem(tree, nt, is, title, true, float(0.0));
break;
status = createItem(tree, nt, is, title, true, double(0.0));
break;
/*
case DataTypeInfo::NTCHAR:
case DataTypeInfo::LONG_NTCHAR:
status =
createItem(tree, nt, is, title, true, (char*)0);
break;
case DataTypeInfo::STRING:
case DataTypeInfo::LONG_STRING:
status =
createItem(tree, nt, is, title, true, string(""));
break;
*/
status = createItem(tree, nt, is, title, false, (IOpaqueAddress*)0);
break;
status = createItem(tree, nt, is, title, true, (void*)0);
break;
default:
status = S_FAIL;
break;
}
if ( !status.isSuccess() ) {
<< "Error connecting (Unknown) column:" << j << endmsg
<< par_val << endmsg;
return makeError("createObj[NTuple]> Cannot determine column!");
}
}
if ( status.isSuccess() ) {
unsigned long* ipar = const_cast<unsigned long*>(rpA->ipar());
log() << MSG::DEBUG << "Created N-tuple with description:"
<< par_val << endl;
ipar[0] = (unsigned long)con;
ipar[1] = ~0x0UL;
rpA->section = tree;
refpObject = nt;
}
else {
refpObject = 0;
if ( nt ) nt->release();
}
}
}
}
return status;
}
virtual StatusCode Gaudi::RootNTupleCnv::createObj ( IOpaqueAddress pAddress,
DataObject *&  refpObject 
)
virtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
refpObject[OUT] Location to store pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

StatusCode RootNTupleCnv::createRep ( DataObject pObj,
IOpaqueAddress *&  refpAdd 
)
virtual

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

Convert the transient object to the requested representation.

Parameters
pObj[IN] Valid pointer to DataObject
refpAdd[OUT] Location to store pointer to the object's opaque address
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

Definition at line 400 of file RootNTupleCnv.cpp.

{
IRegistry* pRegistry = pObj->registry();
if ( 0 != pRegistry ) {
pAddr = pRegistry->address();
if ( 0 != pAddr ) {
return S_OK;
}
string path = fileName(pRegistry);
string cntName = containerName(pRegistry);
string secName = cntName.c_str();
const INTuple* nt = dynamic_cast<const INTuple*>(pObj);
StatusCode status = m_dbMgr->connectDatabase(path, IDataConnection::UPDATE, &con);
if ( !status.isSuccess() ) {
return makeError("Failed to access Tuple file:"+path);
}
TTree* tree = con->getSection(_tr(secName),true);
if ( 0 != nt ) {
const INTuple::ItemContainer& items = nt->items();
ostringstream os;
size_t item_no;
string desc;
os << nt->title()<<';'<<pObj->clID()<<';'<<items.size()<< ';';
map<string,TBranch*> branches;
TBranch* b = 0;
for(item_no = 0; item_no < items.size(); ++item_no ) {
INTupleItem* it = items[item_no];
if ( it->hasIndex() ) {
const string& n = itm->name();
switch( itm->type() )
{
desc = n+"/b";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/s";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/i";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/l";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/B";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/S";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/I";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
desc = n+"/L";
b = tree->Branch(n.c_str(),(void*)itm->buffer(),desc.c_str());
break;
default:
return makeError("Column "+it->index()+" is not a valid index column!");
}
branches[n] = b;
}
}
for(item_no = 0; item_no < items.size(); ++item_no ) {
INTupleItem* it = items[item_no];
const string& n = it->name();
os << '{'
<< n << ';'
<< it->type() << ';'
<< it->length() << ';'
<< it->ndim() << ';'
<< it->hasIndex() << ';';
if ( it->hasIndex() ) {
os << it->index() << ';';
INTupleItem* itm = it->indexItem();
switch( itm->type() )
{
putRange(os, dynamic_cast<NTuple::_Data<unsigned char>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<unsigned short>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<unsigned int>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<unsigned long>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<char>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<short>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<int>*>(itm));
break;
putRange(os, dynamic_cast<NTuple::_Data<long>*>(itm));
break;
default:
return makeError("NTuple:"+pRegistry->name()+" Column "+it->index()+
" is not a valid index column!");
}
}
for ( long k = 0; k < it->ndim(); k++ ) {
os << it->dim(k) << ';';
}
desc = n;
TClass* cl = 0;
switch(it->type())
{
desc = "/C";
os << 0 << ';' << 0 << ';';
break;
desc = "/C";
os << 0 << ';' << 0 << ';';
break;
if ( it->length() == 1 ) {
desc = System::typeinfoName(typeid(RootRef));
os << 0 << ';' << 0 << ';';
cl = TClass::GetClass(desc.c_str(),kTRUE);
}
break;
if ( it->length() == 1 ) {
os << 0 << ';' << 0 << ';';
cl = TClass::GetClass(it->typeID(), kTRUE);
}
break;
desc = "/b";
putRange(os, dynamic_cast<NTuple::_Data<unsigned char>*>(it));
break;
desc = "/s";
putRange(os, dynamic_cast<NTuple::_Data<unsigned short>*>(it));
break;
desc = "/i";
putRange(os, dynamic_cast<NTuple::_Data<unsigned int>*>(it));
break;
desc = "/l";
putRange(os, dynamic_cast<NTuple::_Data<unsigned long>*>(it));
break;
desc = "/B";
putRange(os, dynamic_cast<NTuple::_Data<char>*>(it));
break;
desc = "/S";
putRange(os, dynamic_cast<NTuple::_Data<short>*>(it));
break;
desc = "/I";
putRange(os, dynamic_cast<NTuple::_Data<int>*>(it));
break;
desc = "/L";
putRange(os, dynamic_cast<NTuple::_Data<long>*>(it));
break;
desc = "/b";
putRange(os, dynamic_cast<NTuple::_Data<bool>*>(it));
break;
desc = "/F";
putRange(os, dynamic_cast<NTuple::_Data<float>*>(it));
break;
desc = "/D";
putRange(os, dynamic_cast<NTuple::_Data<double>*>(it));
break;
default:
return makeError("Create item[FAIL]: "+it->name());
}
os << '}';
if ( branches.find(n) == branches.end() ) {
string tmp;
char text[32];
switch(it->ndim())
{
case 0:
desc = n+desc;
break;
case 2:
sprintf(text,"[%ld]",it->dim(0));
tmp = text;
case 1:
if ( it->hasIndex() ) {
INTupleItem* itm = it->indexItem();
desc = n + tmp + "[" + itm->name() + "]" + desc;
}
else {
sprintf(text,"[%ld]",it->dim(0));
desc = n + tmp + text + desc;
}
}
log() << MSG::DEBUG << "Create branch:" << n << " Desc:" << desc
<< " of type:" << it->type() << endmsg;
switch(it->type())
{
branches[n] = tree->Branch(n.c_str(),cl->GetName(),(void*)it->buffer());
break;
branches[n] = tree->Branch(n.c_str(),cl->GetName(),(void*)it->buffer());
break;
default:
branches[n] = tree->Branch(n.c_str(),(void*)it->buffer(),desc.c_str());
break;
}
}
}
log() << MSG::DEBUG << "Save description:" << path << " -> " << cntName << endmsg
<< os.str() << endmsg;
status = saveDescription(path,cntName,os.str(),"",pObj->clID());
if ( status.isSuccess() ) {
status = m_dbMgr->commitOutput(path, true);
if ( status.isSuccess() ) {
string spar[] = { path, cntName};
unsigned long ipar[] = { (unsigned long)con, ~0x0u };
status = m_dbMgr->createAddress(repSvcType(),pObj->clID(),spar,ipar,pAddr);
if ( status.isSuccess() ) {
RootAddress* rpA = dynamic_cast<RootAddress*>(pAddr);
((unsigned long*)rpA->ipar())[0] = (unsigned long)con;
rpA->section = tree;
}
else {
pAddr->release();
pAddr = 0;
}
}
}
return status;
}
}
return S_FAIL;
}
virtual StatusCode Gaudi::RootNTupleCnv::createRep ( DataObject pObj,
IOpaqueAddress *&  refpAdd 
)
virtual

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

Parameters
pObj[IN] Valid pointer to DataObject
refpAdd[OUT] Location to store pointer to the object's opaque address
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

virtual StatusCode Gaudi::RootNTupleCnv::fillObjRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

Definition at line 100 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::fillObjRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

Definition at line 100 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
StatusCode RootNTupleCnv::fillRepRefs ( IOpaqueAddress pAdd,
DataObject pObj 
)
virtual

Resolve the references of the converted object.

Parameters
pAdd[IN] Valid pointer to the object's opaque address
pObj[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

Definition at line 656 of file RootNTupleCnv.cpp.

{
typedef INTuple::ItemContainer Cont;
INTuple* tupl = dynamic_cast<INTuple*>(pObj);
IRegistry* pReg = pObj->registry();
RootAddress* rpA = dynamic_cast<RootAddress*>(pAddr);
if ( tupl && pReg && rpA ) {
string cntName = containerName(pReg);
unsigned long* ipar = const_cast<unsigned long*>(pAddr->ipar());
if ( con ) {
TTree* tree = rpA->section;
if ( tree ) {
Cont& it = tupl->items();
size_t k, n = it.size();
vector<RootRef*> paddr(n);
vector<RootRef> addr(n);
for(k = 0; k < n; ++k) {
IOpaqueAddress* pA = 0;
Cont::value_type j = it[k];
switch( j->type() )
{
pA = (*(IOpaqueAddress**)j->buffer());
paddr[k] = &addr[k];
addr[k].reset();
if ( pA ) {
con->makeRef(pA->registry(),addr[k]);
addr[k].entry = pA->ipar()[1];
}
tree->SetBranchAddress(j->name().c_str(),&paddr[k]);
break;
default:
break;
}
}
int nb = tree->Fill();
if ( nb>1 ) ++ipar[1];
for(k = 0; k < n; ++k) it[k]->reset();
}
return makeError("fillRepRefs> Failed to access data tree:"+cntName);
}
return makeError("fillRepRefs> Failed to access data source!");
}
return makeError("fillRepRefs> Invalid Tuple reference.");
}
virtual StatusCode Gaudi::RootNTupleCnv::fillRepRefs ( IOpaqueAddress pAdd,
DataObject pObj 
)
virtual

Resolve the references of the converted object.

Parameters
pAdd[IN] Valid pointer to the object's opaque address
pObj[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Gaudi::RootConverter.

StatusCode RootNTupleCnv::i__updateObjRoot ( RootAddress rpA,
INTuple tupl,
TTree *  tree,
RootDataConnection con 
)
protected

Update the transient object: NTuples end here when reading records.

Definition at line 293 of file RootNTupleCnv.cpp.

{
typedef INTuple::ItemContainer Cont;
const string* par = rpA->par();
unsigned long* ipar = const_cast<unsigned long*>(rpA->ipar());
++ipar[1];
if ( Long64_t(ipar[1]) <= tree->GetEntries() ) {
GenericAddress* pA = 0;
Cont& it = tupl->items();
size_t k, n = it.size();
vector<RootRef*> paddr(n);
vector<RootRef> addr(n);
for(k = 0; k < n; ++k) {
Cont::value_type j = it[k];
switch( j->type() )
{
paddr[k] = &addr[k];
tree->SetBranchAddress(j->name().c_str(),&paddr[k]);
break;
default:
break;
}
}
ULong64_t last = (ULong64_t)tree->GetEntries();
if ( sel ) {
string criteria = (sel && (sel->type() & ISelectStatement::STRING))
? sel->criteria() : string("");
if ( !(criteria.length() == 0 || criteria == "*") ) {
if ( rpA->select == 0 ) {
log() << MSG::DEBUG << "Selection criteria: " << criteria << " " << ipar[1] << endmsg;
rpA->select = new TTreeFormula(tree->GetName(),criteria.c_str(), tree);
}
rpA->select->SetTree(tree);
for( ; ipar[1] < last; ++ipar[1]) { // loop on all selected entries
tree->LoadTree(ipar[1]);
rpA->select->GetNdata();
if ( fabs(rpA->select->EvalInstance(0)) > std::numeric_limits<float>::epsilon() ) {
break;
}
log() << MSG::DEBUG << par[0] << "/" << par[1] << " SKIP Entry: " << ipar[1] << endmsg;
}
}
}
if ( ipar[1] < last ) {
unsigned long entry = ipar[1];
if ( tree->GetEntry(entry) > 1 ) {
RootRef *r = 0;
string *spar = 0;
for(k = 0; k < n; ++k) {
Cont::value_type j = it[k];
switch( j->type() )
{
r = paddr[k];
pA = (*(GenericAddress**)j->buffer());
if ( pA ) { // Fill only if item is connected!
spar = (string*)pA->par();
ipar = (unsigned long*)pA->ipar();
pair<const RootRef*,const RootDataConnection::ContainerSection*> ls = con->getMergeSection(tree->GetName(),entry);
if ( ls.first ) {
if ( ls.first->dbase >= 0 ) {
// Now patch the references and links 'en block' to be efficient
// First the leafs from the TES
r->dbase += ls.first->dbase;
r->container += ls.first->container;
r->link += ls.first->link;
if ( log().isActive() ) {
log() << "Refs: LS [" << entry << "] -> "
<< ls.first->dbase << "," << ls.first->container
<< "," << ls.first->link
<< "," << ls.first->entry
<< " DB:" << con->getDb(r->dbase)
<< endmsg;
}
}
}
spar[0] = con->getDb(r->dbase);
spar[1] = con->getCont(r->container);
spar[2] = con->getLink(r->link);
ipar[0] = 0;
ipar[1] = r->entry;
pA->setClID(r->clid);
pA->setSvcType(r->svc);
break;
}
break;
default:
break;
}
}
}
log() << MSG::ERROR << "Failed to read data from NTuple tree." << endmsg;
}
log() << MSG::INFO << "End of input Ntuple." << endmsg;
}
}
StatusCode Gaudi::RootNTupleCnv::i__updateObjRoot ( RootAddress rpA,
INTuple tupl,
TTree *  tree,
RootDataConnection con 
)
protected

Update the transient object: NTuples end here when reading records.

StatusCode RootNTupleCnv::updateObj ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Update the transient object: NTuples end here when reading records.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 267 of file RootNTupleCnv.cpp.

{
INTuple* tupl = dynamic_cast<INTuple*>(pObj);
RootAddress* rpA = dynamic_cast<RootAddress*>(pAddr);
if ( 0 != tupl && 0 != rpA ) {
if ( con ) {
TTree* tree = rpA->section;
if ( tree ) {
con->resetAge();
if ( con->tool()->refs() )
return i__updateObjRoot(rpA,tupl,tree,con);
#ifdef __POOL_COMPATIBILITY
// POOL compatibility mode:
return i__updateObjPool(rpA,tupl,tree,con);
#else
return makeError("Failed to access reference branch for data tree:"+rpA->par()[1]);
#endif
}
return makeError("Failed to access data tree:"+pAddr->par()[1]);
}
return makeError("updateObj> Failed to access data source!");
}
return makeError("updateObj> Invalid Tuple reference.");
}
virtual StatusCode Gaudi::RootNTupleCnv::updateObj ( IOpaqueAddress pAddress,
DataObject pObject 
)
virtual

Update the transient object: NTuples end here when reading records.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

virtual StatusCode Gaudi::RootNTupleCnv::updateObjRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 122 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::updateObjRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

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

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 122 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::updateRep ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

Converter overrides: Update the converted representation of a transient object.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 134 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::updateRep ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

Converter overrides: Update the converted representation of a transient object.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 134 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::updateRepRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

Converter overrides: Update the converted representation of a transient object.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 146 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }
virtual StatusCode Gaudi::RootNTupleCnv::updateRepRefs ( IOpaqueAddress ,
DataObject  
)
inlinevirtual

Converter overrides: Update the converted representation of a transient object.

Parameters
pAddress[IN] Valid pointer to the object's opaque address
pObject[IN] Valid pointer to DataObject
Returns
Status code indicating success or failure

Reimplemented from Converter.

Definition at line 146 of file RootNTupleCnv.h.

{ return StatusCode::SUCCESS; }

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