| Athena EDM |
| Example of Making a Converter. |
| ATLAS database page |
The converter package basically consists of two parts: a data definition of the
TTable class for storing the data in Root, and a converter class for translating
between DataObject and TTable. In this case, the DataObject is
LArCellContainer ,
(basically an ObjectVector This defines a TTable class that consists of rows of C-struct of
LArCellContainerRoot_t.
In order for Root to understand this object, it is necessary to
generate a Dictionary class for this data object. This is done by
the command, rootcint, which is in a script
MakeDict
.
After executing this script, LArGaudiRootDict.cxx and
LArGaudiRootDict.h files are created.
The converter
(LArCellGaudiRootCnv) is a derived class of
GaudiRootConverter
The basic functionality of a converter is taken care of in the
base class GaudiRootConverter.
The derived class for a particular data type is only supposed to convert between
a DataObject and a TDataSet. For objects that does not contain reference to
other objects, basically there are two methods to be implemented,
#ifndef _LArCellContainerRoot_H_
#define _LArCellContainerRoot_H_
#include "TTable.h"
#include "Ttypes.h"
typedef struct
{
float energy; // Energy deposited by hit [GeV]
float eta; // eta cell
float phi; // phi cell
float t; // time
float q; // quality dummy for now.
short channel[8]; // channel
} LArCellContainerRoot_t;
class LArCellContainerRoot : public TTable
{
public:
ClassDefTable(LArCellContainerRoot,LArCellContainerRoot_t)
ClassDef(LArCellContainerRoot,1) //C++ container for
};
#endif
virtual StatusCode DataObjectToTDataSet(DataObject* d, TDataSet*& t, string tname);
// create a TDataSet object from DataObject
virtual StatusCode TDataSetToDataObject(TDataSet* t, DataObject*& d);
// create a DataObject from TDataSet object.
See
LArCellGaudiRootCnv.cxx for detail.