Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
RootHistCnv::RCWNTupleCnv Class Reference

Converter of Column-wise NTuple into ROOT format. More...

#include <RCWNTupleCnv.h>

Inheritance diagram for RootHistCnv::RCWNTupleCnv:
Inheritance graph
[legend]
Collaboration diagram for RootHistCnv::RCWNTupleCnv:
Collaboration graph
[legend]

Public Member Functions

 RCWNTupleCnv (ISvcLocator *svc)
 Standard constructor.
 
virtual ~RCWNTupleCnv ()
 Standard destructor.
 
- Public Member Functions inherited from RootHistCnv::RNTupleCnv
virtual StatusCode initialize ()
 Initialize the converter.
 
virtual StatusCode finalize ()
 Finalize the converter.
 
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create the transient representation of an object.
 
virtual StatusCode updateObj (IOpaqueAddress *pAddr, DataObject *refpObj)
 Update the transient object from the other representation.
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
 Convert the transient object to the requested representation.
 
virtual StatusCode updateRep (IOpaqueAddress *pAddr, DataObject *pObj)
 Update the converted representation of a transient object.
 
- Public Member Functions inherited from RootHistCnv::RConverter
long repSvcType () const
 Retrieve the class type of the data store the converter uses.
 
StatusCode error (const std::string &msg)
 
StatusCode regTFile (const std::string, const TFile *)
 
StatusCode findTFile (const std::string, TFile *&)
 
std::string diskDirectory (const std::string &loc)
 
std::string directory (const std::string &loc)
 
void setDirectory (const std::string &loc)
 
void setDiskDirectory (const std::string &loc)
 
StatusCode createDirectory (const std::string &loc)
 
StatusCode createDiskDirectory (const std::string &loc)
 
std::string getDirectory ()
 
std::string convertId (const std::string &) const
 
- 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.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the created transient object.
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an updated transient object.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted 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< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name")
 

Static Public Member Functions

static const CLIDclassID ()
 Inquire class type.
 

Protected Member Functions

virtual StatusCode load (TTree *tree, INTuple *&refpObject)
 Create the transient representation of an object.
 
virtual StatusCode book (const std::string &desc, INTuple *pObject, TTree *&tree)
 Book the N tuple.
 
virtual StatusCode writeData (TTree *rtree, INTuple *pObject)
 Write N tuple data.
 
virtual StatusCode readData (TTree *rtree, INTuple *pObject, long ievt)
 Read N tuple data.
 
template<class T >
size_t saveItem (char *target, const T *src, size_t len)
 
template<typename T >
size_t saveItem (char *target, T *src, size_t len)
 
template<class T >
size_t loadItem (char *src, T *tar, size_t len)
 
size_t loadItem (char *src, bool *tar, size_t len)
 
size_t loadItem (char *src, float *target, size_t len)
 
size_t loadItem (char *src, double *target, size_t len)
 
size_t loadItem (char *src, long *target, size_t len)
 
size_t loadItem (char *src, unsigned long *target, size_t len)
 
- Protected Member Functions inherited from RootHistCnv::RNTupleCnv
 RNTupleCnv (ISvcLocator *svc, const CLID &clid)
 Standard constructor.
 
virtual ~RNTupleCnv ()
 Standard destructor.
 
virtual std::string rootVarType (int)
 Return ROOT type info:
 
- Protected Member Functions inherited from RootHistCnv::RConverter
 RConverter (const CLID &clid, ISvcLocator *svc)
 Standard constructor.
 
virtual ~RConverter ()
 Standard destructor.
 
