US ATLAS Computing
ROOT I/O Work for ATLAS at BNL 
ATLAS database page

 

Overview

This is a description of a Root I/O service in Athena that has been developed at BNL based on a model used in Star Experiment at RHIC. The goal is to provide Athena users with a light weight persistency service with full ROOT capabilities. It not only can be used to read/write data objects in Athena transient data store (TDS) from/to Root data files, but also the data classes in persistency are fully described in the Root environment, hence can be analysed independent of Athena. It also provides a route to read external data into Athena. For example, the LAr EM barrel Geant4 simulation data are read into Athena using this service. It has also been tested for writing/reading LArCell data objects into Root persistency. The persistency of ATLFAST is currently being developed.

The implementation of the persistency service follows the Gaudi Data Store. It provides a new conversion service (GaudiRootCnvSvc) and a new EventSelector (EventSelectorGaudiRoot), as well as a set of Converters for the DataObject of interest. The DataObjects in TDS are mapped on to Root representation of the same data. Those Root Objects should be derived classes of TDataSet. TTable provides efficient implementation of containers. Currently, for each DataObject user has to define a TDataSet object by hand, and write a simple converter class that translates between the two representation. It is foreseeable that with ADL, these data classes as well as the converters can be automatically generated.

This Root persistency service has the advantage of being a light-weight service. It is easy to use on a laptop. In addition, the data in Root files can be retrieved and analysed in a stand-alone Root environment, independent of Athena. This is to be compared to the Gaudi Root-Streamer IO, which does not carry the data description for the objects in the root file. The objects are only meanful when converted back to DataObjects in Athena. One feature of this implementation may prove to be useful: while running Athena application, one can break into the Root prompt (for example at the end of an interesting event), and interactively examine the data objects in the Root representation.

Packages

The following packages have been checked into atlas CVS, except AtlfastGaudiRoot.

RootKernel:
This is a package for basic ROOT support, with no dependency on Athena. It is adapted from libStar developed for Star experiment. This package can be used outside of Athena, for example to create stand-alone ROOT analysis macros and to use RootKernel with GEANT4.
To create libRootKernel.so, one can
cvs -d :kserver:atlas-sw.cern.ch:/atlascvs co -d RootKernel offline/Database/AthenaRoot/RootKernel
make -f RootKernel/RMakefile
RootSvcModules:
This is a Gaudi service that is responsible for interacting with Root files and mananges the Root objects in memory.  It support four streams:
All data classes to be persistified in this RootSvc has to be a derived class of TDataSet. TTable is used as container, and TTableMap is used for making references to objects in other TTables. User may define their own TTable data classes in their own package or use the TGenericTable class instead.
EventSelectorGaudiRoot:
This package includes the essential components for using ROOT as input event source in Athena, providing the implementation for EventSelector/EventIterator.
GaudiRootCnvSvc:
EventHdrGaudiRoot:
GaudiRoot Converter for EventInfo class. This converter creates EventInfo for TDS in createObj(), and creates EventInfoRoot for Root in createReps(). In method fillObjRefs(), It also creates the IOpaqueAddress for the objects under EventInfo.
LArGaudiRoot:
GaudiRoot Converter packages for LAr Data classes.
AtlfastGaudiRoot: (in USATLAS CVS only).
Persistency for Atlfast. Still under development, see separate note

A container package, Database/AthenaRoot/ is expected to contain RootSvc, EventSelectorGaudiRoot and GaudiRootCnvSvc packages. LArGaudiRoot is expected to be release in LArCalorimeter/LArCnv/, while EventInfoGaudiRoot in Event/ . We aimed to keep a parity between NaiveObjy persistency and this Root Persistency.

The name "GaudiRoot" that appears in the package names and class names reflects the fact that this is a persistency service for the Gaudi Data Store. As Athena develops its own data store ( the new backend of StoreGate), a new persistnecy service may be developed.

A converter package contains both the root data class and the converter. Two libraries are created, one is the component library that contains the converter, and the other is a link library that only has the root data class definition, (normally named as lib${package}DataDef.so ), with not dependency on Athena. The latter is to be used in root session, to read the root file into memory.

A csh script for checking out and building the packages with SRT release 2.0.1 can be found here . Another csh script for building the packaghes with CMT release 2.1.1 is here .

Examples:

Reading and Writing LAr Data classes


For building a running example, there is a script for checking out all the necessary packages and building the packages in proper order: ~hma/public/co-1.3.2-LArRoot-v5 (on both usatlas machines, and cern atlas machines. ) This has been tested on both cern linux machines and usatlas linux machines . If you run at cern, you need to run klog to rhic so that you have access to usatlas cvs (ask Torre or Hong for passwd). Also make sure that $ROOTSYS is defined (at cern, it should be /afs/cern.ch/na49/library.4/ROOT/pro/rootsys), and $ROOTSYS/bin is in your $path, and ROOTTOP is defined as $ROOTSYS/lib.

jobOptions files:

jobOptions_LArDDWriter.txt
It reads Zebra TDR data, and writes LArDetDescr.root and LArDD.C for LArDetDescrManager.
jobOptions_LArCellWriter.txt
Builds LArCell objects from Zebra files, then writes LArCell into Root persistency.
jobOptions_LArCellReader.txt
Reads LArCell objects from Root persistency as well as builds LArDetDescrManager from LArDetDescr.root .
jobOptions_LArHitReader.txt:
Reads LArHit objects from Root persistency made by G4 simulation. Make Ntuple. Builds LArDetDescrManager as well.
jobOptions_LArHitLArCell.txt:
Reads LArHit objects from Root, Makes Ntuple for LArHits Makes LArCell from LArHit, Makes Ntuple for LArCells. These jobs produce ntuple files, *.hbook.
 

More Details:

LAr Simulation/Reconstruction with ROOT I/O

StoreGate

Example of Making a Converter

Root Persistency for Atlfast