23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Athena</strong><br />

Chapter 15 Converters Version/Issue: 2.0.0<br />

Listing 15.1 An example converter class<br />

// Converter for class UDO.<br />

extern const CLID& CLID_UDO;<br />

extern unsigned char OBJY_StorageType;<br />

static CnvFactory s_factory;<br />

const ICnvFactory& UDOCnvFactory = s_factory;<br />

class UDOCnv : public Converter {<br />

public:<br />

UDOCnv(ISvcLocator* svcLoc) :<br />

Converter(Objectivity_StorageType, CLID_UDO, svcLoc) { }<br />

}<br />

createRep(DataObject* pO, IOpaqueAddress*& a); // transient->persistent<br />

createObj(IOpaqueAddress* pa, DataObject*& pO); // persistent->transient<br />

fillObjRefs( ... ); // transient->persistent<br />

fillRepRefs( ... ); // persistent->transient<br />

15.6 Storing Data using the ROOT I/O Engine<br />

One possibility for storing data is to use the ROOT I/O engine to write ROOT files. Although ROOT by<br />

itself is not an object oriented database, with modest effort a structure can be built on top to allow the<br />

Converters to emulate this behaviour. In particular, the issue of object linking had to be solved in order<br />

to resolve pointers in the transient world.<br />

The concept of ROOT supporting paged tuples called trees and branches is adequate for storing bulk<br />

event data. Trees split into one or several branches containing individual leaves with data. The data<br />

structure within the <strong>Athena</strong> data store is tree like (as an example, part of the LHCb event data model is<br />

shown in Figure 15.1).<br />

In the transient world <strong>Athena</strong> objects are sub-class instances of the “DataObject”. The DataObject<br />

offers some basic functionality like the implicit data directory which allows e.g. to browse a data store.<br />

This tree structure will be mapped to a flat structure in the ROOT file resulting in a separate tree<br />

representing each leaf of the data store. Each data tree contains a single branch containing objects of the<br />

same type. The <strong>Athena</strong> tree is split up into individual ROOT trees in order to give easy access to<br />

individual items represented in the transient model without the need of loading complete events from<br />

the root file i.e. to allow for selective data retrieval. The feature of ROOT supporting selective data<br />

reading using split trees did not seem too attractive since, generally, complete nodes in the transient<br />

store should be made available in one go.<br />

However, ROOT expects “ROOT” objects, they must inherit from TObject. Therefore the objects<br />

from the transient store have to be converted to objects understandable by ROOT.<br />

page 143

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!