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> Chapter 7 Accessing data Version/Issue: 2.0.0<br />

• Put some instructions (i.e. options) into the job option file (see Listing 7.7)<br />

• Register your object in the store us usual, typically in the execute() method of your<br />

algorithm.<br />

// myAlg implementation file<br />

StatusCode myAlg::execute() {<br />

// Create a UDO object and register it into the event data store<br />

UDO* p = new UDO();<br />

eventSvc->registerObject(“/Event/myStuff/myUDO”, p);<br />

}<br />

In order to actually trigger the conversion and saving of the objects at the end of the current event<br />

processing it is necessary to inform the application manager. This requires some options to be specified<br />

in the job options file:<br />

Listing 7.7 Job options for output to persistent storage<br />

ApplicationMgr.OutStream = { "DstWriter" };<br />

DstWriter.ItemList<br />

DstWriter.EvtDataSvc<br />

DstWriter.Output<br />

= { "/Event#1", "/Event/MyTracks#1"};<br />

= "EventDataSvc";<br />

= "DATAFILE='result.root' TYP='ROOT'";<br />

ApplicationMgr.DLLs<br />

+= { "DbConverters", "RootDb"};<br />

ApplicationMgr.ExtSvc += { "DbEventCnvSvc/RootEvtCnvSvc" };<br />

EventPersistencySvc.CnvServices += { "RootEvtCnvSvc" };<br />

RootEvtCnvSvc.DbType<br />

= "ROOT";<br />

The first option tells the application manager that you wish to create an output stream called<br />

“DstWriter”. You may create as many output streams as you like and give them whatever name you<br />

prefer.<br />

For each output stream object which you create you must set several properties. The ItemList option<br />

specifies the list of paths to the objects which you wish to write to this output stream. The number after<br />

the “#” symbol denotes the number of directory levels below the specified path which should be<br />

traversed. The (optional) EvtDataSvc option specifies in which transient data service the output<br />

stream should search for the objects in the ItemList, the default is the standard transient event data<br />

service EventDataSvc. The Output option specifies the name of the output data file and the type of<br />

persistency technology, ROOT in this example. The last three options are needed to tell the Application<br />

manager to instantiate the RootEvtCnvSvc and to associate the ROOT persistency type to this<br />

service.<br />

An example of saving data to a ROOT persistent data store is available in the RootIO example<br />

distributed with the framework.<br />

page 54

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

Saved successfully!

Ooh no, something went wrong!