Warning, /geant4/examples/extended/persistency/P02/README is written in an unsupported language. File is not indexed.
0001
0002 =========================================================
0003 Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0004 =========================================================
0005
0006 ExampleP02
0007 ----------
0008
0009 General description
0010 -------------------
0011
0012 This example shows how to store in a binary file and how to
0013 read back the geometry tree using the 'reflection' technique for
0014 persistency provided by the Reflex tool also included in ROOT. The
0015 Reflex tool allows to create a dictionary for the geometry classes,
0016 making then possible to save the entire tree in a .root file.
0017
0018 The provided makefile produces the executable: 'exampleP02'. In order
0019 to run it one has to specify the argument, either 'write' or
0020 'read'. In the first case the geometry is instaciated in the standard
0021 way and then saved into the root file (geo.root). In the second case,
0022 the geometry is read from geo.root file.
0023
0024
0025 Building and running the example
0026 --------------------------------
0027
0028 This examples requires the ROOT toolkit of version 6 to be installed. The
0029 provided CMake file checks for the existence of the package and its version.
0030 Once the CMake configuration has been succesfully done, the executable
0031 for this example should be built using make
0032 (in your CMake build directory):
0033
0034 make
0035
0036 Remark on dictionary generation
0037 -------------------------------
0038
0039 The dictionary is generated by ${ROOTSYS}/bin/genreflex
0040 tool. The arguments that will be used by this tool are configured
0041 in CMakeLists.txt using the CMake function REFLEX_GENERATE_DICTIONARY
0042 provided by ROOT. They include the header file including headers for
0043 all the classes we want to generate the dictionary, and additionally,
0044 a so called selection file (xml). The role of this file is to
0045 specify which classes we want to generate the dictionary for. The
0046 selection file for our dictionary is in xml/ directory. Please refer
0047 to genreflex manual for more details concerning the usage of that
0048 tool.
0049
0050 Concerning generating dictionary for the Geant4 objects, there are
0051 also two technical remarks that need to be made here.
0052 The Reflex tool requires all the templated classes to be
0053 explicitely used somewhere in the included header files in order for
0054 the generation of the dictionary to be possible. For those templated
0055 classes for which it is not the case, the problem can be very easily
0056 solved by instaciating them in the headerfile which is given to
0057 genreflex (see includes/ExP02Classes.hh) as argument.
0058 The second remark is that there is an unfortunate clash of names as
0059 far as G4String class is concerned. The header of G4String class
0060 defines __G4String which happens to be the name of a variable used
0061 within the generated dictionary code. The solution for that is to do
0062 #undef __G4String in include/ExP02Classes.hh file.