Geant4 User's Guide
For Application Developers Detector Definition and Response |
4.6 Object Persistency
4.6.1 Persistency in Geant4
Object persistency is provided by Geant4 as an optional category, so that the
user may run Geant4 with or without an object database management system
(ODBMS).
When a usual (transient) object is created in C++, the object is placed onto the application heap and it ceases to exist when the application terminates. Persistent objects, on the other hand, live beyond the termination of the application process and may then be accessed by other processes (in some cases, by processes on other machines).
C++ does not have, as an intrinsic part of the language, the ability to store and retrieve persistent objects. Geant4 provides an abstract framework for persistency of hits, digits and events.
An example which demonstrates an implementation of object persistency using one of the tools accessible through the available interface, is provided in examples/extended/persistency.
4.6.2 Using Reflex for persistency of Geant4 objects
Object persistency of Geant4 objects is also possible by the mean of the Reflex library [1]. Reflex provides, in a non-intrusive way, reflection capabilities to C++ classes by generating "dictionary information" for them. Those dictionaries can then be loaded in memory allowing direct persistency of the given objects without any instrumentation of the code. The Reflex library is also part of ROOT [2] (since release v5.08).
The basic steps that one needs to do in order to use Reflex with ROOT I/O for arbitrary C++ classes is:
[1] | http://cern.ch/seal-reflex |
[2] | http://root.cern.ch |