virtual StatusCode readObject (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create the transient representation of an object.
 
virtual TObject * createPersistent (DataObject *pObj)
 Create the persistent representation of an object.
 
StatusCode createAddress (DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
 Create address of the transient object according to the requested representation.
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, long id, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, const std::string &title, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
TDirectory * changeDirectory (DataObject *pObject)
 Switch to object directory (=Parent directory)
 
- Protected Member Functions inherited from Converter
virtual ~Converter ()
 Standard Destructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service.
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service.
 

Additional Inherited Members

- Public Types inherited from Converter
typedef
Gaudi::PluginService::Factory1
< IConverter *, ISvcLocator * > 
Factory
 
- Protected Attributes inherited from RootHistCnv::RNTupleCnv
SmartIF< INTupleSvcm_ntupleSvc
 Reference to N tuple service.
 

Detailed Description

Converter of Column-wise NTuple into ROOT format.

Author
Charles Leggett

Definition at line 23 of file RCWNTupleCnv.h.

Constructor & Destructor Documentation

RootHistCnv::RCWNTupleCnv::RCWNTupleCnv ( ISvcLocator svc)
inline

Standard constructor.

Definition at line 30 of file RCWNTupleCnv.h.

: RNTupleCnv(svc, classID()) {
}
virtual RootHistCnv::RCWNTupleCnv::~RCWNTupleCnv ( )
inlinevirtual

Standard destructor.

Definition at line 33 of file RCWNTupleCnv.h.

{
}

Member Function Documentation

StatusCode RootHistCnv::RCWNTupleCnv::book ( const std::string &  desc,
INTuple pObject,
TTree *&  tree 
)
protectedvirtual

Book the N tuple.

Implements RootHistCnv::RNTupleCnv.

Definition at line 91 of file RCWNTupleCnv.cpp.

{
MsgStream log(msgSvc(), "RCWNTupleCnv");
rtree = new TTree(desc.c_str(), nt->title().c_str());
log << MSG::VERBOSE << "created tree id: " << rtree->GetName()
<< " title: "<< nt->title() << " desc: " << desc << endmsg;
// Loop over the items
std::string block_name,var_name;
long lowerRange, upperRange;
long size = 0;
long cursize, oldsize = 0;
std::vector<std::string> item_fullname;
// std::vector<long> item_size,item_size2;
std::vector<long> item_buf_pos, item_buf_len, item_buf_end;
std::vector<long> item_range_lower, item_range_upper;
std::vector<std::pair<std::string,std::string> > item_name;
const INTuple::ItemContainer& cols = nt->items();
for (INTuple::ItemContainer::const_iterator i = cols.begin();
i != cols.end(); ++i ) {
std::string item = "";
switch( (*i)->type() ) {
case DataTypeInfo::INT: // int
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<int>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::CHAR: // char
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<char>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::SHORT: // short
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<short>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::LONG: // long
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<long>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::LONGLONG: // long long
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<long long>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::UCHAR: // unsigned char
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<unsigned char>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::USHORT: // unsigned short
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<unsigned short>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::UINT: // unsigned int
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<unsigned int>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::ULONG: // unsigned long
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<unsigned long>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::ULONGLONG: // unsigned long long
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<unsigned long long>*>(*i),
item, block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::DOUBLE: // double
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<double>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::FLOAT: // float
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<float>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
case DataTypeInfo::BOOL: // bool
analyzeItem(rootVarType( (*i)->type() ),
dynamic_cast<const NTuple::_Data<bool>*>(*i),item,
block_name,var_name,lowerRange,upperRange,size);
break;
default:
break;
}
item_name.push_back(std::pair<std::string,std::string>(block_name,item));
cursize = size - oldsize;
log << MSG::VERBOSE << "item: " << item << " type " << (*i)->type()
<< " blk: " << block_name
<< " var: " << var_name << " rng: " << lowerRange << " "
<< upperRange << " sz: " << size << " " << cursize
<< " buf_pos: " << size-cursize << endmsg;
item_fullname.push_back(var_name);
item_buf_pos.push_back(size-cursize);
item_buf_len.push_back(cursize);
item_buf_end.push_back(size);
item_range_lower.push_back(lowerRange);
item_range_upper.push_back(upperRange);
oldsize = size;
}
char* buff = new char[size];
log << MSG::VERBOSE << "Created buffer size: " << size << " at "
<< (void*)buff << endmsg;
// Zero out the buffer to make ROOT happy
memset (buff,0,size);
// Tell the ntuple where it is
nt->setBuffer(buff);
char *buf_pos = buff;
std::vector<std::pair<std::string,std::string> >::const_iterator itr,end;
end = item_name.end();
// Loop over items, creating a new branch for each one;
unsigned int i_item = 0;
for (itr=item_name.begin(); itr!=end; ++itr, ++i_item) {
buf_pos = buff + item_buf_pos[i_item];
// log << MSG::WARNING << "adding TBranch " << i_item << " "
// << item_fullname[i_item]
// << " format: " << itr->second.c_str() << " at "
// << (void*) buf_pos << " (" << (void*) buff << "+"
// << (void*)item_buf_pos[i_item] << ")"
// << endmsg;
#if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,0)
TBranch *br = new TBranch(rtree,
#else
TBranch *br = new TBranch(
#endif
item_fullname[i_item].c_str(),
buf_pos,
itr->second.c_str()
);
if (itr->first != "AUTO_BLK") {
std::string tit = itr->first;
tit = itr->first + "::" + br->GetTitle();
br->SetTitle(tit.c_str());
}
log << MSG::DEBUG << "adding TBranch " << br->GetTitle() << " at "
<< (void*) buf_pos << endmsg;
// for index items with a limited range. Must be a TLeafI!
if ( item_range_lower[i_item] < item_range_upper[i_item] ) {
// log << MSG::VERBOSE << "\"" << item_fullname[i_item]
// << "\" is range limited " << item_range_lower[i_item] << " "
// << item_range_upper[i_item] << endmsg;
TLeafI *index = 0;
TObject *tobj = br->GetListOfLeaves()->FindObject( item_fullname[i_item].c_str() );
if (tobj->IsA()->InheritsFrom("TLeafI")) {
index = dynamic_cast<TLeafI*>(tobj);
if (index != 0) {
index->SetMaximum( item_range_upper[i_item] );
// FIXME -- add for next version of ROOT
// index->SetMinimum( item_range_lower[i_item] );
} else {
log << MSG::ERROR << "Could dynamic cast to TLeafI: "
<< item_fullname[i_item] << endmsg;
}
}
}
rtree->GetListOfBranches()->Add(br);
}
log << MSG::INFO << "Booked TTree with ID: " << desc
<< " \"" << nt->title() << "\" in directory "
}
static const CLID& RootHistCnv::RCWNTupleCnv::classID ( )
inlinestatic

Inquire class type.

Definition at line 26 of file RCWNTupleCnv.h.

{
}
StatusCode RootHistCnv::RCWNTupleCnv::load ( TTree *  tree,
INTuple *&  refpObject 
)
protectedvirtual

Create the transient representation of an object.

Implements RootHistCnv::RNTupleCnv.

Definition at line 428 of file RCWNTupleCnv.cpp.

{
MsgStream log(msgSvc(), "RCWNTupleCnv::load");
StatusCode status;
NTuple::Tuple *pObj = 0;
std::string title = tree->GetTitle();
log << MSG::VERBOSE << "loading CWNT " << title << " at: "
<< tree << endmsg;
status = m_ntupleSvc->create(CLID_ColumnWiseTuple, title, pObj);
INTuple* ntup = dynamic_cast<INTuple*>(pObj);
std::string itemName, indexName, item_type, itemTitle, blockName;
// long numEnt, numVar;
long size, totsize=0;
std::list< std::pair<TLeaf*,int> > itemList;
// numEnt = (int)tree->GetEntries();
// numVar = tree->GetNbranches();
// loop over all branches (==leaves)
TObjArray* lbr = tree->GetListOfBranches();
TIter bitr ( lbr );
while ( TObject *tobjb = bitr() ) {
TBranch* br = (TBranch*)tobjb;
itemTitle = br->GetTitle();
int ipos = itemTitle.find("::");
if (ipos >= 0) {
blockName = itemTitle.substr(0,ipos);
} else {
blockName = "";
}
TObjArray* lf = br->GetListOfLeaves();
TIter litr ( lf );
while ( TObject *tobj = litr() ) {
bool hasRange=false;
int indexRange = 0;
int itemSize;
item = 0;
// TLeaf* tl = (TLeaf*)tobj;
TLeaf* tl = dynamic_cast<TLeaf*> (tobj);
itemName = tl->GetName();
// char* buf_pos = (char*)tl->GetValuePointer();
// cout << " " << itemName << " " << blockName << " "
// << (void*)buf_pos;
if (blockName != "") {
log << MSG::DEBUG << "loading NTuple item " << blockName << "/"
<< itemName;
} else {
log << MSG::DEBUG << "loading NTuple item " << itemName;
}
int arraySize;
TLeaf* indexLeaf = tl->GetLeafCounter(arraySize);
if (arraySize == 0) {
log << MSG::ERROR << "TLeaf counter size = 0. This should not happen!"
<< endmsg;
}
if (indexLeaf != 0) {
//index Arrays and Matrices
indexName = indexLeaf->GetName();
// indexRange = tl->GetNdata();
indexRange = indexLeaf->GetMaximum();
itemSize = indexRange * tl->GetLenType() * arraySize;
log << "[" << indexName;
// Just for Matrices
if (arraySize != 1) {
log << "][" << arraySize;
}
log << "]";
} else {
itemSize = tl->GetLenType() * arraySize;
indexName = "";
if (arraySize == 1) {
// Simple items
} else {
// Arrays of constant size
log << "[" << arraySize << "]";
}
}
log << endmsg;
// cout << " index: " << indexName << endl;
// size = tl->GetNdata() * tl->GetLenType();
size = itemSize;
totsize += size;
hasRange = tl->IsRange();
itemList.push_back(std::pair<TLeaf*,int>(tl,itemSize));
// Integer
if (tobj->IsA()->InheritsFrom("TLeafI")) {
TLeafI *tli = dynamic_cast<TLeafI*>(tobj);
if (tli->IsUnsigned()) {
unsigned long min=0, max=0;
if (hasRange) {
min = tli->GetMinimum();
max = tli->GetMaximum();
}
item = createNTupleItem(itemName, blockName, indexName, indexRange,
arraySize,
min, max, ntup);
} else {
long min=0, max=0;
if (hasRange) {
min = tli->GetMinimum();
max = tli->GetMaximum();
}
item = createNTupleItem(itemName, blockName, indexName, indexRange,
arraySize,
min, max, ntup);
}
// Float
} else if (tobj->IsA()->InheritsFrom("TLeafF")) {
float min=0., max=0.;
TLeafF *tlf = dynamic_cast<TLeafF*>(tobj);
if (hasRange) {
min = float(tlf->GetMinimum());
max = float(tlf->GetMaximum());
}
item = createNTupleItem(itemName, blockName, indexName, indexRange,
arraySize,
min, max, ntup);
// Double
} else if (tobj->IsA()->InheritsFrom("TLeafD")) {
double min=0., max=0.;
TLeafD *tld = dynamic_cast<TLeafD*>(tobj);
if (hasRange) {
min = tld->GetMinimum();
max = tld->GetMaximum();
}
item = createNTupleItem(itemName, blockName, indexName, indexRange,
arraySize,
min, max, ntup);
} else {
log << MSG::ERROR << "Uknown data type" << endmsg;
}
if (item) {
ntup->add(item);
} else {
<< "Unable to create ntuple item \""
<< itemName << "\"" << endmsg;
}
} // end litr
} // end bitr
log << MSG::DEBUG << "Total buffer size of NTuple: " << totsize
<< " Bytes." << endmsg;
char* buf = new char[totsize];
char* bufpos = buf;
ntup->setBuffer(buf);
std::list< std::pair<TLeaf*,int> >::const_iterator iitr = itemList.begin();
int ts = 0;
for (; iitr!= itemList.end(); ++iitr) {
TLeaf* leaf = (*iitr).first;
int isize = (*iitr).second;
log << MSG::VERBOSE << "setting TBranch " << leaf->GetBranch()->GetName()
<< " buffer at " << (void*) bufpos << endmsg;
leaf->GetBranch()->SetAddress((void*)bufpos);
// //testing
// if (leaf->IsA()->InheritsFrom("TLeafI")) {
// for (int ievt=0; ievt<5; ievt++) {
// leaf->GetBranch()->GetEvent(ievt);
// int *idat = (int*)bufpos;
// log << MSG::WARNING << leaf->GetName() << ": " << ievt << " "
// << *idat << endmsg;
// }
// }
ts += isize;
bufpos += isize;
}
if (totsize != ts ) {
log << MSG::ERROR << "buffer size mismatch: " << ts << " " << totsize
<< endmsg;
}
refpObject = ntup;
}
template<class T >
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
T *  tar,
size_t  len 
)
inlineprotected

Definition at line 60 of file RCWNTupleCnv.h.

{
long* s = (long*)src;
for ( size_t i = 0; i < len; i++ ) {
*(tar++) = T( *(s++));
}
return sizeof(long)*len;
}
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
bool *  tar,
size_t  len 
)
inlineprotected

Definition at line 67 of file RCWNTupleCnv.h.

{
long* s = (long*)src;
for ( size_t i = 0; i < len; i++ ) {
*(tar++) = (*(s++)) ? true : false;
}
return sizeof(long)*len;
}
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
float *  target,
size_t  len 
)
inlineprotected

