Load LGC dictionaries in ROOT

 

Load LGC dictionaries in ROOT

 

The LCG Dictionary is an attempt to provide introspection (reflection) functionality to the standard  C++. Reflection is a mechanism making it possible to investigate yourself. If we are speaking about programming languages, reflection is used to investigate format of objects at runtime, invoke methods and access fields of these objects. Reflection is required if you want to implement some generic code which can work with objects of unknown (at the time of creation of this code) types. There are several tasks in which reflection can be used: remote method invocation, serialization, object dumps, database interfaces. How it works? Given some object we first should ask for its type. As a result we are given class descriptor, which provides information about class methods and fields. We can use these field descriptors to fetch/store object fields and can use method descriptors to lookup and invoke methods.

In Athena LCG dictionaries are added using these lines in the requirement file of MyPackage:


use AtlasReflex AtlasReflex-00-* External -no_auto_imports

apply_pattern lcgdict dict=MyPackage selectionfile=selection.xml \

headerfile="../MyPackage/MyPackageDict.h"


Providing selection.xml and MyPackageDict.h files. See http://seal.web.cern.ch/seal/snapshot/workbook/HowToLCGDictionary.html  for how to create them.

After compiling dictionary library is named libMyPackageDict.so

This can be loaded in ROOT using:


Cintex::Enable()

gSystem->Load("libMyPackageDict")


At this point classes, structures, enumerations defined in selection.hml and MyPackageDict.h files should be accessible directly in ROOT.

Thursday, April 10, 2008

 
 
Made on a Mac

next >

< previous