source: trunk/examples/extended/persistency/P02/README @ 1332

Last change on this file since 1332 was 807, checked in by garnier, 16 years ago

update

File size: 3.3 KB
Line 
1
2     =========================================================
3     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
4     =========================================================
5
6                            ExampleP02
7                            ----------
8
9        General description
10        -------------------
11
12        This example shows how to store in a binary file and how to
13read back the geometry tree using the 'reflection' technique for
14persistency provided by the Reflex tool also included in ROOT. The
15Reflex tool allows to create a dictionary for the geometry classes,
16making then possible to save the entire tree in a .root file. 
17
18The provided makefile produces the executable: 'exampleP02'. In order
19to run it one has to specify the argument, either 'write' or
20'read'. In the first case the geometry is instaciated in the standard
21way and then saved into the root file (geo.root). In the second case,
22the geometry is read from geo.root file.
23
24
25        Building and running the example
26        --------------------------------
27
28        Before buidling and/or running the example you need to set the
29following environment variables:
30
31ROOTSYS - ROOT installation directory, it is required to run ROOT
32
33GCCXMLPATH - gccxml binary directory, it is needed by ROOT for the
34             dictionary generation
35LD_LIBRARY_PATH - to include the ROOT library path and the path to
36                  the dictionary library, i.e., for tcsh UNIX shell:
37   setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$ROOTSYS/lib:
38                          $G4WORKDIR/tmp/$G4SYSTEM/exampleP01
39
40The present version of the example requires that Geant4 headers are
41installed in a single directory referenced by G4INCLUDE, as the standard
42Geant4 installation procedure allows to do.
43
44Once those variables are set (together with the standard Geant4 setup)
45the example can be build by issueing the 'make' command. The final
46executable file can be found in the usual directory:
47
48$G4WORKDIR/bin/$G4SYSTEM/
49
50
51        Remark on dictionary generation
52        -------------------------------
53
54        The dictionary is generated by ${ROOTSYS}/bin/genreflex
55tool. The header file including headers for all the classes we want to
56generate the dictionary for should be given as argument. Additionally,
57a so called selection file (xml) should be provided (with -s flag) to
58the genreflex tool (see the GNUmakefile). The role of this file is to
59specify which classes we want to generate the dictionary for. The
60selection file for our dictionary is in xml/ directory. Please refer
61to genreflex manual for more details concerning the usage of that
62tool. 
63
64Concerning generating dictionary for the Geant4 objects, there are
65also two technical remarks that need to be made here. The gccxml tool
66(version 0.6.0_patch1) requires all the templated classes to be
67explicitely used somewhere in the included header files in order for
68the generation of the dictionary to be possible. For those templated
69classes for which it is not the case, the problem can be very easily
70solved by instaciating them in the headerfile which is given to
71genreflex (see includes/Classes.h) as argument. 
72The second remark is that there is an unfortunate clash of names as
73far as G4String class is concerned. The header of G4String class
74defines __G4String which happens to be the name of a variable used
75within the generated dictionary code. The solution for that is to do
76#undef __G4String in include/Classes.h file.
77
78 
Note: See TracBrowser for help on using the repository browser.