Definition at line 74 of file RCWNTupleCnv.h.

{
memcpy(target, src, sizeof(float)*len);
return sizeof(float)*len;
}
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
double *  target,
size_t  len 
)
inlineprotected

Definition at line 78 of file RCWNTupleCnv.h.

{
memcpy(target, src, sizeof(double)*len);
return sizeof(double)*len;
}
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
long *  target,
size_t  len 
)
inlineprotected

Definition at line 82 of file RCWNTupleCnv.h.

{
memcpy(target, src, sizeof(long)*len);
return sizeof(long)*len;
}
size_t RootHistCnv::RCWNTupleCnv::loadItem ( char *  src,
unsigned long *  target,
size_t  len 
)
inlineprotected

Definition at line 86 of file RCWNTupleCnv.h.

{
memcpy(target, src, sizeof(unsigned long)*len);
return sizeof(unsigned long)*len;
}
StatusCode RootHistCnv::RCWNTupleCnv::readData ( TTree *  rtree,
INTuple pObject,
long  ievt 
)
protectedvirtual

Read N tuple data.

Implements RootHistCnv::RNTupleCnv.

Definition at line 351 of file RCWNTupleCnv.cpp.

{
MsgStream log(msgSvc(), "RCWNTupleCnv::readData");
if (ievt >= rtree->GetEntries()) {
log << MSG::ERROR << "no more entries in tree to read. max: "
<< rtree->GetEntries() << " current: " << ievt
<< endmsg;
}
rtree->GetEvent(ievt);
ievt++;
INTuple::ItemContainer& cols = ntup->items();
char * src = ntup->buffer();
// copy data from ntup->buffer() to ntup->items()->buffer()
for (INTuple::ItemContainer::iterator i = cols.begin(); i != cols.end(); i++ ) {
switch( (*i)->type() ) {
case DataTypeInfo::BOOL: // bool
src += loadItem(src, (bool*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::CHAR: // char
src += loadItem(src, (char*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::SHORT: // short
src += loadItem(src, (short*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::INT: // short
src += loadItem(src, (int*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::LONG: // long
src += loadItem(src, (long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::LONGLONG: // long long
src += loadItem(src, (long long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::UCHAR: // unsigned char
src += loadItem(src, (unsigned char*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::USHORT: // unsigned short
src += loadItem(src, (unsigned short*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::UINT: // unsigned short
src += loadItem(src, (unsigned int*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::ULONG: // unsigned long
src += loadItem(src, (unsigned long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::ULONGLONG: // unsigned long long
src += loadItem(src, (unsigned long long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::FLOAT: // float
src += loadItem(src, (float*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::DOUBLE: // unsigned short
src += loadItem(src, (double*)(*i)->buffer(), (*i)->length());
break;
default:
break;
}
}
}
template<class T >
size_t RootHistCnv::RCWNTupleCnv::saveItem ( char *  target,
const T *  src,
size_t  len 
)
inlineprotected

Definition at line 46 of file RCWNTupleCnv.h.

{
long* tar = (long*)target;
for ( size_t i = 0; i < len; i++ ) {
*(tar++) = long( *(src++));
}
return sizeof(long)*len;
}
template<typename T >
size_t RootHistCnv::RCWNTupleCnv::saveItem ( char *  target,
T *  src,
size_t  len 
)
inlineprotected

Definition at line 54 of file RCWNTupleCnv.h.

{
memcpy(target, src, sizeof(T)*len);
return sizeof(T)*len;
}
StatusCode RootHistCnv::RCWNTupleCnv::writeData ( TTree *  rtree,
INTuple pObject 
)
protectedvirtual

Write N tuple data.

Implements RootHistCnv::RNTupleCnv.

Definition at line 292 of file RCWNTupleCnv.cpp.

{
// Fill the tree;
const INTuple::ItemContainer& cols = nt->items();
char * tar = nt->buffer();
for (INTuple::ItemContainer::const_iterator i = cols.begin(); i != cols.end(); i++ ) {
switch( (*i)->type() ) {
case DataTypeInfo::BOOL: // bool
tar += saveItem(tar, (bool*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::CHAR: // char
tar += saveItem(tar, (char*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::SHORT: // short
tar += saveItem(tar, (short*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::INT: // int
tar += saveItem(tar, (int*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::LONG: // long
tar += saveItem(tar, (long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::LONGLONG: // long long
tar += saveItem(tar, (long long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::UCHAR: // unsigned char
tar += saveItem(tar, (unsigned char*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::USHORT: // unsigned short
tar += saveItem(tar, (unsigned short*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::UINT: // unsigned int
tar += saveItem(tar, (unsigned int*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::ULONG: // unsigned long
tar += saveItem(tar, (unsigned long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::ULONGLONG: // unsigned long
tar += saveItem(tar, (unsigned long long*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::FLOAT: // float
tar += saveItem(tar, (float*)(*i)->buffer(), (*i)->length());
break;
case DataTypeInfo::DOUBLE: // double
tar += saveItem(tar, (double*)(*i)->buffer(), (*i)->length());
break;
default:
break;
}
}
rtree->Fill();
nt->reset();
}

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

Generated at Wed Jun 4 2014 14:49:07 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004